aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java')
-rw-r--r--framework/src/onos/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java42
1 files changed, 28 insertions, 14 deletions
diff --git a/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java b/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java
index fbce9648..713b4b5a 100644
--- a/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java
+++ b/framework/src/onos/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java
@@ -26,6 +26,7 @@ import org.onlab.util.Bandwidth;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
+import org.onosproject.net.EncapsulationType;
import org.onosproject.net.Link;
import org.onosproject.net.PortNumber;
import org.onosproject.net.flow.DefaultTrafficSelector;
@@ -36,10 +37,10 @@ import org.onosproject.net.intent.Constraint;
import org.onosproject.net.intent.Intent;
import org.onosproject.net.intent.Key;
import org.onosproject.net.intent.constraint.BandwidthConstraint;
+import org.onosproject.net.intent.constraint.EncapsulationConstraint;
import org.onosproject.net.intent.constraint.LambdaConstraint;
import org.onosproject.net.intent.constraint.LinkTypeConstraint;
import org.onosproject.net.intent.constraint.PartialFailureConstraint;
-import org.onosproject.net.resource.link.BandwidthResource;
import java.util.LinkedList;
import java.util.List;
@@ -117,14 +118,6 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand {
required = false, multiValued = true)
private List<String> extHdrStringList = null;
- @Option(name = "-b", aliases = "--bandwidth", description = "Bandwidth",
- required = false, multiValued = false)
- private String bandwidthString = null;
-
- @Option(name = "-l", aliases = "--lambda", description = "Lambda",
- required = false, multiValued = false)
- private boolean lambda = false;
-
@Option(name = "-a", aliases = "--appId", description = "Application Id",
required = false, multiValued = false)
private String appId = null;
@@ -133,10 +126,6 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand {
required = false, multiValued = false)
private String intentKey = null;
- @Option(name = "--partial", description = "Allow partial installation",
- required = false, multiValued = false)
- private boolean partial = false;
-
// Treatments
@Option(name = "--setEthSrc", description = "Rewrite Source MAC Address",
@@ -177,6 +166,24 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand {
required = false, multiValued = false)
private int priority = Intent.DEFAULT_INTENT_PRIORITY;
+ // Constraints
+ @Option(name = "-b", aliases = "--bandwidth", description = "Bandwidth",
+ required = false, multiValued = false)
+ private String bandwidthString = null;
+
+ @Option(name = "-l", aliases = "--lambda", description = "Lambda",
+ required = false, multiValued = false)
+ private boolean lambda = false;
+
+ @Option(name = "--partial", description = "Allow partial installation",
+ required = false, multiValued = false)
+ private boolean partial = false;
+
+ @Option(name = "-e", aliases = "--encapsulation", description = "Encapsulation type",
+ required = false, multiValued = false)
+ private String encapsulationString = null;
+
+
/**
* Constructs a traffic selector based on the command line arguments
* presented to the command.
@@ -365,7 +372,7 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand {
// Check for a bandwidth specification
if (!isNullOrEmpty(bandwidthString)) {
final Bandwidth bandwidth = Bandwidth.bps(Double.parseDouble(bandwidthString));
- constraints.add(new BandwidthConstraint(new BandwidthResource(bandwidth)));
+ constraints.add(new BandwidthConstraint(bandwidth));
}
// Check for a lambda specification
@@ -374,10 +381,17 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand {
}
constraints.add(new LinkTypeConstraint(lambda, Link.Type.OPTICAL));
+ // Check for partial failure specification
if (partial) {
constraints.add(new PartialFailureConstraint());
}
+ // Check for encapsulation specification
+ if (!isNullOrEmpty(encapsulationString)) {
+ final EncapsulationType encapType = EncapsulationType.valueOf(encapsulationString);
+ constraints.add(new EncapsulationConstraint(encapType));
+ }
+
return constraints;
}