Resource group to share resources between intents

Change-Id: I5bf7d4261197449924d07dabac841cf8ccbe9389
diff --git a/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java
index 5d5d18b..7ebc3be 100644
--- a/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java
@@ -28,6 +28,7 @@
 import org.onosproject.core.CoreService;
 import org.onosproject.net.EncapsulationType;
 import org.onosproject.net.PortNumber;
+import org.onosproject.net.ResourceGroup;
 import org.onosproject.net.flow.DefaultTrafficSelector;
 import org.onosproject.net.flow.DefaultTrafficTreatment;
 import org.onosproject.net.flow.TrafficSelector;
@@ -181,6 +182,11 @@
             required = false, multiValued = false)
     private boolean hashedPathSelection = false;
 
+    // Resource Group
+    @Option(name = "-r", aliases = "--resourceGroup", description = "Resource Group Id",
+            required = false, multiValued = false)
+    private String resourceGroupId = null;
+
 
     /**
      * Constructs a traffic selector based on the command line arguments
@@ -409,6 +415,18 @@
         return appIdForIntent;
     }
 
+    protected ResourceGroup resourceGroup() {
+        if (resourceGroupId != null) {
+            if (resourceGroupId.toLowerCase().startsWith("0x")) {
+                return ResourceGroup.of(Long.parseUnsignedLong(resourceGroupId.substring(2), 16));
+            } else {
+                return ResourceGroup.of(Long.parseUnsignedLong(resourceGroupId));
+            }
+        } else {
+            return null;
+        }
+    }
+
     /**
      * Creates a key for an intent based on command line arguments.  If a key
      * has been specified, it is returned.  If no key is specified, null