netconf protocol changes for karaf 4.2.1 CLI
Change-Id: Ica9b614c4ef4f8264df13bd119531bb7806c290b
diff --git a/protocols/netconf/ctl/BUILD b/protocols/netconf/ctl/BUILD
index f2919e6..0e9a912 100644
--- a/protocols/netconf/ctl/BUILD
+++ b/protocols/netconf/ctl/BUILD
@@ -12,6 +12,7 @@
]
osgi_jar_with_tests(
+ karaf_command_packages = ["org.onosproject.netconf.cli.impl"],
test_deps = TEST_DEPS,
deps = COMPILE_DEPS,
)
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/NetconfGetCommand.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/NetconfGetCommand.java
index ba6f2f8..c99e11e 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/NetconfGetCommand.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/NetconfGetCommand.java
@@ -22,9 +22,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.Option;
import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.cli.net.DeviceIdCompleter;
import org.onosproject.net.DeviceId;
import org.onosproject.netconf.NetconfController;
import org.onosproject.netconf.NetconfDevice;
@@ -43,6 +45,7 @@
@Argument(index = 0, name = "deviceId", description = "Device ID",
required = true, multiValued = false)
+ @Completion(DeviceIdCompleter.class)
String uri = null;
@Option(name = "--timeout",
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/NetconfGetConfigCommand.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/NetconfGetConfigCommand.java
index 58057ab..8198102 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/NetconfGetConfigCommand.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/NetconfGetConfigCommand.java
@@ -24,14 +24,17 @@
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;
+import org.onosproject.cli.net.DeviceIdCompleter;
import org.onosproject.net.DeviceId;
import org.onosproject.netconf.NetconfController;
import org.onosproject.netconf.NetconfDevice;
import org.onosproject.netconf.NetconfException;
import org.onosproject.netconf.NetconfSession;
+import org.onosproject.netconf.cli.impl.completers.DatastoreIdCompleter;
/**
* Command that gets the configuration of the specified type from the specified
@@ -45,11 +48,13 @@
@Argument(index = 0, name = "deviceId", description = "Device ID",
required = true, multiValued = false)
+ @Completion(DeviceIdCompleter.class)
String uri = null;
@Argument(index = 1, name = "datastore",
description = "Configuration datastore name (running, etc.)",
required = false, multiValued = false)
+ @Completion(DatastoreIdCompleter.class)
String datastore = "running";
@Option(name = "--timeout",
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/NetconfRpcTestCommand.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/NetconfRpcTestCommand.java
index 1cc4b5f..30113d1 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/NetconfRpcTestCommand.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/NetconfRpcTestCommand.java
@@ -17,8 +17,10 @@
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.net.DeviceIdCompleter;
import org.onosproject.net.DeviceId;
import org.onosproject.net.behaviour.ConfigSetter;
import org.onosproject.net.driver.DriverHandler;
@@ -47,6 +49,7 @@
@Argument(index = 1, name = "cfgFile", description = "File path to RPC XML",
required = true, multiValued = false)
+ @Completion(DeviceIdCompleter.class)
private String cfgFile = null;
private DeviceId deviceId;
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/NetconfSubscriptionTestCommand.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/NetconfSubscriptionTestCommand.java
index de58fa5..aa36d88 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/NetconfSubscriptionTestCommand.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/NetconfSubscriptionTestCommand.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;
@@ -39,6 +40,7 @@
@Argument(index = 0, name = "deviceId", description = "Device ID",
required = true, multiValued = false)
+ @Completion(DeviceIdCompleter.class)
String uri = null;
@Option(name = "--end",
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/completers/DatastoreIdCompleter.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/completers/DatastoreIdCompleter.java
index 7a243e6..90df1dd 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/completers/DatastoreIdCompleter.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/cli/impl/completers/DatastoreIdCompleter.java
@@ -21,6 +21,7 @@
import java.util.Objects;
import java.util.stream.Collectors;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractChoicesCompleter;
import org.onosproject.netconf.DatastoreId;
@@ -28,6 +29,7 @@
* Completer for predefined {@link DatastoreId}.
*
*/
+@Service
public class DatastoreIdCompleter extends AbstractChoicesCompleter {
@Override