Charles Chan
Committed by Gerrit Code Review

Change untagged representation in OfdpaMatchVlanVid from 0 to NONE

Note: Match vlan 0 is still not supported in this commit

Change-Id: Iecfcde151261e9df53b1cc8fbe9c1a397686a3d9
......@@ -51,15 +51,13 @@ public class OfdpaExtensionSelectorInterpreter extends AbstractHandlerBehaviour
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 @@ public class OfdpaExtensionSelectorInterpreter extends AbstractHandlerBehaviour
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;
......
......@@ -369,7 +369,7 @@ public class OFDPA2Pipeline extends AbstractHandlerBehaviour implements Pipeline
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 @@ public class OFDPA2Pipeline extends AbstractHandlerBehaviour implements Pipeline
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);
......