Charles Chan
Committed by Gerrit Code Review

Only pop internally assigned VLANs before sending ARP to controller

Change-Id: I066e03ad9a491ad99816a976bc5561667878031a
...@@ -56,6 +56,7 @@ import org.onosproject.net.flowobjective.ObjectiveError; ...@@ -56,6 +56,7 @@ import org.onosproject.net.flowobjective.ObjectiveError;
56 import org.onosproject.net.group.Group; 56 import org.onosproject.net.group.Group;
57 import org.onosproject.net.group.GroupKey; 57 import org.onosproject.net.group.GroupKey;
58 import org.onosproject.net.group.GroupService; 58 import org.onosproject.net.group.GroupService;
59 +import org.onosproject.net.packet.PacketPriority;
59 import org.slf4j.Logger; 60 import org.slf4j.Logger;
60 61
61 import java.util.ArrayList; 62 import java.util.ArrayList;
...@@ -254,13 +255,9 @@ public class CpqdOfdpa2Pipeline extends Ofdpa2Pipeline { ...@@ -254,13 +255,9 @@ public class CpqdOfdpa2Pipeline extends Ofdpa2Pipeline {
254 selector.matchVlanId(vidCriterion.vlanId()); 255 selector.matchVlanId(vidCriterion.vlanId());
255 treatment.transition(TMAC_TABLE); 256 treatment.transition(TMAC_TABLE);
256 257
257 - VlanId storeVlan = null;
258 if (vidCriterion.vlanId() == VlanId.NONE) { 258 if (vidCriterion.vlanId() == VlanId.NONE) {
259 // untagged packets are assigned vlans 259 // untagged packets are assigned vlans
260 treatment.pushVlan().setVlanId(assignedVlan); 260 treatment.pushVlan().setVlanId(assignedVlan);
261 - storeVlan = assignedVlan;
262 - } else {
263 - storeVlan = vidCriterion.vlanId();
264 } 261 }
265 262
266 // ofdpa cannot match on ALL portnumber, so we need to use separate 263 // ofdpa cannot match on ALL portnumber, so we need to use separate
...@@ -289,6 +286,25 @@ public class CpqdOfdpa2Pipeline extends Ofdpa2Pipeline { ...@@ -289,6 +286,25 @@ public class CpqdOfdpa2Pipeline extends Ofdpa2Pipeline {
289 .forTable(VLAN_TABLE).build(); 286 .forTable(VLAN_TABLE).build();
290 rules.add(rule); 287 rules.add(rule);
291 } 288 }
289 +
290 + // Emulating OFDPA behavior by popping off internal assigned VLAN
291 + // before sending to controller
292 + TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder()
293 + .matchEthType(Ethernet.TYPE_ARP)
294 + .matchVlanId(assignedVlan);
295 + TrafficTreatment.Builder tbuilder = DefaultTrafficTreatment.builder()
296 + .popVlan()
297 + .punt();
298 + FlowRule internalVlan = DefaultFlowRule.builder()
299 + .forDevice(deviceId)
300 + .withSelector(sbuilder.build())
301 + .withTreatment(tbuilder.build())
302 + .withPriority(PacketPriority.CONTROL.priorityValue() + 1)
303 + .fromApp(applicationId)
304 + .makePermanent()
305 + .forTable(ACL_TABLE).build();
306 + rules.add(internalVlan);
307 +
292 return rules; 308 return rules;
293 } 309 }
294 310
...@@ -659,9 +675,6 @@ public class CpqdOfdpa2Pipeline extends Ofdpa2Pipeline { ...@@ -659,9 +675,6 @@ public class CpqdOfdpa2Pipeline extends Ofdpa2Pipeline {
659 if (ins instanceof OutputInstruction) { 675 if (ins instanceof OutputInstruction) {
660 OutputInstruction o = (OutputInstruction) ins; 676 OutputInstruction o = (OutputInstruction) ins;
661 if (o.port() == PortNumber.CONTROLLER) { 677 if (o.port() == PortNumber.CONTROLLER) {
662 - // emulating real ofdpa behavior by popping off internal
663 - // vlan before sending to controller
664 - ttBuilder.popVlan();
665 ttBuilder.add(o); 678 ttBuilder.add(o);
666 } else { 679 } else {
667 log.warn("Only allowed treatments in versatile forwarding " 680 log.warn("Only allowed treatments in versatile forwarding "
......