SDN IP app changes for karaf 4.2.1 CLI
Change-Id: I9c03a2148257e7f7122a1135a7a68cdfac50b297
diff --git a/apps/sdnip/BUILD b/apps/sdnip/BUILD
index 861fe8e..50fa4d2 100644
--- a/apps/sdnip/BUILD
+++ b/apps/sdnip/BUILD
@@ -17,6 +17,10 @@
]
osgi_jar_with_tests(
+ karaf_command_packages = [
+ "org.onosproject.sdnip.cli",
+ "org.onosproject.sdnip.cli.completer",
+ ],
test_deps = TEST_DEPS,
deps = COMPILE_DEPS,
)
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/SdnIpCommand.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/SdnIpCommand.java
index 2181114..b3fafa9 100644
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/SdnIpCommand.java
+++ b/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/SdnIpCommand.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.core.ApplicationId;
@@ -24,6 +25,8 @@
import org.onosproject.net.EncapsulationType;
import org.onosproject.net.config.NetworkConfigService;
import org.onosproject.sdnip.SdnIp;
+import org.onosproject.sdnip.cli.completer.SdnIpCommandCompleter;
+import org.onosproject.sdnip.cli.completer.SdnIpEncapCompleter;
import org.onosproject.sdnip.config.SdnIpConfig;
/**
@@ -51,11 +54,13 @@
@Argument(index = 0, name = "command", description = "Command name" +
" {set-encap}",
required = true, multiValued = false)
+ @Completion(SdnIpCommandCompleter.class)
String command = null;
@Argument(index = 1, name = "encapType", description = "The encapsulation" +
" type {NONE | VLAN | MPLS}",
required = true, multiValued = false)
+ @Completion(SdnIpEncapCompleter.class)
String encapType = null;
@Override
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/completer/SdnIpCommandCompleter.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/completer/SdnIpCommandCompleter.java
index 90e1c5b..276da12 100644
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/completer/SdnIpCommandCompleter.java
+++ b/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/completer/SdnIpCommandCompleter.java
@@ -16,6 +16,7 @@
package org.onosproject.sdnip.cli.completer;
import com.google.common.collect.Lists;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractChoicesCompleter;
import java.util.List;
@@ -23,6 +24,7 @@
/**
* SDN-IP command completer.
*/
+@Service
public class SdnIpCommandCompleter extends AbstractChoicesCompleter {
@Override
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/completer/SdnIpEncapCompleter.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/completer/SdnIpEncapCompleter.java
index dec4fcf..76d67ee 100644
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/completer/SdnIpEncapCompleter.java
+++ b/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/completer/SdnIpEncapCompleter.java
@@ -15,6 +15,7 @@
*/
package org.onosproject.sdnip.cli.completer;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractChoicesCompleter;
import org.onosproject.net.EncapsulationType;
@@ -25,6 +26,7 @@
/**
* SDN-IP encapsulation type completer.
*/
+@Service
public class SdnIpEncapCompleter extends AbstractChoicesCompleter {
@Override