Adds OfdpaPipelineUtility
Change-Id: I96086e408dd9d7265325414dace512b64a048e9a
(cherry picked from commit 9469f3e47eacd26fc00d34e413a42eb5294f64cc)
(cherry picked from commit 2798cd134313d438a89934cbfc8d873bddce3b8d)
diff --git a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa3GroupHandler.java b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa3GroupHandler.java
index 6d28a11..d427a6c 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa3GroupHandler.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa3GroupHandler.java
@@ -29,8 +29,6 @@
import org.onosproject.net.flow.DefaultTrafficTreatment;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
-import org.onosproject.net.flow.criteria.Criterion;
-import org.onosproject.net.flow.criteria.VlanIdCriterion;
import org.onosproject.net.flow.instructions.Instruction;
import org.onosproject.net.flow.instructions.Instructions;
import org.onosproject.net.flow.instructions.L2ModificationInstruction;
@@ -101,7 +99,7 @@
);
if (groupInfo == null) {
log.error("Could not process nextObj={} in dev:{}", nextObjective.id(), deviceId);
- Ofdpa2Pipeline.fail(nextObjective, ObjectiveError.GROUPINSTALLATIONFAILED);
+ OfdpaPipelineUtility.fail(nextObjective, ObjectiveError.GROUPINSTALLATIONFAILED);
return;
}
// We update the chain with the last two groups;
@@ -128,7 +126,7 @@
log.error("Next Objective for pseudo wire should have at "
+ "most {} mpls instruction sets. Next Objective Id:{}",
MAX_DEPTH_UNPROTECTED_PW, nextObjective.id());
- Ofdpa2Pipeline.fail(nextObjective, ObjectiveError.BADPARAMS);
+ OfdpaPipelineUtility.fail(nextObjective, ObjectiveError.BADPARAMS);
return;
}
@@ -487,28 +485,4 @@
return new GroupInfo(l2groupDescription, outerGrpDesc);
}
- /**
- * Helper method to decide whether L2 Interface group or L2 Unfiltered group needs to be created.
- * L2 Unfiltered group will be created if meta has VlanIdCriterion with VlanId.ANY, and
- * treatment has set Vlan ID action.
- *
- * @param treatment treatment passed in by the application as part of the nextObjective
- * @param meta metadata passed in by the application as part of the nextObjective
- * @return true if L2 Unfiltered group needs to be created, false otherwise.
- */
- private boolean isUnfiltered(TrafficTreatment treatment, TrafficSelector meta) {
- if (meta == null || treatment == null) {
- return false;
- }
- VlanIdCriterion vlanIdCriterion = (VlanIdCriterion) meta.getCriterion(Criterion.Type.VLAN_VID);
- if (vlanIdCriterion == null || !vlanIdCriterion.vlanId().equals(VlanId.ANY)) {
- return false;
- }
-
- return treatment.allInstructions().stream()
- .filter(i -> (i.type() == Instruction.Type.L2MODIFICATION
- && ((L2ModificationInstruction) i).subtype() == L2ModificationInstruction.L2SubType.VLAN_ID))
- .count() == 1;
- }
-
}