Removed unnecessary criterion translators
For which a translation is not really possible (e.g. optical parameters,
extensions, etc.)
Change-Id: I3e8b7aeec6e4888d3f55d45d9783609a842372f9
diff --git a/core/net/src/main/java/org/onosproject/net/pi/impl/CriterionTranslatorHelper.java b/core/net/src/main/java/org/onosproject/net/pi/impl/CriterionTranslatorHelper.java
index 5d9d792..50f6ec9 100644
--- a/core/net/src/main/java/org/onosproject/net/pi/impl/CriterionTranslatorHelper.java
+++ b/core/net/src/main/java/org/onosproject/net/pi/impl/CriterionTranslatorHelper.java
@@ -19,15 +19,15 @@
import com.google.common.collect.ImmutableMap;
import org.apache.commons.lang3.tuple.Pair;
import org.onlab.util.ImmutableByteSequence;
+import org.onosproject.net.flow.criteria.ArpHaCriterion;
+import org.onosproject.net.flow.criteria.ArpOpCriterion;
+import org.onosproject.net.flow.criteria.ArpPaCriterion;
import org.onosproject.net.flow.criteria.Criterion;
import org.onosproject.net.flow.criteria.EthCriterion;
import org.onosproject.net.flow.criteria.EthTypeCriterion;
import org.onosproject.net.flow.criteria.IPCriterion;
-import org.onosproject.net.flow.criteria.PortCriterion;
-import org.onosproject.net.flow.criteria.VlanIdCriterion;
-import org.onosproject.net.flow.criteria.UdpPortCriterion;
-import org.onosproject.net.flow.criteria.ExtensionCriterion;
import org.onosproject.net.flow.criteria.IPDscpCriterion;
+import org.onosproject.net.flow.criteria.IPEcnCriterion;
import org.onosproject.net.flow.criteria.IPProtocolCriterion;
import org.onosproject.net.flow.criteria.IPv6ExthdrFlagsCriterion;
import org.onosproject.net.flow.criteria.IPv6FlowLabelCriterion;
@@ -38,34 +38,26 @@
import org.onosproject.net.flow.criteria.Icmpv6CodeCriterion;
import org.onosproject.net.flow.criteria.Icmpv6TypeCriterion;
import org.onosproject.net.flow.criteria.LambdaCriterion;
+import org.onosproject.net.flow.criteria.MetadataCriterion;
import org.onosproject.net.flow.criteria.MplsBosCriterion;
import org.onosproject.net.flow.criteria.MplsCriterion;
import org.onosproject.net.flow.criteria.MplsTcCriterion;
-import org.onosproject.net.flow.criteria.OchSignalCriterion;
-import org.onosproject.net.flow.criteria.OchSignalTypeCriterion;
-import org.onosproject.net.flow.criteria.OduSignalIdCriterion;
-import org.onosproject.net.flow.criteria.OduSignalTypeCriterion;
import org.onosproject.net.flow.criteria.PbbIsidCriterion;
-import org.onosproject.net.flow.criteria.PiCriterion;
+import org.onosproject.net.flow.criteria.PortCriterion;
import org.onosproject.net.flow.criteria.SctpPortCriterion;
import org.onosproject.net.flow.criteria.TcpFlagsCriterion;
import org.onosproject.net.flow.criteria.TcpPortCriterion;
import org.onosproject.net.flow.criteria.TunnelIdCriterion;
+import org.onosproject.net.flow.criteria.UdpPortCriterion;
+import org.onosproject.net.flow.criteria.VlanIdCriterion;
import org.onosproject.net.flow.criteria.VlanPcpCriterion;
-import org.onosproject.net.flow.criteria.ArpHaCriterion;
-import org.onosproject.net.flow.criteria.ArpOpCriterion;
-import org.onosproject.net.flow.criteria.ArpPaCriterion;
-import org.onosproject.net.flow.criteria.IPEcnCriterion;
-import org.onosproject.net.flow.criteria.MetadataCriterion;
-
+import org.onosproject.net.pi.impl.CriterionTranslators.ArpHaCriterionTranslator;
+import org.onosproject.net.pi.impl.CriterionTranslators.ArpOpCriterionTranslator;
+import org.onosproject.net.pi.impl.CriterionTranslators.ArpPaCriterionTranslator;
import org.onosproject.net.pi.impl.CriterionTranslators.EthCriterionTranslator;
import org.onosproject.net.pi.impl.CriterionTranslators.EthTypeCriterionTranslator;
-import org.onosproject.net.pi.impl.CriterionTranslators.IpCriterionTranslator;
-import org.onosproject.net.pi.impl.CriterionTranslators.PortCriterionTranslator;
-import org.onosproject.net.pi.impl.CriterionTranslators.VlanIdCriterionTranslator;
-import org.onosproject.net.pi.impl.CriterionTranslators.UdpPortCriterionTranslator;
-import org.onosproject.net.pi.impl.CriterionTranslators.ExtensionCriterionTranslator;
import org.onosproject.net.pi.impl.CriterionTranslators.IPDscpCriterionTranslator;
+import org.onosproject.net.pi.impl.CriterionTranslators.IPEcnCriterionTranslator;
import org.onosproject.net.pi.impl.CriterionTranslators.IPProtocolCriterionTranslator;
import org.onosproject.net.pi.impl.CriterionTranslators.IPv6ExthdrFlagsCriterionTranslator;
import org.onosproject.net.pi.impl.CriterionTranslators.IPv6FlowLabelCriterionTranslator;
@@ -75,27 +67,21 @@
import org.onosproject.net.pi.impl.CriterionTranslators.IcmpTypeCriterionTranslator;
import org.onosproject.net.pi.impl.CriterionTranslators.Icmpv6CodeCriterionTranslator;
import org.onosproject.net.pi.impl.CriterionTranslators.Icmpv6TypeCriterionTranslator;
+import org.onosproject.net.pi.impl.CriterionTranslators.IpCriterionTranslator;
import org.onosproject.net.pi.impl.CriterionTranslators.LambdaCriterionTranslator;
+import org.onosproject.net.pi.impl.CriterionTranslators.MetadataCriterionTranslator;
import org.onosproject.net.pi.impl.CriterionTranslators.MplsBosCriterionTranslator;
import org.onosproject.net.pi.impl.CriterionTranslators.MplsCriterionTranslator;
import org.onosproject.net.pi.impl.CriterionTranslators.MplsTcCriterionTranslator;
-import org.onosproject.net.pi.impl.CriterionTranslators.OchSignalCriterionTranslator;
-import org.onosproject.net.pi.impl.CriterionTranslators.OchSignalTypeCriterionTranslator;
-import org.onosproject.net.pi.impl.CriterionTranslators.OduSignalIdCriterionTranslator;
-import org.onosproject.net.pi.impl.CriterionTranslators.OduSignalTypeCriterionTranslator;
import org.onosproject.net.pi.impl.CriterionTranslators.PbbIsidCriterionTranslator;
-import org.onosproject.net.pi.impl.CriterionTranslators.PiCriterionTranslator;
+import org.onosproject.net.pi.impl.CriterionTranslators.PortCriterionTranslator;
import org.onosproject.net.pi.impl.CriterionTranslators.SctpPortCriterionTranslator;
import org.onosproject.net.pi.impl.CriterionTranslators.TcpFlagsCriterionTranslator;
import org.onosproject.net.pi.impl.CriterionTranslators.TcpPortCriterionTranslator;
import org.onosproject.net.pi.impl.CriterionTranslators.TunnelIdCriterionTranslator;
+import org.onosproject.net.pi.impl.CriterionTranslators.UdpPortCriterionTranslator;
+import org.onosproject.net.pi.impl.CriterionTranslators.VlanIdCriterionTranslator;
import org.onosproject.net.pi.impl.CriterionTranslators.VlanPcpCriterionTranslator;
-import org.onosproject.net.pi.impl.CriterionTranslators.ArpHaCriterionTranslator;
-import org.onosproject.net.pi.impl.CriterionTranslators.ArpOpCriterionTranslator;
-import org.onosproject.net.pi.impl.CriterionTranslators.ArpPaCriterionTranslator;
-import org.onosproject.net.pi.impl.CriterionTranslators.IPEcnCriterionTranslator;
-import org.onosproject.net.pi.impl.CriterionTranslators.MetadataCriterionTranslator;
-
import org.onosproject.net.pi.model.PiMatchType;
import org.onosproject.net.pi.runtime.PiExactFieldMatch;
import org.onosproject.net.pi.runtime.PiFieldMatch;
@@ -123,7 +109,6 @@
.put(IPCriterion.class, new IpCriterionTranslator())
.put(VlanIdCriterion.class, new VlanIdCriterionTranslator())
.put(UdpPortCriterion.class, new UdpPortCriterionTranslator())
- .put(ExtensionCriterion.class, new ExtensionCriterionTranslator())
.put(IPDscpCriterion.class, new IPDscpCriterionTranslator())
.put(IPProtocolCriterion.class, new IPProtocolCriterionTranslator())
.put(IPv6ExthdrFlagsCriterion.class, new IPv6ExthdrFlagsCriterionTranslator())
@@ -138,12 +123,7 @@
.put(MplsBosCriterion.class, new MplsBosCriterionTranslator())
.put(MplsCriterion.class, new MplsCriterionTranslator())
.put(MplsTcCriterion.class, new MplsTcCriterionTranslator())
- .put(OchSignalCriterion.class, new OchSignalCriterionTranslator())
- .put(OchSignalTypeCriterion.class, new OchSignalTypeCriterionTranslator())
- .put(OduSignalIdCriterion.class, new OduSignalIdCriterionTranslator())
- .put(OduSignalTypeCriterion.class, new OduSignalTypeCriterionTranslator())
.put(PbbIsidCriterion.class, new PbbIsidCriterionTranslator())
- .put(PiCriterion.class, new PiCriterionTranslator())
.put(SctpPortCriterion.class, new SctpPortCriterionTranslator())
.put(TcpFlagsCriterion.class, new TcpFlagsCriterionTranslator())
.put(TcpPortCriterion.class, new TcpPortCriterionTranslator())
diff --git a/core/net/src/main/java/org/onosproject/net/pi/impl/CriterionTranslators.java b/core/net/src/main/java/org/onosproject/net/pi/impl/CriterionTranslators.java
index 30a3c28..a5d676e 100644
--- a/core/net/src/main/java/org/onosproject/net/pi/impl/CriterionTranslators.java
+++ b/core/net/src/main/java/org/onosproject/net/pi/impl/CriterionTranslators.java
@@ -17,18 +17,20 @@
package org.onosproject.net.pi.impl;
import org.onlab.util.ImmutableByteSequence;
+import org.onosproject.net.flow.criteria.ArpHaCriterion;
+import org.onosproject.net.flow.criteria.ArpOpCriterion;
+import org.onosproject.net.flow.criteria.ArpPaCriterion;
import org.onosproject.net.flow.criteria.Criterion;
import org.onosproject.net.flow.criteria.EthCriterion;
import org.onosproject.net.flow.criteria.EthTypeCriterion;
import org.onosproject.net.flow.criteria.IPCriterion;
-import org.onosproject.net.flow.criteria.PortCriterion;
-import org.onosproject.net.flow.criteria.VlanIdCriterion;
-import org.onosproject.net.flow.criteria.UdpPortCriterion;
-import org.onosproject.net.flow.criteria.ExtensionCriterion;
import org.onosproject.net.flow.criteria.IPDscpCriterion;
+import org.onosproject.net.flow.criteria.IPEcnCriterion;
import org.onosproject.net.flow.criteria.IPProtocolCriterion;
import org.onosproject.net.flow.criteria.IPv6ExthdrFlagsCriterion;
import org.onosproject.net.flow.criteria.IPv6FlowLabelCriterion;
+import org.onosproject.net.flow.criteria.IPv6NDLinkLayerAddressCriterion;
+import org.onosproject.net.flow.criteria.IPv6NDTargetAddressCriterion;
import org.onosproject.net.flow.criteria.IcmpCodeCriterion;
import org.onosproject.net.flow.criteria.IcmpTypeCriterion;
import org.onosproject.net.flow.criteria.Icmpv6CodeCriterion;
@@ -38,23 +40,15 @@
import org.onosproject.net.flow.criteria.MplsBosCriterion;
import org.onosproject.net.flow.criteria.MplsCriterion;
import org.onosproject.net.flow.criteria.MplsTcCriterion;
-import org.onosproject.net.flow.criteria.OchSignalCriterion;
-import org.onosproject.net.flow.criteria.OchSignalTypeCriterion;
-import org.onosproject.net.flow.criteria.OduSignalIdCriterion;
-import org.onosproject.net.flow.criteria.OduSignalTypeCriterion;
import org.onosproject.net.flow.criteria.PbbIsidCriterion;
-import org.onosproject.net.flow.criteria.PiCriterion;
+import org.onosproject.net.flow.criteria.PortCriterion;
import org.onosproject.net.flow.criteria.SctpPortCriterion;
import org.onosproject.net.flow.criteria.TcpFlagsCriterion;
import org.onosproject.net.flow.criteria.TcpPortCriterion;
import org.onosproject.net.flow.criteria.TunnelIdCriterion;
+import org.onosproject.net.flow.criteria.UdpPortCriterion;
+import org.onosproject.net.flow.criteria.VlanIdCriterion;
import org.onosproject.net.flow.criteria.VlanPcpCriterion;
-import org.onosproject.net.flow.criteria.ArpHaCriterion;
-import org.onosproject.net.flow.criteria.ArpOpCriterion;
-import org.onosproject.net.flow.criteria.ArpPaCriterion;
-import org.onosproject.net.flow.criteria.IPv6NDLinkLayerAddressCriterion;
-import org.onosproject.net.flow.criteria.IPv6NDTargetAddressCriterion;
-import org.onosproject.net.flow.criteria.IPEcnCriterion;
import static org.onlab.util.ImmutableByteSequence.ByteSequenceTrimException;
import static org.onlab.util.ImmutableByteSequence.copyFrom;
@@ -143,17 +137,6 @@
}
/**
- * Translator of ExtensionCriterion.
- */
- static final class ExtensionCriterionTranslator extends AbstractCriterionTranslator {
- @Override
- public void init(Criterion criterion, int bitWidth) throws ByteSequenceTrimException {
- ExtensionCriterion c = (ExtensionCriterion) criterion;
- initAsExactMatch(copyFrom(c.extensionSelector().type().toInt()), bitWidth);
- }
- }
-
- /**
* Translator of IPDscpCriterion.
*/
static final class IPDscpCriterionTranslator extends AbstractCriterionTranslator {
@@ -293,8 +276,7 @@
@Override
public void init(Criterion criterion, int bitWidth) throws ByteSequenceTrimException {
MplsBosCriterion c = (MplsBosCriterion) criterion;
- int iMplsBos = c.mplsBos() ? 0 : 1;
- initAsExactMatch(copyFrom(iMplsBos), bitWidth);
+ initAsExactMatch(copyFrom(c.mplsBos() ? 0 : 1), bitWidth);
}
}
@@ -321,51 +303,6 @@
}
/**
- * Translator of OchSignalCriterion.
- */
- static final class OchSignalCriterionTranslator extends AbstractCriterionTranslator {
- @Override
- public void init(Criterion criterion, int bitWidth) throws ByteSequenceTrimException {
- OchSignalCriterion c = (OchSignalCriterion) criterion;
- initAsExactMatch(copyFrom(c.lambda().slotGranularity()), bitWidth);
- }
- }
-
- /**
- * Translator of OchSignalTypeCriterion.
- */
- static final class OchSignalTypeCriterionTranslator extends AbstractCriterionTranslator {
- @Override
- public void init(Criterion criterion, int bitWidth) throws ByteSequenceTrimException {
- OchSignalTypeCriterion c = (OchSignalTypeCriterion) criterion;
- initAsExactMatch(copyFrom(c.signalType().ordinal()), bitWidth);
- }
- }
-
- /**
- * Translator of OduSignalIdCriterion.
- */
- static final class OduSignalIdCriterionTranslator extends AbstractCriterionTranslator {
- @Override
- public void init(Criterion criterion, int bitWidth) throws ByteSequenceTrimException {
- OduSignalIdCriterion c = (OduSignalIdCriterion) criterion;
- initAsExactMatch(copyFrom(c.oduSignalId().tributaryPortNumber()), bitWidth);
- }
- }
-
-
- /**
- * Translator of OduSignalTypeCriterion.
- */
- static final class OduSignalTypeCriterionTranslator extends AbstractCriterionTranslator {
- @Override
- public void init(Criterion criterion, int bitWidth) throws ByteSequenceTrimException {
- OduSignalTypeCriterion c = (OduSignalTypeCriterion) criterion;
- initAsExactMatch(copyFrom(c.signalType().bitRate()), bitWidth);
- }
- }
-
- /**
* Translator of PbbIsidCriterion.
*/
static final class PbbIsidCriterionTranslator extends AbstractCriterionTranslator {
@@ -377,17 +314,6 @@
}
/**
- * Translator of PiCriterion.
- */
- static final class PiCriterionTranslator extends AbstractCriterionTranslator {
- @Override
- public void init(Criterion criterion, int bitWidth) throws ByteSequenceTrimException {
- PiCriterion c = (PiCriterion) criterion;
- initAsExactMatch(copyFrom(c.fieldMatches().size()), bitWidth);
- }
- }
-
- /**
* Translator of SctpPortCriterion.
*/
static final class SctpPortCriterionTranslator extends AbstractCriterionTranslator {