Resource group to share resources between intents

Change-Id: I5bf7d4261197449924d07dabac841cf8ccbe9389
diff --git a/core/api/src/main/java/org/onosproject/net/intent/PathIntent.java b/core/api/src/main/java/org/onosproject/net/intent/PathIntent.java
index 94a05b2..3c386cc 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/PathIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/PathIntent.java
@@ -21,6 +21,7 @@
 import org.onosproject.core.ApplicationId;
 import org.onosproject.net.Link;
 import org.onosproject.net.Path;
+import org.onosproject.net.ResourceGroup;
 import org.onosproject.net.flow.TrafficSelector;
 import org.onosproject.net.flow.TrafficTreatment;
 
@@ -50,7 +51,9 @@
      * @param constraints  optional list of constraints
      * @param priority  priority to use for the generated flows
      * @throws NullPointerException {@code path} is null
+     * @deprecated 1.9.1
      */
+    @Deprecated
     protected PathIntent(ApplicationId appId,
                          Key key,
                          TrafficSelector selector,
@@ -59,7 +62,7 @@
                          List<Constraint> constraints,
                          int priority) {
         this(appId, key, selector, treatment, path, constraints, priority,
-             ProtectionType.PRIMARY);
+             ProtectionType.PRIMARY, null);
     }
 
     /**
@@ -75,6 +78,7 @@
      * @param constraints  optional list of constraints
      * @param priority  priority to use for the generated flows
      * @param type      PRIMARY or BACKUP
+     * @param resourceGroup resource group for this intent
      * @throws NullPointerException {@code path} is null
      */
     protected PathIntent(ApplicationId appId,
@@ -84,9 +88,10 @@
                          Path path,
                          List<Constraint> constraints,
                          int priority,
-                         ProtectionType type) {
+                         ProtectionType type,
+                         ResourceGroup resourceGroup) {
         super(appId, key, resources(path.links()), selector, treatment, constraints,
-              priority);
+              priority, resourceGroup);
         PathIntent.validate(path.links());
         this.path = path;
         this.type = type;
@@ -151,6 +156,11 @@
             return (Builder) super.priority(priority);
         }
 
+        @Override
+        public Builder resourceGroup(ResourceGroup resourceGroup) {
+            return (Builder) super.resourceGroup(resourceGroup);
+        }
+
         /**
          * Sets the path of the intent that will be built.
          *
@@ -182,7 +192,8 @@
                     path,
                     constraints,
                     priority,
-                    type == null ? ProtectionType.PRIMARY : type
+                    type == null ? ProtectionType.PRIMARY : type,
+                    resourceGroup
             );
         }
     }
@@ -237,6 +248,7 @@
                 .add("constraints", constraints())
                 .add("path", path)
                 .add("type", type)
+                .add("resourceGroup", resourceGroup())
                 .toString();
     }