Support in fabric pipeliner for pushing double VLAN tag in Next obj
- Small modification to better support pop and route
- To support route and push we expect to receive a Next Objective with two VLAN_ID
- Added capability to check if the pipeline support double VLAN termination
Change-Id: I8bfbf61ccd838a069121e5ab4a804f695a446bac
(cherry picked from commit f51d0c110af13bd0bfc0d006e070f0e6bbbcd231)
diff --git a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricUtils.java b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricUtils.java
index 8e5caa1..ae000b5 100644
--- a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricUtils.java
+++ b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricUtils.java
@@ -27,6 +27,8 @@
import org.onosproject.net.flowobjective.NextTreatment;
import java.util.Collection;
+import java.util.List;
+import java.util.stream.Collectors;
import static com.google.common.base.Preconditions.checkNotNull;
import static java.lang.String.format;
@@ -77,6 +79,15 @@
.findFirst().orElse(null);
}
+ public static List<L2ModificationInstruction> l2Instructions(
+ TrafficTreatment treatment, L2ModificationInstruction.L2SubType subType) {
+ return treatment.allInstructions().stream()
+ .filter(i -> i.type().equals(Instruction.Type.L2MODIFICATION))
+ .map(i -> (L2ModificationInstruction) i)
+ .filter(i -> i.subtype().equals(subType))
+ .collect(Collectors.toList());
+ }
+
public static Instructions.OutputInstruction outputInstruction(TrafficTreatment treatment) {
return instruction(treatment, Instruction.Type.OUTPUT);
}