odtn app changes for karaf 4.2.1 CLI
Change-Id: I8fba09a8da1319a8c6ca32a391355f8329402b57
diff --git a/apps/odtn/service/BUILD b/apps/odtn/service/BUILD
index 38f187e..5daed804 100644
--- a/apps/odtn/service/BUILD
+++ b/apps/odtn/service/BUILD
@@ -9,6 +9,7 @@
]
osgi_jar_with_tests(
+ karaf_command_packages = ["org.onosproject.odtn.cli.impl"],
test_deps = TEST_ADAPTERS,
deps = COMPILE_DEPS,
)
diff --git a/apps/odtn/service/src/main/java/org/onosproject/odtn/cli/impl/ModeCompleter.java b/apps/odtn/service/src/main/java/org/onosproject/odtn/cli/impl/ModeCompleter.java
index f00a3f8..7cb2be7 100644
--- a/apps/odtn/service/src/main/java/org/onosproject/odtn/cli/impl/ModeCompleter.java
+++ b/apps/odtn/service/src/main/java/org/onosproject/odtn/cli/impl/ModeCompleter.java
@@ -20,9 +20,11 @@
import java.util.stream.Collectors;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractChoicesCompleter;
import org.onosproject.odtn.cli.impl.OdtnManualTestCommand.Mode;
+@Service
public class ModeCompleter extends AbstractChoicesCompleter {
@Override
diff --git a/apps/odtn/service/src/main/java/org/onosproject/odtn/cli/impl/OdtnManualTestCommand.java b/apps/odtn/service/src/main/java/org/onosproject/odtn/cli/impl/OdtnManualTestCommand.java
index 581f01b..e17ddf6 100644
--- a/apps/odtn/service/src/main/java/org/onosproject/odtn/cli/impl/OdtnManualTestCommand.java
+++ b/apps/odtn/service/src/main/java/org/onosproject/odtn/cli/impl/OdtnManualTestCommand.java
@@ -33,6 +33,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.onlab.util.XmlString;
@@ -76,24 +77,24 @@
ModeCompleter modeCompleter;
@Argument(index = 0, name = "mode", description = "one of Mode see source",
required = true)
+ @Completion(ModeCompleter.class)
String modeStr = Mode.ENABLE_TRANSCEIVER.name();
Mode mode;
- // injecting dependency for OSGi package import generation purpose
- DeviceIdCompleter uriCompleter;
@Option(name = "--deviceId", description = "Device ID URI to send configuration to",
required = false)
+ @Completion(DeviceIdCompleter.class)
String uri = null;
- // injecting dependency for OSGi package import generation purpose
- PortNumberCompleter portNoCompleter;
// Note: this will required Port information in device subystem
@Option(name = "--cltPortNo", description = "Client-side PortNumber to send configuration to",
required = false)
+ @Completion(PortNumberCompleter.class)
String cltPortNo = null;
@Option(name = "--linePortNo", description = "Line-side PortNumber to send configuration to",
required = false)
+ @Completion(PortNumberCompleter.class)
String linePortNo = null;