Add method to get available resources filtered by its type
Change-Id: I034bdcf4e9a399af6c68c7ed7f53185bba9b2e27
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
index b113b07..0430f99 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
@@ -24,7 +24,6 @@
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.onlab.util.Frequency;
-import org.onlab.util.Tools;
import org.onosproject.net.AnnotationKeys;
import org.onosproject.net.ChannelSpacing;
import org.onosproject.net.ConnectPoint;
@@ -217,9 +216,7 @@
Resources.discrete(x.src().deviceId(), x.src().port()).id(),
Resources.discrete(x.dst().deviceId(), x.dst().port()).id()
))
- .map(resourceService::getAvailableResources)
- .map(x -> x.stream()
- .flatMap(r -> Tools.stream(r.valueAs(OchSignal.class))).collect(Collectors.toList()))
+ .map(x -> resourceService.getAvailableResourceValues(x, OchSignal.class))
.map(x -> (Set<OchSignal>) ImmutableSet.copyOf(x))
.reduce(Sets::intersection)
.orElse(Collections.emptySet());