null provider changes for karaf 4.2.1 CLI
Change-Id: Iee039332a1ff00f7957b58a8bf9c320fba974e15
diff --git a/cli/src/main/java/org/onosproject/cli/StartStopCompleter.java b/cli/src/main/java/org/onosproject/cli/StartStopCompleter.java
index 42b4e95..71ad389 100644
--- a/cli/src/main/java/org/onosproject/cli/StartStopCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/StartStopCompleter.java
@@ -16,12 +16,14 @@
package org.onosproject.cli;
import com.google.common.collect.ImmutableList;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.List;
/**
* Start/stop command completer.
*/
+@Service
public class StartStopCompleter extends AbstractChoicesCompleter {
public static final String START = "start";
diff --git a/cli/src/main/java/org/onosproject/cli/UpDownCompleter.java b/cli/src/main/java/org/onosproject/cli/UpDownCompleter.java
index 268b00f..a73ec42 100644
--- a/cli/src/main/java/org/onosproject/cli/UpDownCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/UpDownCompleter.java
@@ -16,12 +16,14 @@
package org.onosproject.cli;
import com.google.common.collect.ImmutableList;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import java.util.List;
/**
* Up/down command completer.
*/
+@Service
public class UpDownCompleter extends AbstractChoicesCompleter {
public static final String UP = "up";
diff --git a/cli/src/main/java/org/onosproject/cli/net/LinkDstCompleter.java b/cli/src/main/java/org/onosproject/cli/net/LinkDstCompleter.java
index df7ca10..cccec10 100644
--- a/cli/src/main/java/org/onosproject/cli/net/LinkDstCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/LinkDstCompleter.java
@@ -15,6 +15,7 @@
*/
package org.onosproject.cli.net;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.apache.karaf.shell.api.console.CommandLine;
import org.apache.karaf.shell.api.console.Session;
import org.apache.karaf.shell.support.completers.StringsCompleter;
@@ -29,6 +30,7 @@
/**
* Link destination end-point completer.
*/
+@Service
public class LinkDstCompleter extends AbstractCompleter {
@Override
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/LinkSrcCompleter.java b/cli/src/main/java/org/onosproject/cli/net/LinkSrcCompleter.java
index 38842ba..27e6881 100644
--- a/cli/src/main/java/org/onosproject/cli/net/LinkSrcCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/LinkSrcCompleter.java
@@ -15,6 +15,7 @@
*/
package org.onosproject.cli.net;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.apache.karaf.shell.api.console.CommandLine;
import org.apache.karaf.shell.api.console.Session;
import org.apache.karaf.shell.support.completers.StringsCompleter;
@@ -28,6 +29,7 @@
/**
* Link source end-point completer.
*/
+@Service
public class LinkSrcCompleter extends AbstractCompleter {
@Override
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
diff --git a/providers/null/BUILD b/providers/null/BUILD
index 8059800..77be221 100644
--- a/providers/null/BUILD
+++ b/providers/null/BUILD
@@ -1,7 +1,7 @@
COMPILE_DEPS = CORE_DEPS + NETTY + CLI
osgi_jar_with_tests(
- import_packages = "*,org.onosproject.cli.net",
+ karaf_command_packages = ["org.onosproject.provider.nil.cli"],
resources = glob(["src/main/resources/**"]),
resources_root = "src/main/resources",
deps = COMPILE_DEPS,
diff --git a/providers/null/src/main/java/org/onosproject/provider/nil/cli/NullControlCommand.java b/providers/null/src/main/java/org/onosproject/provider/nil/cli/NullControlCommand.java
index 9ebcf4b..1be41d6 100644
--- a/providers/null/src/main/java/org/onosproject/provider/nil/cli/NullControlCommand.java
+++ b/providers/null/src/main/java/org/onosproject/provider/nil/cli/NullControlCommand.java
@@ -17,9 +17,11 @@
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;
+import org.onosproject.cli.StartStopCompleter;
import org.onosproject.provider.nil.NullProviders;
import org.onosproject.provider.nil.TopologySimulator;
@@ -35,11 +37,13 @@
@Argument(index = 0, name = "cmd", description = "Control command: start/stop",
required = true)
+ @Completion(StartStopCompleter.class)
String cmd = null;
@Argument(index = 1, name = "topoShape",
description = "Topology shape: e.g. configured, linear, reroute, " +
"centipede, tree, spineleaf, mesh, fattree, custom")
+ @Completion(TopologyShapeCompleter.class)
String topoShape = null;
@Override
diff --git a/providers/null/src/main/java/org/onosproject/provider/nil/cli/NullDeviceCommand.java b/providers/null/src/main/java/org/onosproject/provider/nil/cli/NullDeviceCommand.java
index 69557f5..f4100a6 100644
--- a/providers/null/src/main/java/org/onosproject/provider/nil/cli/NullDeviceCommand.java
+++ b/providers/null/src/main/java/org/onosproject/provider/nil/cli/NullDeviceCommand.java
@@ -17,8 +17,11 @@
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.cli.UpDownCompleter;
+import org.onosproject.cli.net.DeviceIdCompleter;
import org.onosproject.net.DeviceId;
import org.onosproject.provider.nil.NullProviders;
@@ -35,10 +38,12 @@
@Argument(index = 0, name = "id", description = "Device identifier",
required = true, multiValued = false)
+ @Completion(DeviceIdCompleter.class)
String id = null;
@Argument(index = 1, name = "cmd", description = "up/down",
required = true, multiValued = false)
+ @Completion(UpDownCompleter.class)
String cmd = null;
diff --git a/providers/null/src/main/java/org/onosproject/provider/nil/cli/NullLinkCommand.java b/providers/null/src/main/java/org/onosproject/provider/nil/cli/NullLinkCommand.java
index 263bf5a..2a32cdf 100644
--- a/providers/null/src/main/java/org/onosproject/provider/nil/cli/NullLinkCommand.java
+++ b/providers/null/src/main/java/org/onosproject/provider/nil/cli/NullLinkCommand.java
@@ -17,8 +17,12 @@
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.cli.UpDownCompleter;
+import org.onosproject.cli.net.LinkDstCompleter;
+import org.onosproject.cli.net.LinkSrcCompleter;
import org.onosproject.net.ConnectPoint;
import org.onosproject.provider.nil.NullProviders;
@@ -35,14 +39,17 @@
@Argument(index = 0, name = "one", description = "One link end-point as device/port",
required = true, multiValued = false)
+ @Completion(LinkSrcCompleter.class)
String one = null;
@Argument(index = 1, name = "two", description = "Another link end-point as device/port",
required = true, multiValued = false)
+ @Completion(LinkDstCompleter.class)
String two = null;
@Argument(index = 2, name = "cmd", description = "up/down",
required = true, multiValued = false)
+ @Completion(UpDownCompleter.class)
String cmd = null;