[AETHER-1032] Backport AETHER-538 to fabric.p4
AETHER-538 introduces a new design for the egress pipeline
where the tagged ports are explicitily matched in the
egress_vlan table. Moreover, no match means dropped with
this new design.
Change-Id: If6f8c73aad0effd01f18c87c147535378e8db84c
diff --git a/pipelines/fabric/impl/src/main/java/org/onosproject/pipelines/fabric/impl/behaviour/FabricTreatmentInterpreter.java b/pipelines/fabric/impl/src/main/java/org/onosproject/pipelines/fabric/impl/behaviour/FabricTreatmentInterpreter.java
index 21ff675..2da557a 100644
--- a/pipelines/fabric/impl/src/main/java/org/onosproject/pipelines/fabric/impl/behaviour/FabricTreatmentInterpreter.java
+++ b/pipelines/fabric/impl/src/main/java/org/onosproject/pipelines/fabric/impl/behaviour/FabricTreatmentInterpreter.java
@@ -38,12 +38,7 @@
import static java.lang.String.format;
import static org.onosproject.net.flow.instructions.Instruction.Type.OUTPUT;
-import static org.onosproject.net.flow.instructions.L2ModificationInstruction.L2SubType.ETH_DST;
-import static org.onosproject.net.flow.instructions.L2ModificationInstruction.L2SubType.ETH_SRC;
-import static org.onosproject.net.flow.instructions.L2ModificationInstruction.L2SubType.MPLS_LABEL;
-import static org.onosproject.net.flow.instructions.L2ModificationInstruction.L2SubType.MPLS_PUSH;
-import static org.onosproject.net.flow.instructions.L2ModificationInstruction.L2SubType.VLAN_ID;
-import static org.onosproject.net.flow.instructions.L2ModificationInstruction.L2SubType.VLAN_POP;
+import static org.onosproject.net.flow.instructions.L2ModificationInstruction.L2SubType.*;
import static org.onosproject.pipelines.fabric.impl.behaviour.FabricUtils.instruction;
import static org.onosproject.pipelines.fabric.impl.behaviour.FabricUtils.l2Instruction;
import static org.onosproject.pipelines.fabric.impl.behaviour.FabricUtils.l2Instructions;
@@ -225,6 +220,12 @@
static PiAction mapEgressNextTreatment(
TrafficTreatment treatment, PiTableId tableId)
throws PiInterpreterException {
+ L2ModificationInstruction pushVlan = l2Instruction(treatment, VLAN_PUSH);
+ if (pushVlan != null) {
+ return PiAction.builder()
+ .withId(FabricConstants.FABRIC_EGRESS_EGRESS_NEXT_PUSH_VLAN)
+ .build();
+ }
l2InstructionOrFail(treatment, VLAN_POP, tableId);
return PiAction.builder()
.withId(FabricConstants.FABRIC_EGRESS_EGRESS_NEXT_POP_VLAN)