Support metadata in forwarding objective

Change-Id: Iaa916a8b2749bec6b9db42fe3f3765b922bd921b
diff --git a/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultForwardingObjective.java b/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultForwardingObjective.java
index fd08fd4..bb38039 100644
--- a/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultForwardingObjective.java
+++ b/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultForwardingObjective.java
@@ -44,6 +44,7 @@
     private final TrafficTreatment treatment;
     private final Operation op;
     private final Optional<ObjectiveContext> context;
+    private final TrafficSelector meta;
 
     private final int id;
 
@@ -58,6 +59,7 @@
         this.treatment = builder.treatment;
         this.op = builder.op;
         this.context = Optional.ofNullable(builder.context);
+        this.meta = builder.meta;
 
         this.id = Objects.hash(selector, flag, permanent,
                 timeout, appId, priority, nextId,
@@ -122,9 +124,14 @@
     }
 
     @Override
+    public TrafficSelector meta() {
+        return meta;
+    }
+
+    @Override
     public int hashCode() {
         return Objects.hash(selector, flag, permanent, timeout, appId,
-                            priority, nextId, treatment, op);
+                            priority, nextId, treatment, op, meta);
     }
 
     @Override
@@ -142,7 +149,8 @@
                     && Objects.equals(this.priority, other.priority)
                     && Objects.equals(this.nextId, other.nextId)
                     && Objects.equals(this.treatment, other.treatment)
-                    && Objects.equals(this.op, other.op);
+                    && Objects.equals(this.op, other.op)
+                    && Objects.equals(this.meta, other.meta);
         }
         return false;
     }
@@ -156,6 +164,7 @@
                 .add("selector", selector())
                 .add("treatment", treatment())
                 .add("nextId", nextId())
+                .add("meta", meta())
                 .add("flag", flag())
                 .add("appId", appId())
                 .add("permanent", permanent())
@@ -192,6 +201,7 @@
         private TrafficTreatment treatment;
         private Operation op;
         private ObjectiveContext context;
+        private TrafficSelector meta;
 
         // Creates an empty builder
         private Builder() {
@@ -208,6 +218,7 @@
             this.nextId = objective.nextId();
             this.treatment = objective.treatment();
             this.op = objective.op();
+            this.meta = objective.meta();
         }
 
         @Override
@@ -260,6 +271,12 @@
         }
 
         @Override
+        public Builder withMeta(TrafficSelector meta) {
+            this.meta = meta;
+            return this;
+        }
+
+        @Override
         public ForwardingObjective add() {
             checkNotNull(selector, "Must have a selector");
             checkNotNull(flag, "A flag must be set");
diff --git a/core/api/src/main/java/org/onosproject/net/flowobjective/FilteringObjective.java b/core/api/src/main/java/org/onosproject/net/flowobjective/FilteringObjective.java
index d74b082..772eb6d 100644
--- a/core/api/src/main/java/org/onosproject/net/flowobjective/FilteringObjective.java
+++ b/core/api/src/main/java/org/onosproject/net/flowobjective/FilteringObjective.java
@@ -83,7 +83,7 @@
     Collection<Criterion> conditions();
 
     /**
-     * Auxiliary optional information provided to the device-driver.Typically
+     * Auxiliary optional information provided to the device driver. Typically
      * conveys information about changes (treatments) to packets that are
      * permitted into the pipeline by the PERMIT filtering condition.
      *
diff --git a/core/api/src/main/java/org/onosproject/net/flowobjective/ForwardingObjective.java b/core/api/src/main/java/org/onosproject/net/flowobjective/ForwardingObjective.java
index bf1bd39..4e998ed 100644
--- a/core/api/src/main/java/org/onosproject/net/flowobjective/ForwardingObjective.java
+++ b/core/api/src/main/java/org/onosproject/net/flowobjective/ForwardingObjective.java
@@ -87,6 +87,16 @@
     Flag flag();
 
     /**
+     * Auxiliary optional information provided to the device driver. Typically
+     * conveys information about selectors (matches) that are intended to
+     * use this Forwarding Objective.
+     *
+     * @return a selector intended to pass meta information to the device driver.
+     *         Value may be null if no meta information is provided.
+     */
+    TrafficSelector meta();
+
+    /**
      * A forwarding objective builder.
      */
     interface Builder extends Objective.Builder {
@@ -124,6 +134,14 @@
         Builder withFlag(Flag flag);
 
         /**
+         * Set meta information related to this forwarding objective.
+         *
+         * @param selector match conditions
+         * @return an objective builder
+         */
+        Builder withMeta(TrafficSelector selector);
+
+        /**
          * Builds the forwarding objective that will be added.
          *
          * @return a forwarding objective
diff --git a/core/api/src/main/java/org/onosproject/net/flowobjective/NextObjective.java b/core/api/src/main/java/org/onosproject/net/flowobjective/NextObjective.java
index cbe7ebe..4a86d86 100644
--- a/core/api/src/main/java/org/onosproject/net/flowobjective/NextObjective.java
+++ b/core/api/src/main/java/org/onosproject/net/flowobjective/NextObjective.java
@@ -85,7 +85,7 @@
     Type type();
 
     /**
-     * Auxiliary optional information provided to the device-driver.Typically
+     * Auxiliary optional information provided to the device driver. Typically
      * conveys information about selectors (matches) that are intended to
      * use this Next Objective.
      *