Remove dependency on LinkResourceService from Constraint
Change-Id: Ib9c488331b22eef6769a767c6186ef7d2e8b1501
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/ConnectivityIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/ConnectivityIntentCompiler.java
index 6de4cfd..69101a9 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/ConnectivityIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/ConnectivityIntentCompiler.java
@@ -27,8 +27,8 @@
import org.onosproject.net.intent.IntentCompiler;
import org.onosproject.net.intent.IntentExtensionService;
import org.onosproject.net.intent.impl.PathNotFoundException;
+import org.onosproject.net.newresource.ResourceService;
import org.onosproject.net.provider.ProviderId;
-import org.onosproject.net.resource.link.LinkResourceService;
import org.onosproject.net.topology.LinkWeight;
import org.onosproject.net.topology.PathService;
import org.onosproject.net.topology.TopologyEdge;
@@ -55,7 +55,7 @@
protected PathService pathService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected LinkResourceService resourceService;
+ protected ResourceService resourceService;
/**
* Returns an edge-weight capable of evaluating links on the basis of the
@@ -77,7 +77,7 @@
*/
protected boolean checkPath(Path path, List<Constraint> constraints) {
for (Constraint constraint : constraints) {
- if (!constraint.validate(path, resourceService)) {
+ if (!constraint.validate(path, resourceService::isAvailable)) {
return false;
}
}
@@ -138,9 +138,9 @@
// the first one with fast fail over the first failure
Iterator<Constraint> it = constraints.iterator();
- double cost = it.next().cost(edge.link(), resourceService);
+ double cost = it.next().cost(edge.link(), resourceService::isAvailable);
while (it.hasNext() && cost > 0) {
- if (it.next().cost(edge.link(), resourceService) < 0) {
+ if (it.next().cost(edge.link(), resourceService::isAvailable) < 0) {
return -1;
}
}