ONOS-3296: Support continuous type resources
Change-Id: I155e41e7a7c1750ff45986a55bedab353485d3fa
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompiler.java
index ee04aab..2c547ea 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompiler.java
@@ -313,9 +313,11 @@
OchPort ochPort = (OchPort) deviceService.getPort(ochCP.deviceId(), ochCP.port());
Optional<IntentId> intentId =
resourceService.getResourceAllocation(ResourcePath.discrete(ochCP.deviceId(), ochCP.port()))
+ .stream()
.map(ResourceAllocation::consumer)
.filter(x -> x instanceof IntentId)
- .map(x -> (IntentId) x);
+ .map(x -> (IntentId) x)
+ .findAny();
if (isAvailable(intentId.orElse(null))) {
return ochPort;
@@ -332,9 +334,12 @@
Optional<IntentId> intentId =
resourceService.getResourceAllocation(ResourcePath.discrete(oduPort.deviceId(), port.number()))
+ .stream()
.map(ResourceAllocation::consumer)
.filter(x -> x instanceof IntentId)
- .map(x -> (IntentId) x);
+ .map(x -> (IntentId) x)
+ .findAny();
+
if (isAvailable(intentId.orElse(null))) {
return (OchPort) port;
}