Adds OfdpaPipelineUtility
Change-Id: I96086e408dd9d7265325414dace512b64a048e9a
diff --git a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa3Pipeline.java b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa3Pipeline.java
index 7168f6d..dbf1280 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa3Pipeline.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa3Pipeline.java
@@ -64,6 +64,7 @@
import java.util.List;
import static org.onlab.packet.MacAddress.NONE;
+import static org.onosproject.driver.pipeline.ofdpa.OfdpaPipelineUtility.*;
import static org.onosproject.driver.extensions.Ofdpa3MplsType.VPWS;
import static org.onosproject.net.flow.criteria.Criterion.Type.INNER_VLAN_VID;
import static org.onosproject.net.flow.criteria.Criterion.Type.IN_PORT;
@@ -446,45 +447,6 @@
}
/**
- * Determines if the filtering objective will be used for double-tagged packets.
- *
- * @param fob Filtering objective
- * @return True if the objective was created for double-tagged packets, false otherwise.
- */
- private boolean isDoubleTagged(FilteringObjective fob) {
- return fob.meta() != null &&
- fob.meta().allInstructions().stream().anyMatch(inst -> inst.type() == L2MODIFICATION
- && ((L2ModificationInstruction) inst).subtype() == L2SubType.VLAN_POP) &&
- fob.conditions().stream().filter(criterion -> criterion.type() == VLAN_VID).count() == 2;
- }
-
- /**
- * Determines if the filtering objective will be used for a pseudowire.
- *
- * @param filteringObjective
- * @return True if objective was created for a pseudowire, false otherwise.
- */
- private boolean isPseudowire(FilteringObjective filteringObjective) {
-
-
- if (filteringObjective.meta() != null) {
-
- TrafficTreatment treatment = filteringObjective.meta();
- for (Instruction instr : treatment.immediate()) {
- if (instr.type().equals(Instruction.Type.L2MODIFICATION)) {
-
- L2ModificationInstruction l2Instr = (L2ModificationInstruction) instr;
- if (l2Instr.subtype().equals(L2SubType.TUNNEL_ID)) {
- return true;
- }
- }
- }
- }
-
- return false;
- }
-
- /**
* Method to process the pw related filtering objectives.
*
* @param portCriterion the in port match
@@ -814,52 +776,6 @@
}
/**
- * Utility function to get the mod tunnel id instruction
- * if present.
- *
- * @param treatment the treatment to analyze
- * @return the mod tunnel id instruction if present,
- * otherwise null
- */
- private ModTunnelIdInstruction getModTunnelIdInstruction(TrafficTreatment treatment) {
- if (treatment == null) {
- return null;
- }
-
- L2ModificationInstruction l2ModificationInstruction;
- for (Instruction instruction : treatment.allInstructions()) {
- if (instruction.type() == L2MODIFICATION) {
- l2ModificationInstruction = (L2ModificationInstruction) instruction;
- if (l2ModificationInstruction.subtype() == L2SubType.TUNNEL_ID) {
- return (ModTunnelIdInstruction) l2ModificationInstruction;
- }
- }
- }
- return null;
- }
-
- /**
- * Utility function to get the output instruction
- * if present.
- *
- * @param treatment the treatment to analyze
- * @return the output instruction if present,
- * otherwise null
- */
- private OutputInstruction getOutputInstruction(TrafficTreatment treatment) {
- if (treatment == null) {
- return null;
- }
-
- for (Instruction instruction : treatment.allInstructions()) {
- if (instruction.type() == Instruction.Type.OUTPUT) {
- return (OutputInstruction) instruction;
- }
- }
- return null;
- }
-
- /**
* Helper method for dividing the tunnel instructions from the mpls
* instructions.
*
@@ -910,4 +826,5 @@
}
}
}
+
}