Resource group to share resources between intents

Change-Id: I5bf7d4261197449924d07dabac841cf8ccbe9389
diff --git a/core/api/src/main/java/org/onosproject/net/intent/OpticalCircuitIntent.java b/core/api/src/main/java/org/onosproject/net/intent/OpticalCircuitIntent.java
index 3bc9db6..afe95bc 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/OpticalCircuitIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/OpticalCircuitIntent.java
@@ -20,6 +20,7 @@
 import org.onosproject.core.ApplicationId;
 import org.onosproject.net.CltSignalType;
 import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.ResourceGroup;
 
 import java.util.Collections;
 
@@ -47,10 +48,35 @@
      * @param signalType ODU signal type
      * @param isBidirectional indicate if intent is bidirectional
      * @param priority priority to use for flows from this intent
+     * @deprecated 1.9.1
      */
+    @Deprecated
     protected OpticalCircuitIntent(ApplicationId appId, Key key, ConnectPoint src, ConnectPoint dst,
                                    CltSignalType signalType, boolean isBidirectional, int priority) {
-        super(appId, key, Collections.emptyList(), priority);
+        super(appId, key, Collections.emptyList(), priority, null);
+        this.src = checkNotNull(src);
+        this.dst = checkNotNull(dst);
+        this.signalType = checkNotNull(signalType);
+        this.isBidirectional = isBidirectional;
+    }
+
+    /**
+     * Creates an optical circuit intent between the specified
+     * connection points.
+     *
+     * @param appId application identification
+     * @param key intent key
+     * @param src the source transponder port
+     * @param dst the destination transponder port
+     * @param signalType ODU signal type
+     * @param isBidirectional indicate if intent is bidirectional
+     * @param priority priority to use for flows from this intent
+     * @param resourceGroup resource group for this intent
+     */
+    protected OpticalCircuitIntent(ApplicationId appId, Key key, ConnectPoint src, ConnectPoint dst,
+                                   CltSignalType signalType, boolean isBidirectional, int priority,
+                                   ResourceGroup resourceGroup) {
+        super(appId, key, Collections.emptyList(), priority, resourceGroup);
         this.src = checkNotNull(src);
         this.dst = checkNotNull(dst);
         this.signalType = checkNotNull(signalType);
@@ -91,6 +117,11 @@
             return (Builder) super.priority(priority);
         }
 
+        @Override
+        public Builder resourceGroup(ResourceGroup resourceGroup) {
+            return (Builder) super.resourceGroup(resourceGroup);
+        }
+
         /**
          * Sets the source for the intent that will be built.
          *
@@ -149,7 +180,8 @@
                     dst,
                     signalType,
                     isBidirectional,
-                    priority
+                    priority,
+                    resourceGroup
             );
         }
     }
@@ -213,6 +245,7 @@
                 .add("dst", dst)
                 .add("signalType", signalType)
                 .add("isBidirectional", isBidirectional)
+                .add("resourceGroup", resourceGroup())
                 .toString();
     }