ONOS-22 - Add Constraints to CLI Commands
Added optional --lambda and --bandwidth operations to command
line for host to host, point to point, and multi point to
single point intents
Fixed intent compilers to add constraints to the PathIntents they
create
Change-Id: I25510d401118feba493f51ecddc72d770d8ae3e3
diff --git a/core/net/src/main/java/org/onlab/onos/net/intent/impl/ConnectivityIntentCompiler.java b/core/net/src/main/java/org/onlab/onos/net/intent/impl/ConnectivityIntentCompiler.java
index 4cf1830..8a31900 100644
--- a/core/net/src/main/java/org/onlab/onos/net/intent/impl/ConnectivityIntentCompiler.java
+++ b/core/net/src/main/java/org/onlab/onos/net/intent/impl/ConnectivityIntentCompiler.java
@@ -118,13 +118,14 @@
@Override
public double weight(TopologyEdge edge) {
- if (constraints == null) {
+ if (constraints == null || !constraints.iterator().hasNext()) {
return 1.0;
}
// iterate over all constraints in order and return the weight of
// the first one with fast fail over the first failure
Iterator<Constraint> it = constraints.iterator();
+
double cost = it.next().cost(edge.link(), resourceService);
while (it.hasNext() && cost > 0) {
if (it.next().cost(edge.link(), resourceService) < 0) {
@@ -132,6 +133,7 @@
}
}
return cost;
+
}
}