Added support for specifying unidirectional vs bidirectional optical connections.
Change-Id: I0f8c2f64f5734873b80235ad97afb58be7aaa3ae
diff --git a/cli/src/main/java/org/onosproject/cli/net/AddOpticalIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/AddOpticalIntentCommand.java
index fc20f3e..57c4100 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AddOpticalIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AddOpticalIntentCommand.java
@@ -17,6 +17,7 @@
import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.OchPort;
import org.onosproject.net.OduCltPort;
@@ -49,7 +50,13 @@
description = "Egress Device/Port Description",
required = true, multiValued = false)
String egressDeviceString = null;
- // TODO: add parameter for uni/bidirectional intents
+
+ @Option(name = "-b", aliases = "--bidirectional",
+ description = "If this argument is passed the optical link created will be bidirectional, " +
+ "else the link will be unidirectional.",
+ required = false, multiValued = false)
+ private boolean bidirectional = false;
+
private ConnectPoint createConnectPoint(String devicePortString) {
String[] splitted = devicePortString.split("/");
@@ -96,6 +103,7 @@
.src(ingress)
.dst(egress)
.signalType(OduCltPort.SignalType.CLT_10GBE)
+ .bidirectional(bidirectional)
.build();
} else if (srcPort instanceof OchPort && dstPort instanceof OchPort) {
intent = OpticalConnectivityIntent.builder()
@@ -104,6 +112,7 @@
.src(ingress)
.dst(egress)
.signalType(OduSignalType.ODU4)
+ .bidirectional(bidirectional)
.build();
} else {
print("Unable to create optical intent between connect points {} and {}", ingress, egress);