ONOS extensions for use of egress tables.
This patch depends on 17671 onos-loxi patch. When we make
the new loxi release we need to change the prebuild
openflowj in lib/BUCK to that of the actual release number.
It provides support for programming l2 unfiltered groups,
the egress vlan table and the egress tpid table.
Depends-On: I3cea6ed2234147c8dbe440ae1701856a60706e7c
Change-Id: I7525f5856300eac25548b5219a5dffed12b291ad
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/ExtensionSelectorType.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/ExtensionSelectorType.java
index 4664693..2e1f451 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/ExtensionSelectorType.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/ExtensionSelectorType.java
@@ -47,6 +47,8 @@
OFDPA_MATCH_OVID(17),
OFDPA_MATCH_MPLS_L2_PORT(18),
EXT_MATCH_FLOW_TYPE(20),
+ OFDPA_MATCH_ACTSET_OUTPUT(19),
+ OFDPA_MATCH_ALLOW_VLAN_TRANSLATION(21),
UNRESOLVED_TYPE(200);
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionTreatmentType.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionTreatmentType.java
index b626f19..4029bcf 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionTreatmentType.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/ExtensionTreatmentType.java
@@ -73,7 +73,8 @@
NICIRA_ENCAP_ETH_DST(122),
NICIRA_ENCAP_ETH_TYPE(123),
OPLINK_ATTENUATION(130),
-
+ OFDPA_ALLOW_VLAN_TRANSLATION(131),
+ ONF_COPY_FIELD(132),
UNRESOLVED_TYPE(200);
private ExtensionTreatmentType type;
diff --git a/drivers/default/src/main/java/org/onosproject/driver/DefaultCodecRegister.java b/drivers/default/src/main/java/org/onosproject/driver/DefaultCodecRegister.java
index 0c59d54..97f4c6a 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/DefaultCodecRegister.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/DefaultCodecRegister.java
@@ -30,12 +30,15 @@
import org.onosproject.driver.extensions.NiciraSetNshSi;
import org.onosproject.driver.extensions.NiciraSetNshSpi;
import org.onosproject.driver.extensions.NiciraSetTunnelDst;
+import org.onosproject.driver.extensions.Ofdpa3CopyField;
import org.onosproject.driver.extensions.Ofdpa3MatchMplsL2Port;
import org.onosproject.driver.extensions.Ofdpa3MatchOvid;
import org.onosproject.driver.extensions.Ofdpa3SetMplsL2Port;
import org.onosproject.driver.extensions.Ofdpa3SetMplsType;
import org.onosproject.driver.extensions.Ofdpa3SetOvid;
import org.onosproject.driver.extensions.Ofdpa3SetQosIndex;
+import org.onosproject.driver.extensions.OfdpaMatchActsetOutput;
+import org.onosproject.driver.extensions.OfdpaMatchAllowVlanTranslation;
import org.onosproject.driver.extensions.OfdpaMatchVlanVid;
import org.onosproject.driver.extensions.OfdpaSetVlanVid;
import org.onosproject.driver.extensions.OplinkAttenuation;
@@ -48,12 +51,15 @@
import org.onosproject.driver.extensions.codec.NiciraSetNshSiCodec;
import org.onosproject.driver.extensions.codec.NiciraSetNshSpiCodec;
import org.onosproject.driver.extensions.codec.NiciraSetTunnelDstCodec;
+import org.onosproject.driver.extensions.codec.Ofdpa3CopyFieldCodec;
import org.onosproject.driver.extensions.codec.Ofdpa3MatchMplsL2PortCodec;
import org.onosproject.driver.extensions.codec.Ofdpa3MatchOvidCodec;
import org.onosproject.driver.extensions.codec.Ofdpa3SetMplsL2PortCodec;
import org.onosproject.driver.extensions.codec.Ofdpa3SetMplsTypeCodec;
import org.onosproject.driver.extensions.codec.Ofdpa3SetOvidCodec;
import org.onosproject.driver.extensions.codec.Ofdpa3SetQosIndexCodec;
+import org.onosproject.driver.extensions.codec.OfdpaMatchActsetOutputCodec;
+import org.onosproject.driver.extensions.codec.OfdpaMatchAllowVlanTranslationCodec;
import org.onosproject.driver.extensions.codec.OfdpaMatchVlanVidCodec;
import org.onosproject.driver.extensions.codec.OfdpaSetVlanVidCodec;
import org.onosproject.driver.extensions.codec.OplinkAttenuationCodec;
@@ -85,6 +91,8 @@
codecService.registerCodec(NiciraSetNshContextHeader.class, new NiciraSetNshContextHeaderCodec());
codecService.registerCodec(OfdpaMatchVlanVid.class, new OfdpaMatchVlanVidCodec());
codecService.registerCodec(OfdpaSetVlanVid.class, new OfdpaSetVlanVidCodec());
+ codecService.registerCodec(OfdpaMatchActsetOutput.class, new OfdpaMatchActsetOutputCodec());
+ codecService.registerCodec(OfdpaMatchAllowVlanTranslation.class, new OfdpaMatchAllowVlanTranslationCodec());
codecService.registerCodec(Ofdpa3SetMplsType.class, new Ofdpa3SetMplsTypeCodec());
codecService.registerCodec(Ofdpa3MatchOvid.class, new Ofdpa3MatchOvidCodec());
codecService.registerCodec(Ofdpa3SetOvid.class, new Ofdpa3SetOvidCodec());
@@ -92,6 +100,7 @@
codecService.registerCodec(Ofdpa3MatchMplsL2Port.class, new Ofdpa3MatchMplsL2PortCodec());
codecService.registerCodec(Ofdpa3SetMplsL2Port.class, new Ofdpa3SetMplsL2PortCodec());
codecService.registerCodec(OplinkAttenuation.class, new OplinkAttenuationCodec());
+ codecService.registerCodec(Ofdpa3CopyField.class, new Ofdpa3CopyFieldCodec());
log.info("Registered default driver codecs.");
}
diff --git a/drivers/default/src/main/java/org/onosproject/driver/extensions/Ofdpa3AllowVlanTranslationType.java b/drivers/default/src/main/java/org/onosproject/driver/extensions/Ofdpa3AllowVlanTranslationType.java
new file mode 100644
index 0000000..e9ebacb
--- /dev/null
+++ b/drivers/default/src/main/java/org/onosproject/driver/extensions/Ofdpa3AllowVlanTranslationType.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.driver.extensions;
+
+public enum Ofdpa3AllowVlanTranslationType {
+ NOT_ALLOW((byte) 0),
+ ALLOW((byte) 1);
+
+ private byte value;
+
+ Ofdpa3AllowVlanTranslationType(byte value) {
+ this.value = value;
+ }
+
+ /*
+ * Get value as a byte.
+ */
+ public byte getValue() {
+ return this.value;
+ }
+}
diff --git a/drivers/default/src/main/java/org/onosproject/driver/extensions/Ofdpa3CopyField.java b/drivers/default/src/main/java/org/onosproject/driver/extensions/Ofdpa3CopyField.java
new file mode 100644
index 0000000..8ec8869
--- /dev/null
+++ b/drivers/default/src/main/java/org/onosproject/driver/extensions/Ofdpa3CopyField.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.driver.extensions;
+
+import com.google.common.base.MoreObjects;
+import org.onlab.util.KryoNamespace;
+import org.onosproject.net.flow.AbstractExtension;
+import org.onosproject.net.flow.instructions.ExtensionTreatment;
+import org.onosproject.net.flow.instructions.ExtensionTreatmentType;
+
+import java.util.Objects;
+
+/**
+ * OFDPA copy field extension instruction.
+ */
+public class Ofdpa3CopyField extends AbstractExtension implements ExtensionTreatment {
+ private int nBits;
+ private int srcOffset;
+ private int dstOffset;
+ private int src;
+ private int dst;
+
+ private static final KryoNamespace APPKRYO = new KryoNamespace.Builder()
+ .register(Ofdpa3AllowVlanTranslationType.class)
+ .build();
+
+ public Ofdpa3CopyField() {
+ nBits = 0;
+ srcOffset = 0;
+ dstOffset = 0;
+ // this default value corresponds to the vlan-id from ofdpa spec.
+ src = 0x80000c02;
+ // this default value corresponds to register 1 from ofdpa spec.
+ dst = 0x80010200;
+
+ }
+
+ public Ofdpa3CopyField(int nBits, int srcOffset, int dstOffset, int src, int dst) {
+ this.nBits = nBits;
+ this.srcOffset = srcOffset;
+ this.dstOffset = dstOffset;
+ this.src = src;
+ this.dst = dst;
+ }
+
+ /**
+ * Returns the nBits value.
+ * @return nBits value.
+ */
+ public int getnBits() {
+ return nBits;
+ }
+
+ /**
+ * Returns the srcOffset value.
+ * @return srcOffset value.
+ */
+ public int getSrcOffset() {
+ return srcOffset;
+ }
+
+ /**
+ * Returns the dstOffset value.
+ * @return dstOffset value.
+ */
+ public int getDstOffset() {
+ return dstOffset;
+ }
+
+ /**
+ * Returns the src value.
+ * @return src value.
+ */
+ public int getSrc() {
+ return src;
+ }
+
+ /**
+ * Returns the dst value.
+ * @return dst value.
+ */
+ public int getDst() {
+ return dst;
+ }
+
+ @Override
+ public ExtensionTreatmentType type() {
+ return ExtensionTreatmentType.ExtensionTreatmentTypes.ONF_COPY_FIELD.type();
+ }
+
+ @Override
+ public void deserialize(byte[] data) {
+ }
+
+ @Override
+ public byte[] serialize() {
+ return APPKRYO.serialize(this);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(this);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof Ofdpa3CopyField) {
+ Ofdpa3CopyField that = (Ofdpa3CopyField) obj;
+ return Objects.equals(nBits, that.nBits) &&
+ Objects.equals(srcOffset, that.srcOffset) &&
+ Objects.equals(dstOffset, that.dstOffset) &&
+ Objects.equals(src, that.src) &&
+ Objects.equals(dst, that.dst);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .add("nBits", nBits)
+ .add("srcOffset", Integer.toHexString(srcOffset))
+ .add("dstOffset", Integer.toHexString(dstOffset))
+ .add("src", Integer.toHexString(src))
+ .add("dst", Integer.toHexString(dst))
+ .toString();
+ }
+}
diff --git a/drivers/default/src/main/java/org/onosproject/driver/extensions/Ofdpa3ExtensionSelectorInterpreter.java b/drivers/default/src/main/java/org/onosproject/driver/extensions/Ofdpa3ExtensionSelectorInterpreter.java
index 5ac9cf3..1431ca1 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/extensions/Ofdpa3ExtensionSelectorInterpreter.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/extensions/Ofdpa3ExtensionSelectorInterpreter.java
@@ -19,6 +19,7 @@
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onlab.packet.VlanId;
import org.onosproject.codec.CodecContext;
+import org.onosproject.net.PortNumber;
import org.onosproject.net.behaviour.ExtensionSelectorResolver;
import org.onosproject.net.driver.AbstractHandlerBehaviour;
import org.onosproject.net.flow.criteria.ExtensionSelector;
@@ -28,10 +29,13 @@
import org.projectfloodlight.openflow.protocol.OFFactory;
import org.projectfloodlight.openflow.protocol.match.MatchField;
import org.projectfloodlight.openflow.protocol.oxm.OFOxm;
+import org.projectfloodlight.openflow.protocol.oxm.OFOxmOfdpaActsetOutput;
+import org.projectfloodlight.openflow.protocol.oxm.OFOxmOfdpaAllowVlanTranslation;
import org.projectfloodlight.openflow.protocol.oxm.OFOxmOfdpaMplsL2Port;
import org.projectfloodlight.openflow.protocol.oxm.OFOxmOfdpaOvid;
import org.projectfloodlight.openflow.types.U16;
import org.projectfloodlight.openflow.types.U32;
+import org.projectfloodlight.openflow.types.U8;
import org.slf4j.Logger;
import static org.slf4j.LoggerFactory.getLogger;
@@ -50,6 +54,12 @@
return true;
} else if (extensionSelectorType.equals(ExtensionSelectorTypes.OFDPA_MATCH_MPLS_L2_PORT.type())) {
return true;
+ } else if (extensionSelectorType.equals(
+ ExtensionSelectorType.ExtensionSelectorTypes.OFDPA_MATCH_ACTSET_OUTPUT.type())) {
+ return true;
+ } else if (extensionSelectorType.equals(
+ ExtensionSelectorTypes.OFDPA_MATCH_ALLOW_VLAN_TRANSLATION.type())) {
+ return true;
}
return false;
}
@@ -82,7 +92,15 @@
}
throw new UnsupportedOperationException(
"Unexpected ExtensionSelector: " + extensionSelector.toString());
+ } else if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.OFDPA_MATCH_ACTSET_OUTPUT.type())) {
+ PortNumber port = ((OfdpaMatchActsetOutput) extensionSelector).port();
+ return factory.oxms().ofdpaActsetOutput(U32.of(port.toLong()));
+ } else if (type.equals(ExtensionSelectorTypes.OFDPA_MATCH_ALLOW_VLAN_TRANSLATION.type())) {
+ Short allowVlanTranslation =
+ ((OfdpaMatchAllowVlanTranslation) extensionSelector).allowVlanTranslation();
+ return factory.oxms().ofdpaAllowVlanTranslation(U8.of(allowVlanTranslation));
}
+
throw new UnsupportedOperationException(
"Unexpected ExtensionSelector: " + extensionSelector.toString());
}
@@ -123,7 +141,15 @@
throw new UnsupportedOperationException(
"Unexpected OXM: " + oxm.toString());
}
+ } else if (oxm.getMatchField().equals(MatchField.OFDPA_ACTSET_OUTPUT)) {
+ U32 portNumberU32 = ((OFOxmOfdpaActsetOutput) oxm).getValue();
+ PortNumber portNumber = PortNumber.portNumber(portNumberU32.getValue());
+ return new OfdpaMatchActsetOutput(portNumber);
+ } else if (oxm.getMatchField().equals(MatchField.OFDPA_ALLOW_VLAN_TRANSLATION)) {
+ U8 value = ((OFOxmOfdpaAllowVlanTranslation) oxm).getValue();
+ return new OfdpaMatchAllowVlanTranslation(value.getValue());
}
+
throw new UnsupportedOperationException(
"Unexpected OXM: " + oxm.toString());
}
@@ -134,7 +160,12 @@
return new Ofdpa3MatchOvid();
} else if (type.equals(ExtensionSelectorTypes.OFDPA_MATCH_MPLS_L2_PORT.type())) {
return new Ofdpa3MatchMplsL2Port();
+ } else if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.OFDPA_MATCH_ACTSET_OUTPUT.type())) {
+ return new OfdpaMatchActsetOutput();
+ } else if (type.equals(ExtensionSelectorTypes.OFDPA_MATCH_ALLOW_VLAN_TRANSLATION.type())) {
+ return new OfdpaMatchAllowVlanTranslation();
}
+
throw new UnsupportedOperationException(
"Driver does not support extension type " + type.toString());
}
diff --git a/drivers/default/src/main/java/org/onosproject/driver/extensions/Ofdpa3ExtensionTreatmentInterpreter.java b/drivers/default/src/main/java/org/onosproject/driver/extensions/Ofdpa3ExtensionTreatmentInterpreter.java
index 2a89b26..099f995 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/extensions/Ofdpa3ExtensionTreatmentInterpreter.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/extensions/Ofdpa3ExtensionTreatmentInterpreter.java
@@ -29,8 +29,11 @@
import org.projectfloodlight.openflow.protocol.action.OFAction;
import org.projectfloodlight.openflow.protocol.action.OFActionExperimenter;
import org.projectfloodlight.openflow.protocol.action.OFActionOfdpa;
+import org.projectfloodlight.openflow.protocol.action.OFActionOnf;
+import org.projectfloodlight.openflow.protocol.action.OFActionOnfCopyField;
import org.projectfloodlight.openflow.protocol.action.OFActionSetField;
import org.projectfloodlight.openflow.protocol.oxm.OFOxm;
+import org.projectfloodlight.openflow.protocol.oxm.OFOxmOfdpaAllowVlanTranslation;
import org.projectfloodlight.openflow.protocol.oxm.OFOxmOfdpaMplsL2Port;
import org.projectfloodlight.openflow.protocol.oxm.OFOxmOfdpaMplsType;
import org.projectfloodlight.openflow.protocol.oxm.OFOxmOfdpaOvid;
@@ -51,11 +54,12 @@
implements ExtensionTreatmentInterpreter, ExtensionTreatmentResolver {
private static final int TYPE_OFDPA = 0x1018;
+ private static final int TYPE_ONF = 0x4f4e4600;
private static final int SUB_TYPE_PUSH_L2_HEADER = 1;
private static final int SUB_TYPE_POP_L2_HEADER = 2;
private static final int SUB_TYPE_PUSH_CW = 3;
private static final int SUB_TYPE_POP_CW = 4;
-
+ private static final int SUB_TYPE_COPY_FIELD = 3200;
private static final String TYPE = "type";
private static final String MISSING_MEMBER_MESSAGE = " member is required in Ofdpa3ExtensionTreatmentInterpreter";
private static final String MISSING_TREATMENT_MESSAGE = "Extension treatment cannot be null";
@@ -89,7 +93,14 @@
} else if (extensionTreatmentType.equals(
ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_POP_CW.type())) {
return true;
+ } else if (extensionTreatmentType.equals(
+ ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_ALLOW_VLAN_TRANSLATION.type())) {
+ return true;
+ } else if (extensionTreatmentType.equals(
+ ExtensionTreatmentType.ExtensionTreatmentTypes.ONF_COPY_FIELD.type())) {
+ return true;
}
+
return false;
}
@@ -141,8 +152,25 @@
return factory.actions().ofdpaPopL2Header();
} else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_POP_CW.type())) {
return factory.actions().ofdpaPopCw();
+ } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_ALLOW_VLAN_TRANSLATION.type())) {
+ byte allow = ((OfdpaSetAllowVlanTranslation) extensionTreatment).getVlanTranslation();
+ return factory.actions().setField(factory.oxms().ofdpaAllowVlanTranslation(
+ U8.ofRaw(allow)));
+ } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.ONF_COPY_FIELD.type())) {
+ Ofdpa3CopyField copyField = (Ofdpa3CopyField) extensionTreatment;
+
+ // this action uses the ONF experimenter id thus
+ // we differentiate here, but, we should treat the extensionTreatment
+ // as an ofdpa3 treatment, because it is ofdpa specific.
+ return factory.actions().buildOnfCopyField()
+ .setDstOffset(copyField.getDstOffset())
+ .setSrcOffset(copyField.getSrcOffset())
+ .setNBits(copyField.getnBits())
+ .setSrc(copyField.getSrc())
+ .setDst(copyField.getDst())
+ .build();
}
- throw new UnsupportedOperationException(
+ throw new UnsupportedOperationException(
"Unexpected ExtensionTreatment: " + extensionTreatment.toString());
}
@@ -176,6 +204,13 @@
return new Ofdpa3SetQosIndex(qosIndex);
}
break;
+ case OFDPA_ALLOW_VLAN_TRANSLATION:
+ OFOxmOfdpaAllowVlanTranslation allowVlanTranslation = (OFOxmOfdpaAllowVlanTranslation) oxm;
+ Byte allowVlan = allowVlanTranslation.getValue().getRaw();
+ if ((allowVlan == 0) || (allowVlan == 1)) {
+ return new OfdpaSetAllowVlanTranslation(allowVlan);
+ }
+ break;
default:
throw new UnsupportedOperationException(
"Driver does not support extension type " + oxm.getMatchField().id);
@@ -197,6 +232,19 @@
throw new UnsupportedOperationException(
"Unexpected OFAction: " + action.toString());
}
+ } else if (Long.valueOf(experimenter.getExperimenter()).intValue() == TYPE_ONF) {
+ OFActionOnf onf = (OFActionOnf) experimenter;
+ switch (onf.getExpType()) {
+ case SUB_TYPE_COPY_FIELD:
+ return new Ofdpa3CopyField(((OFActionOnfCopyField) onf).getNBits(),
+ ((OFActionOnfCopyField) onf).getSrcOffset(),
+ ((OFActionOnfCopyField) onf).getDstOffset(),
+ (int) ((OFActionOnfCopyField) onf).getSrc(),
+ (int) ((OFActionOnfCopyField) onf).getDst());
+ default:
+ throw new UnsupportedOperationException(
+ "Unexpected OFAction: " + action.toString());
+ }
}
throw new UnsupportedOperationException(
"Unexpected OFAction: " + action.toString());
@@ -223,6 +271,10 @@
return new Ofdpa3PopL2Header();
} else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_POP_CW.type())) {
return new Ofdpa3PopCw();
+ } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_ALLOW_VLAN_TRANSLATION.type())) {
+ return new OfdpaSetAllowVlanTranslation();
+ } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.ONF_COPY_FIELD.type())) {
+ return new Ofdpa3CopyField();
}
throw new UnsupportedOperationException(NOT_SUPPORTED_MESSAGE + type.toString());
}
@@ -257,8 +309,13 @@
root.put(TYPE, ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_POP_L2_HEADER.name());
} else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_POP_CW.type())) {
root.put(TYPE, ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_POP_CW.name());
+ } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_ALLOW_VLAN_TRANSLATION.type())) {
+ root.put(TYPE, ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_ALLOW_VLAN_TRANSLATION.name());
+ } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.ONF_COPY_FIELD.type())) {
+ root.put(TYPE, ExtensionTreatmentType.ExtensionTreatmentTypes.ONF_COPY_FIELD.name());
}
+
return root;
}
@@ -286,6 +343,10 @@
return new Ofdpa3PopL2Header();
} else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_POP_CW.name())) {
return new Ofdpa3PopCw();
+ } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_ALLOW_VLAN_TRANSLATION.name())) {
+ return new OfdpaSetAllowVlanTranslation();
+ } else if (type.equals(ExtensionTreatmentType.ExtensionTreatmentTypes.ONF_COPY_FIELD.name())) {
+ return new Ofdpa3CopyField();
} else {
throw new UnsupportedOperationException(NOT_SUPPORTED_MESSAGE + type.toString());
}
diff --git a/drivers/default/src/main/java/org/onosproject/driver/extensions/OfdpaExtensionSelectorInterpreter.java b/drivers/default/src/main/java/org/onosproject/driver/extensions/OfdpaExtensionSelectorInterpreter.java
index 67f390a..1d64c31 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/extensions/OfdpaExtensionSelectorInterpreter.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/extensions/OfdpaExtensionSelectorInterpreter.java
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.onosproject.driver.extensions;
import org.onlab.packet.VlanId;
+import org.onosproject.net.PortNumber;
import org.onosproject.net.behaviour.ExtensionSelectorResolver;
import org.onosproject.net.driver.AbstractHandlerBehaviour;
import org.onosproject.net.flow.criteria.ExtensionSelector;
@@ -26,9 +26,13 @@
import org.projectfloodlight.openflow.protocol.OFFactory;
import org.projectfloodlight.openflow.protocol.match.MatchField;
import org.projectfloodlight.openflow.protocol.oxm.OFOxm;
+import org.projectfloodlight.openflow.protocol.oxm.OFOxmOfdpaActsetOutput;
+import org.projectfloodlight.openflow.protocol.oxm.OFOxmOfdpaAllowVlanTranslation;
import org.projectfloodlight.openflow.protocol.oxm.OFOxmVlanVid;
import org.projectfloodlight.openflow.protocol.oxm.OFOxmVlanVidMasked;
import org.projectfloodlight.openflow.types.OFVlanVidMatch;
+import org.projectfloodlight.openflow.types.U32;
+import org.projectfloodlight.openflow.types.U8;
import org.projectfloodlight.openflow.types.VlanVid;
/**
@@ -41,6 +45,12 @@
public boolean supported(ExtensionSelectorType extensionSelectorType) {
if (extensionSelectorType.equals(ExtensionSelectorTypes.OFDPA_MATCH_VLAN_VID.type())) {
return true;
+ } else if (extensionSelectorType.equals(
+ ExtensionSelectorType.ExtensionSelectorTypes.OFDPA_MATCH_ACTSET_OUTPUT.type())) {
+ return true;
+ } else if (extensionSelectorType.equals(
+ ExtensionSelectorTypes.OFDPA_MATCH_ALLOW_VLAN_TRANSLATION.type())) {
+ return true;
}
return false;
}
@@ -61,6 +71,16 @@
} else {
return factory.oxms().vlanVid(OFVlanVidMatch.ofVlanVid(VlanVid.ofVlan(vlanId.toShort())));
}
+ } else if (type.equals(
+ ExtensionSelectorType.ExtensionSelectorTypes.OFDPA_MATCH_ACTSET_OUTPUT.type())) {
+ PortNumber port = ((OfdpaMatchActsetOutput) extensionSelector).port();
+ return factory.oxms().ofdpaActsetOutput(U32.of(port.toLong()));
+ } else if (type.equals(ExtensionSelectorTypes.OFDPA_MATCH_ALLOW_VLAN_TRANSLATION.type())) {
+
+ Short allowVlanTranslation =
+ ((OfdpaMatchAllowVlanTranslation) extensionSelector).allowVlanTranslation();
+
+ return factory.oxms().ofdpaAllowVlanTranslation(U8.of(allowVlanTranslation));
}
throw new UnsupportedOperationException(
"Unexpected ExtensionSelector: " + extensionSelector.toString());
@@ -93,6 +113,13 @@
}
}
return new OfdpaMatchVlanVid(vlanId);
+ } else if (oxm.getMatchField().equals(MatchField.OFDPA_ACTSET_OUTPUT)) {
+ U32 portNumberU32 = ((OFOxmOfdpaActsetOutput) oxm).getValue();
+ PortNumber portNumber = PortNumber.portNumber(portNumberU32.getValue());
+ return new OfdpaMatchActsetOutput(portNumber);
+ } else if (oxm.getMatchField().equals(MatchField.OFDPA_ALLOW_VLAN_TRANSLATION)) {
+ U8 value = ((OFOxmOfdpaAllowVlanTranslation) oxm).getValue();
+ return new OfdpaMatchAllowVlanTranslation(value.getValue());
}
throw new UnsupportedOperationException(
"Unexpected OXM: " + oxm.toString());
@@ -102,6 +129,10 @@
public ExtensionSelector getExtensionSelector(ExtensionSelectorType type) {
if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.OFDPA_MATCH_VLAN_VID.type())) {
return new OfdpaMatchVlanVid();
+ } else if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.OFDPA_MATCH_ACTSET_OUTPUT.type())) {
+ return new OfdpaMatchActsetOutput();
+ } else if (type.equals(ExtensionSelectorTypes.OFDPA_MATCH_ALLOW_VLAN_TRANSLATION.type())) {
+ return new OfdpaMatchAllowVlanTranslation();
}
throw new UnsupportedOperationException(
"Driver does not support extension type " + type.toString());
diff --git a/drivers/default/src/main/java/org/onosproject/driver/extensions/OfdpaMatchActsetOutput.java b/drivers/default/src/main/java/org/onosproject/driver/extensions/OfdpaMatchActsetOutput.java
new file mode 100644
index 0000000..d645f12
--- /dev/null
+++ b/drivers/default/src/main/java/org/onosproject/driver/extensions/OfdpaMatchActsetOutput.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.driver.extensions;
+
+import com.google.common.base.MoreObjects;
+import org.onlab.util.KryoNamespace;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.flow.AbstractExtension;
+import org.onosproject.net.flow.criteria.ExtensionSelector;
+import org.onosproject.net.flow.criteria.ExtensionSelectorType;
+
+import java.util.Objects;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * OFDPA ACTSET_OUTPUT extension match.
+ */
+public class OfdpaMatchActsetOutput extends AbstractExtension implements ExtensionSelector {
+
+ private PortNumber port;
+ private static final KryoNamespace APPKRYO = new KryoNamespace.Builder()
+ .register(PortNumber.class)
+ .build();
+
+ /**
+ * OFDPA ACTSET_OUTPUT extension match.
+ */
+ public OfdpaMatchActsetOutput() {
+ this.port = null;
+ }
+
+ /**
+ * Constructs new ACTSET_OUTPUT match with given port number.
+ *
+ * @param port port number
+ */
+ public OfdpaMatchActsetOutput(PortNumber port) {
+ checkNotNull(port);
+ this.port = port;
+ }
+
+ /**
+ * Gets the port number.
+ *
+ * @return the port number
+ */
+ public PortNumber port() {
+ return port;
+ }
+
+ @Override
+ public ExtensionSelectorType type() {
+ return ExtensionSelectorType.ExtensionSelectorTypes.OFDPA_MATCH_ACTSET_OUTPUT.type();
+ }
+
+ @Override
+ public byte[] serialize() {
+ return APPKRYO.serialize(port);
+ }
+
+ @Override
+ public void deserialize(byte[] data) {
+ port = APPKRYO.deserialize(data);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(port);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+
+ if (this == obj) {
+ return true;
+ }
+
+ if (obj == null || !obj.getClass().equals(OfdpaMatchActsetOutput.class)) {
+ return false;
+ }
+
+ OfdpaMatchActsetOutput that = (OfdpaMatchActsetOutput) obj;
+ return port.equals(that.port());
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .add("port", port)
+ .toString();
+ }
+}
diff --git a/drivers/default/src/main/java/org/onosproject/driver/extensions/OfdpaMatchAllowVlanTranslation.java b/drivers/default/src/main/java/org/onosproject/driver/extensions/OfdpaMatchAllowVlanTranslation.java
new file mode 100644
index 0000000..e5adc74
--- /dev/null
+++ b/drivers/default/src/main/java/org/onosproject/driver/extensions/OfdpaMatchAllowVlanTranslation.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.driver.extensions;
+
+import org.onlab.util.KryoNamespace;
+import org.onosproject.net.flow.AbstractExtension;
+import org.onosproject.net.flow.criteria.ExtensionSelector;
+import org.onosproject.net.flow.criteria.ExtensionSelectorType;
+
+import java.util.Objects;
+
+/**
+ * OFDPA ALLOW_VLAN_TRANSLATION extension match.
+ */
+public class OfdpaMatchAllowVlanTranslation extends AbstractExtension implements ExtensionSelector {
+ private static final KryoNamespace APPKRYO = new KryoNamespace.Builder()
+ .register(Short.class)
+ .build();
+
+ private Short allowVlanTranslation;
+
+ /**
+ * OFDPA ALLOW_VLAN_TRANSLATION extension match.
+ */
+ public OfdpaMatchAllowVlanTranslation() {
+ allowVlanTranslation = 0;
+ }
+
+ /**
+ * Constructs new ALLOW_VLAN_TRANSLATION match with given boolean data.
+ *
+ * @param allowVlanTranslation allows vlan translation
+ */
+ public OfdpaMatchAllowVlanTranslation(Short allowVlanTranslation) {
+ this.allowVlanTranslation = allowVlanTranslation;
+ }
+
+ /**
+ * Gets allow vlan translation flag.
+ *
+ * @return allowVlanTranslation field
+ */
+ public Short allowVlanTranslation() {
+ return allowVlanTranslation;
+ }
+
+ @Override
+ public ExtensionSelectorType type() {
+ return ExtensionSelectorType.ExtensionSelectorTypes.OFDPA_MATCH_ALLOW_VLAN_TRANSLATION.type();
+ }
+
+ @Override
+ public byte[] serialize() {
+ return APPKRYO.serialize(allowVlanTranslation);
+ }
+
+ @Override
+ public void deserialize(byte[] data) {
+ allowVlanTranslation = APPKRYO.deserialize(data);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(allowVlanTranslation);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+
+ if (obj == null || !obj.getClass().equals(OfdpaMatchAllowVlanTranslation.class)) {
+ return false;
+ }
+
+ OfdpaMatchAllowVlanTranslation that = (OfdpaMatchAllowVlanTranslation) obj;
+ return that.allowVlanTranslation().equals(allowVlanTranslation);
+ }
+}
diff --git a/drivers/default/src/main/java/org/onosproject/driver/extensions/OfdpaSetAllowVlanTranslation.java b/drivers/default/src/main/java/org/onosproject/driver/extensions/OfdpaSetAllowVlanTranslation.java
new file mode 100644
index 0000000..059e6b9
--- /dev/null
+++ b/drivers/default/src/main/java/org/onosproject/driver/extensions/OfdpaSetAllowVlanTranslation.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.driver.extensions;
+
+import com.google.common.base.MoreObjects;
+import org.onlab.util.KryoNamespace;
+import org.onosproject.net.flow.AbstractExtension;
+import org.onosproject.net.flow.instructions.ExtensionTreatment;
+import org.onosproject.net.flow.instructions.ExtensionTreatmentType;
+
+import java.util.Objects;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * OFDPA set Allow Vlan Translation extension instruction.
+ */
+public class OfdpaSetAllowVlanTranslation extends AbstractExtension implements ExtensionTreatment {
+ private byte vlanTranslation;
+
+ private static final KryoNamespace APPKRYO = new KryoNamespace.Builder()
+ .register(Ofdpa3AllowVlanTranslationType.class)
+ .build();
+
+ protected OfdpaSetAllowVlanTranslation() {
+ vlanTranslation = Ofdpa3AllowVlanTranslationType.NOT_ALLOW.getValue();
+ }
+
+ public OfdpaSetAllowVlanTranslation(byte allow) {
+ checkNotNull(allow);
+ this.vlanTranslation = allow;
+ }
+
+ public OfdpaSetAllowVlanTranslation(Ofdpa3AllowVlanTranslationType allow) {
+ this.vlanTranslation = allow.getValue();
+ }
+
+ public byte getVlanTranslation() {
+ return vlanTranslation;
+ }
+
+ @Override
+ public ExtensionTreatmentType type() {
+ return ExtensionTreatmentType.ExtensionTreatmentTypes.OFDPA_ALLOW_VLAN_TRANSLATION.type();
+ }
+
+ @Override
+ public void deserialize(byte[] data) {
+ vlanTranslation = APPKRYO.deserialize(data);
+ }
+
+ @Override
+ public byte[] serialize() {
+ return APPKRYO.serialize(vlanTranslation);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(vlanTranslation);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof OfdpaSetAllowVlanTranslation) {
+ OfdpaSetAllowVlanTranslation that = (OfdpaSetAllowVlanTranslation) obj;
+ return Objects.equals(vlanTranslation, that.vlanTranslation);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .add("ofdpaSetAllowVlanTranslation", vlanTranslation)
+ .toString();
+ }
+}
diff --git a/drivers/default/src/main/java/org/onosproject/driver/extensions/codec/Ofdpa3CopyFieldCodec.java b/drivers/default/src/main/java/org/onosproject/driver/extensions/codec/Ofdpa3CopyFieldCodec.java
new file mode 100644
index 0000000..999bb74
--- /dev/null
+++ b/drivers/default/src/main/java/org/onosproject/driver/extensions/codec/Ofdpa3CopyFieldCodec.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2016-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.driver.extensions.codec;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onosproject.codec.CodecContext;
+import org.onosproject.codec.JsonCodec;
+import org.onosproject.driver.extensions.Ofdpa3CopyField;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.onlab.util.Tools.nullIsIllegal;
+
+/**
+ * JSON Codec for Ofdpa copy field class.
+ */
+public class Ofdpa3CopyFieldCodec extends JsonCodec<Ofdpa3CopyField> {
+
+ private static final String N_BITS = "nBits";
+ private static final String SRC = "src";
+ private static final String DST = "dst";
+ private static final String SRC_OFFSET = "srcOffset";
+ private static final String DST_OFFSET = "dstOffset";
+
+ private static final String MISSING_MEMBER_MESSAGE = " member is required in Ofdpa3CopyField";
+ private static final String MISSING_COPY_FIELD_MESSAGE = "CopyField can not be null";
+
+ @Override
+ public ObjectNode encode(Ofdpa3CopyField copyField, CodecContext context) {
+ checkNotNull(copyField, MISSING_COPY_FIELD_MESSAGE);
+ return context.mapper().createObjectNode()
+ .put(N_BITS, copyField.getnBits())
+ .put(SRC_OFFSET, copyField.getSrcOffset())
+ .put(DST_OFFSET, copyField.getDstOffset())
+ .put(SRC, copyField.getSrc())
+ .put(DST, copyField.getDst());
+ }
+
+ @Override
+ public Ofdpa3CopyField decode(ObjectNode json, CodecContext context) {
+ if (json == null || !json.isObject()) {
+ return null;
+ }
+
+ // parse members of copy field action
+ int nBits = (int) nullIsIllegal(json.get(N_BITS),
+ N_BITS + MISSING_MEMBER_MESSAGE).asInt();
+ int src = (int) nullIsIllegal(json.get(SRC),
+ SRC + MISSING_MEMBER_MESSAGE).asInt();
+ int dst = (int) nullIsIllegal(json.get(DST),
+ DST + MISSING_MEMBER_MESSAGE).asInt();
+ int srcOffset = (int) nullIsIllegal(json.get(SRC_OFFSET),
+ SRC_OFFSET + MISSING_MEMBER_MESSAGE).asInt();
+ int dstOffset = (int) nullIsIllegal(json.get(DST_OFFSET),
+ DST_OFFSET + MISSING_MEMBER_MESSAGE).asInt();
+ return new Ofdpa3CopyField(nBits, src, dst, srcOffset, dstOffset);
+ }
+}
diff --git a/drivers/default/src/main/java/org/onosproject/driver/extensions/codec/OfdpaMatchActsetOutputCodec.java b/drivers/default/src/main/java/org/onosproject/driver/extensions/codec/OfdpaMatchActsetOutputCodec.java
new file mode 100644
index 0000000..cb051e4
--- /dev/null
+++ b/drivers/default/src/main/java/org/onosproject/driver/extensions/codec/OfdpaMatchActsetOutputCodec.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.driver.extensions.codec;
+
+import org.onosproject.driver.extensions.OfdpaMatchActsetOutput;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onosproject.codec.CodecContext;
+import org.onosproject.codec.JsonCodec;
+import org.onosproject.net.PortNumber;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.onlab.util.Tools.nullIsIllegal;
+
+/**
+ * JSON Codec for Ofdpa match actset output class.
+ */
+public class OfdpaMatchActsetOutputCodec extends JsonCodec<OfdpaMatchActsetOutput> {
+
+ private static final String ACTSET_OUTPUT = "actsetOutput";
+ private static final String MISSING_MEMBER_MESSAGE = " member is required in OfdpaMatchActsetOutput";
+ private static final String MISSING_ACTSET_OUTPUT_MESSAGE = "Actset Output cannot be null";
+
+ @Override
+ public ObjectNode encode(OfdpaMatchActsetOutput actsetOutput, CodecContext context) {
+ checkNotNull(actsetOutput, MISSING_ACTSET_OUTPUT_MESSAGE);
+ return context.mapper().createObjectNode()
+ .put(ACTSET_OUTPUT, actsetOutput.port().toLong());
+ }
+
+ @Override
+ public OfdpaMatchActsetOutput decode(ObjectNode json, CodecContext context) {
+ if (json == null || !json.isObject()) {
+ return null;
+ }
+
+ // parse ofdpa match actset output
+ long portNumber = nullIsIllegal(json.get(ACTSET_OUTPUT),
+ ACTSET_OUTPUT + MISSING_MEMBER_MESSAGE).asLong();
+ return new OfdpaMatchActsetOutput(PortNumber.portNumber(portNumber));
+ }
+}
diff --git a/drivers/default/src/main/java/org/onosproject/driver/extensions/codec/OfdpaMatchAllowVlanTranslationCodec.java b/drivers/default/src/main/java/org/onosproject/driver/extensions/codec/OfdpaMatchAllowVlanTranslationCodec.java
new file mode 100644
index 0000000..c72aa2c
--- /dev/null
+++ b/drivers/default/src/main/java/org/onosproject/driver/extensions/codec/OfdpaMatchAllowVlanTranslationCodec.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.driver.extensions.codec;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.onosproject.codec.CodecContext;
+import org.onosproject.codec.JsonCodec;
+import org.onosproject.driver.extensions.OfdpaMatchAllowVlanTranslation;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.onlab.util.Tools.nullIsIllegal;
+
+/**
+ * JSON Codec for Ofdpa match allow vlan translation class.
+ */
+public class OfdpaMatchAllowVlanTranslationCodec extends JsonCodec<OfdpaMatchAllowVlanTranslation> {
+
+ private static final String ALLOW_VLAN_TRANSLATION = "allowVlanTranslation";
+ private static final String MISSING_MEMBER_MESSAGE = " member is required in OfdpaMatchAllowVlanTranslation";
+ private static final String MISSING_ALLOW_VLAN_TRANSLATION_MESSAGE = "Allow Vlan Translation cannot be null";
+
+ @Override
+ public ObjectNode encode(OfdpaMatchAllowVlanTranslation allowVlanTranslation, CodecContext context) {
+ checkNotNull(allowVlanTranslation, MISSING_ALLOW_VLAN_TRANSLATION_MESSAGE);
+ return context.mapper().createObjectNode().put(ALLOW_VLAN_TRANSLATION,
+ allowVlanTranslation.allowVlanTranslation());
+ }
+
+ @Override
+ public OfdpaMatchAllowVlanTranslation decode(ObjectNode json, CodecContext context) {
+ if (json == null || !json.isObject()) {
+ return null;
+ }
+
+ // parse ofdpa match allow vlan translation
+ short allowVlanTranslation = (short) nullIsIllegal(json.get(ALLOW_VLAN_TRANSLATION),
+ ALLOW_VLAN_TRANSLATION + MISSING_MEMBER_MESSAGE).asLong();
+ return new OfdpaMatchAllowVlanTranslation(allowVlanTranslation);
+ }
+}
diff --git a/lib/BUCK b/lib/BUCK
index 1302f55..c37f470 100644
--- a/lib/BUCK
+++ b/lib/BUCK
@@ -1,4 +1,4 @@
-# ***** This file was auto-generated at Wed, 4 Apr 2018 19:53:12 GMT. Do not edit this file manually. *****
+# ***** This file was auto-generated at Thu, 12 Apr 2018 17:32:52 GMT. Do not edit this file manually. *****
# ***** Use onos-lib-gen *****
pass_thru_pom(
@@ -963,10 +963,10 @@
remote_jar (
name = 'openflowj',
- out = 'openflowj-3.2.0.onos.jar',
- url = 'mvn:org.onosproject:openflowj:jar:3.2.0.onos',
- sha1 = 'b890ecb2901912b9c7ededd1d1028fea73aa5db4',
- maven_coords = 'org.onosproject:openflowj:3.2.0.onos',
+ out = 'openflowj-3.2.1.onos.jar',
+ url = 'mvn:org.onosproject:openflowj:jar:3.2.1.onos',
+ sha1 = '66544b285cddc8d53485107310f07b7bc90ac63b',
+ maven_coords = 'org.onosproject:openflowj:3.2.1.onos',
visibility = [ 'PUBLIC' ],
)
diff --git a/lib/deps.json b/lib/deps.json
index 8192ee7..ccf648d 100644
--- a/lib/deps.json
+++ b/lib/deps.json
@@ -200,7 +200,7 @@
"netty-codec-http2": "mvn:io.netty:netty-codec-http2:4.1.8.Final",
"netty-codec-http": "mvn:io.netty:netty-codec-http:4.1.8.Final",
"objenesis": "mvn:org.objenesis:objenesis:2.6",
- "openflowj": "mvn:org.onosproject:openflowj:3.2.0.onos",
+ "openflowj": "mvn:org.onosproject:openflowj:3.2.1.onos",
"org.apache.felix.framework.security": "mvn:org.onosproject:org.apache.felix.framework.security:jar:2.2.0.onos",
"org.apache.felix.scr": "mvn:org.apache.felix:org.apache.felix.scr:1.8.2",
"org.apache.felix.scr.annotations": "mvn:org.apache.felix:org.apache.felix.scr.annotations:1.9.12",
diff --git a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/util/FlowEntryBuilder.java b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/util/FlowEntryBuilder.java
index a71d440..cb9568b 100644
--- a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/util/FlowEntryBuilder.java
+++ b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/util/FlowEntryBuilder.java
@@ -798,6 +798,7 @@
case OFDPA_MPLS_TYPE:
case OFDPA_OVID:
case OFDPA_MPLS_L2_PORT:
+ case OFDPA_ALLOW_VLAN_TRANSLATION:
case OFDPA_QOS_INDEX:
if (treatmentInterpreter != null) {
try {
@@ -1277,6 +1278,31 @@
}
}
break;
+ case OFDPA_ALLOW_VLAN_TRANSLATION:
+ if (selectorInterpreter != null &&
+ selectorInterpreter.supported(
+ ExtensionSelectorTypes.OFDPA_MATCH_ALLOW_VLAN_TRANSLATION.type())) {
+ if (isOF13OrLater(match)) {
+ OFOxm oxm = ((OFMatchV3) match).getOxmList().get(MatchField.OFDPA_ALLOW_VLAN_TRANSLATION);
+ builder.extension(selectorInterpreter.mapOxm(oxm),
+ deviceId);
+ } else {
+ break;
+ }
+ }
+ break;
+ case OFDPA_ACTSET_OUTPUT:
+ if (selectorInterpreter != null &&
+ selectorInterpreter.supported(ExtensionSelectorTypes.OFDPA_MATCH_ACTSET_OUTPUT.type())) {
+ if (isOF13OrLater(match)) {
+ OFOxm oxm = ((OFMatchV3) match).getOxmList().get(MatchField.OFDPA_ACTSET_OUTPUT);
+ builder.extension(selectorInterpreter.mapOxm(oxm),
+ deviceId);
+ } else {
+ break;
+ }
+ }
+ break;
case MPLS_TC:
default:
log.warn("Match type {} not yet implemented.", field.id);