Fix: resolve CLI auto-completion issue of openstack apps
Change-Id: I0dc973628910cae3588f25e066e81a87a4264f06
diff --git a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/DeleteExternalPeerRouterCommand.java b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/DeleteExternalPeerRouterCommand.java
index 25a7858..77bec0e 100644
--- a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/DeleteExternalPeerRouterCommand.java
+++ b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/DeleteExternalPeerRouterCommand.java
@@ -18,6 +18,7 @@
import com.google.common.collect.Lists;
import org.apache.karaf.shell.api.action.Argument;
import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.openstacknetworking.api.ExternalPeerRouter;
@@ -34,6 +35,7 @@
public class DeleteExternalPeerRouterCommand extends AbstractShellCommand {
@Argument(index = 0, name = "ip address", description = "ip address",
required = true, multiValued = false)
+ @Completion(IpAddressCompleter.class)
private String ipAddress = null;
private static final String FORMAT = "%-20s%-20s%-20s";
diff --git a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackConfigArpModeCommand.java b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackConfigArpModeCommand.java
index 0b5d226..dec34c7 100644
--- a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackConfigArpModeCommand.java
+++ b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackConfigArpModeCommand.java
@@ -17,6 +17,7 @@
import org.apache.karaf.shell.api.action.Argument;
import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cfg.ComponentConfigService;
import org.onosproject.cli.AbstractShellCommand;
@@ -48,6 +49,7 @@
@Argument(index = 0, name = "arpMode",
description = "ARP mode (proxy | broadcast)",
required = true, multiValued = false)
+ @Completion(ArpModeCompleter.class)
String arpMode = null;
@Override
diff --git a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackDirectPortAddCommand.java b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackDirectPortAddCommand.java
index 85da732..974c2cc 100644
--- a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackDirectPortAddCommand.java
+++ b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackDirectPortAddCommand.java
@@ -17,6 +17,7 @@
import org.apache.karaf.shell.api.action.Argument;
import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.device.DeviceService;
@@ -42,6 +43,7 @@
description = "Manually adds OpenStack direct ports to the device")
public class OpenstackDirectPortAddCommand extends AbstractShellCommand {
@Argument(index = 0, name = "port ID", description = "port ID", required = true)
+ @Completion(DirectPortListCompleter.class)
private String portId = null;
@Override
diff --git a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackFlowTraceCommand.java b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackFlowTraceCommand.java
index ad5ef21..5829772 100644
--- a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackFlowTraceCommand.java
+++ b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackFlowTraceCommand.java
@@ -17,6 +17,7 @@
import org.apache.karaf.shell.api.action.Argument;
import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.openstacknetworking.api.InstancePort;
@@ -40,10 +41,12 @@
@Argument(index = 0, name = "src ip address", description = "src ip address",
required = true, multiValued = false)
+ @Completion(InstanceIpAddressCompleter.class)
private String srcIp = null;
@Argument(index = 1, name = "dst ip address", description = "dst ip address",
required = true, multiValued = false)
+ @Completion(InstanceIpAddressCompleter.class)
private String dstIp = null;
private static final String NO_ELEMENT = "There's no instance port information with given ip address";
diff --git a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackResetPortsCommand.java b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackResetPortsCommand.java
index adfd5c2..7f14358 100755
--- a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackResetPortsCommand.java
+++ b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/OpenstackResetPortsCommand.java
@@ -17,6 +17,7 @@
import org.apache.karaf.shell.api.action.Argument;
import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
import org.apache.karaf.shell.api.action.Option;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
@@ -45,6 +46,7 @@
@Argument(index = 0, name = "portIds", description = "Instance Port IDs",
required = false, multiValued = true)
+ @Completion(InstancePortIdCompleter.class)
private String[] portIds = null;
private static final long SLEEP_MS = 1000; // we wait 1s for reset each port
diff --git a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/PurgeInstancePortsCommand.java b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/PurgeInstancePortsCommand.java
index 6109a77..89f6a04 100644
--- a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/PurgeInstancePortsCommand.java
+++ b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/PurgeInstancePortsCommand.java
@@ -17,6 +17,7 @@
import org.apache.karaf.shell.api.action.Argument;
import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
import org.apache.karaf.shell.api.action.Option;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
@@ -50,6 +51,7 @@
@Argument(index = 0, name = "portIds", description = "Instance Port IDs",
required = false, multiValued = true)
+ @Completion(InstancePortIdCompleter.class)
private String[] portIds = null;
@Override
diff --git a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/UpdateExternalPeerRouterCommand.java b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/UpdateExternalPeerRouterCommand.java
index 81fcd8c..d851e10 100644
--- a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/UpdateExternalPeerRouterCommand.java
+++ b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/UpdateExternalPeerRouterCommand.java
@@ -18,6 +18,7 @@
import com.google.common.collect.Lists;
import org.apache.karaf.shell.api.action.Argument;
import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.IpAddress;
@@ -39,14 +40,17 @@
@Argument(index = 0, name = "ip address", description = "ip address",
required = true, multiValued = false)
+ @Completion(IpAddressCompleter.class)
private String ipAddress = null;
@Argument(index = 1, name = "mac address", description = "mac address",
required = true, multiValued = false)
+ @Completion(MacAddressCompleter.class)
private String macAddress = null;
@Argument(index = 2, name = "vlan id", description = "vlan id",
required = true, multiValued = false)
+ @Completion(VlanIdCompleter.class)
private String vlanId = null;
private static final String FORMAT = "%-20s%-20s%-20s";
diff --git a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/UpdateExternalPeerRouterVlanCommand.java b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/UpdateExternalPeerRouterVlanCommand.java
index 9e84ebc..f53f5f5 100644
--- a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/UpdateExternalPeerRouterVlanCommand.java
+++ b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/cli/UpdateExternalPeerRouterVlanCommand.java
@@ -18,6 +18,7 @@
import com.google.common.collect.Lists;
import org.apache.karaf.shell.api.action.Argument;
import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.IpAddress;
@@ -41,10 +42,12 @@
public class UpdateExternalPeerRouterVlanCommand extends AbstractShellCommand {
@Argument(index = 0, name = "ip address", description = "ip address",
required = true, multiValued = false)
+ @Completion(IpAddressCompleter.class)
private String ipAddress = null;
@Argument(index = 1, name = "vlan id", description = "vlan id",
required = true, multiValued = false)
+ @Completion(VlanIdCompleter.class)
private String vlanId = null;
private static final String FORMAT = "%-20s%-20s%-20s";
diff --git a/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/cli/OpenstackNodeCheckCommand.java b/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/cli/OpenstackNodeCheckCommand.java
index 7f1d630..c8c6ba2 100644
--- a/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/cli/OpenstackNodeCheckCommand.java
+++ b/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/cli/OpenstackNodeCheckCommand.java
@@ -18,6 +18,7 @@
import org.apache.karaf.shell.api.action.Argument;
import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
@@ -46,6 +47,7 @@
@Argument(index = 0, name = "hostname", description = "Hostname",
required = true, multiValued = false)
+ @Completion(OpenstackHostnameCompleter.class)
private String hostname = null;
private static final String MSG_OK = "OK";
diff --git a/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/cli/OpenstackNodeInitCommand.java b/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/cli/OpenstackNodeInitCommand.java
index 155ecfc..54e01b5 100644
--- a/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/cli/OpenstackNodeInitCommand.java
+++ b/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/cli/OpenstackNodeInitCommand.java
@@ -18,6 +18,7 @@
import org.apache.karaf.shell.api.action.Argument;
import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
import org.apache.karaf.shell.api.action.Option;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
@@ -45,6 +46,7 @@
@Argument(index = 0, name = "hostnames", description = "Hostname(s) to apply this command",
required = false, multiValued = true)
+ @Completion(OpenstackHostnameCompleter.class)
private String[] hostnames = null;
@Override
diff --git a/apps/openstacktroubleshoot/app/src/main/java/org/onosproject/openstacktroubleshoot/cli/OpenstackEastWestProbeCommand.java b/apps/openstacktroubleshoot/app/src/main/java/org/onosproject/openstacktroubleshoot/cli/OpenstackEastWestProbeCommand.java
index 8d4ac94..dac096a 100644
--- a/apps/openstacktroubleshoot/app/src/main/java/org/onosproject/openstacktroubleshoot/cli/OpenstackEastWestProbeCommand.java
+++ b/apps/openstacktroubleshoot/app/src/main/java/org/onosproject/openstacktroubleshoot/cli/OpenstackEastWestProbeCommand.java
@@ -18,6 +18,7 @@
import com.google.common.collect.Sets;
import org.apache.karaf.shell.api.action.Argument;
import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
import org.apache.karaf.shell.api.action.Option;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.packet.IpAddress;
@@ -62,6 +63,7 @@
@Argument(index = 0, name = "vmIps", description = "VMs' IP addresses",
required = false, multiValued = true)
+ @Completion(ActiveVmIpCompleter.class)
private String[] vmIps = null;
private final ExecutorService probeExecutor = newSingleThreadScheduledExecutor(
diff --git a/apps/openstacktroubleshoot/app/src/main/java/org/onosproject/openstacktroubleshoot/cli/OpenstackNorthSouthProbeCommand.java b/apps/openstacktroubleshoot/app/src/main/java/org/onosproject/openstacktroubleshoot/cli/OpenstackNorthSouthProbeCommand.java
index 32c32c0..37240b7 100644
--- a/apps/openstacktroubleshoot/app/src/main/java/org/onosproject/openstacktroubleshoot/cli/OpenstackNorthSouthProbeCommand.java
+++ b/apps/openstacktroubleshoot/app/src/main/java/org/onosproject/openstacktroubleshoot/cli/OpenstackNorthSouthProbeCommand.java
@@ -18,6 +18,7 @@
import com.google.common.collect.Sets;
import org.apache.karaf.shell.api.action.Argument;
import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
import org.apache.karaf.shell.api.action.Option;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
@@ -59,6 +60,7 @@
@Argument(index = 0, name = "vmIps", description = "VMs' IP addresses",
required = false, multiValued = true)
+ @Completion(ActiveFloatingIpCompleter.class)
private String[] vmIps = null;
private final ExecutorService probeExecutor = newSingleThreadScheduledExecutor(
diff --git a/apps/openstackvtap/app/src/main/java/org/onosproject/openstackvtap/cli/OpenstackVtapAddCommand.java b/apps/openstackvtap/app/src/main/java/org/onosproject/openstackvtap/cli/OpenstackVtapAddCommand.java
index 9480346..013ac89 100644
--- a/apps/openstackvtap/app/src/main/java/org/onosproject/openstackvtap/cli/OpenstackVtapAddCommand.java
+++ b/apps/openstackvtap/app/src/main/java/org/onosproject/openstackvtap/cli/OpenstackVtapAddCommand.java
@@ -17,6 +17,7 @@
import org.apache.karaf.shell.api.action.Argument;
import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.packet.IpPrefix;
import org.onlab.packet.TpPort;
@@ -42,16 +43,19 @@
@Argument(index = 0, name = "srcIp",
description = "source IP address CIDR (e.g., \"10.1.0.2/32\")",
required = true, multiValued = false)
+ @Completion(VmIpCompleter.class)
String srcIp = "";
@Argument(index = 1, name = "dstIp",
description = "destination IP address CIDR (e.g., \"10.1.0.3/32\")",
required = true, multiValued = false)
+ @Completion(VmIpCompleter.class)
String dstIp = "";
@Argument(index = 2, name = "ipProto",
description = "IP protocol [any|tcp|udp|icmp]",
required = false, multiValued = false)
+ @Completion(ProtocolTypeCompleter.class)
String ipProto = "any";
@Argument(index = 3, name = "srcTpPort",
@@ -67,6 +71,7 @@
@Argument(index = 5, name = "type",
description = "vtap type [all|rx|tx]",
required = false, multiValued = false)
+ @Completion(VtapTypeCompleter.class)
String vtapTypeStr = "all";
@Override
diff --git a/apps/openstackvtap/app/src/main/java/org/onosproject/openstackvtap/cli/OpenstackVtapDeleteCommand.java b/apps/openstackvtap/app/src/main/java/org/onosproject/openstackvtap/cli/OpenstackVtapDeleteCommand.java
index e2d37f7..17db27c 100644
--- a/apps/openstackvtap/app/src/main/java/org/onosproject/openstackvtap/cli/OpenstackVtapDeleteCommand.java
+++ b/apps/openstackvtap/app/src/main/java/org/onosproject/openstackvtap/cli/OpenstackVtapDeleteCommand.java
@@ -15,6 +15,7 @@
*/
package org.onosproject.openstackvtap.cli;
import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.apache.karaf.shell.api.action.Argument;
@@ -34,6 +35,7 @@
@Argument(index = 0, name = "id", description = "vtap ID",
required = true, multiValued = false)
+ @Completion(VtapIdCompleter.class)
String vtapId = "";
@Override
diff --git a/apps/openstackvtap/app/src/main/java/org/onosproject/openstackvtap/cli/OpenstackVtapListCommand.java b/apps/openstackvtap/app/src/main/java/org/onosproject/openstackvtap/cli/OpenstackVtapListCommand.java
index 089f850..8826952 100644
--- a/apps/openstackvtap/app/src/main/java/org/onosproject/openstackvtap/cli/OpenstackVtapListCommand.java
+++ b/apps/openstackvtap/app/src/main/java/org/onosproject/openstackvtap/cli/OpenstackVtapListCommand.java
@@ -18,6 +18,7 @@
import com.google.common.collect.ImmutableSet;
import org.apache.karaf.shell.api.action.Argument;
import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
@@ -46,6 +47,7 @@
@Argument(index = 0, name = "type",
description = "vtap type [any|all|rx|tx]",
required = false, multiValued = false)
+ @Completion(VtapTypeCompleter.class)
String vtapType = "any";
private static final String FORMAT = "ID { %s }: type [%s], srcIP [%s], dstIP [%s]";