Add L2 selector options to connectivity intents
Added --etherType, --etherSrc, and --etherDst to
PointToPointIntent and MultiPontToSinglePointIntent
creation in the ONOS CLI.
Change-Id: Ibccd3c0b331e7f89be6903f264a6889ac1ad5f17
diff --git a/cli/src/main/java/org/onlab/onos/cli/net/AddPointToPointIntentCommand.java b/cli/src/main/java/org/onlab/onos/cli/net/AddPointToPointIntentCommand.java
index bd24366..9e037d2 100644
--- a/cli/src/main/java/org/onlab/onos/cli/net/AddPointToPointIntentCommand.java
+++ b/cli/src/main/java/org/onlab/onos/cli/net/AddPointToPointIntentCommand.java
@@ -2,18 +2,16 @@
import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
-import org.onlab.onos.cli.AbstractShellCommand;
import org.onlab.onos.net.ConnectPoint;
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.PortNumber;
-import org.onlab.onos.net.flow.DefaultTrafficSelector;
-import org.onlab.onos.net.flow.DefaultTrafficTreatment;
import org.onlab.onos.net.flow.TrafficSelector;
import org.onlab.onos.net.flow.TrafficTreatment;
import org.onlab.onos.net.intent.Intent;
import org.onlab.onos.net.intent.IntentService;
import org.onlab.onos.net.intent.PointToPointIntent;
-import org.onlab.packet.Ethernet;
+
+import static org.onlab.onos.net.flow.DefaultTrafficTreatment.builder;
import static org.onlab.onos.net.DeviceId.deviceId;
import static org.onlab.onos.net.PortNumber.portNumber;
@@ -23,7 +21,7 @@
*/
@Command(scope = "onos", name = "add-point-intent",
description = "Installs point-to-point connectivity intent")
-public class AddPointToPointIntentCommand extends AbstractShellCommand {
+public class AddPointToPointIntentCommand extends ConnectivityIntentCommand {
@Argument(index = 0, name = "ingressDevice",
description = "Ingress Device/Port Description",
@@ -47,10 +45,8 @@
PortNumber egressPortNumber = portNumber(getPortNumber(egressDeviceString));
ConnectPoint egress = new ConnectPoint(egressDeviceId, egressPortNumber);
- TrafficSelector selector = DefaultTrafficSelector.builder()
- .matchEthType(Ethernet.TYPE_IPV4)
- .build();
- TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
+ TrafficSelector selector = buildTrafficSelector();
+ TrafficTreatment treatment = builder().build();
Intent intent = new PointToPointIntent(appId(), selector, treatment,
ingress, egress);