Allow SingleSwitchFibInstaller to support untagged interfaces.
Added support in OVSCorsaPipeline and SoftRouter.
Change-Id: I7242f0f26cbdf7d6d2205fc6f48458d604de5326
diff --git a/apps/routing/src/main/java/org/onosproject/routing/impl/SingleSwitchFibInstaller.java b/apps/routing/src/main/java/org/onosproject/routing/impl/SingleSwitchFibInstaller.java
index a70e270..29f063d 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/impl/SingleSwitchFibInstaller.java
+++ b/apps/routing/src/main/java/org/onosproject/routing/impl/SingleSwitchFibInstaller.java
@@ -29,6 +29,7 @@
import org.onlab.packet.Ethernet;
import org.onlab.packet.IpAddress;
import org.onlab.packet.IpPrefix;
+import org.onlab.packet.VlanId;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.incubator.net.intf.Interface;
@@ -279,20 +280,23 @@
NextHop nextHop = new NextHop(entry.nextHopIp(), entry.nextHopMac(), groupKey);
- TrafficTreatment treatment = DefaultTrafficTreatment.builder()
+ TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder()
.setEthSrc(egressIntf.mac())
- .setEthDst(nextHop.mac())
- .pushVlan()
- .setVlanId(egressIntf.vlan())
- .setVlanPcp((byte) 0)
- .setOutput(egressIntf.connectPoint().port())
- .build();
+ .setEthDst(nextHop.mac());
+
+ if (!egressIntf.vlan().equals(VlanId.NONE)) {
+ treatment.pushVlan()
+ .setVlanId(egressIntf.vlan())
+ .setVlanPcp((byte) 0);
+ }
+
+ treatment.setOutput(egressIntf.connectPoint().port());
int nextId = flowObjectiveService.allocateNextId();
NextObjective nextObjective = DefaultNextObjective.builder()
.withId(nextId)
- .addTreatment(treatment)
+ .addTreatment(treatment.build())
.withType(NextObjective.Type.SIMPLE)
.fromApp(appId)
.add(); // TODO add callbacks