Segment Routing refactor with flow objectives

Change-Id: I0b87f89bb8b18522b9d38bdf5e96f55485b6f1e3
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/PolicyGroupHandler.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/PolicyGroupHandler.java
index 9f35c74..d141ed1 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/PolicyGroupHandler.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/grouphandler/PolicyGroupHandler.java
@@ -25,19 +25,13 @@
 
 import org.onlab.packet.MplsLabel;
 import org.onosproject.core.ApplicationId;
-import org.onosproject.core.GroupId;
 import org.onosproject.segmentrouting.grouphandler.GroupBucketIdentifier.BucketOutputType;
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.PortNumber;
 import org.onosproject.net.flow.DefaultTrafficTreatment;
 import org.onosproject.net.flow.TrafficTreatment;
-import org.onosproject.net.group.DefaultGroupBucket;
-import org.onosproject.net.group.DefaultGroupDescription;
+import org.onosproject.net.flowobjective.FlowObjectiveService;
 import org.onosproject.net.group.GroupBucket;
-import org.onosproject.net.group.GroupBuckets;
-import org.onosproject.net.group.GroupDescription;
-import org.onosproject.net.group.GroupEvent;
-import org.onosproject.net.group.GroupService;
 import org.onosproject.net.link.LinkService;
 import org.slf4j.Logger;
 
@@ -58,14 +52,14 @@
      * @param appId application identifier
      * @param config interface to retrieve the device properties
      * @param linkService link service object
-     * @param groupService group service object
+     * @param flowObjService flow objective service object
      */
     public PolicyGroupHandler(DeviceId deviceId,
                               ApplicationId appId,
                               DeviceProperties config,
                               LinkService linkService,
-                              GroupService groupService) {
-        super(deviceId, appId, config, linkService, groupService);
+                              FlowObjectiveService flowObjService) {
+        super(deviceId, appId, config, linkService, flowObjService);
     }
 
     public PolicyGroupIdentifier createPolicyGroupChain(String id,
@@ -111,15 +105,16 @@
                                     .setEthSrc(nodeMacAddr)
                                     .pushMpls()
                                     .setMpls(MplsLabel.mplsLabel(label));
-                            outBuckets.add(DefaultGroupBucket.
+                            /*outBuckets.add(DefaultGroupBucket.
                                            createSelectGroupBucket(tBuilder.build()));
                             GroupDescription desc = new
                                     DefaultGroupDescription(deviceId,
                                                             GroupDescription.Type.INDIRECT,
                                                             new GroupBuckets(outBuckets));
-                            //TODO: BoS
+                            //TODO: BoS*/
                             previousGroupkey = key;
-                            groupService.addGroup(desc);
+                            //groupService.addGroup(desc);
+                            //TODO: Use nextObjective APIs here
                         } else {
                             // Intermediate Groups
                             GroupBucketIdentifier bucketId =
@@ -179,20 +174,22 @@
                             .setMpls(MplsLabel.mplsLabel(bucketId.label()));
                     }
                     //TODO: BoS
-                    outBuckets.add(DefaultGroupBucket.
-                                   createSelectGroupBucket(tBuilder.build()));
+                    /*outBuckets.add(DefaultGroupBucket.
+                                   createSelectGroupBucket(tBuilder.build()));*/
                 }
-                GroupDescription desc = new
+                /*GroupDescription desc = new
                         DefaultGroupDescription(deviceId,
                                                 GroupDescription.Type.SELECT,
                                                 new GroupBuckets(outBuckets));
-                groupService.addGroup(desc);
+                groupService.addGroup(desc);*/
+                //TODO: Use nextObjective APIs here
             }
         }
         return innermostGroupkey;
     }
 
-    @Override
+    //TODO: Use nextObjective APIs to handle the group chains
+    /*@Override
     protected void handleGroupEvent(GroupEvent event) {
         if (event.type() == GroupEvent.Type.GROUP_ADDED) {
             if (dependentGroups.get(event.subject().appCookie()) != null) {
@@ -253,7 +250,7 @@
                 }
             }
         }
-    }
+    }*/
 
     public PolicyGroupIdentifier generatePolicyGroupKey(String id,
                                    List<PolicyGroupParams> params) {
@@ -343,9 +340,10 @@
                     groupsToBeDeleted.add(bucketId.outGroup());
                 }
             }
-            groupService.removeGroup(deviceId,
+            /*groupService.removeGroup(deviceId,
                                      getGroupKey(innerMostGroupKey),
-                                     appId);
+                                     appId);*/
+            //TODO: Use nextObjective APIs here
             it.remove();
         }
     }