[ONOS-6412] allocate resource by Intent.Key

- Allocate resources by Intent.Key instead of IntentId

- ONOS-5808 changed the IntentManager's Intent withdrawal behavior to
  release resouces allocated by Intent.Key
  (was releasing resource allocated by IntentId)

Change-Id: I62e048e4ee8f841b92d9985784c95abba3d37a0a
diff --git a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
index 1fb4969..5183a3e 100644
--- a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
@@ -118,7 +118,7 @@
         // Release of intent resources here is only a temporary solution for handling the
         // case of recompiling due to intent restoration (when intent state is FAILED).
         // TODO: try to release intent resources in IntentManager.
-        resourceService.release(intent.id());
+        resourceService.release(intent.key());
 
         // Check OCh port availability
         Resource srcPortResource = Resources.discrete(src.deviceId(), src.port()).resource();
@@ -244,9 +244,9 @@
 
     private void allocateResources(Intent intent, List<Resource> resources) {
         // reserve all of required resources
-        List<ResourceAllocation> allocations = resourceService.allocate(intent.id(), resources);
+        List<ResourceAllocation> allocations = resourceService.allocate(intent.key(), resources);
         if (allocations.isEmpty()) {
-            log.error("Resource allocation for {} failed (resource request: {})", intent.id(), resources);
+            log.error("Resource allocation for {} failed (resource request: {})", intent.key(), resources);
             if (log.isDebugEnabled()) {
                 log.debug("requested resources:\n\t{}", resources.stream()
                                   .map(Resource::toString)