Resource group to share resources between intents

Change-Id: I5bf7d4261197449924d07dabac841cf8ccbe9389
diff --git a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompiler.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompiler.java
index 9b131ae..a3af158 100644
--- a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompiler.java
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompiler.java
@@ -57,6 +57,7 @@
 import org.onosproject.net.intent.IntentService;
 import org.onosproject.net.intent.OpticalCircuitIntent;
 import org.onosproject.net.intent.OpticalConnectivityIntent;
+import org.onosproject.net.intent.PathIntent;
 import org.onosproject.net.optical.OchPort;
 import org.onosproject.net.optical.OduCltPort;
 import org.onosproject.net.intent.IntentSetMultimap;
@@ -252,6 +253,7 @@
                     .dst(dstCP)
                     .signalType(ochPorts.getLeft().signalType())
                     .bidirectional(intent.isBidirectional())
+                    .resourceGroup(intent.resourceGroup())
                     .build();
 
             if (!supportsMultiplexing) {
@@ -328,7 +330,10 @@
             rules.add(connectPorts(higherIntent.getDst(), lowerIntent.getDst(), higherIntent.priority(), slots));
         }
 
-        return new FlowRuleIntent(appId, higherIntent.key(), rules, higherIntent.resources());
+        return new FlowRuleIntent(appId, higherIntent.key(), rules,
+                                  higherIntent.resources(),
+                                  PathIntent.ProtectionType.PRIMARY,
+                                  higherIntent.resourceGroup());
     }
 
     /**