[CORD-2721] Implement group bucket modification

Change-Id: I0f637ec4ff2b0c12db53d70fed195ea28e542535
diff --git a/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultNextObjective.java b/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultNextObjective.java
index 671cc5f..8c466c9 100644
--- a/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultNextObjective.java
+++ b/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultNextObjective.java
@@ -316,6 +316,24 @@
         }
 
         @Override
+        public NextObjective modify() {
+            return modify(null);
+        }
+
+        @Override
+        public NextObjective modify(ObjectiveContext context) {
+            treatments = listBuilder.build();
+            op = Operation.MODIFY;
+            this.context = context;
+            checkNotNull(appId, "Must supply an application id");
+            checkNotNull(id, "id cannot be null");
+            checkNotNull(type, "The type cannot be null");
+            checkArgument(!treatments.isEmpty(), "Must have at least one treatment");
+
+            return new DefaultNextObjective(this);
+        }
+
+        @Override
         public NextObjective verify() {
             return verify(null);
         }
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 725ebf5..4cc8478 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
@@ -228,6 +228,23 @@
         NextObjective removeFromExisting(ObjectiveContext context);
 
         /**
+         * Build the next objective that will be modified with {@link Operation}
+         * MODIFY.
+         *
+         * @return a next objective
+         */
+
+        NextObjective modify();
+        /**
+         * Build the next objective that will be modified, with {@link Operation}
+         * MODIFY. The context will be used to notify the calling application.
+         *
+         * @param context an objective context
+         * @return a next objective
+         */
+        NextObjective modify(ObjectiveContext context);
+
+        /**
          * Builds the next objective that needs to be verified.
          *
          * @return a next objective with {@link Operation} VERIFY
diff --git a/core/api/src/main/java/org/onosproject/net/flowobjective/Objective.java b/core/api/src/main/java/org/onosproject/net/flowobjective/Objective.java
index f0e4305..3b0346c 100644
--- a/core/api/src/main/java/org/onosproject/net/flowobjective/Objective.java
+++ b/core/api/src/main/java/org/onosproject/net/flowobjective/Objective.java
@@ -63,6 +63,11 @@
         REMOVE_FROM_EXISTING,
 
         /**
+         * Modify an existing Next Objective. Can be used to modify group buckets.
+         */
+        MODIFY,
+
+        /**
          * Verifies that an existing Next Objective's collection of treatments
          * are correctly represented by the underlying implementation of the objective.
          * Corrective action is taken if discrepancies are found during verification.