Aaron Kruglikov
Committed by Brian O'Connor

Added support for specifying unidirectional vs bidirectional optical connections.

Change-Id: I0f8c2f64f5734873b80235ad97afb58be7aaa3ae
...@@ -17,6 +17,7 @@ package org.onosproject.cli.net; ...@@ -17,6 +17,7 @@ package org.onosproject.cli.net;
17 17
18 import org.apache.karaf.shell.commands.Argument; 18 import org.apache.karaf.shell.commands.Argument;
19 import org.apache.karaf.shell.commands.Command; 19 import org.apache.karaf.shell.commands.Command;
20 +import org.apache.karaf.shell.commands.Option;
20 import org.onosproject.net.ConnectPoint; 21 import org.onosproject.net.ConnectPoint;
21 import org.onosproject.net.OchPort; 22 import org.onosproject.net.OchPort;
22 import org.onosproject.net.OduCltPort; 23 import org.onosproject.net.OduCltPort;
...@@ -49,7 +50,13 @@ public class AddOpticalIntentCommand extends ConnectivityIntentCommand { ...@@ -49,7 +50,13 @@ public class AddOpticalIntentCommand extends ConnectivityIntentCommand {
49 description = "Egress Device/Port Description", 50 description = "Egress Device/Port Description",
50 required = true, multiValued = false) 51 required = true, multiValued = false)
51 String egressDeviceString = null; 52 String egressDeviceString = null;
52 - // TODO: add parameter for uni/bidirectional intents 53 +
54 + @Option(name = "-b", aliases = "--bidirectional",
55 + description = "If this argument is passed the optical link created will be bidirectional, " +
56 + "else the link will be unidirectional.",
57 + required = false, multiValued = false)
58 + private boolean bidirectional = false;
59 +
53 60
54 private ConnectPoint createConnectPoint(String devicePortString) { 61 private ConnectPoint createConnectPoint(String devicePortString) {
55 String[] splitted = devicePortString.split("/"); 62 String[] splitted = devicePortString.split("/");
...@@ -96,6 +103,7 @@ public class AddOpticalIntentCommand extends ConnectivityIntentCommand { ...@@ -96,6 +103,7 @@ public class AddOpticalIntentCommand extends ConnectivityIntentCommand {
96 .src(ingress) 103 .src(ingress)
97 .dst(egress) 104 .dst(egress)
98 .signalType(OduCltPort.SignalType.CLT_10GBE) 105 .signalType(OduCltPort.SignalType.CLT_10GBE)
106 + .bidirectional(bidirectional)
99 .build(); 107 .build();
100 } else if (srcPort instanceof OchPort && dstPort instanceof OchPort) { 108 } else if (srcPort instanceof OchPort && dstPort instanceof OchPort) {
101 intent = OpticalConnectivityIntent.builder() 109 intent = OpticalConnectivityIntent.builder()
...@@ -104,6 +112,7 @@ public class AddOpticalIntentCommand extends ConnectivityIntentCommand { ...@@ -104,6 +112,7 @@ public class AddOpticalIntentCommand extends ConnectivityIntentCommand {
104 .src(ingress) 112 .src(ingress)
105 .dst(egress) 113 .dst(egress)
106 .signalType(OduSignalType.ODU4) 114 .signalType(OduSignalType.ODU4)
115 + .bidirectional(bidirectional)
107 .build(); 116 .build();
108 } else { 117 } else {
109 print("Unable to create optical intent between connect points {} and {}", ingress, egress); 118 print("Unable to create optical intent between connect points {} and {}", ingress, egress);
......