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 ...@@ -51,15 +51,13 @@ public class OfdpaExtensionSelectorInterpreter extends AbstractHandlerBehaviour
51 if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.OFDPA_MATCH_VLAN_VID.type())) { 51 if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.OFDPA_MATCH_VLAN_VID.type())) {
52 VlanId vlanId = ((OfdpaMatchVlanVid) extensionSelector).vlanId(); 52 VlanId vlanId = ((OfdpaMatchVlanVid) extensionSelector).vlanId();
53 // Special VLAN 0x0000/0x1FFF required by OFDPA 53 // Special VLAN 0x0000/0x1FFF required by OFDPA
54 - if (vlanId.toShort() == 0x0000) { 54 + if (vlanId.equals(VlanId.NONE)) {
55 - OFVlanVidMatch vid = OFVlanVidMatch.ofRawVid(vlanId.toShort()); 55 + OFVlanVidMatch vid = OFVlanVidMatch.ofRawVid((short) 0x0000);
56 OFVlanVidMatch mask = OFVlanVidMatch.ofRawVid((short) 0x1FFF); 56 OFVlanVidMatch mask = OFVlanVidMatch.ofRawVid((short) 0x1FFF);
57 return factory.oxms().vlanVidMasked(vid, mask); 57 return factory.oxms().vlanVidMasked(vid, mask);
58 // Normal case 58 // Normal case
59 } else if (vlanId.equals(VlanId.ANY)) { 59 } else if (vlanId.equals(VlanId.ANY)) {
60 return factory.oxms().vlanVidMasked(OFVlanVidMatch.PRESENT, OFVlanVidMatch.PRESENT); 60 return factory.oxms().vlanVidMasked(OFVlanVidMatch.PRESENT, OFVlanVidMatch.PRESENT);
61 - } else if (vlanId.equals(VlanId.NONE)) {
62 - return factory.oxms().vlanVid(OFVlanVidMatch.NONE);
63 } else { 61 } else {
64 return factory.oxms().vlanVid(OFVlanVidMatch.ofVlanVid(VlanVid.ofVlan(vlanId.toShort()))); 62 return factory.oxms().vlanVid(OFVlanVidMatch.ofVlanVid(VlanVid.ofVlan(vlanId.toShort())));
65 } 63 }
...@@ -78,7 +76,7 @@ public class OfdpaExtensionSelectorInterpreter extends AbstractHandlerBehaviour ...@@ -78,7 +76,7 @@ public class OfdpaExtensionSelectorInterpreter extends AbstractHandlerBehaviour
78 OFVlanVidMatch mask = ((OFOxmVlanVidMasked) oxm).getMask(); 76 OFVlanVidMatch mask = ((OFOxmVlanVidMasked) oxm).getMask();
79 77
80 if (vid.equals(OFVlanVidMatch.ofRawVid((short) 0))) { 78 if (vid.equals(OFVlanVidMatch.ofRawVid((short) 0))) {
81 - vlanId = VlanId.vlanId((short) 0); 79 + vlanId = VlanId.NONE;
82 } else if (vid.equals(OFVlanVidMatch.PRESENT) && 80 } else if (vid.equals(OFVlanVidMatch.PRESENT) &&
83 mask.equals(OFVlanVidMatch.PRESENT)) { 81 mask.equals(OFVlanVidMatch.PRESENT)) {
84 vlanId = VlanId.ANY; 82 vlanId = VlanId.ANY;
......
...@@ -369,7 +369,7 @@ public class OFDPA2Pipeline extends AbstractHandlerBehaviour implements Pipeline ...@@ -369,7 +369,7 @@ public class OFDPA2Pipeline extends AbstractHandlerBehaviour implements Pipeline
369 ExtensionCriterion extCriterion = 369 ExtensionCriterion extCriterion =
370 (ExtensionCriterion) flowRule.selector().getCriterion(Criterion.Type.EXTENSION); 370 (ExtensionCriterion) flowRule.selector().getCriterion(Criterion.Type.EXTENSION);
371 VlanId vlanId = ((OfdpaMatchVlanVid) extCriterion.extensionSelector()).vlanId(); 371 VlanId vlanId = ((OfdpaMatchVlanVid) extCriterion.extensionSelector()).vlanId();
372 - if (vlanId.toShort() != (short) 0) { 372 + if (!vlanId.equals(VlanId.NONE)) {
373 filteringRules.add(flowRule); 373 filteringRules.add(flowRule);
374 } else { 374 } else {
375 assignmentRules.add(flowRule); 375 assignmentRules.add(flowRule);
...@@ -461,7 +461,7 @@ public class OFDPA2Pipeline extends AbstractHandlerBehaviour implements Pipeline ...@@ -461,7 +461,7 @@ public class OFDPA2Pipeline extends AbstractHandlerBehaviour implements Pipeline
461 VlanId storeVlan = null; 461 VlanId storeVlan = null;
462 if (vidCriterion.vlanId() == VlanId.NONE) { 462 if (vidCriterion.vlanId() == VlanId.NONE) {
463 // untagged packets are assigned vlans 463 // untagged packets are assigned vlans
464 - OfdpaMatchVlanVid ofdpaMatchVlanVid = new OfdpaMatchVlanVid(VlanId.vlanId((short) 0)); 464 + OfdpaMatchVlanVid ofdpaMatchVlanVid = new OfdpaMatchVlanVid(VlanId.NONE);
465 selector.extension(ofdpaMatchVlanVid, deviceId); 465 selector.extension(ofdpaMatchVlanVid, deviceId);
466 OfdpaSetVlanVid ofdpaSetVlanVid = new OfdpaSetVlanVid(assignedVlan); 466 OfdpaSetVlanVid ofdpaSetVlanVid = new OfdpaSetVlanVid(assignedVlan);
467 treatment.extension(ofdpaSetVlanVid, deviceId); 467 treatment.extension(ofdpaSetVlanVid, deviceId);
......