[WIP] Upgrade ONOS to karaf version 4.2.1
Change-Id: I7cd40c995bdf1c80f94b1895fb3344e32404c7fa
diff --git a/cli/BUILD b/cli/BUILD
index b8a3f5b..9924aac 100644
--- a/cli/BUILD
+++ b/cli/BUILD
@@ -1,5 +1,5 @@
COMPILE_DEPS = CORE_DEPS + JACKSON + METRICS + [
- "@org_apache_karaf_shell_console//jar",
+ "@org_apache_karaf_shell_core//jar",
"//incubator/api:onos-incubator-api",
"//incubator/net:onos-incubator-net",
"//utils/rest:onlab-rest",
@@ -7,6 +7,13 @@
]
osgi_jar(
+ karaf_command_packages = [
+ "org.onosproject.cli",
+ "org.onosproject.cli.app",
+ "org.onosproject.cli.cfg",
+ "org.onosproject.cli.net",
+ "org.onosproject.cli.security",
+ ],
visibility = ["//visibility:public"],
deps = COMPILE_DEPS,
)
diff --git a/cli/src/main/java/org/onosproject/cli/AbstractChoicesCompleter.java b/cli/src/main/java/org/onosproject/cli/AbstractChoicesCompleter.java
index 5b5e808..4f1962c 100644
--- a/cli/src/main/java/org/onosproject/cli/AbstractChoicesCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/AbstractChoicesCompleter.java
@@ -15,7 +15,9 @@
*/
package org.onosproject.cli;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import java.util.List;
import java.util.SortedSet;
@@ -26,13 +28,17 @@
public abstract class AbstractChoicesCompleter extends AbstractCompleter {
protected abstract List<String> choices();
+ protected CommandLine commandLine;
+ protected Session session;
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
+ this.session = session;
+ this.commandLine = commandLine;
StringsCompleter delegate = new StringsCompleter();
SortedSet<String> strings = delegate.getStrings();
choices().forEach(strings::add);
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/AbstractCompleter.java b/cli/src/main/java/org/onosproject/cli/AbstractCompleter.java
index 19f51f1..44cbea7 100644
--- a/cli/src/main/java/org/onosproject/cli/AbstractCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/AbstractCompleter.java
@@ -15,25 +15,23 @@
*/
package org.onosproject.cli;
-import org.apache.felix.service.command.CommandSession;
-import org.apache.karaf.shell.console.CommandSessionHolder;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.ArgumentCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
+
+import java.util.List;
/**
* Abstract argument completer.
*/
public abstract class AbstractCompleter implements Completer {
- /**
- * Returns the argument list.
- *
- * @return argument list
- */
- protected ArgumentCompleter.ArgumentList getArgumentList() {
- CommandSession session = CommandSessionHolder.getSession();
- return (ArgumentCompleter.ArgumentList)
- session.get(ArgumentCompleter.ARGUMENTS_LIST);
+ @Override
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
+ StringsCompleter delegate = new StringsCompleter();
+
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/AbstractShellCommand.java b/cli/src/main/java/org/onosproject/cli/AbstractShellCommand.java
index 09e08fa..d6d044e 100644
--- a/cli/src/main/java/org/onosproject/cli/AbstractShellCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/AbstractShellCommand.java
@@ -15,8 +15,8 @@
*/
package org.onosproject.cli;
-import org.apache.karaf.shell.commands.Option;
-import org.apache.karaf.shell.console.AbstractAction;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.Action;
import org.onlab.osgi.DefaultServiceDirectory;
import org.onlab.osgi.ServiceNotFoundException;
import org.onosproject.codec.CodecContext;
@@ -29,6 +29,8 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onosproject.net.DefaultAnnotations;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.Set;
import java.util.TreeSet;
@@ -36,7 +38,8 @@
/**
* Base abstraction of Karaf shell commands.
*/
-public abstract class AbstractShellCommand extends AbstractAction implements CodecContext {
+public abstract class AbstractShellCommand implements Action, CodecContext {
+ protected final Logger log = LoggerFactory.getLogger(this.getClass());
@Option(name = "-j", aliases = "--json", description = "Output JSON",
required = false, multiValued = false)
@@ -136,11 +139,6 @@
}
/**
- * Executes this command.
- */
- protected abstract void execute();
-
- /**
* Indicates whether JSON format should be output.
*
* @return true if JSON is requested
@@ -150,16 +148,22 @@
}
@Override
- protected Object doExecute() throws Exception {
+ public Object execute() throws Exception {
try {
- execute();
+ doExecute();
} catch (ServiceNotFoundException e) {
error(e.getMessage());
}
return null;
}
-
+ protected void doExecute() throws Exception {
+ try {
+ execute();
+ } catch (ServiceNotFoundException e) {
+ error(e.getMessage());
+ }
+ }
private final ObjectMapper mapper = new ObjectMapper();
diff --git a/cli/src/main/java/org/onosproject/cli/BalanceMastersCommand.java b/cli/src/main/java/org/onosproject/cli/BalanceMastersCommand.java
index 8c86c71..7ef8f4e 100644
--- a/cli/src/main/java/org/onosproject/cli/BalanceMastersCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/BalanceMastersCommand.java
@@ -15,18 +15,20 @@
*/
package org.onosproject.cli;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.mastership.MastershipAdminService;
/**
* Forces device mastership rebalancing.
*/
+@Service
@Command(scope = "onos", name = "balance-masters",
description = "Forces device mastership rebalancing")
public class BalanceMastersCommand extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
get(MastershipAdminService.class).balanceRoles();
}
diff --git a/cli/src/main/java/org/onosproject/cli/CliComponent.java b/cli/src/main/java/org/onosproject/cli/CliComponent.java
index 2c44578..558abda 100644
--- a/cli/src/main/java/org/onosproject/cli/CliComponent.java
+++ b/cli/src/main/java/org/onosproject/cli/CliComponent.java
@@ -15,10 +15,10 @@
*/
package org.onosproject.cli;
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
import org.onosproject.core.CoreService;
/**
@@ -28,7 +28,7 @@
@Component(immediate = true)
public class CliComponent {
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
protected CoreService coreService;
@Activate
diff --git a/cli/src/main/java/org/onosproject/cli/IssuCommand.java b/cli/src/main/java/org/onosproject/cli/IssuCommand.java
index e2ff991..04e3ad9 100644
--- a/cli/src/main/java/org/onosproject/cli/IssuCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/IssuCommand.java
@@ -15,14 +15,16 @@
*/
package org.onosproject.cli;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.upgrade.UpgradeAdminService;
import org.onosproject.upgrade.UpgradeService;
/**
* Commands for managing upgrades.
*/
+@Service
@Command(scope = "onos", name = "issu",
description = "Manages upgrades")
public class IssuCommand extends AbstractShellCommand {
@@ -41,7 +43,7 @@
String command = null;
@Override
- protected void execute() {
+ protected void doExecute() {
UpgradeService upgradeService = get(UpgradeService.class);
UpgradeAdminService upgradeAdminService = get(UpgradeAdminService.class);
if (command == null) {
diff --git a/cli/src/main/java/org/onosproject/cli/MarkCommand.java b/cli/src/main/java/org/onosproject/cli/MarkCommand.java
index dc119ed..f7881f3 100644
--- a/cli/src/main/java/org/onosproject/cli/MarkCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/MarkCommand.java
@@ -20,9 +20,10 @@
import java.util.List;
import java.util.stream.Collectors;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.slf4j.Logger;
import com.google.common.collect.ImmutableList;
@@ -30,6 +31,7 @@
/**
* CLI command which just log message to ONOS log for ease of debugging, etc.
*/
+@Service
@Command(scope = "onos", name = "mark",
description = "Mark message in the log")
public class MarkCommand extends AbstractShellCommand {
@@ -49,7 +51,7 @@
List<String> message = ImmutableList.of(MARK);
@Override
- protected void execute() {
+ protected void doExecute() {
Logger log = getLogger(loggerName);
diff --git a/cli/src/main/java/org/onosproject/cli/MastersListCommand.java b/cli/src/main/java/org/onosproject/cli/MastersListCommand.java
index 7ffc3b2..6debc1b 100644
--- a/cli/src/main/java/org/onosproject/cli/MastersListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/MastersListCommand.java
@@ -19,7 +19,8 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.google.common.collect.Lists;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cluster.ClusterService;
import org.onosproject.cluster.ControllerNode;
import org.onosproject.mastership.MastershipService;
@@ -34,12 +35,13 @@
/**
* Lists device mastership information.
*/
+@Service
@Command(scope = "onos", name = "masters",
description = "Lists device mastership information")
public class MastersListCommand extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
ClusterService service = get(ClusterService.class);
MastershipService mastershipService = get(MastershipService.class);
DeviceService deviceService = get(DeviceService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/MembershipsListCommand.java b/cli/src/main/java/org/onosproject/cli/MembershipsListCommand.java
index f1a5c42..ffb9aca 100644
--- a/cli/src/main/java/org/onosproject/cli/MembershipsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/MembershipsListCommand.java
@@ -20,7 +20,8 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cluster.ClusterAdminService;
import org.onosproject.cluster.ControllerNode;
import org.onosproject.cluster.Member;
@@ -35,12 +36,13 @@
/**
* Command to list the memberships in the system.
*/
+@Service
@Command(scope = "onos", name = "memberships",
description = "Lists information about memberships in the system")
public class MembershipsListCommand extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
MembershipService service = get(MembershipService.class);
ClusterAdminService clusterService = get(ClusterAdminService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/MetricsListCommand.java b/cli/src/main/java/org/onosproject/cli/MetricsListCommand.java
index d1ecafa..3cd9515 100644
--- a/cli/src/main/java/org/onosproject/cli/MetricsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/MetricsListCommand.java
@@ -29,8 +29,9 @@
import com.google.common.base.Strings;
import com.google.common.collect.Ordering;
import com.google.common.collect.TreeMultimap;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.metrics.MetricsService;
import org.onlab.util.Tools;
@@ -43,6 +44,7 @@
/**
* Prints metrics in the system.
*/
+@Service
@Command(scope = "onos", name = "metrics",
description = "Prints metrics in the system")
public class MetricsListCommand extends AbstractShellCommand {
@@ -71,7 +73,7 @@
String metricName = null;
@Override
- protected void execute() {
+ protected void doExecute() {
MetricsService metricsService = get(MetricsService.class);
MetricFilter filter = metricName != null ? (name, metric) -> name.equals(metricName) : MetricFilter.ALL;
diff --git a/cli/src/main/java/org/onosproject/cli/NodeAddCommand.java b/cli/src/main/java/org/onosproject/cli/NodeAddCommand.java
index 2b2b659..e01fd67 100644
--- a/cli/src/main/java/org/onosproject/cli/NodeAddCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/NodeAddCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cluster.ClusterAdminService;
import org.onosproject.cluster.DefaultControllerNode;
import org.onosproject.cluster.NodeId;
@@ -25,6 +26,7 @@
/**
* Adds a new controller cluster node.
*/
+@Service
@Command(scope = "onos", name = "add-node",
description = "Adds a new controller cluster node")
public class NodeAddCommand extends AbstractShellCommand {
@@ -42,7 +44,7 @@
int tcpPort = DefaultControllerNode.DEFAULT_PORT;
@Override
- protected void execute() {
+ protected void doExecute() {
ClusterAdminService service = get(ClusterAdminService.class);
service.addNode(new NodeId(nodeId), IpAddress.valueOf(ip), tcpPort);
}
diff --git a/cli/src/main/java/org/onosproject/cli/NodeIdCompleter.java b/cli/src/main/java/org/onosproject/cli/NodeIdCompleter.java
index c770f4f..5d55de3 100644
--- a/cli/src/main/java/org/onosproject/cli/NodeIdCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/NodeIdCompleter.java
@@ -15,8 +15,11 @@
*/
package org.onosproject.cli;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.onosproject.cluster.ClusterService;
import org.onosproject.cluster.ControllerNode;
@@ -27,9 +30,10 @@
/**
* Node ID completer.
*/
+@Service
public class NodeIdCompleter implements Completer {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
@@ -42,7 +46,7 @@
}
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/NodeRemoveCommand.java b/cli/src/main/java/org/onosproject/cli/NodeRemoveCommand.java
index 215156f..5470c38 100644
--- a/cli/src/main/java/org/onosproject/cli/NodeRemoveCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/NodeRemoveCommand.java
@@ -15,14 +15,16 @@
*/
package org.onosproject.cli;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cluster.ClusterAdminService;
import org.onosproject.cluster.NodeId;
/**
* Removes a controller cluster node.
*/
+@Service
@Command(scope = "onos", name = "remove-node",
description = "Removes a new controller cluster node")
public class NodeRemoveCommand extends AbstractShellCommand {
@@ -32,7 +34,7 @@
String nodeId = null;
@Override
- protected void execute() {
+ protected void doExecute() {
ClusterAdminService service = get(ClusterAdminService.class);
service.removeNode(new NodeId(nodeId));
}
diff --git a/cli/src/main/java/org/onosproject/cli/NodesListCommand.java b/cli/src/main/java/org/onosproject/cli/NodesListCommand.java
index ab1216e..ac6a5ec 100644
--- a/cli/src/main/java/org/onosproject/cli/NodesListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/NodesListCommand.java
@@ -19,7 +19,8 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cluster.ClusterAdminService;
import org.onosproject.cluster.ControllerNode;
import org.onosproject.core.Version;
@@ -33,6 +34,7 @@
/**
* Lists all controller cluster nodes.
*/
+@Service
@Command(scope = "onos", name = "nodes",
description = "Lists all controller cluster nodes")
public class NodesListCommand extends AbstractShellCommand {
@@ -40,7 +42,7 @@
private static final String FMT = "id=%s, address=%s:%s, state=%s, version=%s, updated=%s %s";
@Override
- protected void execute() {
+ protected void doExecute() {
ClusterAdminService service = get(ClusterAdminService.class);
List<ControllerNode> nodes = newArrayList(service.getNodes());
Collections.sort(nodes, Comparators.NODE_COMPARATOR);
diff --git a/cli/src/main/java/org/onosproject/cli/PlaceholderCompleter.java b/cli/src/main/java/org/onosproject/cli/PlaceholderCompleter.java
index bba871e..537aa28 100644
--- a/cli/src/main/java/org/onosproject/cli/PlaceholderCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/PlaceholderCompleter.java
@@ -16,7 +16,9 @@
package org.onosproject.cli;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import java.util.List;
import java.util.SortedSet;
@@ -28,13 +30,13 @@
public class PlaceholderCompleter extends AbstractCompleter {
@Override
- public int complete(String s, int i, List<String> list) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Populate a string completer with what the user has typed so far
StringsCompleter delegate = new StringsCompleter();
SortedSet<String> strings = delegate.getStrings();
- if (s != null) {
- strings.add(s);
+ if (commandLine.getCursorArgument() != null) {
+ strings.add(commandLine.getCursorArgument());
}
- return delegate.complete(s, i, list);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/PrettyJson.java b/cli/src/main/java/org/onosproject/cli/PrettyJson.java
index 22b08a0..39d7da6 100644
--- a/cli/src/main/java/org/onosproject/cli/PrettyJson.java
+++ b/cli/src/main/java/org/onosproject/cli/PrettyJson.java
@@ -16,7 +16,8 @@
package org.onosproject.cli;
import java.io.IOException;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
@@ -24,12 +25,13 @@
/**
* Pretty print previous command output JSON.
*/
+@Service
@Command(scope = "onos", name = "pp",
description = "Pretty print JSON output from previous command")
public class PrettyJson extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
try {
ObjectMapper mapper = new ObjectMapper();
mapper.enable(SerializationFeature.INDENT_OUTPUT);
diff --git a/cli/src/main/java/org/onosproject/cli/PrettyXml.java b/cli/src/main/java/org/onosproject/cli/PrettyXml.java
index 9b3635f..20c8180 100644
--- a/cli/src/main/java/org/onosproject/cli/PrettyXml.java
+++ b/cli/src/main/java/org/onosproject/cli/PrettyXml.java
@@ -18,7 +18,8 @@
import java.io.IOException;
import java.io.InputStreamReader;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.util.XmlString;
import com.google.common.io.CharStreams;
@@ -26,12 +27,13 @@
/**
* Pretty print previous command output XML.
*/
+@Service
@Command(scope = "onos", name = "ppxml",
description = "Pretty print XML output from previous command")
public class PrettyXml extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
try {
String xmlS = CharStreams.toString(new InputStreamReader(System.in));
diff --git a/cli/src/main/java/org/onosproject/cli/RolesCommand.java b/cli/src/main/java/org/onosproject/cli/RolesCommand.java
index 17f46aa..88fa8fe 100644
--- a/cli/src/main/java/org/onosproject/cli/RolesCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/RolesCommand.java
@@ -19,7 +19,8 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cluster.NodeId;
import org.onosproject.cluster.RoleInfo;
import org.onosproject.mastership.MastershipService;
@@ -34,6 +35,7 @@
/**
* Lists mastership roles of nodes for each device.
*/
+@Service
@Command(scope = "onos", name = "roles",
description = "Lists mastership roles of nodes for each device.")
public class RolesCommand extends AbstractShellCommand {
@@ -41,7 +43,7 @@
private static final String FMT_HDR = "%s: master=%s, standbys=[ %s]";
@Override
- protected void execute() {
+ protected void doExecute() {
DeviceService deviceService = get(DeviceService.class);
MastershipService roleService = get(MastershipService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/SummaryCommand.java b/cli/src/main/java/org/onosproject/cli/SummaryCommand.java
index 51a2fc3..02ff37d 100644
--- a/cli/src/main/java/org/onosproject/cli/SummaryCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/SummaryCommand.java
@@ -16,7 +16,8 @@
package org.onosproject.cli;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.packet.IpAddress;
import org.onosproject.cluster.ClusterMetadataService;
import org.onosproject.cluster.ClusterService;
@@ -35,6 +36,7 @@
/**
* Provides summary of ONOS model.
*/
+@Service
@Command(scope = "onos", name = "summary",
description = "Provides summary of ONOS model")
public class SummaryCommand extends AbstractShellCommand {
@@ -55,7 +57,7 @@
}
@Override
- protected void execute() {
+ protected void doExecute() {
IpAddress nodeIp = get(ClusterService.class).getLocalNode().ip();
Version version = get(CoreService.class).version();
long numNodes = activeNodes(get(ClusterService.class).getNodes());
diff --git a/cli/src/main/java/org/onosproject/cli/app/ApplicationCommand.java b/cli/src/main/java/org/onosproject/cli/app/ApplicationCommand.java
index 4db129d..55e7a93 100644
--- a/cli/src/main/java/org/onosproject/cli/app/ApplicationCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/app/ApplicationCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.app;
import com.google.common.io.ByteStreams;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.app.ApplicationAdminService;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.core.Application;
@@ -31,6 +32,7 @@
/**
* Manages application inventory.
*/
+@Service
@Command(scope = "onos", name = "app",
description = "Manages application inventory")
public class ApplicationCommand extends AbstractShellCommand {
@@ -51,7 +53,7 @@
String[] names = null;
@Override
- protected void execute() {
+ protected void doExecute() {
ApplicationAdminService service = get(ApplicationAdminService.class);
if (command.equals(INSTALL)) {
for (String name : names) {
diff --git a/cli/src/main/java/org/onosproject/cli/app/ApplicationIdListCommand.java b/cli/src/main/java/org/onosproject/cli/app/ApplicationIdListCommand.java
index 15e7227..8e8a482 100644
--- a/cli/src/main/java/org/onosproject/cli/app/ApplicationIdListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/app/ApplicationIdListCommand.java
@@ -18,7 +18,8 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.utils.Comparators;
import org.onosproject.core.ApplicationId;
@@ -32,12 +33,13 @@
/**
* Lists application ID information.
*/
+@Service
@Command(scope = "onos", name = "app-ids",
description = "Lists application ID information")
public class ApplicationIdListCommand extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
CoreService service = get(CoreService.class);
List<ApplicationId> ids = newArrayList(service.getAppIds());
Collections.sort(ids, Comparators.APP_ID_COMPARATOR);
diff --git a/cli/src/main/java/org/onosproject/cli/app/ApplicationIdWithIntentNameCompleter.java b/cli/src/main/java/org/onosproject/cli/app/ApplicationIdWithIntentNameCompleter.java
index 275d6b9..d9e1a15 100644
--- a/cli/src/main/java/org/onosproject/cli/app/ApplicationIdWithIntentNameCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/app/ApplicationIdWithIntentNameCompleter.java
@@ -18,17 +18,21 @@
import java.util.List;
import java.util.SortedSet;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.intent.IntentService;
/**
* Application name completer.
*/
+@Service
public class ApplicationIdWithIntentNameCompleter implements Completer {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
@@ -41,7 +45,7 @@
strings.add(intent.appId().name()));
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/app/ApplicationNameCompleter.java b/cli/src/main/java/org/onosproject/cli/app/ApplicationNameCompleter.java
index 3f93ced..badbcd8 100644
--- a/cli/src/main/java/org/onosproject/cli/app/ApplicationNameCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/app/ApplicationNameCompleter.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.app;
-import org.apache.karaf.shell.console.completer.ArgumentCompleter;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.onosproject.app.ApplicationService;
import org.onosproject.app.ApplicationState;
import org.onosproject.cli.AbstractCompleter;
@@ -44,13 +45,12 @@
*/
public class ApplicationNameCompleter extends AbstractCompleter {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
// Command name is the second argument.
- ArgumentCompleter.ArgumentList list = getArgumentList();
- String cmd = list.getArguments()[1];
+ String cmd = commandLine.getArguments()[1];
// Grab apps already on the command (to prevent tab-completed duplicates)
// FIXME: This does not work.
@@ -80,7 +80,7 @@
}
// add unique suffix to candidates, if user has something in buffer
- if (!Strings.isNullOrEmpty(buffer)) {
+ if (!Strings.isNullOrEmpty(commandLine.getCursorArgument())) {
List<String> suffixCandidates = strings.stream()
// remove onos common prefix
.map(full -> full.replaceFirst("org\\.onosproject\\.", ""))
@@ -107,7 +107,7 @@
}
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/app/ApplicationsListCommand.java b/cli/src/main/java/org/onosproject/cli/app/ApplicationsListCommand.java
index 5b0c1ef..24b2da1 100644
--- a/cli/src/main/java/org/onosproject/cli/app/ApplicationsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/app/ApplicationsListCommand.java
@@ -20,8 +20,9 @@
import java.util.Comparator;
import java.util.List;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.app.ApplicationService;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.utils.Comparators;
@@ -37,6 +38,7 @@
/**
* Lists application information.
*/
+@Service
@Command(scope = "onos", name = "apps",
description = "Lists application information")
public class ApplicationsListCommand extends AbstractShellCommand {
@@ -61,7 +63,7 @@
@Override
- protected void execute() {
+ protected void doExecute() {
ApplicationService service = get(ApplicationService.class);
List<Application> apps = newArrayList(service.getApplications());
if (sortByName) {
diff --git a/cli/src/main/java/org/onosproject/cli/cfg/ComponentConfigCommand.java b/cli/src/main/java/org/onosproject/cli/cfg/ComponentConfigCommand.java
index ef20d07..546a637 100644
--- a/cli/src/main/java/org/onosproject/cli/cfg/ComponentConfigCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/cfg/ComponentConfigCommand.java
@@ -18,9 +18,10 @@
import java.util.Optional;
import java.util.Set;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cfg.ComponentConfigService;
import org.onosproject.cfg.ConfigProperty;
import org.onosproject.cli.AbstractShellCommand;
@@ -35,6 +36,7 @@
/**
* Manages component configuration.
*/
+@Service
@Command(scope = "onos", name = "cfg",
description = "Manages component configuration")
public class ComponentConfigCommand extends AbstractShellCommand {
@@ -71,7 +73,7 @@
ComponentConfigService service;
@Override
- protected void execute() {
+ protected void doExecute() {
service = get(ComponentConfigService.class);
try {
if (isNullOrEmpty(command)) {
diff --git a/cli/src/main/java/org/onosproject/cli/cfg/ComponentConfigCommandCompleter.java b/cli/src/main/java/org/onosproject/cli/cfg/ComponentConfigCommandCompleter.java
index 46830cf..8c1819f 100644
--- a/cli/src/main/java/org/onosproject/cli/cfg/ComponentConfigCommandCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/cfg/ComponentConfigCommandCompleter.java
@@ -15,8 +15,11 @@
*/
package org.onosproject.cli.cfg;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import java.util.List;
import java.util.SortedSet;
@@ -28,9 +31,10 @@
/**
* Component configuration command completer.
*/
+@Service
public class ComponentConfigCommandCompleter implements Completer {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
SortedSet<String> strings = delegate.getStrings();
@@ -39,7 +43,7 @@
strings.add(PRESET);
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/cfg/ComponentNameCompleter.java b/cli/src/main/java/org/onosproject/cli/cfg/ComponentNameCompleter.java
index 1e4853b..fedeb01 100644
--- a/cli/src/main/java/org/onosproject/cli/cfg/ComponentNameCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/cfg/ComponentNameCompleter.java
@@ -15,8 +15,11 @@
*/
package org.onosproject.cli.cfg;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.onosproject.cfg.ComponentConfigService;
import org.onosproject.cli.AbstractShellCommand;
@@ -26,9 +29,10 @@
/**
* Component name completer.
*/
+@Service
public class ComponentNameCompleter implements Completer {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
@@ -38,7 +42,7 @@
service.getComponentNames().forEach(strings::add);
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/cfg/ComponentPropertyNameCompleter.java b/cli/src/main/java/org/onosproject/cli/cfg/ComponentPropertyNameCompleter.java
index 0c842fa..4d6161a 100644
--- a/cli/src/main/java/org/onosproject/cli/cfg/ComponentPropertyNameCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/cfg/ComponentPropertyNameCompleter.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.cfg;
-import org.apache.karaf.shell.console.completer.ArgumentCompleter;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.onosproject.cfg.ComponentConfigService;
import org.onosproject.cfg.ConfigProperty;
import org.onosproject.cli.AbstractCompleter;
@@ -32,13 +33,12 @@
*/
public class ComponentPropertyNameCompleter extends AbstractCompleter {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
// Component name is the previous argument.
- ArgumentCompleter.ArgumentList list = getArgumentList();
- String componentName = list.getArguments()[list.getCursorArgumentIndex() - 1];
+ String componentName = commandLine.getArguments()[commandLine.getCursorArgumentIndex() - 1];
ComponentConfigService service = get(ComponentConfigService.class);
SortedSet<String> strings = delegate.getStrings();
@@ -49,7 +49,7 @@
}
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/cfg/ConfigKeyCompleter.java b/cli/src/main/java/org/onosproject/cli/cfg/ConfigKeyCompleter.java
index 35dd2a0..55baaf6 100644
--- a/cli/src/main/java/org/onosproject/cli/cfg/ConfigKeyCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/cfg/ConfigKeyCompleter.java
@@ -21,7 +21,6 @@
import java.util.Set;
import java.util.stream.Collectors;
-import org.apache.karaf.shell.console.completer.ArgumentCompleter.ArgumentList;
import org.onosproject.cli.AbstractChoicesCompleter;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.config.Config;
@@ -42,17 +41,16 @@
@Override
protected List<String> choices() {
NetworkConfigRegistry service = AbstractShellCommand.get(NetworkConfigRegistry.class);
- ArgumentList args = getArgumentList();
- checkArgument(args.getCursorArgumentIndex() >= 2);
- String subjectClassKey = args.getArguments()[args.getCursorArgumentIndex() - 2];
+ checkArgument(commandLine.getCursorArgumentIndex() >= 2);
+ String subjectClassKey = commandLine.getArguments()[commandLine.getCursorArgumentIndex() - 2];
SubjectFactory<?> subjectFactory = service.getSubjectFactory(subjectClassKey);
if (subjectFactory == null) {
return ImmutableList.of();
}
- String subjectKey = args.getArguments()[args.getCursorArgumentIndex() - 1];
+ String subjectKey = commandLine.getArguments()[commandLine.getCursorArgumentIndex() - 1];
Object subject = subjectFactory.createSubject(subjectKey);
Set<? extends Config<Object>> configs = service.getConfigs(subject);
diff --git a/cli/src/main/java/org/onosproject/cli/cfg/NetworkConfigCommand.java b/cli/src/main/java/org/onosproject/cli/cfg/NetworkConfigCommand.java
index a45efcb..b155090 100644
--- a/cli/src/main/java/org/onosproject/cli/cfg/NetworkConfigCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/cfg/NetworkConfigCommand.java
@@ -19,9 +19,10 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.config.Config;
import org.onosproject.net.config.NetworkConfigService;
@@ -33,6 +34,7 @@
/**
* Manages network configuration.
*/
+@Service
@Command(scope = "onos", name = "netcfg",
description = "Manages network configuration")
public class NetworkConfigCommand extends AbstractShellCommand {
@@ -60,7 +62,7 @@
private NetworkConfigService service;
@Override
- protected void execute() {
+ protected void doExecute() {
service = get(NetworkConfigService.class);
JsonNode root = mapper.createObjectNode();
if (isNullOrEmpty(subjectClassKey)) {
diff --git a/cli/src/main/java/org/onosproject/cli/cfg/NetworkConfigRegistryCommand.java b/cli/src/main/java/org/onosproject/cli/cfg/NetworkConfigRegistryCommand.java
index 5026fec..d477279 100644
--- a/cli/src/main/java/org/onosproject/cli/cfg/NetworkConfigRegistryCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/cfg/NetworkConfigRegistryCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.cfg;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.config.ConfigFactory;
import org.onosproject.net.config.NetworkConfigRegistry;
@@ -24,6 +25,7 @@
/**
* Displays network configuration registry contents.
*/
+@Service
@Command(scope = "onos", name = "netcfg-registry",
description = "Displays network configuration registry contents")
public class NetworkConfigRegistryCommand extends AbstractShellCommand {
@@ -36,7 +38,7 @@
private boolean shortOnly = false;
@Override
- protected void execute() {
+ protected void doExecute() {
get(NetworkConfigRegistry.class).getConfigFactories().forEach(this::print);
}
diff --git a/cli/src/main/java/org/onosproject/cli/cfg/SubjectKeyCompleter.java b/cli/src/main/java/org/onosproject/cli/cfg/SubjectKeyCompleter.java
index 0267023..e0d183d 100644
--- a/cli/src/main/java/org/onosproject/cli/cfg/SubjectKeyCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/cfg/SubjectKeyCompleter.java
@@ -20,7 +20,6 @@
import java.util.Set;
import java.util.stream.Collectors;
-import org.apache.karaf.shell.console.completer.ArgumentCompleter.ArgumentList;
import org.onosproject.cli.AbstractChoicesCompleter;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.config.NetworkConfigRegistry;
@@ -36,8 +35,7 @@
@Override
protected List<String> choices() {
NetworkConfigRegistry service = AbstractShellCommand.get(NetworkConfigRegistry.class);
- ArgumentList args = getArgumentList();
- String subjectClassKey = args.getArguments()[args.getCursorArgumentIndex() - 1];
+ String subjectClassKey = commandLine.getArguments()[commandLine.getCursorArgumentIndex() - 1];
SubjectFactory subjectFactory = service.getSubjectFactory(subjectClassKey);
if (subjectFactory == null) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/AddHostToHostIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/AddHostToHostIntentCommand.java
index 8f2fa87..fb95646 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AddHostToHostIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AddHostToHostIntentCommand.java
@@ -17,8 +17,9 @@
import java.util.List;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.net.HostId;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
@@ -29,6 +30,7 @@
/**
* Installs host-to-host connectivity intent.
*/
+@Service
@Command(scope = "onos", name = "add-host-intent",
description = "Installs host-to-host connectivity intent")
public class AddHostToHostIntentCommand extends ConnectivityIntentCommand {
@@ -42,7 +44,7 @@
String two = null;
@Override
- protected void execute() {
+ protected void doExecute() {
IntentService service = get(IntentService.class);
HostId oneId = HostId.hostId(one);
diff --git a/cli/src/main/java/org/onosproject/cli/net/AddMultiPointToSinglePointIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/AddMultiPointToSinglePointIntentCommand.java
index 16250a3..7c8c6bb 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AddMultiPointToSinglePointIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AddMultiPointToSinglePointIntentCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.FilteredConnectPoint;
import org.onosproject.net.flow.TrafficSelector;
@@ -33,6 +34,7 @@
/**
* Installs connectivity intent between multiple ingress devices and a single egress device.
*/
+@Service
@Command(scope = "onos", name = "add-multi-to-single-intent",
description = "Installs connectivity intent between multiple ingress devices and a single egress device")
public class AddMultiPointToSinglePointIntentCommand extends ConnectivityIntentCommand {
@@ -43,7 +45,7 @@
String[] deviceStrings = null;
@Override
- protected void execute() {
+ protected void doExecute() {
IntentService service = get(IntentService.class);
if (deviceStrings.length < 2) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/AddPointToPointIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/AddPointToPointIntentCommand.java
index 264eb39..6b48914 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AddPointToPointIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AddPointToPointIntentCommand.java
@@ -15,9 +15,10 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.FilteredConnectPoint;
import org.onosproject.net.flow.TrafficSelector;
@@ -35,6 +36,7 @@
/**
* Installs point-to-point connectivity intents.
*/
+@Service
@Command(scope = "onos", name = "add-point-intent",
description = "Installs point-to-point connectivity intent")
public class AddPointToPointIntentCommand extends ConnectivityIntentCommand {
@@ -59,7 +61,7 @@
private boolean useProtected = false;
@Override
- protected void execute() {
+ protected void doExecute() {
IntentService service = get(IntentService.class);
ConnectPoint ingress = ConnectPoint.deviceConnectPoint(ingressDeviceString);
diff --git a/cli/src/main/java/org/onosproject/cli/net/AddProtectedTransportIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/AddProtectedTransportIntentCommand.java
index 1254f41..7360cec 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AddProtectedTransportIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AddProtectedTransportIntentCommand.java
@@ -17,9 +17,10 @@
import java.util.Optional;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
import org.onosproject.net.intent.Intent;
@@ -30,6 +31,7 @@
/**
* Installs ProtectedTransportIntent.
*/
+@Service
@Command(scope = "onos", name = "add-protected-transport",
description = "Adds ProtectedTransportIntent")
public class AddProtectedTransportIntentCommand
@@ -53,7 +55,7 @@
private IntentService intentService;
@Override
- protected void execute() {
+ protected void doExecute() {
intentService = get(IntentService.class);
DeviceId did1 = DeviceId.deviceId(deviceId1Str);
diff --git a/cli/src/main/java/org/onosproject/cli/net/AddSinglePointToMultiPointIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/AddSinglePointToMultiPointIntentCommand.java
index 9cb8fea..c868f19 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AddSinglePointToMultiPointIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AddSinglePointToMultiPointIntentCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
@@ -31,6 +32,7 @@
/**
* Installs connectivity intent between a single ingress device and multiple egress devices.
*/
+@Service
@Command(scope = "onos", name = "add-single-to-multi-intent",
description = "Installs connectivity intent between a single ingress device and multiple egress devices")
public class AddSinglePointToMultiPointIntentCommand extends ConnectivityIntentCommand {
@@ -40,7 +42,7 @@
String[] deviceStrings = null;
@Override
- protected void execute() {
+ protected void doExecute() {
IntentService service = get(IntentService.class);
if (deviceStrings.length < 2) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/AddTestFlowsCommand.java b/cli/src/main/java/org/onosproject/cli/net/AddTestFlowsCommand.java
index 004ebfa..05c4451 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AddTestFlowsCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AddTestFlowsCommand.java
@@ -20,8 +20,9 @@
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang.math.RandomUtils;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.packet.MacAddress;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.core.ApplicationId;
@@ -51,6 +52,7 @@
/**
* Installs bulk flows.
*/
+@Service
@Command(scope = "onos", name = "add-test-flows",
description = "Installs a number of test flow rules - for testing only")
public class AddTestFlowsCommand extends AbstractShellCommand {
@@ -68,7 +70,7 @@
String numOfRuns = null;
@Override
- protected void execute() {
+ protected void doExecute() {
FlowRuleService flowService = get(FlowRuleService.class);
DeviceService deviceService = get(DeviceService.class);
CoreService coreService = get(CoreService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/AddTunnelCommand.java b/cli/src/main/java/org/onosproject/cli/net/AddTunnelCommand.java
index 35b5744..18c677f 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AddTunnelCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AddTunnelCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.domain.IntentDomainId;
import org.onosproject.incubator.net.domain.IntentDomainService;
@@ -28,6 +29,7 @@
/**
* Installs intent domain tunnel primitive.
*/
+@Service
@Command(scope = "onos", name = "add-domain-tunnel",
description = "Installs intent domain tunnel primitive")
public class AddTunnelCommand extends AbstractShellCommand {
@@ -43,7 +45,7 @@
String twoString = null;
@Override
- protected void execute() {
+ protected void doExecute() {
IntentDomainService service = get(IntentDomainService.class);
ConnectPoint one = ConnectPoint.deviceConnectPoint(oneString);
diff --git a/cli/src/main/java/org/onosproject/cli/net/AllocationsCommand.java b/cli/src/main/java/org/onosproject/cli/net/AllocationsCommand.java
index c228645..de4a4dd 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AllocationsCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AllocationsCommand.java
@@ -27,9 +27,10 @@
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onlab.packet.MplsLabel;
import org.onlab.packet.VlanId;
import org.onlab.util.Bandwidth;
@@ -51,6 +52,7 @@
/**
* Lists allocated resources.
*/
+@Service
@Command(scope = "onos", name = "allocations",
description = "Lists allocated resources")
public class AllocationsCommand extends AbstractShellCommand {
@@ -83,7 +85,7 @@
private ResourceService resourceService;
@Override
- protected void execute() {
+ protected void doExecute() {
deviceService = get(DeviceService.class);
resourceService = get(ResourceService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/AnnotateDeviceCommand.java b/cli/src/main/java/org/onosproject/cli/net/AnnotateDeviceCommand.java
index 0680d59..4a4cb06 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AnnotateDeviceCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AnnotateDeviceCommand.java
@@ -15,9 +15,10 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
import org.onosproject.net.config.NetworkConfigService;
@@ -27,6 +28,7 @@
/**
* Annotates network device model.
*/
+@Service
@Command(scope = "onos", name = "annotate-device",
description = "Annotates network model entities")
public class AnnotateDeviceCommand extends AbstractShellCommand {
@@ -51,7 +53,7 @@
private boolean removeCfg = false;
@Override
- protected void execute() {
+ protected void doExecute() {
NetworkConfigService netcfgService = get(NetworkConfigService.class);
DeviceId deviceId = DeviceId.deviceId(uri);
diff --git a/cli/src/main/java/org/onosproject/cli/net/AnnotateLinkCommand.java b/cli/src/main/java/org/onosproject/cli/net/AnnotateLinkCommand.java
index 382f354..b20546f 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AnnotateLinkCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AnnotateLinkCommand.java
@@ -18,9 +18,10 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onosproject.net.ConnectPoint.deviceConnectPoint;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DefaultAnnotations;
@@ -36,6 +37,7 @@
/**
* Annotates network link model.
*/
+@Service
@Command(scope = "onos", name = "annotate-link",
description = "Annotates network model entities")
public class AnnotateLinkCommand extends AbstractShellCommand {
@@ -67,7 +69,7 @@
@Override
- protected void execute() {
+ protected void doExecute() {
LinkService service = get(LinkService.class);
ConnectPoint src = deviceConnectPoint(srcCp);
ConnectPoint dst = deviceConnectPoint(dstCp);
diff --git a/cli/src/main/java/org/onosproject/cli/net/AnnotatePortCommand.java b/cli/src/main/java/org/onosproject/cli/net/AnnotatePortCommand.java
index 6550bdc..931ea67 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AnnotatePortCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AnnotatePortCommand.java
@@ -15,9 +15,10 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.config.NetworkConfigService;
@@ -27,6 +28,7 @@
/**
* Annotates network device port model.
*/
+@Service
@Command(scope = "onos", name = "annotate-port",
description = "Annotates port entities")
public class AnnotatePortCommand extends AbstractShellCommand {
@@ -49,7 +51,7 @@
private boolean removeCfg = false;
@Override
- protected void execute() {
+ protected void doExecute() {
DeviceService deviceService = get(DeviceService.class);
NetworkConfigService netcfgService = get(NetworkConfigService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/ClusterDevicesCommand.java b/cli/src/main/java/org/onosproject/cli/net/ClusterDevicesCommand.java
index b81e9c3..49a2571 100644
--- a/cli/src/main/java/org/onosproject/cli/net/ClusterDevicesCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/ClusterDevicesCommand.java
@@ -17,8 +17,9 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Lists;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.utils.Comparators;
import org.onosproject.net.DeviceId;
import org.onosproject.net.topology.TopologyCluster;
@@ -32,6 +33,7 @@
/**
* Lists devices of the specified topology cluster in the current topology.
*/
+@Service
@Command(scope = "onos", name = "topo-cluster-devices",
description = "Lists devices of the specified topology cluster in the current topology")
public class ClusterDevicesCommand extends ClustersListCommand {
@@ -41,7 +43,7 @@
String id = null;
@Override
- protected void execute() {
+ protected void doExecute() {
int cid = Integer.parseInt(id);
init();
TopologyCluster cluster = service.getCluster(topology, clusterId(cid));
diff --git a/cli/src/main/java/org/onosproject/cli/net/ClusterIdCompleter.java b/cli/src/main/java/org/onosproject/cli/net/ClusterIdCompleter.java
index ed0c259..3ae21c3 100644
--- a/cli/src/main/java/org/onosproject/cli/net/ClusterIdCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/ClusterIdCompleter.java
@@ -15,8 +15,11 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.topology.Topology;
import org.onosproject.net.topology.TopologyCluster;
@@ -28,9 +31,10 @@
/**
* Cluster ID completer.
*/
+@Service
public class ClusterIdCompleter implements Completer {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
@@ -44,7 +48,7 @@
}
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/ClusterLinksCommand.java b/cli/src/main/java/org/onosproject/cli/net/ClusterLinksCommand.java
index df6ab96..9bc690b 100644
--- a/cli/src/main/java/org/onosproject/cli/net/ClusterLinksCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/ClusterLinksCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.net.Link;
import org.onosproject.net.topology.TopologyCluster;
@@ -27,6 +28,7 @@
/**
* Lists links of the specified topology cluster in the current topology.
*/
+@Service
@Command(scope = "onos", name = "topo-cluster-links",
description = "Lists links of the specified topology cluster in the current topology")
public class ClusterLinksCommand extends ClustersListCommand {
@@ -36,7 +38,7 @@
String id = null;
@Override
- protected void execute() {
+ protected void doExecute() {
int cid = Integer.parseInt(id);
init();
TopologyCluster cluster = service.getCluster(topology, clusterId(cid));
diff --git a/cli/src/main/java/org/onosproject/cli/net/ClustersListCommand.java b/cli/src/main/java/org/onosproject/cli/net/ClustersListCommand.java
index 7721d10..b4b5540 100644
--- a/cli/src/main/java/org/onosproject/cli/net/ClustersListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/ClustersListCommand.java
@@ -19,7 +19,8 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.google.common.collect.Lists;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.utils.Comparators;
import org.onosproject.net.topology.TopologyCluster;
@@ -29,6 +30,7 @@
/**
* Lists all clusters in the current topology.
*/
+@Service
@Command(scope = "onos", name = "topo-clusters",
description = "Lists all clusters in the current topology")
public class ClustersListCommand extends TopologyCommand {
@@ -37,7 +39,7 @@
"id=%d, devices=%d, links=%d";
@Override
- protected void execute() {
+ protected void doExecute() {
init();
List<TopologyCluster> clusters = Lists.newArrayList(service.getClusters(topology));
Collections.sort(clusters, Comparators.CLUSTER_COMPARATOR);
diff --git a/cli/src/main/java/org/onosproject/cli/net/ConfigureLinkCommand.java b/cli/src/main/java/org/onosproject/cli/net/ConfigureLinkCommand.java
index 1607ab3..6af7a26 100644
--- a/cli/src/main/java/org/onosproject/cli/net/ConfigureLinkCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/ConfigureLinkCommand.java
@@ -19,9 +19,10 @@
import java.util.Optional;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.Link;
@@ -33,6 +34,7 @@
/**
* Add Link configuration.
*/
+@Service
@Command(scope = "onos", name = "config-link",
description = "Configure link.")
public class ConfigureLinkCommand extends AbstractShellCommand {
@@ -71,7 +73,7 @@
@Override
- protected void execute() {
+ protected void doExecute() {
DeviceService deviceService = get(DeviceService.class);
NetworkConfigService netCfgService = get(NetworkConfigService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/ConnectPointCompleter.java b/cli/src/main/java/org/onosproject/cli/net/ConnectPointCompleter.java
index ab230c1..dfc76a7 100644
--- a/cli/src/main/java/org/onosproject/cli/net/ConnectPointCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/ConnectPointCompleter.java
@@ -15,8 +15,11 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.Device;
import org.onosproject.net.Port;
@@ -28,9 +31,10 @@
/**
* ConnectPoint completer.
*/
+@Service
public class ConnectPointCompleter implements Completer {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
@@ -48,7 +52,7 @@
}
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java
index 679a0af..9cfa346 100644
--- a/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/ConnectivityIntentCommand.java
@@ -15,7 +15,7 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Option;
import org.onlab.packet.Ip6Address;
import org.onlab.packet.IpAddress;
import org.onlab.packet.IpPrefix;
diff --git a/cli/src/main/java/org/onosproject/cli/net/CounterCommand.java b/cli/src/main/java/org/onosproject/cli/net/CounterCommand.java
index ca71ca7..a3d0f35 100644
--- a/cli/src/main/java/org/onosproject/cli/net/CounterCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/CounterCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.store.service.AtomicCounter;
import org.onosproject.store.service.StorageService;
@@ -27,6 +28,7 @@
/**
* Command to display the current value of a atomic counter.
*/
+@Service
@Command(scope = "onos", name = "counter",
description = "Displays the current value of a atomic counter")
public class CounterCommand extends AbstractShellCommand {
@@ -36,7 +38,7 @@
String name = null;
@Override
- protected void execute() {
+ protected void doExecute() {
StorageService storageService = get(StorageService.class);
AtomicCounter counter = storageService.getAtomicCounter(name);
diff --git a/cli/src/main/java/org/onosproject/cli/net/CountersListCommand.java b/cli/src/main/java/org/onosproject/cli/net/CountersListCommand.java
index 51a13a7..02b1a76 100644
--- a/cli/src/main/java/org/onosproject/cli/net/CountersListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/CountersListCommand.java
@@ -17,7 +17,8 @@
import java.util.Map;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.store.service.StorageAdminService;
@@ -27,6 +28,7 @@
/**
* Command to list the various counters in the system.
*/
+@Service
@Command(scope = "onos", name = "counters",
description = "Lists information about atomic counters in the system")
public class CountersListCommand extends AbstractShellCommand {
@@ -34,7 +36,7 @@
private static final String FMT = "name=%s value=%d";
@Override
- protected void execute() {
+ protected void doExecute() {
StorageAdminService storageAdminService = get(StorageAdminService.class);
Map<String, Long> counters = storageAdminService.getCounters();
if (outputJson()) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/DeviceControllersCommand.java b/cli/src/main/java/org/onosproject/cli/net/DeviceControllersCommand.java
index 1231da5..ea39249 100644
--- a/cli/src/main/java/org/onosproject/cli/net/DeviceControllersCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/DeviceControllersCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
import org.onosproject.net.behaviour.ControllerConfig;
@@ -26,6 +27,7 @@
/**
* Sets role of the controller node for the given infrastructure device.
*/
+@Service
@Command(scope = "onos", name = "device-controllers",
description = "gets the list of controllers for the given infrastructure device")
public class DeviceControllersCommand extends AbstractShellCommand {
@@ -36,7 +38,7 @@
private DeviceId deviceId;
@Override
- protected void execute() {
+ protected void doExecute() {
DriverService service = get(DriverService.class);
deviceId = DeviceId.deviceId(uri);
DriverHandler h = service.createHandler(deviceId);
diff --git a/cli/src/main/java/org/onosproject/cli/net/DeviceIdCompleter.java b/cli/src/main/java/org/onosproject/cli/net/DeviceIdCompleter.java
index 4ecf264..a0080cd 100644
--- a/cli/src/main/java/org/onosproject/cli/net/DeviceIdCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/DeviceIdCompleter.java
@@ -15,8 +15,11 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.Device;
import org.onosproject.net.device.DeviceService;
@@ -28,9 +31,10 @@
/**
* Device ID completer.
*/
+@Service
public class DeviceIdCompleter implements Completer {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
@@ -43,7 +47,7 @@
}
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/DeviceInterfaceAddCommand.java b/cli/src/main/java/org/onosproject/cli/net/DeviceInterfaceAddCommand.java
index c28e190..f468008 100644
--- a/cli/src/main/java/org/onosproject/cli/net/DeviceInterfaceAddCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/DeviceInterfaceAddCommand.java
@@ -15,9 +15,10 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onlab.packet.VlanId;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
@@ -31,6 +32,7 @@
/**
* Configures a device interface.
*/
+@Service
@Command(scope = "onos", name = "device-add-interface",
description = "Configures a device interface")
public class DeviceInterfaceAddCommand extends AbstractShellCommand {
@@ -75,7 +77,7 @@
private String accessVlanString = null;
@Override
- protected void execute() {
+ protected void doExecute() {
DriverService service = get(DriverService.class);
DeviceId deviceId = DeviceId.deviceId(uri);
DriverHandler h = service.createHandler(deviceId);
diff --git a/cli/src/main/java/org/onosproject/cli/net/DeviceInterfaceRemoveCommand.java b/cli/src/main/java/org/onosproject/cli/net/DeviceInterfaceRemoveCommand.java
index 76262af..8cdd7b4 100644
--- a/cli/src/main/java/org/onosproject/cli/net/DeviceInterfaceRemoveCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/DeviceInterfaceRemoveCommand.java
@@ -15,9 +15,10 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
import org.onosproject.net.behaviour.InterfaceConfig;
@@ -27,6 +28,7 @@
/**
* Removes an interface configurion from a device.
*/
+@Service
@Command(scope = "onos", name = "device-remove-interface",
description = "Removes an interface configuration from a device")
public class DeviceInterfaceRemoveCommand extends AbstractShellCommand {
@@ -71,7 +73,7 @@
private boolean accessMode = false;
@Override
- protected void execute() {
+ protected void doExecute() {
DriverService service = get(DriverService.class);
DeviceId deviceId = DeviceId.deviceId(uri);
DriverHandler h = service.createHandler(deviceId);
diff --git a/cli/src/main/java/org/onosproject/cli/net/DeviceInterfacesListCommand.java b/cli/src/main/java/org/onosproject/cli/net/DeviceInterfacesListCommand.java
index 0e9de93..801b7d6 100644
--- a/cli/src/main/java/org/onosproject/cli/net/DeviceInterfacesListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/DeviceInterfacesListCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.net.Device;
import org.onosproject.net.behaviour.InterfaceConfig;
import org.onosproject.net.device.DeviceInterfaceDescription;
@@ -32,6 +33,7 @@
/**
* Lists all interfaces or interfaces of a device.
*/
+@Service
@Command(scope = "onos", name = "device-interfaces",
description = "Lists all interfaces or interfaces of a device.")
public class DeviceInterfacesListCommand extends DevicesListCommand {
@@ -50,7 +52,7 @@
private String uri = null;
@Override
- protected void execute() {
+ protected void doExecute() {
DeviceService deviceService = get(DeviceService.class);
DriverService driverService = get(DriverService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/DeviceKeyAddCommand.java b/cli/src/main/java/org/onosproject/cli/net/DeviceKeyAddCommand.java
index 44bc483..fc15cfb 100644
--- a/cli/src/main/java/org/onosproject/cli/net/DeviceKeyAddCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/DeviceKeyAddCommand.java
@@ -16,9 +16,10 @@
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.key.DeviceKey;
import org.onosproject.net.key.DeviceKeyAdminService;
@@ -27,6 +28,7 @@
/**
* Adds a device key.
*/
+@Service
@Command(scope = "onos", name = "device-key-add",
description = "Adds a device key. Adding a new device key with " +
"the same id will replace the existing device key.")
@@ -62,7 +64,7 @@
String password = null;
@Override
- protected void execute() {
+ protected void doExecute() {
DeviceKeyAdminService service = get(DeviceKeyAdminService.class);
DeviceKey deviceKey = null;
if (type.equalsIgnoreCase(COMMUNITY_NAME)) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/DeviceKeyListCommand.java b/cli/src/main/java/org/onosproject/cli/net/DeviceKeyListCommand.java
index 98ac00e..dc1007e 100644
--- a/cli/src/main/java/org/onosproject/cli/net/DeviceKeyListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/DeviceKeyListCommand.java
@@ -16,7 +16,8 @@
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.utils.Comparators;
import org.onosproject.net.key.DeviceKey;
@@ -30,6 +31,7 @@
/**
* Lists all device keys.
*/
+@Service
@Command(scope = "onos", name = "device-keys",
description = "Lists all device keys")
@@ -40,7 +42,7 @@
"identifier=%s, type=%s, username=%s, password=%s";
@Override
- protected void execute() {
+ protected void doExecute() {
DeviceKeyService service = get(DeviceKeyService.class);
for (DeviceKey deviceKey : getSortedDeviceKeys(service)) {
printDeviceKey(deviceKey);
diff --git a/cli/src/main/java/org/onosproject/cli/net/DeviceKeyRemoveCommand.java b/cli/src/main/java/org/onosproject/cli/net/DeviceKeyRemoveCommand.java
index 31d9131..650f1e6 100644
--- a/cli/src/main/java/org/onosproject/cli/net/DeviceKeyRemoveCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/DeviceKeyRemoveCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.key.DeviceKeyAdminService;
import org.onosproject.net.key.DeviceKeyId;
@@ -25,6 +26,7 @@
/**
* Removes a device key.
*/
+@Service
@Command(scope = "onos", name = "device-key-remove",
description = "Removes a device key")
@@ -35,7 +37,7 @@
String id = null;
@Override
- protected void execute() {
+ protected void doExecute() {
DeviceKeyAdminService service = get(DeviceKeyAdminService.class);
service.removeKey(DeviceKeyId.deviceKeyId(id));
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/DevicePortStateCommand.java b/cli/src/main/java/org/onosproject/cli/net/DevicePortStateCommand.java
index 7cd177f..dca8a90 100644
--- a/cli/src/main/java/org/onosproject/cli/net/DevicePortStateCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/DevicePortStateCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
@@ -28,6 +29,7 @@
/**
* Administratively enables or disabled a port on a device.
*/
+@Service
@Command(scope = "onos", name = "portstate",
description = "Administratively enables or disabled a port on a device")
public class DevicePortStateCommand extends AbstractShellCommand {
@@ -45,7 +47,7 @@
String portState = null;
@Override
- protected void execute() {
+ protected void doExecute() {
DeviceService deviceService = get(DeviceService.class);
DeviceAdminService deviceAdminService = get(DeviceAdminService.class);
Device dev = deviceService.getDevice(DeviceId.deviceId(uri));
diff --git a/cli/src/main/java/org/onosproject/cli/net/DevicePortStatsCommand.java b/cli/src/main/java/org/onosproject/cli/net/DevicePortStatsCommand.java
index 18413a7..e3f707d 100644
--- a/cli/src/main/java/org/onosproject/cli/net/DevicePortStatsCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/DevicePortStatsCommand.java
@@ -23,9 +23,10 @@
import java.util.concurrent.TimeUnit;
import com.google.common.collect.Lists;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
@@ -36,6 +37,7 @@
/**
* Lists port statistic of all ports in the system.
*/
+@Service
@Command(scope = "onos", name = "portstats",
description = "Lists statistics of all ports in the system")
public class DevicePortStatsCommand extends AbstractShellCommand {
@@ -70,7 +72,7 @@
" port=%s, pktRx=%s, pktTx=%s, bytesRx=%s, bytesTx=%s, pktRxDrp=%s, pktTxDrp=%s, Dur=%s%s";
@Override
- protected void execute() {
+ protected void doExecute() {
DeviceService deviceService = get(DeviceService.class);
if (portNumberStr != null) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/DevicePortsListCommand.java b/cli/src/main/java/org/onosproject/cli/net/DevicePortsListCommand.java
index c96bab2..b32146c 100644
--- a/cli/src/main/java/org/onosproject/cli/net/DevicePortsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/DevicePortsListCommand.java
@@ -19,9 +19,10 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.utils.Comparators;
import org.onosproject.net.Device;
import org.onosproject.net.Port;
@@ -35,6 +36,7 @@
/**
* Lists all ports or all ports of a device.
*/
+@Service
@Command(scope = "onos", name = "ports",
description = "Lists all ports or all ports of a device")
public class DevicePortsListCommand extends DevicesListCommand {
@@ -54,7 +56,7 @@
protected String uri = null;
@Override
- protected void execute() {
+ protected void doExecute() {
DeviceService service = get(DeviceService.class);
if (uri == null) {
if (outputJson()) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/DeviceRemoveCommand.java b/cli/src/main/java/org/onosproject/cli/net/DeviceRemoveCommand.java
index 83cd43f..8c68259 100644
--- a/cli/src/main/java/org/onosproject/cli/net/DeviceRemoveCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/DeviceRemoveCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
import org.onosproject.net.device.DeviceAdminService;
@@ -24,6 +25,7 @@
/**
* Removes an infrastructure device.
*/
+@Service
@Command(scope = "onos", name = "device-remove",
description = "Removes an infrastructure device")
public class DeviceRemoveCommand extends AbstractShellCommand {
@@ -33,7 +35,7 @@
String uri = null;
@Override
- protected void execute() {
+ protected void doExecute() {
try {
get(DeviceAdminService.class).removeDevice(DeviceId.deviceId(uri));
} catch (IllegalStateException e) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/DeviceRoleCommand.java b/cli/src/main/java/org/onosproject/cli/net/DeviceRoleCommand.java
index 7a2a430..bb68be8 100644
--- a/cli/src/main/java/org/onosproject/cli/net/DeviceRoleCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/DeviceRoleCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.cluster.NodeId;
import org.onosproject.mastership.MastershipAdminService;
@@ -29,6 +30,7 @@
/**
* Sets role of the controller node for the given infrastructure device.
*/
+@Service
@Command(scope = "onos", name = "device-role",
description = "Sets role of the controller node for the given infrastructure device")
public class DeviceRoleCommand extends AbstractShellCommand {
@@ -46,7 +48,7 @@
String role = null;
@Override
- protected void execute() {
+ protected void doExecute() {
MastershipAdminService service = get(MastershipAdminService.class);
MastershipRole mastershipRole = MastershipRole.valueOf(role.toUpperCase());
Futures.getUnchecked(service.setRole(new NodeId(node), deviceId(uri), mastershipRole));
diff --git a/cli/src/main/java/org/onosproject/cli/net/DeviceSetControllersCommand.java b/cli/src/main/java/org/onosproject/cli/net/DeviceSetControllersCommand.java
index e8d3201..fd8fc09 100644
--- a/cli/src/main/java/org/onosproject/cli/net/DeviceSetControllersCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/DeviceSetControllersCommand.java
@@ -16,9 +16,10 @@
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onlab.packet.IpAddress;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.Annotations;
@@ -36,6 +37,7 @@
/**
* Sets role of the controller node for the given infrastructure device.
*/
+@Service
@Command(scope = "onos", name = "device-setcontrollers",
description = "sets the list of controllers for the given infrastructure device")
public class DeviceSetControllersCommand extends AbstractShellCommand {
@@ -62,7 +64,7 @@
private List<ControllerInfo> controllers = new ArrayList<>();
@Override
- protected void execute() {
+ protected void doExecute() {
if (controllersListStrings == null && !removeCont && !removeAll) {
print("No controller are given, skipping.");
diff --git a/cli/src/main/java/org/onosproject/cli/net/DevicesListCommand.java b/cli/src/main/java/org/onosproject/cli/net/DevicesListCommand.java
index 4b95f0f..cf90604 100644
--- a/cli/src/main/java/org/onosproject/cli/net/DevicesListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/DevicesListCommand.java
@@ -19,8 +19,9 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.google.common.collect.ImmutableSet;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.AnnotationKeys;
import org.onosproject.net.Device;
@@ -36,6 +37,7 @@
/**
* Lists all infrastructure devices.
*/
+@Service
@Command(scope = "onos", name = "devices",
description = "Lists all infrastructure devices")
public class DevicesListCommand extends AbstractShellCommand {
@@ -52,7 +54,7 @@
private boolean shortOnly = false;
@Override
- protected void execute() {
+ protected void doExecute() {
DeviceService deviceService = get(DeviceService.class);
if (outputJson()) {
print("%s", json(getSortedDevices(deviceService)));
diff --git a/cli/src/main/java/org/onosproject/cli/net/DomainIdCompleter.java b/cli/src/main/java/org/onosproject/cli/net/DomainIdCompleter.java
index 7f0dc8f..324fbb0 100644
--- a/cli/src/main/java/org/onosproject/cli/net/DomainIdCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/DomainIdCompleter.java
@@ -15,8 +15,11 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.domain.DomainId;
import org.onosproject.net.domain.DomainService;
@@ -28,10 +31,11 @@
/**
* Domain ID completer.
*/
+@Service
public class DomainIdCompleter implements Completer {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
@@ -44,6 +48,6 @@
}
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/DpisListCommand.java b/cli/src/main/java/org/onosproject/cli/net/DpisListCommand.java
index d34c9ed..88e51c4 100644
--- a/cli/src/main/java/org/onosproject/cli/net/DpisListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/DpisListCommand.java
@@ -16,9 +16,10 @@
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.dpi.DpiStatInfo;
import org.onosproject.incubator.net.dpi.DpiStatistics;
@@ -34,6 +35,7 @@
/**
* Fetches DPI statistics list.
*/
+@Service
@Command(scope = "onos", name = "dpis",
description = "Fetches the DPI result entries that is received from DPI engine server")
public class DpisListCommand extends AbstractShellCommand {
@@ -96,7 +98,7 @@
+ " or correct receivedTime format: 'yyyy-MM-dd HH:mm:ss', ex:'2016-08-30 10:31:20'";
@Override
- protected void execute() {
+ protected void doExecute() {
DpiStatisticsManagerService dsms = get(DpiStatisticsManagerService.class);
DpiStatistics ds;
diff --git a/cli/src/main/java/org/onosproject/cli/net/DriverNameCompleter.java b/cli/src/main/java/org/onosproject/cli/net/DriverNameCompleter.java
index d8f6930..f0cc6a7 100644
--- a/cli/src/main/java/org/onosproject/cli/net/DriverNameCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/DriverNameCompleter.java
@@ -15,8 +15,11 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.driver.DriverService;
@@ -26,9 +29,10 @@
/**
* Device driver name completer.
*/
+@Service
public class DriverNameCompleter implements Completer {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
SortedSet<String> strings = delegate.getStrings();
@@ -38,7 +42,7 @@
service.getDrivers().forEach(d -> strings.add(d.name()));
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/DriverProvidersListCommand.java b/cli/src/main/java/org/onosproject/cli/net/DriverProvidersListCommand.java
index 3692c57..0667f28 100644
--- a/cli/src/main/java/org/onosproject/cli/net/DriverProvidersListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/DriverProvidersListCommand.java
@@ -15,7 +15,8 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.driver.Driver;
import org.onosproject.net.driver.DriverAdminService;
@@ -26,6 +27,7 @@
/**
* Lists device drivers.
*/
+@Service
@Command(scope = "onos", name = "driver-providers",
description = "Lists device driver providers")
public class DriverProvidersListCommand extends AbstractShellCommand {
@@ -33,7 +35,7 @@
private static final String FMT = "provider=%s, drivers=%s";
@Override
- protected void execute() {
+ protected void doExecute() {
DriverAdminService service = get(DriverAdminService.class);
service.getProviders().forEach(this::printDriverProvider);
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/DriversListCommand.java b/cli/src/main/java/org/onosproject/cli/net/DriversListCommand.java
index 79fb65a..6a973ea 100644
--- a/cli/src/main/java/org/onosproject/cli/net/DriversListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/DriversListCommand.java
@@ -17,9 +17,10 @@
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.google.common.collect.ImmutableList;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.driver.Behaviour;
import org.onosproject.net.driver.Driver;
@@ -34,6 +35,7 @@
/**
* Lists device drivers.
*/
+@Service
@Command(scope = "onos", name = "drivers",
description = "Lists device drivers")
public class DriversListCommand extends AbstractShellCommand {
@@ -55,7 +57,7 @@
private boolean nameOnly = false;
@Override
- protected void execute() {
+ protected void doExecute() {
DriverService service = get(DriverService.class);
if (driverName != null) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/EdgePortsListCommand.java b/cli/src/main/java/org/onosproject/cli/net/EdgePortsListCommand.java
index 529d778..7592cdf 100644
--- a/cli/src/main/java/org/onosproject/cli/net/EdgePortsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/EdgePortsListCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.edge.EdgePortService;
@@ -31,6 +32,7 @@
/**
* Lists all edge ports.
*/
+@Service
@Command(scope = "onos", name = "edge-ports",
description = "Lists all edge ports.")
public class EdgePortsListCommand extends AbstractShellCommand {
@@ -42,7 +44,7 @@
String uri = null;
@Override
- protected void execute() {
+ protected void doExecute() {
EdgePortService service = get(EdgePortService.class);
if (uri == null) {
printEdgePoints(service.getEdgePoints());
diff --git a/cli/src/main/java/org/onosproject/cli/net/EncapTypeCompleter.java b/cli/src/main/java/org/onosproject/cli/net/EncapTypeCompleter.java
index 1510e31..d6e7566 100644
--- a/cli/src/main/java/org/onosproject/cli/net/EncapTypeCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/EncapTypeCompleter.java
@@ -15,8 +15,11 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.onosproject.net.EncapsulationType;
import java.util.List;
@@ -25,10 +28,11 @@
/**
* Encapsulation type completer.
*/
+@Service
public class EncapTypeCompleter implements Completer {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
SortedSet<String> strings = delegate.getStrings();
@@ -38,6 +42,6 @@
}
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/EthTypeCompleter.java b/cli/src/main/java/org/onosproject/cli/net/EthTypeCompleter.java
index 370e0c9..db4744b 100644
--- a/cli/src/main/java/org/onosproject/cli/net/EthTypeCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/EthTypeCompleter.java
@@ -18,15 +18,19 @@
import java.util.List;
import java.util.SortedSet;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
/**
* Ethernet type completer.
*/
+@Service
public class EthTypeCompleter implements Completer {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
SortedSet<String> strings = delegate.getStrings();
@@ -36,7 +40,7 @@
}
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/ExtHeaderCompleter.java b/cli/src/main/java/org/onosproject/cli/net/ExtHeaderCompleter.java
index e6018e2..3c85b71 100644
--- a/cli/src/main/java/org/onosproject/cli/net/ExtHeaderCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/ExtHeaderCompleter.java
@@ -15,8 +15,11 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import java.util.List;
import java.util.SortedSet;
@@ -24,9 +27,10 @@
/**
* IPv6 extension header completer.
*/
+@Service
public class ExtHeaderCompleter implements Completer {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
SortedSet<String> strings = delegate.getStrings();
@@ -36,7 +40,7 @@
}
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/FlowObjectiveCompositionCommand.java b/cli/src/main/java/org/onosproject/cli/net/FlowObjectiveCompositionCommand.java
index 7e0c358..d87f723 100644
--- a/cli/src/main/java/org/onosproject/cli/net/FlowObjectiveCompositionCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/FlowObjectiveCompositionCommand.java
@@ -15,14 +15,16 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.flowobjective.FlowObjectiveService;
/**
* Manages FlowObjectiveComposition policy.
*/
+@Service
@Command(scope = "onos", name = "policy",
description = "Manages FlowObjectiveComposition policy")
public class FlowObjectiveCompositionCommand extends AbstractShellCommand {
@@ -37,7 +39,7 @@
String[] policies = null;
@Override
- protected void execute() {
+ protected void doExecute() {
FlowObjectiveService service = get(FlowObjectiveService.class);
service.initPolicy(policies[0]);
print("Policy %s installed", policies[0]);
diff --git a/cli/src/main/java/org/onosproject/cli/net/FlowObjectiveNextListCommand.java b/cli/src/main/java/org/onosproject/cli/net/FlowObjectiveNextListCommand.java
index bbf90e3..dd85b5b 100644
--- a/cli/src/main/java/org/onosproject/cli/net/FlowObjectiveNextListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/FlowObjectiveNextListCommand.java
@@ -18,7 +18,8 @@
import java.util.List;
import org.onlab.osgi.ServiceNotFoundException;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.flowobjective.FlowObjectiveService;
@@ -26,6 +27,7 @@
* Returns a mapping of FlowObjective next-ids to the groups that get created
* by a device driver. These mappings are controller instance specific.
*/
+@Service
@Command(scope = "onos", name = "obj-next-ids",
description = "flow-objectives next-ids to group-ids mapping")
public class FlowObjectiveNextListCommand extends AbstractShellCommand {
@@ -33,7 +35,7 @@
private static final String FORMAT_MAPPING = " %s";
@Override
- protected void execute() {
+ protected void doExecute() {
try {
FlowObjectiveService service = get(FlowObjectiveService.class);
printNexts(service.getNextMappings());
diff --git a/cli/src/main/java/org/onosproject/cli/net/FlowObjectivePendingNextCommand.java b/cli/src/main/java/org/onosproject/cli/net/FlowObjectivePendingNextCommand.java
index e3f372b..f0fbca8 100644
--- a/cli/src/main/java/org/onosproject/cli/net/FlowObjectivePendingNextCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/FlowObjectivePendingNextCommand.java
@@ -17,7 +17,8 @@
import java.util.List;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.osgi.ServiceNotFoundException;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.flowobjective.FlowObjectiveService;
@@ -27,6 +28,7 @@
* Also returns the forwarding objectives and next objectives waiting on the pending
* next-objectives. These lists are controller instance specific.
*/
+@Service
@Command(scope = "onos", name = "obj-pending-nexts",
description = "flow-objectives pending next-objectives")
public class FlowObjectivePendingNextCommand extends AbstractShellCommand {
@@ -34,7 +36,7 @@
private static final String FORMAT_MAPPING = " %s";
@Override
- protected void execute() {
+ protected void doExecute() {
try {
FlowObjectiveService service = get(FlowObjectiveService.class);
printNexts(service.getPendingFlowObjectives());
diff --git a/cli/src/main/java/org/onosproject/cli/net/FlowObjectiveQueueClearCommand.java b/cli/src/main/java/org/onosproject/cli/net/FlowObjectiveQueueClearCommand.java
index d15ac87..ff0895e 100644
--- a/cli/src/main/java/org/onosproject/cli/net/FlowObjectiveQueueClearCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/FlowObjectiveQueueClearCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.osgi.ServiceNotFoundException;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.flowobjective.FlowObjectiveService;
@@ -24,6 +25,7 @@
/**
* Clear flow objective that are waiting for the completion of previous objective with the same key.
*/
+@Service
@Command(scope = "onos", name = "obj-clear-queues",
description = "Force empty flow objective queues and invalidate flow objective caches")
public class FlowObjectiveQueueClearCommand extends AbstractShellCommand {
@@ -33,7 +35,7 @@
private String please = null;
@Override
- protected void execute() {
+ protected void doExecute() {
if (please == null || !please.equals(CONFIRM_PHRASE)) {
print("WARNING: System may enter an unpredictable state if the flow obj queues are force emptied." +
"Enter confirmation phrase to continue.");
diff --git a/cli/src/main/java/org/onosproject/cli/net/FlowObjectiveQueueListCommand.java b/cli/src/main/java/org/onosproject/cli/net/FlowObjectiveQueueListCommand.java
index 46f6122..9aded1e 100644
--- a/cli/src/main/java/org/onosproject/cli/net/FlowObjectiveQueueListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/FlowObjectiveQueueListCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net;
import com.google.common.collect.ListMultimap;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onlab.osgi.ServiceNotFoundException;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.flowobjective.FilteringObjQueueKey;
@@ -31,6 +32,7 @@
/**
* Displays flow objective that are waiting for the completion of previous objective with the same key.
*/
+@Service
@Command(scope = "onos", name = "obj-queues",
description = "Display flow objective queues")
public class FlowObjectiveQueueListCommand extends AbstractShellCommand {
@@ -46,7 +48,7 @@
private boolean cache = false;
@Override
- protected void execute() {
+ protected void doExecute() {
try {
FlowObjectiveService service = get(FlowObjectiveService.class);
ListMultimap<FilteringObjQueueKey, Objective> filtObjQueue = service.getFilteringObjQueue();
diff --git a/cli/src/main/java/org/onosproject/cli/net/FlowRuleStatusCompleter.java b/cli/src/main/java/org/onosproject/cli/net/FlowRuleStatusCompleter.java
index 8fe5664..1666332 100644
--- a/cli/src/main/java/org/onosproject/cli/net/FlowRuleStatusCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/FlowRuleStatusCompleter.java
@@ -18,16 +18,20 @@
import java.util.List;
import java.util.SortedSet;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.onosproject.net.flow.FlowEntry.FlowEntryState;
/**
* Flow rule status completer.
*/
+@Service
public class FlowRuleStatusCompleter implements Completer {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
@@ -39,7 +43,7 @@
strings.add(FlowsListCommand.ANY);
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/FlowsListCommand.java b/cli/src/main/java/org/onosproject/cli/net/FlowsListCommand.java
index 5c26b06..ddac49e 100644
--- a/cli/src/main/java/org/onosproject/cli/net/FlowsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/FlowsListCommand.java
@@ -19,9 +19,10 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onlab.util.StringFilter;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.core.ApplicationId;
@@ -54,6 +55,7 @@
/**
* Lists all currently-known flows.
*/
+@Service
@Command(scope = "onos", name = "flows",
description = "Lists all currently-known flows.")
public class FlowsListCommand extends AbstractShellCommand {
@@ -111,7 +113,7 @@
private StringFilter contentFilter;
@Override
- protected void execute() {
+ protected void doExecute() {
CoreService coreService = get(CoreService.class);
DeviceService deviceService = get(DeviceService.class);
FlowRuleService service = get(FlowRuleService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/GetDomainsCommand.java b/cli/src/main/java/org/onosproject/cli/net/GetDomainsCommand.java
index 9854d54..6186d2a 100644
--- a/cli/src/main/java/org/onosproject/cli/net/GetDomainsCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/GetDomainsCommand.java
@@ -15,7 +15,8 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.domain.DomainId;
import org.onosproject.net.domain.DomainService;
@@ -25,11 +26,12 @@
/**
* Gets the complete list of domain IDs.
*/
+@Service
@Command(scope = "onos", name = "domains", description = "Gets the list of domain IDs")
public class GetDomainsCommand extends AbstractShellCommand {
@Override
- public void execute() {
+ public void doExecute() {
DomainService domainService = AbstractShellCommand.get(DomainService.class);
Set<DomainId> domainIds = domainService.getDomainIds();
diff --git a/cli/src/main/java/org/onosproject/cli/net/GetFlowStatisticsCommand.java b/cli/src/main/java/org/onosproject/cli/net/GetFlowStatisticsCommand.java
index 78b1a37..aa86d6e 100644
--- a/cli/src/main/java/org/onosproject/cli/net/GetFlowStatisticsCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/GetFlowStatisticsCommand.java
@@ -16,9 +16,10 @@
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.Device;
@@ -42,6 +43,7 @@
/**
* Fetches flow statistics with a flow type and instruction type.
*/
+@Service
@Command(scope = "onos", name = "get-flow-stats",
description = "Fetches flow stats for a connection point with given flow type and instruction type")
public class GetFlowStatisticsCommand extends AbstractShellCommand {
@@ -79,7 +81,7 @@
String instructionType = null;
@Override
- protected void execute() {
+ protected void doExecute() {
DeviceService deviceService = get(DeviceService.class);
FlowStatisticService flowStatsService = get(FlowStatisticService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/GetStatisticsCommand.java b/cli/src/main/java/org/onosproject/cli/net/GetStatisticsCommand.java
index 12e92c6..54ddfb2 100644
--- a/cli/src/main/java/org/onosproject/cli/net/GetStatisticsCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/GetStatisticsCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
@@ -32,6 +33,7 @@
/**
* Fetches statistics.
*/
+@Service
@Command(scope = "onos", name = "get-stats",
description = "Fetches stats for a connection point")
public class GetStatisticsCommand extends AbstractShellCommand {
@@ -43,7 +45,7 @@
@Override
- protected void execute() {
+ protected void doExecute() {
StatisticService service = get(StatisticService.class);
DeviceId ingressDeviceId = deviceId(getDeviceId(connectPoint));
diff --git a/cli/src/main/java/org/onosproject/cli/net/GlobalLabelApplyCommand.java b/cli/src/main/java/org/onosproject/cli/net/GlobalLabelApplyCommand.java
index 44d0a93..2981408 100644
--- a/cli/src/main/java/org/onosproject/cli/net/GlobalLabelApplyCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/GlobalLabelApplyCommand.java
@@ -18,13 +18,15 @@
import java.util.Collection;
import java.util.Iterator;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.resource.label.DefaultLabelResource;
import org.onosproject.incubator.net.resource.label.LabelResource;
import org.onosproject.incubator.net.resource.label.LabelResourceService;
+@Service
@Command(scope = "onos", name = "global-label-apply",
description = "Apply global labels from global resource pool")
public class GlobalLabelApplyCommand extends AbstractShellCommand {
@@ -36,7 +38,7 @@
private static final String FMT = "deviceid=%s, labelresourceid=%s";
@Override
- protected void execute() {
+ protected void doExecute() {
LabelResourceService lrs = get(LabelResourceService.class);
Collection<LabelResource> result =
lrs.applyFromGlobalPool(Long.parseLong(applyNum));
diff --git a/cli/src/main/java/org/onosproject/cli/net/GlobalLabelCommand.java b/cli/src/main/java/org/onosproject/cli/net/GlobalLabelCommand.java
index bda8876..2dd55af 100644
--- a/cli/src/main/java/org/onosproject/cli/net/GlobalLabelCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/GlobalLabelCommand.java
@@ -15,11 +15,13 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.resource.label.LabelResourcePool;
import org.onosproject.incubator.net.resource.label.LabelResourceService;
+@Service
@Command(scope = "onos", name = "global-label-pool",
description = "Gets global label resource pool information.")
public class GlobalLabelCommand extends AbstractShellCommand {
@@ -28,7 +30,7 @@
+ "releaseLabelIds=%s";
@Override
- protected void execute() {
+ protected void doExecute() {
LabelResourceService lrs = get(LabelResourceService.class);
LabelResourcePool pool = lrs.getGlobalLabelResourcePool();
if (pool != null) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/GlobalLabelPoolCreateCommand.java b/cli/src/main/java/org/onosproject/cli/net/GlobalLabelPoolCreateCommand.java
index 993dd49..6ef72bc 100644
--- a/cli/src/main/java/org/onosproject/cli/net/GlobalLabelPoolCreateCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/GlobalLabelPoolCreateCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.resource.label.LabelResourceAdminService;
import org.onosproject.incubator.net.resource.label.LabelResourceId;
@@ -24,6 +25,7 @@
/**
* create label resource pool by specific device id.
*/
+@Service
@Command(scope = "onos", name = "global-label-pool-create",
description = "Creates global label resource pool.")
public class GlobalLabelPoolCreateCommand extends AbstractShellCommand {
@@ -37,7 +39,7 @@
String endLabel = null;
@Override
- protected void execute() {
+ protected void doExecute() {
LabelResourceAdminService lrs = get(LabelResourceAdminService.class);
lrs.createGlobalPool(LabelResourceId.labelResourceId(Long
.parseLong(beginLabel)), LabelResourceId.labelResourceId(Long
diff --git a/cli/src/main/java/org/onosproject/cli/net/GlobalLabelPoolDestroyCommand.java b/cli/src/main/java/org/onosproject/cli/net/GlobalLabelPoolDestroyCommand.java
index 981210e..387a80a 100644
--- a/cli/src/main/java/org/onosproject/cli/net/GlobalLabelPoolDestroyCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/GlobalLabelPoolDestroyCommand.java
@@ -15,15 +15,17 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.resource.label.LabelResourceAdminService;
+@Service
@Command(scope = "onos", name = "global-label-pool-destroy",
description = "Destroys global label resource pool")
public class GlobalLabelPoolDestroyCommand extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
LabelResourceAdminService lrs = get(LabelResourceAdminService.class);
lrs.destroyGlobalPool();
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/GlobalLabelReleaseCommand.java b/cli/src/main/java/org/onosproject/cli/net/GlobalLabelReleaseCommand.java
index 169833b..edd4dfb 100644
--- a/cli/src/main/java/org/onosproject/cli/net/GlobalLabelReleaseCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/GlobalLabelReleaseCommand.java
@@ -18,12 +18,14 @@
import java.util.HashSet;
import java.util.Set;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.resource.label.LabelResourceId;
import org.onosproject.incubator.net.resource.label.LabelResourceService;
+@Service
@Command(scope = "onos", name = "global-label-release",
description = "Releases labels to global label resource pool.")
public class GlobalLabelReleaseCommand extends AbstractShellCommand {
@@ -33,7 +35,7 @@
String releaseLabelIds = null;
@Override
- protected void execute() {
+ protected void doExecute() {
LabelResourceService lrs = get(LabelResourceService.class);
Set<LabelResourceId> release = new HashSet<LabelResourceId>();
String[] labelIds = releaseLabelIds.split(",");
diff --git a/cli/src/main/java/org/onosproject/cli/net/GroupsListCommand.java b/cli/src/main/java/org/onosproject/cli/net/GroupsListCommand.java
index 48c2e1f..bd61d03 100644
--- a/cli/src/main/java/org/onosproject/cli/net/GroupsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/GroupsListCommand.java
@@ -18,9 +18,10 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.google.common.collect.Lists;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
@@ -44,6 +45,7 @@
/**
* Lists all groups in the system.
*/
+@Service
@Command(scope = "onos", name = "groups",
description = "Lists all groups in the system")
public class GroupsListCommand extends AbstractShellCommand {
@@ -90,7 +92,7 @@
}
@Override
- protected void execute() {
+ protected void doExecute() {
DeviceService deviceService = get(DeviceService.class);
GroupService groupService = get(GroupService.class);
SortedMap<Device, List<Group>> sortedGroups =
diff --git a/cli/src/main/java/org/onosproject/cli/net/HostIdCompleter.java b/cli/src/main/java/org/onosproject/cli/net/HostIdCompleter.java
index 2ee7dca..2efdec3 100644
--- a/cli/src/main/java/org/onosproject/cli/net/HostIdCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/HostIdCompleter.java
@@ -19,8 +19,11 @@
import java.util.List;
import java.util.SortedSet;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.Host;
import org.onosproject.net.host.HostService;
@@ -28,10 +31,11 @@
/**
* Host ID completer.
*/
+@Service
public class HostIdCompleter implements Completer {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
@@ -43,7 +47,7 @@
}
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/HostRemoveCommand.java b/cli/src/main/java/org/onosproject/cli/net/HostRemoveCommand.java
index cba5111..0c83520 100644
--- a/cli/src/main/java/org/onosproject/cli/net/HostRemoveCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/HostRemoveCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.HostId;
import org.onosproject.net.host.HostAdminService;
@@ -24,6 +25,7 @@
/**
* Removes an end-station host.
*/
+@Service
@Command(scope = "onos", name = "host-remove",
description = "Removes an end-station host")
public class HostRemoveCommand extends AbstractShellCommand {
@@ -33,7 +35,7 @@
String id = null;
@Override
- protected void execute() {
+ protected void doExecute() {
get(HostAdminService.class).removeHost(HostId.hostId(id));
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/HostsListCommand.java b/cli/src/main/java/org/onosproject/cli/net/HostsListCommand.java
index 683ab26..3a9f860 100644
--- a/cli/src/main/java/org/onosproject/cli/net/HostsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/HostsListCommand.java
@@ -18,8 +18,9 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.Host;
import org.onosproject.net.host.HostService;
@@ -33,6 +34,7 @@
/**
* Lists all currently-known hosts.
*/
+@Service
@Command(scope = "onos", name = "hosts",
description = "Lists all currently-known hosts.")
public class HostsListCommand extends AbstractShellCommand {
@@ -49,7 +51,7 @@
private boolean shortOnly = false;
@Override
- protected void execute() {
+ protected void doExecute() {
HostService service = get(HostService.class);
if (outputJson()) {
print("%s", json(getSortedHosts(service)));
diff --git a/cli/src/main/java/org/onosproject/cli/net/Icmp6CodeCompleter.java b/cli/src/main/java/org/onosproject/cli/net/Icmp6CodeCompleter.java
index eae82a2..b488d73 100644
--- a/cli/src/main/java/org/onosproject/cli/net/Icmp6CodeCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/Icmp6CodeCompleter.java
@@ -15,8 +15,11 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import java.util.List;
import java.util.SortedSet;
@@ -24,9 +27,10 @@
/**
* ICMPv6 type completer.
*/
+@Service
public class Icmp6CodeCompleter implements Completer {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
SortedSet<String> strings = delegate.getStrings();
@@ -36,7 +40,7 @@
}
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/Icmp6TypeCompleter.java b/cli/src/main/java/org/onosproject/cli/net/Icmp6TypeCompleter.java
index 7f18a4b..553f5be 100644
--- a/cli/src/main/java/org/onosproject/cli/net/Icmp6TypeCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/Icmp6TypeCompleter.java
@@ -15,8 +15,11 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import java.util.List;
import java.util.SortedSet;
@@ -24,9 +27,10 @@
/**
* ICMPv6 type completer.
*/
+@Service
public class Icmp6TypeCompleter implements Completer {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
SortedSet<String> strings = delegate.getStrings();
@@ -36,7 +40,7 @@
}
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/IntentCycleCommand.java b/cli/src/main/java/org/onosproject/cli/net/IntentCycleCommand.java
index fa764fb..96a12f5 100644
--- a/cli/src/main/java/org/onosproject/cli/net/IntentCycleCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/IntentCycleCommand.java
@@ -19,8 +19,9 @@
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.packet.Ethernet;
import org.onlab.packet.MacAddress;
import org.onosproject.cli.AbstractShellCommand;
@@ -49,6 +50,7 @@
/**
* Installs point-to-point connectivity intents.
*/
+@Service
@Command(scope = "onos", name = "cycle-intents",
description = "Installs random intents to test throughput")
public class IntentCycleCommand extends AbstractShellCommand
@@ -83,7 +85,7 @@
private boolean add;
@Override
- protected void execute() {
+ protected void doExecute() {
service = get(IntentService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/IntentDetailsCommand.java b/cli/src/main/java/org/onosproject/cli/net/IntentDetailsCommand.java
index 0445059..e80623b 100644
--- a/cli/src/main/java/org/onosproject/cli/net/IntentDetailsCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/IntentDetailsCommand.java
@@ -18,8 +18,9 @@
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onlab.util.Tools;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.Link;
@@ -32,6 +33,7 @@
/**
* Displays details about an Intent in the system.
*/
+@Service
@Command(scope = "onos", name = "intent-details",
description = "Displays intent details")
public class IntentDetailsCommand extends AbstractShellCommand {
@@ -44,7 +46,7 @@
@Override
- protected void execute() {
+ protected void doExecute() {
detailIntents(idsStr);
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/IntentKeyCompleter.java b/cli/src/main/java/org/onosproject/cli/net/IntentKeyCompleter.java
index 39c3e55..6d26d62 100644
--- a/cli/src/main/java/org/onosproject/cli/net/IntentKeyCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/IntentKeyCompleter.java
@@ -15,8 +15,11 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.intent.Intent;
import org.onosproject.net.intent.IntentService;
@@ -28,9 +31,10 @@
/**
* Intent Key completer.
*/
+@Service
public class IntentKeyCompleter implements Completer {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
@@ -43,7 +47,7 @@
}
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/IntentListCompilers.java b/cli/src/main/java/org/onosproject/cli/net/IntentListCompilers.java
index fd1c145..d920eec 100644
--- a/cli/src/main/java/org/onosproject/cli/net/IntentListCompilers.java
+++ b/cli/src/main/java/org/onosproject/cli/net/IntentListCompilers.java
@@ -15,7 +15,8 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.intent.IntentExtensionService;
@@ -24,12 +25,13 @@
/**
* Lists the inventory of intents and their states.
*/
+@Service
@Command(scope = "onos", name = "intent-compilers",
description = "Lists the mapping from intent type to compiler component")
public class IntentListCompilers extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
IntentExtensionService service = get(IntentExtensionService.class);
OptionalInt length = service.getCompilers().keySet().stream()
.mapToInt(s -> s.getName().length())
diff --git a/cli/src/main/java/org/onosproject/cli/net/IntentListInstallers.java b/cli/src/main/java/org/onosproject/cli/net/IntentListInstallers.java
index 44ee963..10e8270 100644
--- a/cli/src/main/java/org/onosproject/cli/net/IntentListInstallers.java
+++ b/cli/src/main/java/org/onosproject/cli/net/IntentListInstallers.java
@@ -15,7 +15,8 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.intent.IntentExtensionService;
@@ -24,11 +25,12 @@
/**
* Lists the installers of intents.
*/
+@Service
@Command(scope = "onos", name = "intent-installers",
description = "Lists the mapping from intent type to installer component")
public class IntentListInstallers extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
IntentExtensionService service = get(IntentExtensionService.class);
OptionalInt length = service.getInstallers().keySet().stream()
.mapToInt(s -> s.getName().length())
diff --git a/cli/src/main/java/org/onosproject/cli/net/IntentPurgeCommand.java b/cli/src/main/java/org/onosproject/cli/net/IntentPurgeCommand.java
index ec067b7..203be80 100644
--- a/cli/src/main/java/org/onosproject/cli/net/IntentPurgeCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/IntentPurgeCommand.java
@@ -15,7 +15,8 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.intent.Intent;
import org.onosproject.net.intent.IntentService;
@@ -25,11 +26,12 @@
/**
* Purges all WITHDRAWN intents.
*/
+@Service
@Command(scope = "onos", name = "purge-intents",
description = "Purges all WITHDRAWN intents")
public class IntentPurgeCommand extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
IntentService intentService = get(IntentService.class);
for (Intent intent: intentService.getIntents()) {
if (intentService.getIntentState(intent.key()) == WITHDRAWN) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/IntentPushTestCommand.java b/cli/src/main/java/org/onosproject/cli/net/IntentPushTestCommand.java
index 4fcb0c8..bca79353 100644
--- a/cli/src/main/java/org/onosproject/cli/net/IntentPushTestCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/IntentPushTestCommand.java
@@ -16,9 +16,10 @@
package org.onosproject.cli.net;
import com.google.common.collect.Lists;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onlab.packet.Ethernet;
import org.onlab.packet.MacAddress;
import org.onosproject.cli.AbstractShellCommand;
@@ -50,6 +51,7 @@
/**
* Installs bulk point-to-point connectivity intents between given ingress/egress devices.
*/
+@Service
@Command(scope = "onos", name = "push-test-intents",
description = "Installs random intents to test throughput")
public class IntentPushTestCommand extends AbstractShellCommand
@@ -95,7 +97,7 @@
List<Key> keysForWithdraw = new ArrayList<>();
@Override
- protected void execute() {
+ protected void doExecute() {
service = get(IntentService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/IntentRemoveCommand.java b/cli/src/main/java/org/onosproject/cli/net/IntentRemoveCommand.java
index cadae7e..b602dfe 100644
--- a/cli/src/main/java/org/onosproject/cli/net/IntentRemoveCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/IntentRemoveCommand.java
@@ -16,9 +16,10 @@
package org.onosproject.cli.net;
import com.google.common.collect.ImmutableList;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
@@ -45,6 +46,7 @@
/**
* Removes an intent.
*/
+@Service
@Command(scope = "onos", name = "remove-intent",
description = "Removes the specified intent")
public class IntentRemoveCommand extends AbstractShellCommand {
@@ -72,7 +74,7 @@
private static final EnumSet<IntentState> CAN_PURGE = EnumSet.of(WITHDRAWN, FAILED);
@Override
- protected void execute() {
+ protected void doExecute() {
IntentService intentService = get(IntentService.class);
removeIntent(intentService.getIntents(),
applicationIdString, keyString,
diff --git a/cli/src/main/java/org/onosproject/cli/net/IntentsDiagnosisCommand.java b/cli/src/main/java/org/onosproject/cli/net/IntentsDiagnosisCommand.java
index 1dc1d8d..22a20c3 100644
--- a/cli/src/main/java/org/onosproject/cli/net/IntentsDiagnosisCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/IntentsDiagnosisCommand.java
@@ -19,9 +19,10 @@
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.SetMultimap;
import com.google.common.collect.Streams;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.AnnotationKeys;
import org.onosproject.net.ConnectPoint;
@@ -56,6 +57,7 @@
import java.util.Set;
import java.util.stream.Stream;
+@Service
@Command(scope = "onos", name = "intents-diagnosis",
description = "Diagnosis intents")
public class IntentsDiagnosisCommand extends AbstractShellCommand {
@@ -77,7 +79,7 @@
private static final String FIELD_INTENTS_BY_LINK = "intentsByLink";
@Override
- protected void execute() {
+ protected void doExecute() {
print("intents-diagnosis");
ServiceRefs svcRefs = buildServiceRefs();
diff --git a/cli/src/main/java/org/onosproject/cli/net/IntentsListCommand.java b/cli/src/main/java/org/onosproject/cli/net/IntentsListCommand.java
index 20c8b34..0f0c448 100644
--- a/cli/src/main/java/org/onosproject/cli/net/IntentsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/IntentsListCommand.java
@@ -23,8 +23,9 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.apache.commons.lang.StringUtils;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onlab.util.StringFilter;
import org.onlab.util.Tools;
import org.onosproject.cli.AbstractShellCommand;
@@ -63,6 +64,7 @@
/**
* Lists the inventory of intents and their states.
*/
+@Service
@Command(scope = "onos", name = "intents",
description = "Lists the inventory of intents and their states")
public class IntentsListCommand extends AbstractShellCommand {
@@ -181,7 +183,7 @@
private WorkPartitionService workPartitionService;
@Override
- protected void execute() {
+ protected void doExecute() {
service = get(IntentService.class);
workPartitionService = get(WorkPartitionService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/InterfaceAddCommand.java b/cli/src/main/java/org/onosproject/cli/net/InterfaceAddCommand.java
index 32d8f2a..c6210c7 100644
--- a/cli/src/main/java/org/onosproject/cli/net/InterfaceAddCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/InterfaceAddCommand.java
@@ -17,9 +17,10 @@
package org.onosproject.cli.net;
import com.google.common.collect.Lists;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
import org.onosproject.cli.AbstractShellCommand;
@@ -33,6 +34,7 @@
/**
* Adds a new interface configuration.
*/
+@Service
@Command(scope = "onos", name = "interface-add",
description = "Adds a new configured interface")
public class InterfaceAddCommand extends AbstractShellCommand {
@@ -63,7 +65,7 @@
private String vlan = null;
@Override
- protected void execute() {
+ protected void doExecute() {
InterfaceAdminService interfaceService = get(InterfaceAdminService.class);
List<InterfaceIpAddress> ipAddresses = Lists.newArrayList();
diff --git a/cli/src/main/java/org/onosproject/cli/net/InterfaceRemoveCommand.java b/cli/src/main/java/org/onosproject/cli/net/InterfaceRemoveCommand.java
index c98bb20..7645f1d 100644
--- a/cli/src/main/java/org/onosproject/cli/net/InterfaceRemoveCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/InterfaceRemoveCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.intf.InterfaceAdminService;
import org.onosproject.net.ConnectPoint;
@@ -25,6 +26,7 @@
/**
* Removes an interface configuration.
*/
+@Service
@Command(scope = "onos", name = "interface-remove",
description = "Removes a configured interface")
public class InterfaceRemoveCommand extends AbstractShellCommand {
@@ -40,7 +42,7 @@
private String name = null;
@Override
- protected void execute() {
+ protected void doExecute() {
InterfaceAdminService interfaceService = get(InterfaceAdminService.class);
boolean success = interfaceService.remove(
diff --git a/cli/src/main/java/org/onosproject/cli/net/InterfacesListCommand.java b/cli/src/main/java/org/onosproject/cli/net/InterfacesListCommand.java
index deda244..34e7417 100644
--- a/cli/src/main/java/org/onosproject/cli/net/InterfacesListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/InterfacesListCommand.java
@@ -16,7 +16,8 @@
package org.onosproject.cli.net;
import com.google.common.collect.Lists;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
import org.onosproject.cli.AbstractShellCommand;
@@ -30,6 +31,7 @@
/**
* Lists all configured interfaces.
*/
+@Service
@Command(scope = "onos", name = "interfaces",
description = "Lists all configured interfaces.")
public class InterfacesListCommand extends AbstractShellCommand {
@@ -45,7 +47,7 @@
private static final String NO_NAME = "(unamed)";
@Override
- protected void execute() {
+ protected void doExecute() {
InterfaceService interfaceService = get(InterfaceService.class);
List<Interface> interfaces = Lists.newArrayList(interfaceService.getInterfaces());
diff --git a/cli/src/main/java/org/onosproject/cli/net/IpProtocolCompleter.java b/cli/src/main/java/org/onosproject/cli/net/IpProtocolCompleter.java
index 28e68e9..b7b471f 100644
--- a/cli/src/main/java/org/onosproject/cli/net/IpProtocolCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/IpProtocolCompleter.java
@@ -18,15 +18,19 @@
import java.util.List;
import java.util.SortedSet;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
/**
* IP protocol completer.
*/
+@Service
public class IpProtocolCompleter implements Completer {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
SortedSet<String> strings = delegate.getStrings();
@@ -36,7 +40,7 @@
}
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/LabelApplyCommand.java b/cli/src/main/java/org/onosproject/cli/net/LabelApplyCommand.java
index 290f4a8..739e129 100644
--- a/cli/src/main/java/org/onosproject/cli/net/LabelApplyCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/LabelApplyCommand.java
@@ -18,14 +18,16 @@
import java.util.Collection;
import java.util.Iterator;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
import org.onosproject.incubator.net.resource.label.DefaultLabelResource;
import org.onosproject.incubator.net.resource.label.LabelResource;
import org.onosproject.incubator.net.resource.label.LabelResourceService;
+@Service
@Command(scope = "onos", name = "label-apply",
description = "Apply label resource from device pool by specific device id")
public class LabelApplyCommand extends AbstractShellCommand {
@@ -41,7 +43,7 @@
private static final String FMT = "deviceid=%s, labelresourceid=%s";
@Override
- protected void execute() {
+ protected void doExecute() {
LabelResourceService lrs = get(LabelResourceService.class);
Collection<LabelResource> result = lrs.applyFromDevicePool(DeviceId
.deviceId(deviceId), Long.parseLong(applyNum));
diff --git a/cli/src/main/java/org/onosproject/cli/net/LabelPoolCreateCommand.java b/cli/src/main/java/org/onosproject/cli/net/LabelPoolCreateCommand.java
index 9feee57..3b27b95 100644
--- a/cli/src/main/java/org/onosproject/cli/net/LabelPoolCreateCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/LabelPoolCreateCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
import org.onosproject.incubator.net.resource.label.LabelResourceAdminService;
@@ -25,6 +26,7 @@
/**
* create label resource pool by specific device id.
*/
+@Service
@Command(scope = "onos", name = "label-pool-create",
description = "Creates label resource pool by a specific device id")
public class LabelPoolCreateCommand extends AbstractShellCommand {
@@ -38,7 +40,7 @@
String endLabel = null;
@Override
- protected void execute() {
+ protected void doExecute() {
LabelResourceAdminService lrs = get(LabelResourceAdminService.class);
lrs.createDevicePool(DeviceId.deviceId(deviceId), LabelResourceId
.labelResourceId(Long.parseLong(beginLabel)), LabelResourceId
diff --git a/cli/src/main/java/org/onosproject/cli/net/LabelPoolDestroyCommand.java b/cli/src/main/java/org/onosproject/cli/net/LabelPoolDestroyCommand.java
index 2bd9418..74aa26d 100644
--- a/cli/src/main/java/org/onosproject/cli/net/LabelPoolDestroyCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/LabelPoolDestroyCommand.java
@@ -15,12 +15,14 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
import org.onosproject.incubator.net.resource.label.LabelResourceAdminService;
+@Service
@Command(scope = "onos", name = "label-pool-destroy",
description = "Destroys label resource pool by a specific device id")
public class LabelPoolDestroyCommand extends AbstractShellCommand {
@@ -28,7 +30,7 @@
String deviceId = null;
@Override
- protected void execute() {
+ protected void doExecute() {
LabelResourceAdminService lrs = get(LabelResourceAdminService.class);
lrs.destroyDevicePool(DeviceId.deviceId(deviceId));
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/LabelReleaseCommand.java b/cli/src/main/java/org/onosproject/cli/net/LabelReleaseCommand.java
index df84f3f..a4e89c0 100644
--- a/cli/src/main/java/org/onosproject/cli/net/LabelReleaseCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/LabelReleaseCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
import org.onosproject.incubator.net.resource.label.DefaultLabelResource;
@@ -27,6 +28,7 @@
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
+@Service
@Command(scope = "onos", name = "label-release",
description = "Releases label ids to label resource pool by a specific device id")
public class LabelReleaseCommand extends AbstractShellCommand {
@@ -40,7 +42,7 @@
String releaseLabelIds = null;
@Override
- protected void execute() {
+ protected void doExecute() {
LabelResourceService lrs = get(LabelResourceService.class);
Multimap<DeviceId, LabelResource> map = ArrayListMultimap
.create();
diff --git a/cli/src/main/java/org/onosproject/cli/net/LabelResourceCommand.java b/cli/src/main/java/org/onosproject/cli/net/LabelResourceCommand.java
index f381085..1221f23 100644
--- a/cli/src/main/java/org/onosproject/cli/net/LabelResourceCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/LabelResourceCommand.java
@@ -15,13 +15,15 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
import org.onosproject.incubator.net.resource.label.LabelResourcePool;
import org.onosproject.incubator.net.resource.label.LabelResourceService;
+@Service
@Command(scope = "onos", name = "label-pool",
description = "Gets label resource pool information by a specific device id")
public class LabelResourceCommand extends AbstractShellCommand {
@@ -33,7 +35,7 @@
+ "releaseLabelIds=%s";
@Override
- protected void execute() {
+ protected void doExecute() {
LabelResourceService lrs = get(LabelResourceService.class);
LabelResourcePool pool = lrs.getDeviceLabelResourcePool(DeviceId
.deviceId(deviceId));
diff --git a/cli/src/main/java/org/onosproject/cli/net/LayoutAddCommand.java b/cli/src/main/java/org/onosproject/cli/net/LayoutAddCommand.java
index f4d6a94..95ddba8 100644
--- a/cli/src/main/java/org/onosproject/cli/net/LayoutAddCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/LayoutAddCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.region.Region;
import org.onosproject.net.region.RegionService;
@@ -41,6 +42,7 @@
* layout-add root @bayareaGEO . . 1.2 0.0 -4.0
* </pre>
*/
+@Service
@Command(scope = "onos", name = "layout-add",
description = "Adds a new UI layout.")
public class LayoutAddCommand extends AbstractShellCommand {
@@ -86,7 +88,7 @@
private RegionService regionService;
@Override
- protected void execute() {
+ protected void doExecute() {
UiTopoLayoutService service = get(UiTopoLayoutService.class);
RegionService regionService = get(RegionService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/LayoutListCommand.java b/cli/src/main/java/org/onosproject/cli/net/LayoutListCommand.java
index 358a9ef..cf7300d 100644
--- a/cli/src/main/java/org/onosproject/cli/net/LayoutListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/LayoutListCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.ui.UiTopoLayoutService;
import org.onosproject.ui.model.topo.UiTopoLayout;
@@ -32,6 +33,7 @@
/**
* List layout details.
*/
+@Service
@Command(scope = "onos", name = "layouts",
description = "List layout details")
public class LayoutListCommand extends AbstractShellCommand {
@@ -45,7 +47,7 @@
private UiTopoLayoutService layoutService;
@Override
- protected void execute() {
+ protected void doExecute() {
layoutService = get(UiTopoLayoutService.class);
if (id == null) {
for (UiTopoLayout layout : getSortedLayouts(layoutService)) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/LeaderCommand.java b/cli/src/main/java/org/onosproject/cli/net/LeaderCommand.java
index 51601d2..7139b86 100644
--- a/cli/src/main/java/org/onosproject/cli/net/LeaderCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/LeaderCommand.java
@@ -18,9 +18,10 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onlab.util.Tools;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.cluster.Leadership;
@@ -35,6 +36,7 @@
/**
* Prints the leader for every topic.
*/
+@Service
@Command(scope = "onos", name = "leaders",
description = "Finds the leader for particular topic.")
public class LeaderCommand extends AbstractShellCommand {
@@ -134,7 +136,7 @@
}
@Override
- protected void execute() {
+ protected void doExecute() {
LeadershipAdminService leaderService = get(LeadershipAdminService.class);
Map<String, Leadership> leaderBoard = leaderService.getLeaderBoard();
if (topicPattern == null) {
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 d4234f6..df7ca10 100644
--- a/cli/src/main/java/org/onosproject/cli/net/LinkDstCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/LinkDstCompleter.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.console.completer.ArgumentCompleter;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.onosproject.cli.AbstractCompleter;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.ConnectPoint;
@@ -30,7 +31,7 @@
*/
public class LinkDstCompleter extends AbstractCompleter {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
@@ -38,8 +39,7 @@
LinkService service = AbstractShellCommand.get(LinkService.class);
// Link source the previous argument.
- ArgumentCompleter.ArgumentList list = getArgumentList();
- String srcArg = list.getArguments()[list.getCursorArgumentIndex() - 1];
+ String srcArg = commandLine.getArguments()[commandLine.getCursorArgumentIndex() - 1];
// Generate the device ID/port number identifiers
SortedSet<String> strings = delegate.getStrings();
@@ -53,7 +53,7 @@
}
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, 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 8a04832..38842ba 100644
--- a/cli/src/main/java/org/onosproject/cli/net/LinkSrcCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/LinkSrcCompleter.java
@@ -15,7 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.onosproject.cli.AbstractCompleter;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.link.LinkService;
@@ -28,7 +30,7 @@
*/
public class LinkSrcCompleter extends AbstractCompleter {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
@@ -42,7 +44,7 @@
"/" + link.src().port()));
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/LinksListCommand.java b/cli/src/main/java/org/onosproject/cli/net/LinksListCommand.java
index 47e72a2..b7c8ef7 100644
--- a/cli/src/main/java/org/onosproject/cli/net/LinksListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/LinksListCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.util.Tools;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.Link;
@@ -34,6 +35,7 @@
/**
* Lists all infrastructure links.
*/
+@Service
@Command(scope = "onos", name = "links",
description = "Lists all infrastructure links")
public class LinksListCommand extends AbstractShellCommand {
@@ -46,7 +48,7 @@
String uri = null;
@Override
- protected void execute() {
+ protected void doExecute() {
LinkService service = get(LinkService.class);
Iterable<Link> links = uri != null ?
service.getDeviceLinks(deviceId(uri)) : service.getLinks();
diff --git a/cli/src/main/java/org/onosproject/cli/net/MapsListCommand.java b/cli/src/main/java/org/onosproject/cli/net/MapsListCommand.java
index 4e31fcd..1025208 100644
--- a/cli/src/main/java/org/onosproject/cli/net/MapsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/MapsListCommand.java
@@ -17,7 +17,8 @@
import java.util.List;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.store.service.MapInfo;
import org.onosproject.store.service.StorageAdminService;
@@ -30,6 +31,7 @@
/**
* Command to list the various maps in the system.
*/
+@Service
@Command(scope = "onos", name = "maps",
description = "Lists information about consistent maps in the system")
public class MapsListCommand extends AbstractShellCommand {
@@ -71,7 +73,7 @@
}
@Override
- protected void execute() {
+ protected void doExecute() {
StorageAdminService storageAdminService = get(StorageAdminService.class);
List<MapInfo> mapInfo = storageAdminService.getMapInfo();
if (outputJson()) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/McastDeleteCommand.java b/cli/src/main/java/org/onosproject/cli/net/McastDeleteCommand.java
index 26dbfde..270db57 100644
--- a/cli/src/main/java/org/onosproject/cli/net/McastDeleteCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/McastDeleteCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.packet.IpAddress;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.ConnectPoint;
@@ -26,6 +27,7 @@
/**
* Deletes a multicast route.
*/
+@Service
@Command(scope = "onos", name = "mcast-delete",
description = "Delete a multicast route flow")
public class McastDeleteCommand extends AbstractShellCommand {
@@ -55,7 +57,7 @@
@Override
- protected void execute() {
+ protected void doExecute() {
MulticastRouteService mcastRouteManager = get(MulticastRouteService.class);
if ("*".equals(sAddr) && "*".equals(gAddr)) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/McastJoinCommand.java b/cli/src/main/java/org/onosproject/cli/net/McastJoinCommand.java
index 83969a8..1c32d42 100644
--- a/cli/src/main/java/org/onosproject/cli/net/McastJoinCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/McastJoinCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.packet.IpAddress;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.ConnectPoint;
@@ -26,6 +27,7 @@
/**
* Installs a source, multicast group flow.
*/
+@Service
@Command(scope = "onos", name = "mcast-join",
description = "Installs a source, multicast group flow")
public class McastJoinCommand extends AbstractShellCommand {
@@ -55,7 +57,7 @@
String[] ports = null;
@Override
- protected void execute() {
+ protected void doExecute() {
MulticastRouteService mcastRouteManager = get(MulticastRouteService.class);
McastRoute mRoute = new McastRoute(IpAddress.valueOf(sAddr),
diff --git a/cli/src/main/java/org/onosproject/cli/net/McastRoutesListCommand.java b/cli/src/main/java/org/onosproject/cli/net/McastRoutesListCommand.java
index 003e53c..146729a 100644
--- a/cli/src/main/java/org/onosproject/cli/net/McastRoutesListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/McastRoutesListCommand.java
@@ -15,7 +15,8 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.mcast.McastRoute;
@@ -28,6 +29,7 @@
/**
* Displays the source, multicast group flows entries.
*/
+@Service
@Command(scope = "onos", name = "mcast-routes",
description = "Lists routes in the mcast route store")
public class McastRoutesListCommand extends AbstractShellCommand {
@@ -48,7 +50,7 @@
private static final String SINKS = "Sinks";
@Override
- protected void execute() {
+ protected void doExecute() {
// Get the service
MulticastRouteService mcastService = get(MulticastRouteService.class);
// Get the routes
diff --git a/cli/src/main/java/org/onosproject/cli/net/McastShowCommand.java b/cli/src/main/java/org/onosproject/cli/net/McastShowCommand.java
index 91ab0c4..ff9e2e6 100644
--- a/cli/src/main/java/org/onosproject/cli/net/McastShowCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/McastShowCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.packet.IpAddress;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.ConnectPoint;
@@ -32,6 +33,7 @@
/**
* Displays the source, multicast group flows entries.
*/
+@Service
@Command(scope = "onos", name = "mcast-show", description = "Displays the source, multicast group flows")
public class McastShowCommand extends AbstractShellCommand {
@@ -43,7 +45,7 @@
String mcastIp;
@Override
- protected void execute() {
+ protected void doExecute() {
// Get the service
MulticastRouteService mcastService = get(MulticastRouteService.class);
// Get the routes
diff --git a/cli/src/main/java/org/onosproject/cli/net/MeterAddCommand.java b/cli/src/main/java/org/onosproject/cli/net/MeterAddCommand.java
index 0b23f88..a892b17 100644
--- a/cli/src/main/java/org/onosproject/cli/net/MeterAddCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/MeterAddCommand.java
@@ -15,9 +15,10 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.core.CoreService;
import org.onosproject.net.DeviceId;
@@ -36,6 +37,7 @@
/**
* Add a meter to a device.
*/
+@Service
@Command(scope = "onos", name = "meter-add",
description = "Adds a meter to a device (currently for testing)")
public class MeterAddCommand extends AbstractShellCommand {
@@ -139,7 +141,7 @@
}
@Override
- protected void execute() {
+ protected void doExecute() {
MeterService service = get(MeterService.class);
CoreService coreService = get(CoreService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/MeterRemoveCommand.java b/cli/src/main/java/org/onosproject/cli/net/MeterRemoveCommand.java
index 7814476..9c08a86 100644
--- a/cli/src/main/java/org/onosproject/cli/net/MeterRemoveCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/MeterRemoveCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.core.CoreService;
import org.onosproject.net.DeviceId;
@@ -33,6 +34,7 @@
/**
* Remove existing meter from device.
*/
+@Service
@Command(scope = "onos", name = "meter-remove",
description = "Removes a meter from a device (currently for testing)")
public class MeterRemoveCommand extends AbstractShellCommand {
@@ -48,7 +50,7 @@
private final String appId = "org.onosproject.cli.meterCmd";
@Override
- protected void execute() {
+ protected void doExecute() {
MeterService service = get(MeterService.class);
CoreService coreService = get(CoreService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/MetersListCommand.java b/cli/src/main/java/org/onosproject/cli/net/MetersListCommand.java
index 72dca0d..354ccbc 100644
--- a/cli/src/main/java/org/onosproject/cli/net/MetersListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/MetersListCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net;
import com.google.common.collect.Collections2;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
import org.onosproject.net.meter.Meter;
@@ -31,6 +32,7 @@
/**
* Lists all meters.
*/
+@Service
@Command(scope = "onos", name = "meters",
description = "Shows meters")
public class MetersListCommand extends AbstractShellCommand {
@@ -46,7 +48,7 @@
MeterId meterId = null;
@Override
- protected void execute() {
+ protected void doExecute() {
if (!isNullOrEmpty(meterstr)) {
meterId = MeterId.meterId(Long.parseLong(meterstr));
diff --git a/cli/src/main/java/org/onosproject/cli/net/NeighbourHandlersListCommand.java b/cli/src/main/java/org/onosproject/cli/net/NeighbourHandlersListCommand.java
index 8ba768b..924400a 100644
--- a/cli/src/main/java/org/onosproject/cli/net/NeighbourHandlersListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/NeighbourHandlersListCommand.java
@@ -16,7 +16,8 @@
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.intf.Interface;
import org.onosproject.net.neighbour.NeighbourResolutionService;
@@ -24,6 +25,7 @@
/**
* Lists neighbour message handlers.
*/
+@Service
@Command(scope = "onos", name = "neighbour-handlers",
description = "Lists neighbour message handlers")
public class NeighbourHandlersListCommand extends AbstractShellCommand {
@@ -31,7 +33,7 @@
private static final String FORMAT = "%20s: interface=%s, class=%s";
@Override
- protected void execute() {
+ protected void doExecute() {
NeighbourResolutionService service = get(NeighbourResolutionService.class);
service.getHandlerRegistrations().forEach((cp, list) -> {
diff --git a/cli/src/main/java/org/onosproject/cli/net/PacketProcessorsListCommand.java b/cli/src/main/java/org/onosproject/cli/net/PacketProcessorsListCommand.java
index ffc9be2..28a01f7 100644
--- a/cli/src/main/java/org/onosproject/cli/net/PacketProcessorsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/PacketProcessorsListCommand.java
@@ -18,7 +18,8 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.packet.PacketProcessorEntry;
import org.onosproject.net.packet.PacketService;
@@ -31,6 +32,7 @@
/**
* Lists packet processors.
*/
+@Service
@Command(scope = "onos", name = "packet-processors",
description = "Lists packet processors")
public class PacketProcessorsListCommand extends AbstractShellCommand {
@@ -38,7 +40,7 @@
private static final String FMT = "priority=%s, class=%s, packets=%d, avgNanos=%d";
@Override
- protected void execute() {
+ protected void doExecute() {
PacketService service = get(PacketService.class);
if (outputJson()) {
print("%s", json(service.getProcessors()));
diff --git a/cli/src/main/java/org/onosproject/cli/net/PacketRequestsListCommand.java b/cli/src/main/java/org/onosproject/cli/net/PacketRequestsListCommand.java
index f3bfc61..ecc2dc1 100644
--- a/cli/src/main/java/org/onosproject/cli/net/PacketRequestsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/PacketRequestsListCommand.java
@@ -18,7 +18,8 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.packet.PacketRequest;
import org.onosproject.net.packet.PacketService;
@@ -28,6 +29,7 @@
/**
* Lists packet requests.
*/
+@Service
@Command(scope = "onos", name = "packet-requests",
description = "Lists packet requests")
public class PacketRequestsListCommand extends AbstractShellCommand {
@@ -35,7 +37,7 @@
private static final String FMT = "nodeId=%s appId=%s, priority=%s, criteria=%s, deviceId=%s";
@Override
- protected void execute() {
+ protected void doExecute() {
PacketService service = get(PacketService.class);
if (outputJson()) {
print("%s", json(service.getRequests()));
diff --git a/cli/src/main/java/org/onosproject/cli/net/PartitionsListCommand.java b/cli/src/main/java/org/onosproject/cli/net/PartitionsListCommand.java
index c9df46a..f38c78e 100644
--- a/cli/src/main/java/org/onosproject/cli/net/PartitionsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/PartitionsListCommand.java
@@ -17,8 +17,9 @@
import java.util.List;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.cluster.ClusterService;
import org.onosproject.cluster.ControllerNode;
@@ -37,6 +38,7 @@
/**
* Command to list the database partitions in the system.
*/
+@Service
@Command(scope = "onos", name = "partitions",
description = "Lists information about partitions in the system")
public class PartitionsListCommand extends AbstractShellCommand {
@@ -172,7 +174,7 @@
}
@Override
- protected void execute() {
+ protected void doExecute() {
StorageAdminService storageAdminService = get(StorageAdminService.class);
if (reportClientInfo) {
PartitionAdminService partitionAdminService = get(PartitionAdminService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/PathListCommand.java b/cli/src/main/java/org/onosproject/cli/net/PathListCommand.java
index 0ee9214..78d5c46 100644
--- a/cli/src/main/java/org/onosproject/cli/net/PathListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/PathListCommand.java
@@ -18,9 +18,10 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
import org.onosproject.net.DisjointPath;
@@ -37,6 +38,7 @@
* Lists all shortest-paths paths between the specified source and
* destination devices.
*/
+@Service
@Command(scope = "onos", name = "paths",
description = "Lists all shortest-paths paths between the specified source and destination devices")
public class PathListCommand extends TopologyCommand {
@@ -55,7 +57,7 @@
boolean disjoint = false;
@Override
- protected void execute() {
+ protected void doExecute() {
init();
DeviceService deviceService = get(DeviceService.class);
DeviceId srcDid = deviceId(src);
diff --git a/cli/src/main/java/org/onosproject/cli/net/PortNumberCompleter.java b/cli/src/main/java/org/onosproject/cli/net/PortNumberCompleter.java
index f0a5eec..ff38857 100644
--- a/cli/src/main/java/org/onosproject/cli/net/PortNumberCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/PortNumberCompleter.java
@@ -22,7 +22,6 @@
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
-import org.apache.karaf.shell.console.completer.ArgumentCompleter.ArgumentList;
import org.onosproject.cli.AbstractChoicesCompleter;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
@@ -42,11 +41,10 @@
* @return DeviceId found or null if not found
*/
protected DeviceId lookForDeviceId() {
- ArgumentList args = getArgumentList();
//parse argument list for deviceId
DeviceService deviceService = getService(DeviceService.class);
Device dev = null;
- for (String str : args.getArguments()) {
+ for (String str : commandLine.getArguments()) {
if (str.contains(":")) {
dev = deviceService.getDevice(DeviceId.deviceId(str));
if (dev != null) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/PortQueryVlansCommand.java b/cli/src/main/java/org/onosproject/cli/net/PortQueryVlansCommand.java
index 939f14a..75878f7 100644
--- a/cli/src/main/java/org/onosproject/cli/net/PortQueryVlansCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/PortQueryVlansCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.packet.VlanId;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.ConnectPoint;
@@ -36,6 +37,7 @@
/**
* Command to show the list of unused vlan-ids.
*/
+@Service
@Command(scope = "onos", name = "port-query-vlans",
description = "Lists all unused VLAN-IDs on port")
public class PortQueryVlansCommand extends AbstractShellCommand {
@@ -53,7 +55,7 @@
@Override
- protected void execute() {
+ protected void doExecute() {
DeviceService service = get(DeviceService.class);
for (String portStr : ports) {
ConnectPoint connectPoint = ConnectPoint.deviceConnectPoint(portStr);
diff --git a/cli/src/main/java/org/onosproject/cli/net/QueuesListCommand.java b/cli/src/main/java/org/onosproject/cli/net/QueuesListCommand.java
index aa7d088..612fb9e 100644
--- a/cli/src/main/java/org/onosproject/cli/net/QueuesListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/QueuesListCommand.java
@@ -17,7 +17,8 @@
import java.util.Map;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.store.service.StorageAdminService;
import org.onosproject.store.service.WorkQueueStats;
@@ -28,6 +29,7 @@
/**
* Command to list stats for all work queues in the system.
*/
+@Service
@Command(scope = "onos", name = "queues",
description = "Lists information about work queues in the system")
public class QueuesListCommand extends AbstractShellCommand {
@@ -35,7 +37,7 @@
private static final String FMT = "name=%s pending=%d inProgress=%d, completed=%d";
@Override
- protected void execute() {
+ protected void doExecute() {
StorageAdminService storageAdminService = get(StorageAdminService.class);
Map<String, WorkQueueStats> queueStats = storageAdminService.getQueueStats();
if (outputJson()) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/RandomIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/RandomIntentCommand.java
index b31f22d..5d3a277 100644
--- a/cli/src/main/java/org/onosproject/cli/net/RandomIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/RandomIntentCommand.java
@@ -19,8 +19,9 @@
import java.util.Collections;
import java.util.List;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
@@ -35,6 +36,7 @@
/**
* Installs bulk host-to-host intents between hosts of the network.
*/
+@Service
@Command(scope = "onos", name = "push-random-intents",
description = "It installs random intents to test throughput. The " +
"maximum number of intents is determined by the number of " +
@@ -57,7 +59,7 @@
private int count;
@Override
- protected void execute() {
+ protected void doExecute() {
service = get(IntentService.class);
hostService = get(HostService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/RegionAddCommand.java b/cli/src/main/java/org/onosproject/cli/net/RegionAddCommand.java
index 9a10473..5901241 100644
--- a/cli/src/main/java/org/onosproject/cli/net/RegionAddCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/RegionAddCommand.java
@@ -19,8 +19,9 @@
import com.google.common.collect.HashBiMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.cluster.NodeId;
import org.onosproject.net.config.NetworkConfigService;
@@ -35,6 +36,7 @@
/**
* Add a new region.
*/
+@Service
@Command(scope = "onos", name = "region-add",
description = "Adds a new region.")
public class RegionAddCommand extends AbstractShellCommand {
@@ -86,7 +88,7 @@
List<String> masterArgs = null;
@Override
- protected void execute() {
+ protected void doExecute() {
RegionAdminService service = get(RegionAdminService.class);
RegionId regionId = RegionId.regionId(id);
diff --git a/cli/src/main/java/org/onosproject/cli/net/RegionAddDevicesCommand.java b/cli/src/main/java/org/onosproject/cli/net/RegionAddDevicesCommand.java
index 7abb2e9..2ed04f8 100644
--- a/cli/src/main/java/org/onosproject/cli/net/RegionAddDevicesCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/RegionAddDevicesCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
import org.onosproject.net.region.RegionAdminService;
@@ -28,6 +29,7 @@
/**
* Add a set of devices into existing region.
*/
+@Service
@Command(scope = "onos", name = "region-add-devices",
description = "Adds a set of devices into the region.")
public class RegionAddDevicesCommand extends AbstractShellCommand {
@@ -41,7 +43,7 @@
List<String> devIds = null;
@Override
- protected void execute() {
+ protected void doExecute() {
RegionAdminService service = get(RegionAdminService.class);
RegionId regionId = RegionId.regionId(id);
diff --git a/cli/src/main/java/org/onosproject/cli/net/RegionAddPeerLocCommand.java b/cli/src/main/java/org/onosproject/cli/net/RegionAddPeerLocCommand.java
index 3c503c9..146fdda 100644
--- a/cli/src/main/java/org/onosproject/cli/net/RegionAddPeerLocCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/RegionAddPeerLocCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.config.NetworkConfigService;
import org.onosproject.net.config.basics.BasicRegionConfig;
@@ -38,6 +39,7 @@
* at grid-Y 100 and grid-X 200.
*
*/
+@Service
@Command(scope = "onos", name = "region-add-peer-loc",
description = "Adds a peer location annotation to a region.")
public class RegionAddPeerLocCommand extends AbstractShellCommand {
@@ -68,7 +70,7 @@
String locType = GEO;
@Override
- protected void execute() {
+ protected void doExecute() {
RegionId regionId = RegionId.regionId(id);
NetworkConfigService cfgService = get(NetworkConfigService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/RegionListCommand.java b/cli/src/main/java/org/onosproject/cli/net/RegionListCommand.java
index e033ba9..e959d3e 100644
--- a/cli/src/main/java/org/onosproject/cli/net/RegionListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/RegionListCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.utils.Comparators;
import org.onosproject.net.region.Region;
@@ -31,6 +32,7 @@
/**
* List Region details including membership.
*/
+@Service
@Command(scope = "onos", name = "regions",
description = "List Region details including membership")
public class RegionListCommand extends AbstractShellCommand {
@@ -45,7 +47,7 @@
private RegionService regionService;
@Override
- protected void execute() {
+ protected void doExecute() {
regionService = get(RegionService.class);
if (id == null) {
for (Region region : getSortedRegions(regionService)) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/RegionRemoveCommand.java b/cli/src/main/java/org/onosproject/cli/net/RegionRemoveCommand.java
index 20c9dec..83956b5 100644
--- a/cli/src/main/java/org/onosproject/cli/net/RegionRemoveCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/RegionRemoveCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.region.RegionAdminService;
import org.onosproject.net.region.RegionId;
@@ -24,6 +25,7 @@
/**
* Removes a region from the existing region list.
*/
+@Service
@Command(scope = "onos", name = "region-remove",
description = "Removes an existing region.")
public class RegionRemoveCommand extends AbstractShellCommand {
@@ -33,7 +35,7 @@
String id = null;
@Override
- protected void execute() {
+ protected void doExecute() {
RegionAdminService service = get(RegionAdminService.class);
RegionId regionId = RegionId.regionId(id);
diff --git a/cli/src/main/java/org/onosproject/cli/net/RegionRemoveDevicesCommand.java b/cli/src/main/java/org/onosproject/cli/net/RegionRemoveDevicesCommand.java
index 3d16612..aac1023 100644
--- a/cli/src/main/java/org/onosproject/cli/net/RegionRemoveDevicesCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/RegionRemoveDevicesCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
import org.onosproject.net.region.RegionAdminService;
@@ -28,6 +29,7 @@
/**
* Remove a set of devices from existing region.
*/
+@Service
@Command(scope = "onos", name = "region-remove-devices",
description = "Removes a set of devices from the region.")
public class RegionRemoveDevicesCommand extends AbstractShellCommand {
@@ -41,7 +43,7 @@
List<String> devIds = null;
@Override
- protected void execute() {
+ protected void doExecute() {
RegionAdminService service = get(RegionAdminService.class);
RegionId regionId = RegionId.regionId(id);
diff --git a/cli/src/main/java/org/onosproject/cli/net/RegionUpdateCommand.java b/cli/src/main/java/org/onosproject/cli/net/RegionUpdateCommand.java
index a31bbbb..3b164d4 100644
--- a/cli/src/main/java/org/onosproject/cli/net/RegionUpdateCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/RegionUpdateCommand.java
@@ -19,8 +19,9 @@
import com.google.common.collect.HashBiMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.cluster.NodeId;
import org.onosproject.net.region.Region;
@@ -34,6 +35,7 @@
/**
* Update an existing region.
*/
+@Service
@Command(scope = "onos", name = "region-update",
description = "Updates an existing region.")
public class RegionUpdateCommand extends AbstractShellCommand {
@@ -65,7 +67,7 @@
List<String> masterArgs = null;
@Override
- protected void execute() {
+ protected void doExecute() {
RegionService regionService = get(RegionService.class);
RegionAdminService regionAdminService = get(RegionAdminService.class);
RegionId regionId = RegionId.regionId(id);
diff --git a/cli/src/main/java/org/onosproject/cli/net/ResourcesCommand.java b/cli/src/main/java/org/onosproject/cli/net/ResourcesCommand.java
index 1e24cb9..9d57f66 100644
--- a/cli/src/main/java/org/onosproject/cli/net/ResourcesCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/ResourcesCommand.java
@@ -25,9 +25,10 @@
import java.util.Collections;
import com.google.common.collect.Iterables;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onlab.packet.MplsLabel;
import org.onlab.packet.VlanId;
import org.onosproject.cli.AbstractShellCommand;
@@ -52,6 +53,7 @@
/**
* Lists registered resources.
*/
+@Service
@Command(scope = "onos", name = "resources",
description = "Lists registered resources")
public class ResourcesCommand extends AbstractShellCommand {
@@ -83,7 +85,7 @@
private ResourceQueryService resourceService;
@Override
- protected void execute() {
+ protected void doExecute() {
resourceService = get(ResourceQueryService.class);
if (typeStrings != null) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/RoleCompleter.java b/cli/src/main/java/org/onosproject/cli/net/RoleCompleter.java
index 6fa1394..77fad80 100644
--- a/cli/src/main/java/org/onosproject/cli/net/RoleCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/RoleCompleter.java
@@ -15,8 +15,11 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.onosproject.net.MastershipRole;
import java.util.List;
@@ -25,9 +28,10 @@
/**
* Device mastership role completer.
*/
+@Service
public class RoleCompleter implements Completer {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
SortedSet<String> strings = delegate.getStrings();
@@ -36,7 +40,7 @@
strings.add(MastershipRole.NONE.toString().toLowerCase());
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/TableStatisticsCommand.java b/cli/src/main/java/org/onosproject/cli/net/TableStatisticsCommand.java
index aedbaee..9d3ec69 100644
--- a/cli/src/main/java/org/onosproject/cli/net/TableStatisticsCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/TableStatisticsCommand.java
@@ -23,9 +23,10 @@
import java.util.SortedMap;
import java.util.TreeMap;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.utils.Comparators;
import org.onosproject.net.Device;
@@ -42,6 +43,7 @@
/**
* Lists port statistic of all ports in the system.
*/
+@Service
@Command(scope = "onos", name = "tablestats",
description = "Lists statistics of all tables in the device")
public class TableStatisticsCommand extends AbstractShellCommand {
@@ -58,7 +60,7 @@
" table=%s, active=%s, lookedup=%s, matched=%s";
@Override
- protected void execute() {
+ protected void doExecute() {
FlowRuleService flowService = get(FlowRuleService.class);
DeviceService deviceService = get(DeviceService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/TestAllocateResource.java b/cli/src/main/java/org/onosproject/cli/net/TestAllocateResource.java
index 172687a..4631920 100644
--- a/cli/src/main/java/org/onosproject/cli/net/TestAllocateResource.java
+++ b/cli/src/main/java/org/onosproject/cli/net/TestAllocateResource.java
@@ -17,9 +17,10 @@
import java.util.Optional;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.ChannelSpacing;
import org.onosproject.net.DeviceId;
@@ -36,6 +37,7 @@
/**
* Test tool to allocate resources.
*/
+@Service
@Command(scope = "onos", name = "test-allocate-resources",
description = "Test tool to allocate resources")
public class TestAllocateResource extends AbstractShellCommand {
@@ -65,7 +67,7 @@
private ResourceService resourceService;
@Override
- protected void execute() {
+ protected void doExecute() {
resourceService = get(ResourceService.class);
DeviceId did = DeviceId.deviceId(deviceIdStr);
PortNumber portNum = PortNumber.fromString(portNumberStr);
diff --git a/cli/src/main/java/org/onosproject/cli/net/TestProtectionEndpointIntentCommand.java b/cli/src/main/java/org/onosproject/cli/net/TestProtectionEndpointIntentCommand.java
index 27ae936..373d5ff 100644
--- a/cli/src/main/java/org/onosproject/cli/net/TestProtectionEndpointIntentCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/TestProtectionEndpointIntentCommand.java
@@ -19,9 +19,10 @@
import java.util.List;
import java.util.Optional;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onlab.packet.VlanId;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.ConnectPoint;
@@ -40,6 +41,7 @@
/**
* Test tool to add ProtectionEndpointIntent.
*/
+@Service
@Command(scope = "onos", name = "test-add-protection-endpoint",
description = "Test tool to add ProtectionEndpointIntent")
public class TestProtectionEndpointIntentCommand extends AbstractShellCommand {
@@ -83,7 +85,7 @@
private DeviceService deviceService;
@Override
- protected void execute() {
+ protected void doExecute() {
fingerprint = Optional.ofNullable(fingerprint)
.orElse(DEFAULT_FINGERPRINT);
diff --git a/cli/src/main/java/org/onosproject/cli/net/TopologyCommand.java b/cli/src/main/java/org/onosproject/cli/net/TopologyCommand.java
index 0b4b4b3..ad1db11 100644
--- a/cli/src/main/java/org/onosproject/cli/net/TopologyCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/TopologyCommand.java
@@ -20,8 +20,9 @@
import java.util.Calendar;
import java.util.concurrent.TimeUnit;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.topology.Topology;
import org.onosproject.net.topology.TopologyProvider;
@@ -30,6 +31,7 @@
/**
* Lists summary of the current topology.
*/
+@Service
@Command(scope = "onos", name = "topology",
description = "Lists summary of the current topology")
public class TopologyCommand extends AbstractShellCommand {
@@ -53,7 +55,7 @@
}
@Override
- protected void execute() {
+ protected void doExecute() {
init();
long topologyUptime =
Math.max(0, (System.currentTimeMillis() - topology.creationTime()));
diff --git a/cli/src/main/java/org/onosproject/cli/net/TransactionsCommand.java b/cli/src/main/java/org/onosproject/cli/net/TransactionsCommand.java
index ec6a1a8..1eb1643 100644
--- a/cli/src/main/java/org/onosproject/cli/net/TransactionsCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/TransactionsCommand.java
@@ -17,7 +17,8 @@
import java.util.Collection;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.store.primitives.TransactionId;
import org.onosproject.store.service.StorageAdminService;
@@ -29,6 +30,7 @@
/**
* CLI to view in-progress database transactions in the system.
*/
+@Service
@Command(scope = "onos", name = "transactions",
description = "Utility for listing pending/inprogress transactions")
public class TransactionsCommand extends AbstractShellCommand {
@@ -46,7 +48,7 @@
}
@Override
- protected void execute() {
+ protected void doExecute() {
StorageAdminService storageAdminService = get(StorageAdminService.class);
Collection<TransactionId> transactionIds = storageAdminService.getPendingTransactions();
if (outputJson()) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/TunnelBorrowCommand.java b/cli/src/main/java/org/onosproject/cli/net/TunnelBorrowCommand.java
index 1815432..8d30733 100644
--- a/cli/src/main/java/org/onosproject/cli/net/TunnelBorrowCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/TunnelBorrowCommand.java
@@ -19,9 +19,10 @@
import java.util.HashSet;
import java.util.Optional;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onlab.packet.IpAddress;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.core.ApplicationId;
@@ -42,6 +43,7 @@
/**
* Borrows tunnels. It's used by consumers.
*/
+@Service
@Command(scope = "onos", name = "tunnel-borrow", description = "Borrows tunnels. It's used by consumers.")
public class TunnelBorrowCommand extends AbstractShellCommand {
@@ -77,7 +79,7 @@
+ "groupId=%s";
@Override
- protected void execute() {
+ protected void doExecute() {
Collection<Tunnel> tunnelSet = null;
Tunnel.Type trueType = null;
TunnelService service = get(TunnelService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/TunnelCreateCommand.java b/cli/src/main/java/org/onosproject/cli/net/TunnelCreateCommand.java
index 262f50e..6b3a77b 100644
--- a/cli/src/main/java/org/onosproject/cli/net/TunnelCreateCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/TunnelCreateCommand.java
@@ -17,9 +17,10 @@
import java.util.Optional;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onlab.packet.IpAddress;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.core.GroupId;
@@ -44,6 +45,7 @@
* Supports for creating a tunnel by using IP address and optical as tunnel end
* point.
*/
+@Service
@Command(scope = "onos", name = "tunnel-create",
description = "Supports for creating a tunnel by using IP address and optical as tunnel end point now.")
public class TunnelCreateCommand extends AbstractShellCommand {
@@ -77,7 +79,7 @@
private static final String FMT = "The tunnel identity is %s";
@Override
- protected void execute() {
+ protected void doExecute() {
TunnelProvider service = get(TunnelProvider.class);
ProviderId producerName = new ProviderId("default",
"org.onosproject.provider.tunnel.default");
diff --git a/cli/src/main/java/org/onosproject/cli/net/TunnelQueryCommand.java b/cli/src/main/java/org/onosproject/cli/net/TunnelQueryCommand.java
index 1aff456..76dd752 100644
--- a/cli/src/main/java/org/onosproject/cli/net/TunnelQueryCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/TunnelQueryCommand.java
@@ -19,8 +19,9 @@
import java.util.HashSet;
import java.util.Optional;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onlab.packet.IpAddress;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.tunnel.DefaultOpticalTunnelEndPoint;
@@ -40,6 +41,7 @@
/**
* Supports for querying tunnels. It's used by consumers.
*/
+@Service
@Command(scope = "onos", name = "tunnels", description = "Supports for querying tunnels."
+ " It's used by consumers.")
public class TunnelQueryCommand extends AbstractShellCommand {
@@ -67,7 +69,7 @@
+ "groupId=%s, path=%s%s";
@Override
- protected void execute() {
+ protected void doExecute() {
Tunnel.Type trueType = null;
TunnelService service = get(TunnelService.class);
ProviderId producerName = new ProviderId("default",
diff --git a/cli/src/main/java/org/onosproject/cli/net/TunnelQuerySubscriptionCommand.java b/cli/src/main/java/org/onosproject/cli/net/TunnelQuerySubscriptionCommand.java
index 2c8cb20..fed8e64 100644
--- a/cli/src/main/java/org/onosproject/cli/net/TunnelQuerySubscriptionCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/TunnelQuerySubscriptionCommand.java
@@ -17,8 +17,9 @@
import java.util.Collection;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.DefaultApplicationId;
@@ -29,6 +30,7 @@
* Query all tunnel subscriptions of consumer by consumer id.
* It's used by consumers.
*/
+@Service
@Command(scope = "onos", name = "tunnel-subscriptions",
description = "Query all request orders of consumer by consumer id. It's used by consumers.")
public class TunnelQuerySubscriptionCommand extends AbstractShellCommand {
@@ -40,7 +42,7 @@
+ "type=%s, tunnelId=%s";
@Override
- protected void execute() {
+ protected void doExecute() {
TunnelService service = get(TunnelService.class);
ApplicationId applicationId = new DefaultApplicationId(1, consumerId);
Collection<TunnelSubscription> tunnelSet = service.queryTunnelSubscription(applicationId);
diff --git a/cli/src/main/java/org/onosproject/cli/net/TunnelRemoveCommand.java b/cli/src/main/java/org/onosproject/cli/net/TunnelRemoveCommand.java
index 4305d21..8d683cb 100644
--- a/cli/src/main/java/org/onosproject/cli/net/TunnelRemoveCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/TunnelRemoveCommand.java
@@ -18,8 +18,9 @@
import java.util.Collection;
import java.util.Optional;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onlab.packet.IpAddress;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.tunnel.DefaultOpticalTunnelEndPoint;
@@ -40,6 +41,7 @@
/**
* Supports for removing tunnels. It's used by producers.
*/
+@Service
@Command(scope = "onos", name = "tunnel-remove", description = "Supports for removing tunnels. It's used by producers.")
public class TunnelRemoveCommand extends AbstractShellCommand {
@Option(name = "-s", aliases = "--src", description = "Source tunnel point."
@@ -62,7 +64,7 @@
String tunnelId = null;
@Override
- protected void execute() {
+ protected void doExecute() {
TunnelDescription tunnel = null;
TunnelProvider service = get(TunnelProvider.class);
ProviderId producerName = new ProviderId("default",
diff --git a/cli/src/main/java/org/onosproject/cli/net/TunnelReturnCommand.java b/cli/src/main/java/org/onosproject/cli/net/TunnelReturnCommand.java
index dbc34fb..cab46f9 100644
--- a/cli/src/main/java/org/onosproject/cli/net/TunnelReturnCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/TunnelReturnCommand.java
@@ -17,9 +17,10 @@
import java.util.Optional;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onlab.packet.IpAddress;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.core.ApplicationId;
@@ -40,6 +41,7 @@
/**
* Returns tunnels. It's used by consumers.
*/
+@Service
@Command(scope = "onos", name = "tunnel-return",
description = "Returns tunnels. It's used by consumers.")
public class TunnelReturnCommand extends AbstractShellCommand {
@@ -72,7 +74,7 @@
String tunnelName = null;
@Override
- protected void execute() {
+ protected void doExecute() {
Tunnel.Type trueType = null;
TunnelService service = get(TunnelService.class);
ApplicationId appId = new DefaultApplicationId(1, consumerId);
diff --git a/cli/src/main/java/org/onosproject/cli/net/TunnelUpdateCommand.java b/cli/src/main/java/org/onosproject/cli/net/TunnelUpdateCommand.java
index efa0a9f..9bfdadd 100644
--- a/cli/src/main/java/org/onosproject/cli/net/TunnelUpdateCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/TunnelUpdateCommand.java
@@ -15,9 +15,10 @@
*/
package org.onosproject.cli.net;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.tunnel.DefaultTunnelDescription;
import org.onosproject.incubator.net.tunnel.TunnelDescription;
@@ -30,6 +31,7 @@
* Supports for updating a tunnel by tunnel identity.
* It's used by producers.
*/
+@Service
@Command(scope = "onos", name = "tunnel-update",
description = "Supports for updating a tunnel by tunnel identity."
+ " It's used by producers.")
@@ -43,7 +45,7 @@
String bandwidth = null;
@Override
- protected void execute() {
+ protected void doExecute() {
TunnelProvider service = get(TunnelProvider.class);
TunnelId id = TunnelId.valueOf(tunnelId);
SparseAnnotations annotations = DefaultAnnotations
diff --git a/cli/src/main/java/org/onosproject/cli/net/WipeOutCommand.java b/cli/src/main/java/org/onosproject/cli/net/WipeOutCommand.java
index 880621d..7bfd6b9 100644
--- a/cli/src/main/java/org/onosproject/cli/net/WipeOutCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/WipeOutCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net;
import com.google.common.collect.Sets;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.util.Tools;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.Device;
@@ -50,6 +51,7 @@
/**
* Wipes-out the entire network information base, i.e. devices, links, hosts, intents.
*/
+@Service
@Command(scope = "onos", name = "wipe-out",
description = "Wipes-out the entire network information base, i.e. devices, links, hosts")
public class WipeOutCommand extends AbstractShellCommand {
@@ -59,7 +61,7 @@
String please = null;
@Override
- protected void execute() {
+ protected void doExecute() {
if (please == null || !please.equals(PLEASE)) {
print("I'm afraid I can't do that!\nSay: %s", PLEASE);
return;
diff --git a/cli/src/main/java/org/onosproject/cli/net/completer/PeerConnectPointCompleter.java b/cli/src/main/java/org/onosproject/cli/net/completer/PeerConnectPointCompleter.java
index a21eb67..222f643 100644
--- a/cli/src/main/java/org/onosproject/cli/net/completer/PeerConnectPointCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/completer/PeerConnectPointCompleter.java
@@ -15,8 +15,10 @@
*/
package org.onosproject.cli.net.completer;
-import static org.onlab.osgi.DefaultServiceDirectory.getService;
-import static org.onosproject.net.ConnectPoint.deviceConnectPoint;
+import org.onosproject.cli.AbstractChoicesCompleter;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.device.DeviceService;
+import org.onosproject.net.link.LinkService;
import java.util.Arrays;
import java.util.Collections;
@@ -26,11 +28,8 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import org.apache.karaf.shell.console.completer.ArgumentCompleter.ArgumentList;
-import org.onosproject.cli.AbstractChoicesCompleter;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.device.DeviceService;
-import org.onosproject.net.link.LinkService;
+import static org.onlab.osgi.DefaultServiceDirectory.getService;
+import static org.onosproject.net.ConnectPoint.deviceConnectPoint;
/**
* Completer, which proposes remote end of existing Link in the system.
@@ -42,12 +41,11 @@
@Override
protected List<String> choices() {
- ArgumentList args = getArgumentList();
DeviceService deviceService = getService(DeviceService.class);
LinkService linkService = getService(LinkService.class);
- Optional<ConnectPoint> port = Arrays.asList(args.getArguments()).stream()
+ Optional<ConnectPoint> port = Arrays.asList(commandLine.getArguments()).stream()
.filter(s -> s.contains(":") && s.contains("/"))
.map(s -> {
try {
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/TenantAddCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/TenantAddCommand.java
index e9439c8..ab4fc66 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/TenantAddCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/TenantAddCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.TenantId;
import org.onosproject.incubator.net.virtual.VirtualNetworkAdminService;
@@ -25,6 +26,7 @@
/**
* Creates a new virtual network tenant.
*/
+@Service
@Command(scope = "onos", name = "vnet-add-tenant",
description = "Creates a new virtual network tenant.")
@@ -35,7 +37,7 @@
String id = null;
@Override
- protected void execute() {
+ protected void doExecute() {
VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
service.registerTenantId(TenantId.tenantId(id));
print("Tenant successfully added.");
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/TenantCompleter.java b/cli/src/main/java/org/onosproject/cli/net/vnet/TenantCompleter.java
index 22d7b6d..f8b977f 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/TenantCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/TenantCompleter.java
@@ -16,8 +16,11 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.TenantId;
import org.onosproject.incubator.net.virtual.VirtualNetworkAdminService;
@@ -28,9 +31,10 @@
/**
* Tenant Id completer.
*/
+@Service
public class TenantCompleter implements Completer {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
@@ -44,6 +48,6 @@
}
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/TenantListCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/TenantListCommand.java
index a401a48..e701250 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/TenantListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/TenantListCommand.java
@@ -16,7 +16,8 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.TenantId;
import org.onosproject.incubator.net.virtual.VirtualNetworkAdminService;
@@ -29,6 +30,7 @@
/**
* Lists all tenants.
*/
+@Service
@Command(scope = "onos", name = "vnet-tenants",
description = "Lists all virtual network tenants.")
public class TenantListCommand extends AbstractShellCommand {
@@ -36,7 +38,7 @@
private static final String FMT_TENANT = "tenantId=%s";
@Override
- protected void execute() {
+ protected void doExecute() {
VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
List<TenantId> tenants = new ArrayList<>();
tenants.addAll(service.getTenantIds());
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/TenantRemoveCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/TenantRemoveCommand.java
index 36f9d1c..49ed593 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/TenantRemoveCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/TenantRemoveCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.TenantId;
import org.onosproject.incubator.net.virtual.VirtualNetworkAdminService;
@@ -25,6 +26,7 @@
/**
* Creates a new virtual network tenant.
*/
+@Service
@Command(scope = "onos", name = "vnet-remove-tenant",
description = "Removes a virtual network tenant.")
@@ -35,7 +37,7 @@
String id = null;
@Override
- protected void execute() {
+ protected void doExecute() {
VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
service.unregisterTenantId(TenantId.tenantId(id));
print("Tenant successfully removed.");
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualDeviceCompleter.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualDeviceCompleter.java
index 780c0bb..4b554a7 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualDeviceCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualDeviceCompleter.java
@@ -18,7 +18,6 @@
import static org.onlab.osgi.DefaultServiceDirectory.getService;
-import org.apache.karaf.shell.console.completer.ArgumentCompleter.ArgumentList;
import org.onosproject.cli.AbstractChoicesCompleter;
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.VirtualDevice;
@@ -38,9 +37,8 @@
public class VirtualDeviceCompleter extends AbstractChoicesCompleter {
@Override
protected List<String> choices() {
- ArgumentList args = getArgumentList();
//parse argument list for network id
- String[] argsArray = args.getArguments();
+ String[] argsArray = commandLine.getArguments();
for (String str : argsArray) {
if (str.matches("[0-9]+")) {
long networkId = Long.valueOf(str);
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualDeviceCreateCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualDeviceCreateCommand.java
index a9eb8d4..16c1193 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualDeviceCreateCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualDeviceCreateCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.VirtualNetworkAdminService;
@@ -26,6 +27,7 @@
/**
* Creates a new virtual device.
*/
+@Service
@Command(scope = "onos", name = "vnet-create-device",
description = "Creates a new virtual device in a network.")
public class VirtualDeviceCreateCommand extends AbstractShellCommand {
@@ -39,7 +41,7 @@
String deviceId = null;
@Override
- protected void execute() {
+ protected void doExecute() {
VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
service.createVirtualDevice(NetworkId.networkId(networkId), DeviceId.deviceId(deviceId));
print("Virtual device successfully created.");
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualDeviceListCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualDeviceListCommand.java
index 65f4107..3f52021 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualDeviceListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualDeviceListCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.VirtualDevice;
@@ -31,6 +32,7 @@
/**
* Lists all virtual devices for the network ID.
*/
+@Service
@Command(scope = "onos", name = "vnet-devices",
description = "Lists all virtual devices in a virtual network.")
public class VirtualDeviceListCommand extends AbstractShellCommand {
@@ -43,7 +45,7 @@
Long networkId = null;
@Override
- protected void execute() {
+ protected void doExecute() {
getSortedVirtualDevices().forEach(this::printVirtualDevice);
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualDeviceRemoveCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualDeviceRemoveCommand.java
index f04bcda..c04c710 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualDeviceRemoveCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualDeviceRemoveCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.VirtualNetworkAdminService;
@@ -26,6 +27,7 @@
/**
* Removes a virtual device.
*/
+@Service
@Command(scope = "onos", name = "vnet-remove-device",
description = "Removes a virtual device.")
public class VirtualDeviceRemoveCommand extends AbstractShellCommand {
@@ -39,7 +41,7 @@
String deviceId = null;
@Override
- protected void execute() {
+ protected void doExecute() {
VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
service.removeVirtualDevice(NetworkId.networkId(networkId), DeviceId.deviceId(deviceId));
print("Virtual device successfully removed.");
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualFlowsListCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualFlowsListCommand.java
index ff0cf7d..b783ab7 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualFlowsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualFlowsListCommand.java
@@ -19,9 +19,10 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onlab.util.StringFilter;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.core.ApplicationId;
@@ -53,6 +54,7 @@
/**
* Lists all currently-known flows.
*/
+@Service
@Command(scope = "onos", name = "vnet-flows",
description = "Lists all currently-known flows for a virtual network.")
public class VirtualFlowsListCommand extends AbstractShellCommand {
@@ -104,7 +106,7 @@
private StringFilter contentFilter;
@Override
- protected void execute() {
+ protected void doExecute() {
CoreService coreService = get(CoreService.class);
VirtualNetworkService vnetservice = get(VirtualNetworkService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualHostCompleter.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualHostCompleter.java
index c44ef40..dec2a35 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualHostCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualHostCompleter.java
@@ -16,7 +16,6 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.console.completer.ArgumentCompleter.ArgumentList;
import org.onosproject.cli.AbstractChoicesCompleter;
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.VirtualHost;
@@ -37,9 +36,8 @@
public class VirtualHostCompleter extends AbstractChoicesCompleter {
@Override
protected List<String> choices() {
- ArgumentList args = getArgumentList();
//parse argument list for network id
- String[] argsArray = args.getArguments();
+ String[] argsArray = commandLine.getArguments();
for (String str : argsArray) {
if (str.matches("[0-9]+")) {
long networkId = Long.valueOf(str);
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualHostCreateCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualHostCreateCommand.java
index b2990e9..505e8c3 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualHostCreateCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualHostCreateCommand.java
@@ -16,9 +16,10 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onlab.packet.IpAddress;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
@@ -37,6 +38,7 @@
/**
* Creates a new virtual host.
*/
+@Service
@Command(scope = "onos", name = "vnet-create-host",
description = "Creates a new virtual host in a network.")
public class VirtualHostCreateCommand extends AbstractShellCommand {
@@ -67,7 +69,7 @@
protected String[] hostIpStrings;
@Override
- protected void execute() {
+ protected void doExecute() {
VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
Set<IpAddress> hostIps = new HashSet<>();
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualHostListCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualHostListCommand.java
index 12512b7..7ae3b59 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualHostListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualHostListCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.VirtualHost;
@@ -29,6 +30,7 @@
/**
* Lists all virtual hosts for the network ID.
*/
+@Service
@Command(scope = "onos", name = "vnet-hosts",
description = "Lists all virtual hosts in a virtual network.")
public class VirtualHostListCommand extends AbstractShellCommand {
@@ -41,7 +43,7 @@
Long networkId = null;
@Override
- protected void execute() {
+ protected void doExecute() {
getSortedVirtualHosts().forEach(this::printVirtualHost);
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualHostRemoveCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualHostRemoveCommand.java
index a496e38..4d3370d 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualHostRemoveCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualHostRemoveCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.VirtualNetworkAdminService;
@@ -28,6 +29,7 @@
* Removes a virtual host.
*/
+@Service
@Command(scope = "onos", name = "vnet-remove-host",
description = "Removes a virtual host.")
public class VirtualHostRemoveCommand extends AbstractShellCommand {
@@ -41,7 +43,7 @@
String id = null;
@Override
- protected void execute() {
+ protected void doExecute() {
VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
service.removeVirtualHost(NetworkId.networkId(networkId), HostId.hostId(id));
print("Virtual host successfully removed.");
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualLinkCreateCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualLinkCreateCommand.java
index 604e196..89057ad 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualLinkCreateCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualLinkCreateCommand.java
@@ -16,9 +16,10 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.VirtualNetworkAdminService;
@@ -29,6 +30,7 @@
/**
* Creates a new virtual link.
*/
+@Service
@Command(scope = "onos", name = "vnet-create-link",
description = "Creates a new virtual link in a network.")
public class VirtualLinkCreateCommand extends AbstractShellCommand {
@@ -60,7 +62,7 @@
boolean bidirectional = false;
@Override
- protected void execute() {
+ protected void doExecute() {
VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
ConnectPoint src = new ConnectPoint(DeviceId.deviceId(srcDeviceId), PortNumber.portNumber(srcPortNum));
ConnectPoint dst = new ConnectPoint(DeviceId.deviceId(dstDeviceId), PortNumber.portNumber(dstPortNum));
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualLinkListCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualLinkListCommand.java
index c7f3c86..c5c6462 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualLinkListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualLinkListCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.VirtualLink;
@@ -29,6 +30,7 @@
/**
* Lists all virtual links for the network ID.
*/
+@Service
@Command(scope = "onos", name = "vnet-links",
description = "Lists all virtual links in a virtual network.")
public class VirtualLinkListCommand extends AbstractShellCommand {
@@ -41,7 +43,7 @@
Long networkId = null;
@Override
- protected void execute() {
+ protected void doExecute() {
getSortedVirtualLinks().forEach(this::printVirtualLink);
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualLinkRemoveCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualLinkRemoveCommand.java
index 3e0034a..130c580 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualLinkRemoveCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualLinkRemoveCommand.java
@@ -16,9 +16,10 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.VirtualNetworkAdminService;
@@ -29,6 +30,7 @@
/**
* Removes a virtual link.
*/
+@Service
@Command(scope = "onos", name = "vnet-remove-link",
description = "Removes a virtual link.")
public class VirtualLinkRemoveCommand extends AbstractShellCommand {
@@ -60,7 +62,7 @@
boolean bidirectional = false;
@Override
- protected void execute() {
+ protected void doExecute() {
VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
ConnectPoint src = new ConnectPoint(DeviceId.deviceId(srcDeviceId), PortNumber.portNumber(srcPortNum));
ConnectPoint dst = new ConnectPoint(DeviceId.deviceId(dstDeviceId), PortNumber.portNumber(dstPortNum));
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkBalanceMastersCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkBalanceMastersCommand.java
index 632ff57..1481c19 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkBalanceMastersCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkBalanceMastersCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.VirtualNetworkService;
@@ -25,6 +26,7 @@
/**
* Forces virtual network device mastership rebalancing.
*/
+@Service
@Command(scope = "onos", name = "vnet-balance-masters",
description = "Forces virtual network device mastership rebalancing")
public class VirtualNetworkBalanceMastersCommand extends AbstractShellCommand {
@@ -32,7 +34,7 @@
required = true, multiValued = false)
Long networkId = null;
@Override
- protected void execute() {
+ protected void doExecute() {
VirtualNetworkService vnetService = get(VirtualNetworkService.class);
MastershipAdminService mastershipAdminService = vnetService
.get(NetworkId.networkId(networkId), MastershipAdminService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkCompleter.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkCompleter.java
index f06177e7..4fc1732 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkCompleter.java
@@ -16,8 +16,11 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.TenantId;
import org.onosproject.incubator.net.virtual.VirtualNetwork;
@@ -33,9 +36,10 @@
/**
* Virtual network completer.
*/
+@Service
public class VirtualNetworkCompleter implements Completer {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
@@ -53,6 +57,6 @@
virtualNetworks.forEach(virtualNetwork -> strings.add(virtualNetwork.id().toString()));
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkCreateCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkCreateCommand.java
index b927bf9..00903fe 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkCreateCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkCreateCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.TenantId;
import org.onosproject.incubator.net.virtual.VirtualNetworkAdminService;
@@ -25,6 +26,7 @@
/**
* Creates a new virtual network.
*/
+@Service
@Command(scope = "onos", name = "vnet-create",
description = "Creates a new virtual network.")
public class VirtualNetworkCreateCommand extends AbstractShellCommand {
@@ -34,7 +36,7 @@
String id = null;
@Override
- protected void execute() {
+ protected void doExecute() {
VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
service.createVirtualNetwork(TenantId.tenantId(id));
print("Virtual network successfully created.");
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkIntentCreateCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkIntentCreateCommand.java
index 9e48ed6..5684ae5 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkIntentCreateCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkIntentCreateCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.net.ConnectivityIntentCommand;
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.VirtualNetworkIntent;
@@ -34,6 +35,7 @@
/**
* Installs virtual network intents.
*/
+@Service
@Command(scope = "onos", name = "add-vnet-intent",
description = "Installs virtual network connectivity intent")
public class VirtualNetworkIntentCreateCommand extends ConnectivityIntentCommand {
@@ -53,7 +55,7 @@
String egressDeviceString = null;
@Override
- protected void execute() {
+ protected void doExecute() {
VirtualNetworkService service = get(VirtualNetworkService.class);
IntentService virtualNetworkIntentService = service.get(NetworkId.networkId(networkId), IntentService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkIntentRemoveCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkIntentRemoveCommand.java
index 7ba6791..0001d41 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkIntentRemoveCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkIntentRemoveCommand.java
@@ -16,9 +16,10 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
@@ -44,6 +45,7 @@
/**
* Removes a virtual network intent.
*/
+@Service
@Command(scope = "onos", name = "remove-vnet-intent",
description = "Removes the virtual network intent")
public class VirtualNetworkIntentRemoveCommand extends AbstractShellCommand {
@@ -75,7 +77,7 @@
private static final EnumSet<IntentState> CAN_PURGE = EnumSet.of(WITHDRAWN, FAILED);
@Override
- protected void execute() {
+ protected void doExecute() {
VirtualNetworkService service = get(VirtualNetworkService.class);
IntentService intentService = service.get(NetworkId.networkId(networkId), IntentService.class);
CoreService coreService = get(CoreService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkListCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkListCommand.java
index 6d5818c..b6e1c1a 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkListCommand.java
@@ -16,7 +16,8 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.TenantId;
import org.onosproject.incubator.net.virtual.VirtualNetwork;
@@ -32,6 +33,7 @@
/**
* Lists all virtual networks for the tenant ID.
*/
+@Service
@Command(scope = "onos", name = "vnets",
description = "Lists all virtual networks.")
public class VirtualNetworkListCommand extends AbstractShellCommand {
@@ -40,7 +42,7 @@
"tenantId=%s, networkId=%s";
@Override
- protected void execute() {
+ protected void doExecute() {
getSortedVirtualNetworks().forEach(this::printVirtualNetwork);
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkPacketRequestCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkPacketRequestCommand.java
index 2a88198..20b33fd 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkPacketRequestCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkPacketRequestCommand.java
@@ -19,9 +19,10 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.action.Option;
import org.onlab.packet.Ip6Address;
import org.onlab.packet.IpPrefix;
import org.onlab.packet.MacAddress;
@@ -50,6 +51,7 @@
/**
* Tests virtual network packet requests.
*/
+@Service
@Command(scope = "onos", name = "vnet-packet",
description = "Tests virtual network packet requests")
public class VirtualNetworkPacketRequestCommand extends AbstractShellCommand {
@@ -133,7 +135,7 @@
private List<String> extHdrStringList = null;
@Override
- protected void execute() {
+ protected void doExecute() {
VirtualNetworkService service = get(VirtualNetworkService.class);
PacketService virtualPacketService = service.get(NetworkId.networkId(networkId), PacketService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkRemoveCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkRemoveCommand.java
index c608b25..3bf84b6 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkRemoveCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualNetworkRemoveCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.VirtualNetworkAdminService;
@@ -25,6 +26,7 @@
/**
* Removes a virtual network.
*/
+@Service
@Command(scope = "onos", name = "vnet-remove",
description = "Removes a virtual network.")
public class VirtualNetworkRemoveCommand extends AbstractShellCommand {
@@ -34,7 +36,7 @@
Long id;
@Override
- protected void execute() {
+ protected void doExecute() {
VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
service.removeVirtualNetwork(NetworkId.networkId(id));
print("Virtual network successfully removed.");
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortBindCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortBindCommand.java
index 2ebdc2c..fb46fb4 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortBindCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortBindCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.VirtualNetworkAdminService;
@@ -35,6 +36,7 @@
/**
* Binds an existing virtual port with a physical port.
*/
+@Service
@Command(scope = "onos", name = "vnet-bind-port",
description = "Binds an existing virtual port with a physical port.")
public class VirtualPortBindCommand extends AbstractShellCommand {
@@ -59,7 +61,7 @@
Integer physPortNum = null;
@Override
- protected void execute() {
+ protected void doExecute() {
VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
DeviceService deviceService = get(DeviceService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortCompleter.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortCompleter.java
index 19a31a3..2660428 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortCompleter.java
@@ -18,7 +18,6 @@
import static org.onlab.osgi.DefaultServiceDirectory.getService;
-import org.apache.karaf.shell.console.completer.ArgumentCompleter.ArgumentList;
import org.onosproject.cli.AbstractChoicesCompleter;
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.VirtualNetworkService;
@@ -39,9 +38,8 @@
public class VirtualPortCompleter extends AbstractChoicesCompleter {
@Override
protected List<String> choices() {
- ArgumentList args = getArgumentList();
//parse argument list for network id
- String[] argsArray = args.getArguments();
+ String[] argsArray = commandLine.getArguments();
for (String str : argsArray) {
if (str.matches("[0-9]+")) {
long networkId = Long.valueOf(str);
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortCreateCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortCreateCommand.java
index 5769a64..e9b7763 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortCreateCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortCreateCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.VirtualDevice;
@@ -35,6 +36,7 @@
/**
* Creates a new virtual port.
*/
+@Service
@Command(scope = "onos", name = "vnet-create-port",
description = "Creates a new virtual port in a network.")
public class VirtualPortCreateCommand extends AbstractShellCommand {
@@ -60,7 +62,7 @@
Integer physPortNum = null;
@Override
- protected void execute() {
+ protected void doExecute() {
VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
DeviceService deviceService = get(DeviceService.class);
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortListCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortListCommand.java
index 7a0f2f0..4a1ea76 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortListCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.VirtualNetworkService;
@@ -32,6 +33,7 @@
/**
* Lists all virtual ports for the network ID.
*/
+@Service
@Command(scope = "onos", name = "vnet-ports",
description = "Lists all virtual ports in a virtual network.")
public class VirtualPortListCommand extends AbstractShellCommand {
@@ -48,7 +50,7 @@
String deviceId = null;
@Override
- protected void execute() {
+ protected void doExecute() {
getSortedVirtualPorts().forEach(this::printVirtualPort);
}
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortRemoveCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortRemoveCommand.java
index 12710ab..414324e 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortRemoveCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortRemoveCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.VirtualNetworkAdminService;
@@ -27,6 +28,7 @@
/**
* Removes a virtual port.
*/
+@Service
@Command(scope = "onos", name = "vnet-remove-port",
description = "Removes a virtual port.")
public class VirtualPortRemoveCommand extends AbstractShellCommand {
@@ -44,7 +46,7 @@
Integer portNum = null;
@Override
- protected void execute() {
+ protected void doExecute() {
VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
service.removeVirtualPort(NetworkId.networkId(networkId), DeviceId.deviceId(deviceId),
PortNumber.portNumber(portNum));
diff --git a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortStateCommand.java b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortStateCommand.java
index d11e249..25acc931 100644
--- a/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortStateCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/vnet/VirtualPortStateCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.net.vnet;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.incubator.net.virtual.NetworkId;
import org.onosproject.incubator.net.virtual.VirtualNetworkAdminService;
@@ -33,6 +34,7 @@
/**
* Administratively enables or disables state of an existing virtual port.
*/
+@Service
@Command(scope = "onos", name = "vnet-port-state",
description = "Administratively enables or disables state of an existing virtual port.")
public class VirtualPortStateCommand extends AbstractShellCommand {
@@ -54,7 +56,7 @@
String portState = null;
@Override
- protected void execute() {
+ protected void doExecute() {
VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
VirtualPort vPort = getVirtualPort(PortNumber.portNumber(portNum));
diff --git a/cli/src/main/java/org/onosproject/cli/security/ReviewApplicationNameCompleter.java b/cli/src/main/java/org/onosproject/cli/security/ReviewApplicationNameCompleter.java
index f6e306a..452664b 100644
--- a/cli/src/main/java/org/onosproject/cli/security/ReviewApplicationNameCompleter.java
+++ b/cli/src/main/java/org/onosproject/cli/security/ReviewApplicationNameCompleter.java
@@ -16,7 +16,9 @@
package org.onosproject.cli.security;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
import org.onosproject.app.ApplicationService;
import org.onosproject.app.ApplicationState;
import org.onosproject.cli.AbstractCompleter;
@@ -34,7 +36,7 @@
*/
public class ReviewApplicationNameCompleter extends AbstractCompleter {
@Override
- public int complete(String buffer, int cursor, List<String> candidates) {
+ public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
@@ -53,6 +55,6 @@
}
// Now let the completer do the work for figuring out what to offer.
- return delegate.complete(buffer, cursor, candidates);
+ return delegate.complete(session, commandLine, candidates);
}
}
\ No newline at end of file
diff --git a/cli/src/main/java/org/onosproject/cli/security/ReviewCommand.java b/cli/src/main/java/org/onosproject/cli/security/ReviewCommand.java
index 3031c3c..1d7e32c 100644
--- a/cli/src/main/java/org/onosproject/cli/security/ReviewCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/security/ReviewCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.cli.security;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.app.ApplicationAdminService;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.core.Application;
@@ -33,6 +34,7 @@
/**
* Application security policy review commands.
*/
+@Service
@Command(scope = "onos", name = "review",
description = "Application security policy review interface")
public class ReviewCommand extends AbstractShellCommand {
@@ -46,7 +48,7 @@
String accept = null;
@Override
- protected void execute() {
+ protected void doExecute() {
ApplicationAdminService applicationAdminService = get(ApplicationAdminService.class);
ApplicationId appId = applicationAdminService.getId(name);
if (appId == null) {