Permalink
Browse files

ONOS-5810 provide a way to consume protected links

- Add option to add constraint to use protected link only

Change-Id: Id4684b839b02f3b46583d524289ce238e78d92e1
  • Loading branch information...
1 parent cd443da commit 3e8e03567a5d14d69edeabc494a6d04d201462dd @y-higuchi y-higuchi committed with y-higuchi Jan 10, 2017
Showing with 20 additions and 1 deletion.
  1. +20 −1 cli/src/main/java/org/onosproject/cli/net/AddPointToPointIntentCommand.java
@@ -25,6 +25,8 @@
import org.onosproject.net.intent.Intent;
import org.onosproject.net.intent.IntentService;
import org.onosproject.net.intent.PointToPointIntent;
+import org.onosproject.net.intent.constraint.ProtectedConstraint;
+
import static org.onosproject.net.intent.constraint.ProtectionConstraint.protection;
import java.util.List;
@@ -46,12 +48,25 @@
required = true, multiValued = false)
String egressDeviceString = null;
+
+ /**
+ * Option to produce protected path.
+ * @deprecated in 1.9.0
+ */
// -p already defined in ConnectivityIntentCommand
+ @Deprecated
@Option(name = "-r", aliases = "--protect",
- description = "Utilize path protection",
+ description = "(deprecated) Utilize path protection",
required = false, multiValued = false)
private boolean backup = false;
+ /**
+ * Option to consume protected path.
+ */
+ @Option(name = "--useProtected",
+ description = "use protected links only")
+ private boolean useProtected = false;
+
@Override
protected void execute() {
IntentService service = get(IntentService.class);
@@ -68,6 +83,10 @@ protected void execute() {
constraints.add(protection());
}
+ if (useProtected) {
+ constraints.add(ProtectedConstraint.useProtectedLink());
+ }
+
Intent intent = PointToPointIntent.builder()
.appId(appId())
.key(key())

0 comments on commit 3e8e035

Please sign in to comment.