Charles Chan
Committed by Charles Chan

Only pop internally assigned VLANs before sending ARP to controller

This is a fix for gerrit 10292 (commit ec8e06) which was not implemented correctly

Change-Id: If227860120c1e10a3ffbd0f8fb630490734ab751
......@@ -249,7 +249,7 @@ public class CpqdOfdpa2Pipeline extends Ofdpa2Pipeline {
VlanIdCriterion vidCriterion,
VlanId assignedVlan,
ApplicationId applicationId) {
List<FlowRule> rules = new ArrayList<FlowRule>();
List<FlowRule> rules = new ArrayList<>();
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
selector.matchVlanId(vidCriterion.vlanId());
......@@ -258,6 +258,24 @@ public class CpqdOfdpa2Pipeline extends Ofdpa2Pipeline {
if (vidCriterion.vlanId() == VlanId.NONE) {
// untagged packets are assigned vlans
treatment.pushVlan().setVlanId(assignedVlan);
// Emulating OFDPA behavior by popping off internal assigned VLAN
// before sending to controller
TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder()
.matchEthType(Ethernet.TYPE_ARP)
.matchVlanId(assignedVlan);
TrafficTreatment.Builder tbuilder = DefaultTrafficTreatment.builder()
.popVlan()
.punt();
FlowRule internalVlan = DefaultFlowRule.builder()
.forDevice(deviceId)
.withSelector(sbuilder.build())
.withTreatment(tbuilder.build())
.withPriority(PacketPriority.CONTROL.priorityValue() + 1)
.fromApp(applicationId)
.makePermanent()
.forTable(ACL_TABLE).build();
rules.add(internalVlan);
}
// ofdpa cannot match on ALL portnumber, so we need to use separate
......@@ -287,24 +305,6 @@ public class CpqdOfdpa2Pipeline extends Ofdpa2Pipeline {
rules.add(rule);
}
// Emulating OFDPA behavior by popping off internal assigned VLAN
// before sending to controller
TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder()
.matchEthType(Ethernet.TYPE_ARP)
.matchVlanId(assignedVlan);
TrafficTreatment.Builder tbuilder = DefaultTrafficTreatment.builder()
.popVlan()
.punt();
FlowRule internalVlan = DefaultFlowRule.builder()
.forDevice(deviceId)
.withSelector(sbuilder.build())
.withTreatment(tbuilder.build())
.withPriority(PacketPriority.CONTROL.priorityValue() + 1)
.fromApp(applicationId)
.makePermanent()
.forTable(ACL_TABLE).build();
rules.add(internalVlan);
return rules;
}
......