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
diff --git a/drivers/default/src/main/java/org/onosproject/driver/pipeline/CpqdOfdpa2Pipeline.java b/drivers/default/src/main/java/org/onosproject/driver/pipeline/CpqdOfdpa2Pipeline.java
index effa88f..b111e87 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/pipeline/CpqdOfdpa2Pipeline.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/pipeline/CpqdOfdpa2Pipeline.java
@@ -249,7 +249,7 @@
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 @@
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 @@
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;
}