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/api/src/main/java/org/onlab/onos/net/intent/MultiPointToSinglePointIntent.java b/core/api/src/main/java/org/onlab/onos/net/intent/MultiPointToSinglePointIntent.java
index 0c47aad..90907fb 100644
--- a/core/api/src/main/java/org/onlab/onos/net/intent/MultiPointToSinglePointIntent.java
+++ b/core/api/src/main/java/org/onlab/onos/net/intent/MultiPointToSinglePointIntent.java
@@ -22,6 +22,7 @@
import org.onlab.onos.net.flow.TrafficSelector;
import org.onlab.onos.net.flow.TrafficTreatment;
+import java.util.List;
import java.util.Set;
import static com.google.common.base.Preconditions.checkArgument;
@@ -65,6 +66,38 @@
}
/**
+ * Creates a new multi-to-single point connectivity intent for the specified
+ * traffic selector and treatment.
+ *
+ * @param appId application identifier
+ * @param selector traffic selector
+ * @param treatment treatment
+ * @param ingressPoints set of ports from which ingress traffic originates
+ * @param egressPoint port to which traffic will egress
+ * @param constraints constraints to apply to the intent
+ * @throws NullPointerException if {@code ingressPoints} or
+ * {@code egressPoint} is null.
+ * @throws IllegalArgumentException if the size of {@code ingressPoints} is
+ * not more than 1
+ */
+ public MultiPointToSinglePointIntent(ApplicationId appId,
+ TrafficSelector selector,
+ TrafficTreatment treatment,
+ Set<ConnectPoint> ingressPoints,
+ ConnectPoint egressPoint,
+ List<Constraint> constraints) {
+ super(id(MultiPointToSinglePointIntent.class, selector, treatment,
+ ingressPoints, egressPoint), appId, null, selector, treatment,
+ constraints);
+
+ checkNotNull(ingressPoints);
+ checkArgument(!ingressPoints.isEmpty(), "Ingress point set cannot be empty");
+
+ this.ingressPoints = Sets.newHashSet(ingressPoints);
+ this.egressPoint = checkNotNull(egressPoint);
+ }
+
+ /**
* Constructor for serializer.
*/
protected MultiPointToSinglePointIntent() {
@@ -101,6 +134,7 @@
.add("treatment", treatment())
.add("ingress", ingressPoints())
.add("egress", egressPoint())
+ .add("constraints", constraints())
.toString();
}
}