[ONOS-8140][VOL-4152][SDFAB-94] Adding annotations to flow objectives
Change-Id: I4568b7d3bf4d5322395bbe14683ce48f93bd914e
diff --git a/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultFilteringObjective.java b/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultFilteringObjective.java
index f3d4266..37000af 100644
--- a/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultFilteringObjective.java
+++ b/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultFilteringObjective.java
@@ -18,6 +18,8 @@
import com.google.common.annotations.Beta;
import com.google.common.collect.ImmutableList;
import org.onosproject.core.ApplicationId;
+import org.onosproject.net.AbstractAnnotated;
+import org.onosproject.net.Annotations;
import org.onosproject.net.flow.TrafficTreatment;
import org.onosproject.net.flow.criteria.Criteria;
import org.onosproject.net.flow.criteria.Criterion;
@@ -35,7 +37,8 @@
* Default implementation of a filtering objective.
*/
@Beta
-public final class DefaultFilteringObjective implements FilteringObjective {
+public final class DefaultFilteringObjective extends AbstractAnnotated
+ implements FilteringObjective {
private final Type type;
private final boolean permanent;
@@ -50,6 +53,7 @@
private final TrafficTreatment meta;
private DefaultFilteringObjective(Builder builder) {
+ super(builder.annotations);
this.key = builder.key;
this.type = builder.type;
this.permanent = builder.permanent;
@@ -160,6 +164,7 @@
.add("appId", appId())
.add("permanent", permanent())
.add("timeout", timeout())
+ .add("annotations", annotations())
.toString();
}
@@ -191,6 +196,7 @@
private Operation op;
private ObjectiveContext context;
private TrafficTreatment meta;
+ private Annotations annotations;
// Creates an empty builder
private Builder() {
@@ -207,6 +213,7 @@
this.appId = objective.appId();
this.meta = objective.meta();
this.op = objective.op();
+ this.annotations = objective.annotations();
}
@Override
@@ -265,6 +272,12 @@
}
@Override
+ public Builder withAnnotations(Annotations annotations) {
+ this.annotations = annotations;
+ return this;
+ }
+
+ @Override
public FilteringObjective add() {
conditions = listBuilder.build();
op = Operation.ADD;