Change the APIs to instantiate Resource and ResourceId
Now, DiscreteResource/DiscreteResourceId is provided by DiscreteFactory.
Similarly, ContinuousResource/ContinuousResourceId is provided by
ContinuousFactory. These factory instances can be obtained by static
factory method such as Resource.discrete(...) or Resource.continuous(...).
Change-Id: Ic94f7336c0e1f74cf2dddcac899de300362aff3e
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 5d47658..a08b843 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
@@ -160,8 +160,8 @@
log.debug("Compiling optical circuit intent between {} and {}", src, dst);
// Reserve OduClt ports
- Resource srcPortResource = Resource.discrete(src.deviceId(), src.port());
- Resource dstPortResource = Resource.discrete(dst.deviceId(), dst.port());
+ Resource srcPortResource = Resource.discrete(src.deviceId(), src.port()).resource();
+ Resource dstPortResource = Resource.discrete(dst.deviceId(), dst.port()).resource();
List<ResourceAllocation> allocation = resourceService.allocate(intent.id(), srcPortResource, dstPortResource);
if (allocation.isEmpty()) {
throw new IntentCompilationException("Unable to reserve ports for intent " + intent);
@@ -312,7 +312,7 @@
if (ochCP != null) {
OchPort ochPort = (OchPort) deviceService.getPort(ochCP.deviceId(), ochCP.port());
Optional<IntentId> intentId =
- resourceService.getResourceAllocations(Resource.discrete(ochCP.deviceId(), ochCP.port()))
+ resourceService.getResourceAllocations(Resource.discrete(ochCP.deviceId(), ochCP.port()).resource())
.stream()
.map(ResourceAllocation::consumer)
.filter(x -> x instanceof IntentId)
@@ -333,7 +333,8 @@
}
Optional<IntentId> intentId =
- resourceService.getResourceAllocations(Resource.discrete(oduPort.deviceId(), port.number()))
+ resourceService.getResourceAllocations(
+ Resource.discrete(oduPort.deviceId(), port.number()).resource())
.stream()
.map(ResourceAllocation::consumer)
.filter(x -> x instanceof IntentId)