Change untagged representation in OfdpaMatchVlanVid from 0 to NONE
Note: Match vlan 0 is still not supported in this commit
Change-Id: Iecfcde151261e9df53b1cc8fbe9c1a397686a3d9
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 4a9d0ff..aca0c97 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
@@ -51,15 +51,13 @@
if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.OFDPA_MATCH_VLAN_VID.type())) {
VlanId vlanId = ((OfdpaMatchVlanVid) extensionSelector).vlanId();
// Special VLAN 0x0000/0x1FFF required by OFDPA
- if (vlanId.toShort() == 0x0000) {
- OFVlanVidMatch vid = OFVlanVidMatch.ofRawVid(vlanId.toShort());
+ if (vlanId.equals(VlanId.NONE)) {
+ OFVlanVidMatch vid = OFVlanVidMatch.ofRawVid((short) 0x0000);
OFVlanVidMatch mask = OFVlanVidMatch.ofRawVid((short) 0x1FFF);
return factory.oxms().vlanVidMasked(vid, mask);
// Normal case
} else if (vlanId.equals(VlanId.ANY)) {
return factory.oxms().vlanVidMasked(OFVlanVidMatch.PRESENT, OFVlanVidMatch.PRESENT);
- } else if (vlanId.equals(VlanId.NONE)) {
- return factory.oxms().vlanVid(OFVlanVidMatch.NONE);
} else {
return factory.oxms().vlanVid(OFVlanVidMatch.ofVlanVid(VlanVid.ofVlan(vlanId.toShort())));
}
@@ -78,7 +76,7 @@
OFVlanVidMatch mask = ((OFOxmVlanVidMasked) oxm).getMask();
if (vid.equals(OFVlanVidMatch.ofRawVid((short) 0))) {
- vlanId = VlanId.vlanId((short) 0);
+ vlanId = VlanId.NONE;
} else if (vid.equals(OFVlanVidMatch.PRESENT) &&
mask.equals(OFVlanVidMatch.PRESENT)) {
vlanId = VlanId.ANY;
diff --git a/drivers/default/src/main/java/org/onosproject/driver/pipeline/OFDPA2Pipeline.java b/drivers/default/src/main/java/org/onosproject/driver/pipeline/OFDPA2Pipeline.java
index 382d978..2b27f0e 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/pipeline/OFDPA2Pipeline.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/pipeline/OFDPA2Pipeline.java
@@ -369,7 +369,7 @@
ExtensionCriterion extCriterion =
(ExtensionCriterion) flowRule.selector().getCriterion(Criterion.Type.EXTENSION);
VlanId vlanId = ((OfdpaMatchVlanVid) extCriterion.extensionSelector()).vlanId();
- if (vlanId.toShort() != (short) 0) {
+ if (!vlanId.equals(VlanId.NONE)) {
filteringRules.add(flowRule);
} else {
assignmentRules.add(flowRule);
@@ -461,7 +461,7 @@
VlanId storeVlan = null;
if (vidCriterion.vlanId() == VlanId.NONE) {
// untagged packets are assigned vlans
- OfdpaMatchVlanVid ofdpaMatchVlanVid = new OfdpaMatchVlanVid(VlanId.vlanId((short) 0));
+ OfdpaMatchVlanVid ofdpaMatchVlanVid = new OfdpaMatchVlanVid(VlanId.NONE);
selector.extension(ofdpaMatchVlanVid, deviceId);
OfdpaSetVlanVid ofdpaSetVlanVid = new OfdpaSetVlanVid(assignedVlan);
treatment.extension(ofdpaSetVlanVid, deviceId);