Minor tweaks to the flow layer.
Prevent DistributedStatistics store from logging "rule has no output" for
rules that transition to other tables.
Change-Id: I85e86965f5609df608cbc19551632153960a5c5b
diff --git a/core/api/src/main/java/org/onosproject/net/flow/DefaultFlowRule.java b/core/api/src/main/java/org/onosproject/net/flow/DefaultFlowRule.java
index f083d18..5917b63 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/DefaultFlowRule.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/DefaultFlowRule.java
@@ -15,15 +15,15 @@
*/
package org.onosproject.net.flow;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-import java.util.Objects;
-
import org.onosproject.core.ApplicationId;
import org.onosproject.core.DefaultGroupId;
import org.onosproject.core.GroupId;
import org.onosproject.net.DeviceId;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
public class DefaultFlowRule implements FlowRule {
private final DeviceId deviceId;
@@ -233,7 +233,7 @@
.add("deviceId", deviceId)
.add("priority", priority)
.add("selector", selector.criteria())
- .add("treatment", treatment == null ? "N/A" : treatment.instructions())
+ .add("treatment", treatment == null ? "N/A" : treatment.allInstructions())
.add("table type", type)
.add("created", created)
.toString();
diff --git a/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java b/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java
index 7249ac0..f35074b 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficTreatment.java
@@ -18,6 +18,7 @@
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
+import org.apache.commons.collections.ListUtils;
import org.onlab.packet.IpAddress;
import org.onlab.packet.MacAddress;
import org.onlab.packet.MplsLabel;
@@ -84,6 +85,11 @@
}
@Override
+ public List<Instruction> allInstructions() {
+ return ListUtils.union(immediate, deferred);
+ }
+
+ @Override
public Instructions.TableTypeTransition tableTransition() {
return table;
}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java b/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java
index 5f62442..3d76f3b 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/TrafficTreatment.java
@@ -54,6 +54,14 @@
List<Instruction> immediate();
/**
+ * Returns the list of all instructions in the treatment, both immediate and
+ * deferred.
+ *
+ * @return list of treatment instructions
+ */
+ List<Instruction> allInstructions();
+
+ /**
* Returns the next table in the pipeline.
* @return a table transition; may be null.
*/