[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/OpticalCircuitIntentCompiler.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompiler.java
index a44d837..a62a5b0 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
@@ -187,7 +187,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 OduClt ports availability
Resource srcPortResource = Resources.discrete(src.deviceId(), src.port()).resource();
@@ -269,7 +269,7 @@
}
}
- if (resourceService.allocate(intent.id(), required).isEmpty()) {
+ if (resourceService.allocate(intent.key(), required).isEmpty()) {
throw new OpticalIntentCompilationException("Unable to allocate resources for intent " + intent
+ ": resources=" + required);
}