Do not accumulate VERSATILE fwd objectives
Change-Id: I2af35112b145ef46212f74a15528e22a8bb6307c
diff --git a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2Pipeline.java b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2Pipeline.java
index d334421..81a14ef 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2Pipeline.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2Pipeline.java
@@ -113,6 +113,7 @@
import static org.onosproject.driver.extensions.Ofdpa3CopyField.OXM_ID_VLAN_VID;
import static org.onosproject.driver.pipeline.ofdpa.OfdpaGroupHandlerUtility.*;
import static org.onosproject.driver.pipeline.ofdpa.OfdpaPipelineUtility.*;
+import static org.onosproject.net.flowobjective.ForwardingObjective.Flag.SPECIFIC;
import static org.onosproject.net.group.GroupDescription.Type.SELECT;
import static org.slf4j.LoggerFactory.getLogger;
import static org.onosproject.net.flow.criteria.Criterion.Type.MPLS_BOS;
@@ -175,6 +176,14 @@
initializePipeline();
}
+ void setupAccumulatorForTests(int maxFwd, int maxBatchMS, int maxIdleMS) {
+ if (accumulator == null) {
+ accumulator = new ForwardingObjectiveAccumulator(maxFwd,
+ maxBatchMS,
+ maxIdleMS);
+ }
+ }
+
protected void initDriverId() {
driverId = coreService.registerApplication(
"org.onosproject.driver.Ofdpa2Pipeline");
@@ -307,8 +316,9 @@
// generated by FlowRule service for empty flowOps.
return;
}
- // Let's accumulate flow rules - otherwise send directly
- if (accumulator != null) {
+ // Let's accumulate flow rules if accumulator is active and fwd objective is not versatile.
+ // Otherwise send directly, without adding futher delay
+ if (accumulator != null && Objects.equals(fwd.flag(), SPECIFIC)) {
accumulator.add(Pair.of(fwd, rules));
} else {
sendForwards(Collections.singletonList(Pair.of(fwd, rules)));