Merge branch 'master' into merge
Change-Id: Id77bb2de77dd288404c83e331b076aaf9aafacc5
diff --git a/BUCK b/BUCK
deleted file mode 100644
index 1b3990f..0000000
--- a/BUCK
+++ /dev/null
@@ -1,13 +0,0 @@
-BUNDLES = [
- '//apps/segmentrouting/app:onos-apps-segmentrouting-app',
- '//apps/segmentrouting/web:onos-apps-segmentrouting-web',
-]
-
-onos_app (
- title = 'Segment Routing',
- category = 'Traffic Engineering',
- url = 'http://onosproject.org',
- included_bundles = BUNDLES,
- description = 'Segment routing application.',
- required_apps = [ 'org.onosproject.route-service', 'org.onosproject.mcast' ],
-)
diff --git a/app/BUCK b/app/BUCK
deleted file mode 100644
index 7deda13..0000000
--- a/app/BUCK
+++ /dev/null
@@ -1,25 +0,0 @@
-COMPILE_DEPS = [
- '//lib:CORE_DEPS',
- '//lib:JACKSON',
- '//lib:KRYO',
- '//lib:org.apache.karaf.shell.console',
- '//cli:onos-cli',
- '//core/common:onos-core-common',
- '//core/store/serializers:onos-core-serializers',
- '//incubator/api:onos-incubator-api',
- '//apps/route-service/api:onos-apps-route-service-api',
- '//apps/mcast/api:onos-apps-mcast-api',
- '//apps/mcast/cli:onos-apps-mcast-cli',
-]
-
-TEST_DEPS = [
- '//lib:TEST_ADAPTERS',
- '//core/net:onos-core-net',
- '//incubator/api:onos-incubator-api-tests',
- '//apps/route-service/api:onos-apps-route-service-api-tests',
-]
-
-osgi_jar_with_tests (
- deps = COMPILE_DEPS,
- test_deps = TEST_DEPS,
-)
diff --git a/app/BUILD b/app/BUILD
index 9edce3e..f5bb7ec 100644
--- a/app/BUILD
+++ b/app/BUILD
@@ -14,6 +14,7 @@
]
osgi_jar_with_tests(
+ karaf_command_packages = ["org.onosproject.segmentrouting.cli"],
test_deps = TEST_DEPS,
deps = COMPILE_DEPS,
)
diff --git a/app/src/main/java/org/onosproject/segmentrouting/OsgiPropertyConstants.java b/app/src/main/java/org/onosproject/segmentrouting/OsgiPropertyConstants.java
new file mode 100644
index 0000000..399e95b
--- /dev/null
+++ b/app/src/main/java/org/onosproject/segmentrouting/OsgiPropertyConstants.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.segmentrouting;
+
+/**
+ * Constants for default values of configurable properties.
+ */
+public final class OsgiPropertyConstants {
+
+ private OsgiPropertyConstants() {}
+
+ public static final String PROP_ACTIVE_PROBING = "activeProbing";
+ public static final boolean ACTIVE_PROBING_DEFAULT = true;
+
+ public static final String PROP_SINGLE_HOMED_DOWN = "singleHomedDown";
+ public static final boolean SINGLE_HOMED_DOWN_DEFAULT = false;
+
+ public static final String PROP_RESPOND_TO_UNKNOWN_HOSTS = "respondToUnknownHosts";
+ public static final boolean RESPOND_TO_UNKNOWN_HOSTS_DEFAULT = true;
+
+ public static final String PROP_ROUTE_DOUBLE_TAGGED_HOSTS = "routeDoubleTaggedHosts";
+ public static final boolean ROUTE_DOUBLE_TAGGED_HOSTS_DEFAULT = false;
+
+ public static final String PROP_DEFAULT_INTERNAL_VLAN = "defaultInternalVlan";
+ public static final int DEFAULT_INTERNAL_VLAN_DEFAULT = 4094;
+
+ public static final String PROP_PW_TRANSPORT_VLAN = "pwTransportVlan";
+ public static final int PW_TRANSPORT_VLAN_DEFAULT = 4090;
+
+}
diff --git a/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java b/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
index a41c58d..17e733c 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
@@ -20,14 +20,6 @@
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Modified;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferenceCardinality;
-import org.apache.felix.scr.annotations.Service;
import org.onlab.packet.Ethernet;
import org.onlab.packet.ICMP6;
import org.onlab.packet.IPv4;
@@ -110,19 +102,17 @@
import org.onosproject.segmentrouting.mcast.McastHandler;
import org.onosproject.segmentrouting.mcast.McastRole;
import org.onosproject.segmentrouting.mcast.McastRoleStoreKey;
+import org.onosproject.segmentrouting.mcast.McastStoreKey;
import org.onosproject.segmentrouting.pwaas.DefaultL2Tunnel;
import org.onosproject.segmentrouting.pwaas.DefaultL2TunnelDescription;
import org.onosproject.segmentrouting.pwaas.DefaultL2TunnelHandler;
import org.onosproject.segmentrouting.pwaas.DefaultL2TunnelPolicy;
-
import org.onosproject.segmentrouting.pwaas.L2Tunnel;
+import org.onosproject.segmentrouting.pwaas.L2TunnelDescription;
import org.onosproject.segmentrouting.pwaas.L2TunnelHandler;
import org.onosproject.segmentrouting.pwaas.L2TunnelPolicy;
-import org.onosproject.segmentrouting.pwaas.L2TunnelDescription;
-
import org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey;
import org.onosproject.segmentrouting.storekey.DummyVlanIdStoreKey;
-import org.onosproject.segmentrouting.mcast.McastStoreKey;
import org.onosproject.segmentrouting.storekey.PortNextObjectiveStoreKey;
import org.onosproject.segmentrouting.storekey.VlanNextObjectiveStoreKey;
import org.onosproject.segmentrouting.storekey.XConnectStoreKey;
@@ -133,6 +123,12 @@
import org.onosproject.store.service.StorageService;
import org.onosproject.store.service.WallClockTimestamp;
import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Modified;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -161,106 +157,119 @@
import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.net.config.NetworkConfigEvent.Type.CONFIG_REGISTERED;
import static org.onosproject.net.config.NetworkConfigEvent.Type.CONFIG_UNREGISTERED;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.ACTIVE_PROBING_DEFAULT;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.DEFAULT_INTERNAL_VLAN_DEFAULT;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_ACTIVE_PROBING;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_DEFAULT_INTERNAL_VLAN;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_PW_TRANSPORT_VLAN;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_RESPOND_TO_UNKNOWN_HOSTS;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_ROUTE_DOUBLE_TAGGED_HOSTS;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.PROP_SINGLE_HOMED_DOWN;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.PW_TRANSPORT_VLAN_DEFAULT;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.RESPOND_TO_UNKNOWN_HOSTS_DEFAULT;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.ROUTE_DOUBLE_TAGGED_HOSTS_DEFAULT;
+import static org.onosproject.segmentrouting.OsgiPropertyConstants.SINGLE_HOMED_DOWN_DEFAULT;
/**
* Segment routing manager.
*/
-@Service
-@Component(immediate = true)
+@Component(
+ immediate = true,
+ service = SegmentRoutingService.class,
+ property = {
+ PROP_ACTIVE_PROBING + ":Boolean=" + ACTIVE_PROBING_DEFAULT,
+ PROP_SINGLE_HOMED_DOWN + ":Boolean=" + SINGLE_HOMED_DOWN_DEFAULT,
+ PROP_RESPOND_TO_UNKNOWN_HOSTS + ":Boolean=" + RESPOND_TO_UNKNOWN_HOSTS_DEFAULT,
+ PROP_ROUTE_DOUBLE_TAGGED_HOSTS + ":Boolean=" + ROUTE_DOUBLE_TAGGED_HOSTS_DEFAULT,
+ PROP_DEFAULT_INTERNAL_VLAN + ":Integer=" + DEFAULT_INTERNAL_VLAN_DEFAULT,
+ PROP_PW_TRANSPORT_VLAN + ":Integer=" + PW_TRANSPORT_VLAN_DEFAULT,
+ }
+)
public class SegmentRoutingManager implements SegmentRoutingService {
private static Logger log = LoggerFactory.getLogger(SegmentRoutingManager.class);
private static final String NOT_MASTER = "Current instance is not the master of {}. Ignore.";
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
private ComponentConfigService compCfgService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
private NeighbourResolutionService neighbourResolutionService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
public CoreService coreService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
PacketService packetService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
HostService hostService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
HostProbingService probingService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
public DeviceService deviceService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
DeviceAdminService deviceAdminService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
public FlowObjectiveService flowObjectiveService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
public LinkService linkService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
public MastershipService mastershipService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
public StorageService storageService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
public MulticastRouteService multicastRouteService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
public TopologyService topologyService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
RouteService routeService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
public NetworkConfigRegistry cfgService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
public InterfaceService interfaceService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
public ClusterService clusterService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
public WorkPartitionService workPartitionService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
public LeadershipService leadershipService;
- @Reference(cardinality = ReferenceCardinality.OPTIONAL_UNARY)
+ @Reference(cardinality = ReferenceCardinality.OPTIONAL)
public XconnectService xconnectService;
- @Property(name = "activeProbing", boolValue = true,
- label = "Enable active probing to discover dual-homed hosts.")
- boolean activeProbing = true;
+ /** Enable active probing to discover dual-homed hosts. */
+ boolean activeProbing = ACTIVE_PROBING_DEFAULT;
- @Property(name = "singleHomedDown", boolValue = false,
- label = "Enable administratively taking down single-homed hosts "
- + "when all uplinks are gone")
- boolean singleHomedDown = false;
+ /** Enable administratively taking down single-homed hosts. */
+ boolean singleHomedDown = SINGLE_HOMED_DOWN_DEFAULT;
- @Property(name = "respondToUnknownHosts", boolValue = true,
- label = "Enable this to respond to ARP/NDP requests from unknown hosts.")
- boolean respondToUnknownHosts = true;
+ /** Enable this to respond to ARP/NDP requests from unknown hosts. */
+ boolean respondToUnknownHosts = RESPOND_TO_UNKNOWN_HOSTS_DEFAULT;
- @Property(name = "routeDoubleTaggedHosts", boolValue = false,
- label = "Program flows and groups to pop and route double tagged hosts")
- boolean routeDoubleTaggedHosts = false;
+ /** Program flows and groups to pop and route double tagged hosts. */
+ boolean routeDoubleTaggedHosts = ROUTE_DOUBLE_TAGGED_HOSTS_DEFAULT;
- private static final int DEFAULT_INTERNAL_VLAN = 4094;
- @Property(name = "defaultInternalVlan", intValue = DEFAULT_INTERNAL_VLAN,
- label = "internal vlan assigned by default to unconfigured ports")
- private int defaultInternalVlan = DEFAULT_INTERNAL_VLAN;
+ /** internal vlan assigned by default to unconfigured ports. */
+ private int defaultInternalVlan = DEFAULT_INTERNAL_VLAN_DEFAULT;
- private static final int PW_TRANSPORT_VLAN = 4090;
- @Property(name = "pwTransportVlan", intValue = PW_TRANSPORT_VLAN,
- label = "vlan used for transport of pseudowires between switches")
- private int pwTransportVlan = PW_TRANSPORT_VLAN;
+ /** vlan used for transport of pseudowires between switches. */
+ private int pwTransportVlan = PW_TRANSPORT_VLAN_DEFAULT;
ArpHandler arpHandler = null;
IcmpHandler icmpHandler = null;
@@ -609,14 +618,14 @@
return;
}
- String strActiveProbing = Tools.get(properties, "activeProbing");
+ String strActiveProbing = Tools.get(properties, PROP_ACTIVE_PROBING);
boolean expectActiveProbing = Boolean.parseBoolean(strActiveProbing);
if (expectActiveProbing != activeProbing) {
activeProbing = expectActiveProbing;
log.info("{} active probing", activeProbing ? "Enabling" : "Disabling");
}
- String strSingleHomedDown = Tools.get(properties, "singleHomedDown");
+ String strSingleHomedDown = Tools.get(properties, PROP_SINGLE_HOMED_DOWN);
boolean expectSingleHomedDown = Boolean.parseBoolean(strSingleHomedDown);
if (expectSingleHomedDown != singleHomedDown) {
singleHomedDown = expectSingleHomedDown;
@@ -635,14 +644,14 @@
}
}
- String strRespondToUnknownHosts = Tools.get(properties, "respondToUnknownHosts");
+ String strRespondToUnknownHosts = Tools.get(properties, PROP_RESPOND_TO_UNKNOWN_HOSTS);
boolean expectRespondToUnknownHosts = Boolean.parseBoolean(strRespondToUnknownHosts);
if (expectRespondToUnknownHosts != respondToUnknownHosts) {
respondToUnknownHosts = expectRespondToUnknownHosts;
log.info("{} responding to ARPs/NDPs from unknown hosts", respondToUnknownHosts ? "Enabling" : "Disabling");
}
- String strRouteDoubleTaggedHosts = Tools.get(properties, "routeDoubleTaggedHosts");
+ String strRouteDoubleTaggedHosts = Tools.get(properties, PROP_ROUTE_DOUBLE_TAGGED_HOSTS);
boolean expectRouteDoubleTaggedHosts = Boolean.parseBoolean(strRouteDoubleTaggedHosts);
if (expectRouteDoubleTaggedHosts != routeDoubleTaggedHosts) {
routeDoubleTaggedHosts = expectRouteDoubleTaggedHosts;
@@ -655,7 +664,7 @@
}
}
- String strDefaultInternalVlan = Tools.get(properties, "defaultInternalVlan");
+ String strDefaultInternalVlan = Tools.get(properties, PROP_DEFAULT_INTERNAL_VLAN);
int defIntVlan = Integer.parseInt(strDefaultInternalVlan);
if (defIntVlan != defaultInternalVlan) {
if (canUseVlanId(defIntVlan)) {
@@ -673,7 +682,7 @@
}
}
- String strPwTxpVlan = Tools.get(properties, "pwTransportVlan");
+ String strPwTxpVlan = Tools.get(properties, PROP_PW_TRANSPORT_VLAN);
int pwTxpVlan = Integer.parseInt(strPwTxpVlan);
if (pwTxpVlan != pwTransportVlan) {
if (canUseVlanId(pwTxpVlan)) {
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/BlackHoleCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/BlackHoleCommand.java
index d30d49d..c45ff8e 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/BlackHoleCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/BlackHoleCommand.java
@@ -19,8 +19,9 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
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.packet.IpPrefix;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.config.NetworkConfigService;
@@ -32,6 +33,7 @@
/**
* CLI command for managing black hole routes.
*/
+@Service
@Command(scope = "onos", name = "sr-blackhole",
description = "Manage black hole routes")
public class BlackHoleCommand extends AbstractShellCommand {
@@ -46,7 +48,7 @@
private String prefix;
@Override
- protected void execute() {
+ protected void doExecute() {
SegmentRoutingService srService = AbstractShellCommand.get(SegmentRoutingService.class);
NetworkConfigService netcfgService = AbstractShellCommand.get(NetworkConfigService.class);
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/DeviceSubnetListCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/DeviceSubnetListCommand.java
index a364b6e..8f706b0 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/DeviceSubnetListCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/DeviceSubnetListCommand.java
@@ -16,7 +16,8 @@
package org.onosproject.segmentrouting.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.onlab.packet.IpPrefix;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
@@ -28,11 +29,12 @@
/**
* Command to list device-subnet mapping in Segment Routing.
*/
+@Service
@Command(scope = "onos", name = "sr-device-subnets",
description = "List device-subnet mapping in Segment Routing")
public class DeviceSubnetListCommand extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
SegmentRoutingService srService =
AbstractShellCommand.get(SegmentRoutingService.class);
printDeviceSubnetMap(srService.getDeviceSubnetMap());
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/EcmpGraphCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/EcmpGraphCommand.java
index 678114a..269134d 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/EcmpGraphCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/EcmpGraphCommand.java
@@ -19,7 +19,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.net.DeviceId;
import org.onosproject.segmentrouting.EcmpShortestPathGraph;
@@ -29,6 +30,7 @@
* Command to read the current state of the ECMP shortest-path graph.
*
*/
+@Service
@Command(scope = "onos", name = "sr-ecmp-spg",
description = "Displays the current ecmp shortest-path-graph in this "
+ "controller instance")
@@ -37,7 +39,7 @@
private static final String FORMAT_MAPPING = " %s";
@Override
- protected void execute() {
+ protected void doExecute() {
SegmentRoutingService srService =
AbstractShellCommand.get(SegmentRoutingService.class);
printEcmpGraph(srService.getCurrentEcmpSpg());
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/InvalidateNextCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/InvalidateNextCommand.java
index aa3f78b..094bea9 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/InvalidateNextCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/InvalidateNextCommand.java
@@ -17,8 +17,9 @@
package org.onosproject.segmentrouting.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.onlab.osgi.ServiceNotFoundException;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.segmentrouting.SegmentRoutingService;
@@ -26,6 +27,7 @@
/**
* Command to invalidate next id from SR internal stores.
*/
+@Service
@Command(scope = "onos", name = "sr-next-invalidate",
description = "Invalidate given next id from SR internal stores")
public class InvalidateNextCommand extends AbstractShellCommand {
@@ -39,7 +41,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 next ID is force invalidated." +
"Enter confirmation phrase to continue.");
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/LinkStateCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/LinkStateCommand.java
index ded4ae6..9d7147b 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/LinkStateCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/LinkStateCommand.java
@@ -20,7 +20,8 @@
import java.util.List;
import java.util.Set;
-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.DeviceId;
import org.onosproject.net.Link;
@@ -34,13 +35,14 @@
* Command to read the current state of the DestinationSetNextObjectiveStore.
*
*/
+@Service
@Command(scope = "onos", name = "sr-link-state", description = "Displays the current internal link state "
+ "noted by this instance of the controller")
public class LinkStateCommand extends AbstractShellCommand {
private static final String FORMAT_MAPPING = " %s";
@Override
- protected void execute() {
+ protected void doExecute() {
SegmentRoutingService srService = AbstractShellCommand
.get(SegmentRoutingService.class);
printLinkState(srService.getSeenLinks(),
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/McastLeaderListCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/McastLeaderListCommand.java
index 33a9fc9..633745c 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/McastLeaderListCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/McastLeaderListCommand.java
@@ -16,8 +16,10 @@
package org.onosproject.segmentrouting.cli;
-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.Completion;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.packet.IpAddress;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.cluster.NodeId;
@@ -31,6 +33,7 @@
/**
* Command to show the mcast leaders of the groups.
*/
+@Service
@Command(scope = "onos", name = "sr-mcast-leader",
description = "Lists all mcast leaders")
public class McastLeaderListCommand extends AbstractShellCommand {
@@ -45,10 +48,11 @@
description = "IP Address of the multicast group",
valueToShowInHelp = "224.0.0.0",
required = false, multiValued = false)
+ @Completion(McastGroupCompleter.class)
String gAddr = null;
@Override
- protected void execute() {
+ protected void doExecute() {
// Verify mcast group
IpAddress mcastGroup = null;
if (!isNullOrEmpty(gAddr)) {
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/McastNextListCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/McastNextListCommand.java
index 569f097..7dd6fd3 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/McastNextListCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/McastNextListCommand.java
@@ -17,8 +17,10 @@
package org.onosproject.segmentrouting.cli;
import com.google.common.collect.Maps;
-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.Completion;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.packet.IpAddress;
import org.onlab.packet.VlanId;
import org.onosproject.cli.AbstractShellCommand;
@@ -37,6 +39,7 @@
/**
* Command to show the list of mcast nextids.
*/
+@Service
@Command(scope = "onos", name = "sr-next-mcast",
description = "Lists all mcast nextids")
public class McastNextListCommand extends AbstractShellCommand {
@@ -51,10 +54,11 @@
description = "IP Address of the multicast group",
valueToShowInHelp = "224.0.0.0",
required = false, multiValued = false)
+ @Completion(McastGroupCompleter.class)
String gAddr = null;
@Override
- protected void execute() {
+ protected void doExecute() {
// Verify mcast group
IpAddress mcastGroup = null;
if (!isNullOrEmpty(gAddr)) {
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/McastRoleListCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/McastRoleListCommand.java
index facd6a1..2b22c67 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/McastRoleListCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/McastRoleListCommand.java
@@ -19,10 +19,13 @@
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
-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.Completion;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.packet.IpAddress;
import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.cli.net.ConnectPointCompleter;
import org.onosproject.mcast.cli.McastGroupCompleter;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
@@ -40,6 +43,7 @@
/**
* Command to show the list of mcast roles.
*/
+@Service
@Command(scope = "onos", name = "sr-mcast-role",
description = "Lists all mcast roles")
public class McastRoleListCommand extends AbstractShellCommand {
@@ -54,16 +58,18 @@
description = "IP Address of the multicast group",
valueToShowInHelp = "224.0.0.0",
required = false, multiValued = false)
+ @Completion(McastGroupCompleter.class)
String gAddr = null;
@Option(name = "-src", aliases = "--connectPoint",
description = "Source port of:XXXXXXXXXX/XX",
valueToShowInHelp = "of:0000000000000001/1",
required = false, multiValued = false)
+ @Completion(ConnectPointCompleter.class)
String source = null;
@Override
- protected void execute() {
+ protected void doExecute() {
// Verify mcast group
IpAddress mcastGroup = null;
// We want to use source cp only for a specific group
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/McastTreeListCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/McastTreeListCommand.java
index 89f107a..09c795c 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/McastTreeListCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/McastTreeListCommand.java
@@ -21,10 +21,13 @@
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
-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.Completion;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.packet.IpAddress;
import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.cli.net.ConnectPointCompleter;
import org.onosproject.mcast.cli.McastGroupCompleter;
import org.onosproject.net.ConnectPoint;
import org.onosproject.segmentrouting.SegmentRoutingService;
@@ -38,6 +41,7 @@
/**
* Command to show the list of mcast trees.
*/
+@Service
@Command(scope = "onos", name = "sr-mcast-tree",
description = "Lists all mcast trees")
public class McastTreeListCommand extends AbstractShellCommand {
@@ -54,16 +58,18 @@
description = "IP Address of the multicast group",
valueToShowInHelp = "224.0.0.0",
required = false, multiValued = false)
+ @Completion(McastGroupCompleter.class)
String gAddr = null;
@Option(name = "-src", aliases = "--connectPoint",
description = "Source port of:XXXXXXXXXX/XX",
valueToShowInHelp = "of:0000000000000001/1",
required = false, multiValued = false)
+ @Completion(ConnectPointCompleter.class)
String source = null;
@Override
- protected void execute() {
+ protected void doExecute() {
// Get SR service and the handled mcast groups
SegmentRoutingService srService = get(SegmentRoutingService.class);
Set<IpAddress> mcastGroups = ImmutableSet.copyOf(srService.getMcastLeaders(null)
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/NextDstCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/NextDstCommand.java
index 07950a7..e6da695 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/NextDstCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/NextDstCommand.java
@@ -21,7 +21,8 @@
import java.util.Comparator;
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.segmentrouting.SegmentRoutingService;
import org.onosproject.segmentrouting.grouphandler.NextNeighbors;
@@ -30,6 +31,7 @@
/**
* Command to read the current state of the DestinationSetNextObjectiveStore.
*/
+@Service
@Command(scope = "onos", name = "sr-next-dst",
description = "Displays the current next-hops seen by each switch "
+ "towards a set of destinations and the next-id it maps to")
@@ -38,7 +40,7 @@
private static final String FORMAT_MAPPING = " %s";
@Override
- protected void execute() {
+ protected void doExecute() {
SegmentRoutingService srService =
AbstractShellCommand.get(SegmentRoutingService.class);
printDestinationSet(srService.getDstNextObjStore());
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/NextPortCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/NextPortCommand.java
index 5be9d77..fddc1d7 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/NextPortCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/NextPortCommand.java
@@ -16,7 +16,8 @@
package org.onosproject.segmentrouting.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.cli.AbstractShellCommand;
import org.onosproject.segmentrouting.SegmentRoutingService;
import org.onosproject.segmentrouting.storekey.PortNextObjectiveStoreKey;
@@ -28,11 +29,12 @@
/**
* Command to read the current state of the portNextObjStore.
*/
+@Service
@Command(scope = "onos", name = "sr-next-port",
description = "Displays the current port / next-id it mapping")
public class NextPortCommand extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
SegmentRoutingService srService =
AbstractShellCommand.get(SegmentRoutingService.class);
print(srService.getPortNextObjStore());
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/NextVlanCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/NextVlanCommand.java
index 0295a90..8518a5f 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/NextVlanCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/NextVlanCommand.java
@@ -16,7 +16,8 @@
package org.onosproject.segmentrouting.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.cli.AbstractShellCommand;
import org.onosproject.segmentrouting.SegmentRoutingService;
import org.onosproject.segmentrouting.storekey.VlanNextObjectiveStoreKey;
@@ -28,11 +29,12 @@
/**
* Command to read the current state of the vlanNextObjStore.
*/
+@Service
@Command(scope = "onos", name = "sr-next-vlan",
description = "Displays the current vlan / next-id it mapping")
public class NextVlanCommand extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
SegmentRoutingService srService =
AbstractShellCommand.get(SegmentRoutingService.class);
print(srService.getVlanNextObjStore());
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/PolicyAddCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/PolicyAddCommand.java
index 605ba83..1f75317 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/PolicyAddCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/PolicyAddCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.segmentrouting.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.cli.AbstractShellCommand;
import org.onosproject.segmentrouting.Policy;
import org.onosproject.segmentrouting.PolicyHandler;
@@ -26,6 +27,7 @@
/**
* Command to add a new policy.
*/
+@Service
@Command(scope = "onos", name = "sr-policy-add",
description = "Create a new policy")
public class PolicyAddCommand extends AbstractShellCommand {
@@ -78,7 +80,7 @@
String tunnelId;
@Override
- protected void execute() {
+ protected void doExecute() {
SegmentRoutingService srService =
AbstractShellCommand.get(SegmentRoutingService.class);
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/PolicyListCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/PolicyListCommand.java
index 6c91b8b..3520fba 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/PolicyListCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/PolicyListCommand.java
@@ -15,7 +15,8 @@
*/
package org.onosproject.segmentrouting.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.cli.AbstractShellCommand;
import org.onosproject.segmentrouting.Policy;
import org.onosproject.segmentrouting.SegmentRoutingService;
@@ -24,6 +25,7 @@
/**
* Command to show the list of policies.
*/
+@Service
@Command(scope = "onos", name = "sr-policy-list",
description = "Lists all policies")
public class PolicyListCommand extends AbstractShellCommand {
@@ -32,7 +34,7 @@
" id=%s, type=%s, prio=%d, src=%s, port=%d, dst=%s, port=%d, proto=%s, tunnel=%s";
@Override
- protected void execute() {
+ protected void doExecute() {
SegmentRoutingService srService =
AbstractShellCommand.get(SegmentRoutingService.class);
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/PolicyRemoveCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/PolicyRemoveCommand.java
index cdc3034..575d35f 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/PolicyRemoveCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/PolicyRemoveCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.segmentrouting.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.cli.AbstractShellCommand;
import org.onosproject.segmentrouting.PolicyHandler;
import org.onosproject.segmentrouting.SegmentRoutingService;
@@ -26,6 +27,7 @@
/**
* Command to remove a policy.
*/
+@Service
@Command(scope = "onos", name = "sr-policy-remove",
description = "Remove a policy")
public class PolicyRemoveCommand extends AbstractShellCommand {
@@ -36,7 +38,7 @@
String policyId;
@Override
- protected void execute() {
+ protected void doExecute() {
SegmentRoutingService srService =
AbstractShellCommand.get(SegmentRoutingService.class);
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireAddCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireAddCommand.java
index d7d22b4..d595d5c 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireAddCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireAddCommand.java
@@ -16,8 +16,9 @@
package org.onosproject.segmentrouting.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.cli.AbstractShellCommand;
import org.onosproject.net.ConnectPoint;
import org.onosproject.segmentrouting.SegmentRoutingService;
@@ -35,6 +36,7 @@
/**
* Command to add a pseuwodire.
*/
+@Service
@Command(scope = "onos", name = "sr-pw-add",
description = "Add a pseudowire to the network configuration, if it already exists update it.")
public class PseudowireAddCommand extends AbstractShellCommand {
@@ -90,7 +92,7 @@
String cP2OuterVlan;
@Override
- protected void execute() {
+ protected void doExecute() {
SegmentRoutingService srService =
AbstractShellCommand.get(SegmentRoutingService.class);
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireIdCompleter.java b/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireIdCompleter.java
index b44ca76..abf0c0c 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireIdCompleter.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireIdCompleter.java
@@ -15,8 +15,11 @@
*/
package org.onosproject.segmentrouting.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.cli.AbstractShellCommand;
import org.onosproject.segmentrouting.SegmentRoutingService;
import org.onosproject.segmentrouting.pwaas.L2Tunnel;
@@ -29,9 +32,10 @@
/**
* Device ID completer.
*/
+@Service
public class PseudowireIdCompleter 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();
@@ -52,7 +56,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/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireListCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireListCommand.java
index f38fe80..475ce26 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireListCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireListCommand.java
@@ -15,7 +15,8 @@
*/
package org.onosproject.segmentrouting.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.onlab.packet.VlanId;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.segmentrouting.SegmentRoutingService;
@@ -23,6 +24,7 @@
/**
* Command to show the pseudowires.
*/
+@Service
@Command(scope = "onos", name = "sr-pw-list",
description = "Lists all pseudowires")
public class PseudowireListCommand extends AbstractShellCommand {
@@ -36,7 +38,7 @@
" pending = %s";
@Override
- protected void execute() {
+ protected void doExecute() {
SegmentRoutingService srService =
AbstractShellCommand.get(SegmentRoutingService.class);
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireNextListCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireNextListCommand.java
index d37d3e8..f2b3e8d 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireNextListCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireNextListCommand.java
@@ -16,7 +16,8 @@
package org.onosproject.segmentrouting.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.cli.AbstractShellCommand;
import org.onosproject.net.flowobjective.NextObjective;
import org.onosproject.segmentrouting.SegmentRoutingService;
@@ -28,11 +29,12 @@
/**
* Command to read the current state of the pseudowire next stores.
*/
+@Service
@Command(scope = "onos", name = "sr-next-pw",
description = "Displays the current next-id for pseudowire")
public class PseudowireNextListCommand extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
SegmentRoutingService srService =
AbstractShellCommand.get(SegmentRoutingService.class);
print(srService.getPwInitNext());
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireRemoveCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireRemoveCommand.java
index d0f217d..2bb28b0 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireRemoveCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireRemoveCommand.java
@@ -16,8 +16,10 @@
package org.onosproject.segmentrouting.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.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.segmentrouting.SegmentRoutingManager;
import org.onosproject.segmentrouting.SegmentRoutingService;
@@ -29,6 +31,7 @@
/**
* Command to remove a pseudowire.
*/
+@Service
@Command(scope = "onos", name = "sr-pw-remove",
description = "Remove a pseudowire")
public class PseudowireRemoveCommand extends AbstractShellCommand {
@@ -36,10 +39,11 @@
@Argument(index = 0, name = "pwId",
description = "pseudowire ID",
required = true, multiValued = false)
+ @Completion(PseudowireIdCompleter.class)
String pwId;
@Override
- protected void execute() {
+ protected void doExecute() {
SegmentRoutingService srService =
AbstractShellCommand.get(SegmentRoutingService.class);
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/RerouteNetworkCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/RerouteNetworkCommand.java
index 40525f2..6e8d3e9 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/RerouteNetworkCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/RerouteNetworkCommand.java
@@ -17,7 +17,8 @@
package org.onosproject.segmentrouting.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.cli.AbstractShellCommand;
import org.onosproject.segmentrouting.SegmentRoutingService;
@@ -25,12 +26,13 @@
* Command to manually trigger routing and rule-population in the network.
*
*/
+@Service
@Command(scope = "onos", name = "sr-reroute-network",
description = "Repopulate routing rules given current network state")
public class RerouteNetworkCommand extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
SegmentRoutingService srService =
AbstractShellCommand.get(SegmentRoutingService.class);
srService.rerouteNetwork();
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/ShouldProgramCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/ShouldProgramCommand.java
index 43a0213..250fb3b 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/ShouldProgramCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/ShouldProgramCommand.java
@@ -16,7 +16,8 @@
package org.onosproject.segmentrouting.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.cli.AbstractShellCommand;
import org.onosproject.cluster.NodeId;
import org.onosproject.net.DeviceId;
@@ -28,11 +29,12 @@
/**
* Display current shouldProgram map.
*/
+@Service
@Command(scope = "onos", name = "sr-should-program",
description = "Display current shouldProgram map")
public class ShouldProgramCommand extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
SegmentRoutingService srService = AbstractShellCommand.get(SegmentRoutingService.class);
Map<Set<DeviceId>, NodeId> shouldProgram = srService.getShouldProgram();
Map<DeviceId, Boolean> shouldProgramCache = srService.getShouldProgramCache();
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/TunnelAddCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/TunnelAddCommand.java
index 6b3e1fc..0e487d0 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/TunnelAddCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/TunnelAddCommand.java
@@ -15,8 +15,9 @@
*/
package org.onosproject.segmentrouting.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.cli.AbstractShellCommand;
import org.onosproject.segmentrouting.DefaultTunnel;
import org.onosproject.segmentrouting.SegmentRoutingService;
@@ -30,6 +31,7 @@
/**
* Command to add a new tunnel.
*/
+@Service
@Command(scope = "onos", name = "sr-tunnel-add",
description = "Create a new tunnel")
public class TunnelAddCommand extends AbstractShellCommand {
@@ -46,7 +48,7 @@
@Override
- protected void execute() {
+ protected void doExecute() {
SegmentRoutingService srService =
AbstractShellCommand.get(SegmentRoutingService.class);
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/TunnelListCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/TunnelListCommand.java
index 7984eb4..6c5f33d 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/TunnelListCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/TunnelListCommand.java
@@ -15,7 +15,8 @@
*/
package org.onosproject.segmentrouting.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.cli.AbstractShellCommand;
import org.onosproject.segmentrouting.SegmentRoutingService;
import org.onosproject.segmentrouting.Tunnel;
@@ -23,6 +24,7 @@
/**
* Command to show the list of tunnels.
*/
+@Service
@Command(scope = "onos", name = "sr-tunnel-list",
description = "Lists all tunnels")
public class TunnelListCommand extends AbstractShellCommand {
@@ -31,7 +33,7 @@
" id=%s, path=%s";
@Override
- protected void execute() {
+ protected void doExecute() {
SegmentRoutingService srService =
AbstractShellCommand.get(SegmentRoutingService.class);
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/TunnelRemoveCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/TunnelRemoveCommand.java
index b9a7edb..f5f0299 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/TunnelRemoveCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/TunnelRemoveCommand.java
@@ -17,8 +17,9 @@
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.cli.AbstractShellCommand;
import org.onosproject.segmentrouting.DefaultTunnel;
import org.onosproject.segmentrouting.SegmentRoutingService;
@@ -28,6 +29,7 @@
/**
* Command to remove a tunnel.
*/
+@Service
@Command(scope = "onos", name = "sr-tunnel-remove",
description = "Remove a tunnel")
public class TunnelRemoveCommand extends AbstractShellCommand {
@@ -38,7 +40,7 @@
String tunnelId;
@Override
- protected void execute() {
+ protected void doExecute() {
SegmentRoutingService srService =
AbstractShellCommand.get(SegmentRoutingService.class);
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/VerifyGroupsCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/VerifyGroupsCommand.java
index 3e89ca4..385260e 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/VerifyGroupsCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/VerifyGroupsCommand.java
@@ -16,9 +16,12 @@
package org.onosproject.segmentrouting.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.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.cli.net.DeviceIdCompleter;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
import org.onosproject.net.device.DeviceService;
@@ -29,6 +32,7 @@
* and corrects the buckets if necessary. Outcome can be viewed in the 'groups'
* command.
*/
+@Service
@Command(scope = "onos", name = "sr-verify-groups",
description = "Triggers the verification of hashed groups in the specified "
+ "device. Does not return any output; users can query the results "
@@ -37,10 +41,11 @@
@Argument(index = 0, name = "uri", description = "Device ID",
required = true, multiValued = false)
+ @Completion(DeviceIdCompleter.class)
String uri = null;
@Override
- protected void execute() {
+ protected void doExecute() {
DeviceService deviceService = get(DeviceService.class);
SegmentRoutingService srService =
AbstractShellCommand.get(SegmentRoutingService.class);
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/XconnectAddCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/XconnectAddCommand.java
index a1ad929..762b9f3 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/XconnectAddCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/XconnectAddCommand.java
@@ -16,10 +16,15 @@
package org.onosproject.segmentrouting.cli;
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.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.packet.VlanId;
import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.cli.PlaceholderCompleter;
+import org.onosproject.cli.net.DeviceIdCompleter;
+import org.onosproject.cli.net.PortNumberCompleter;
import org.onosproject.net.DeviceId;
import org.onosproject.net.PortNumber;
import org.onosproject.segmentrouting.xconnect.api.XconnectService;
@@ -29,31 +34,36 @@
/**
* Creates Xconnect.
*/
+@Service
@Command(scope = "onos", name = "sr-xconnect-add", description = "Create Xconnect")
public class XconnectAddCommand extends AbstractShellCommand {
@Argument(index = 0, name = "deviceId",
description = "Device ID",
required = true, multiValued = false)
+ @Completion(DeviceIdCompleter.class)
private String deviceIdStr;
@Argument(index = 1, name = "vlanId",
description = "VLAN ID",
required = true, multiValued = false)
+ @Completion(PlaceholderCompleter.class)
private String vlanIdStr;
@Argument(index = 2, name = "port1",
description = "Port 1",
required = true, multiValued = false)
+ @Completion(PortNumberCompleter.class)
private String port1Str;
@Argument(index = 3, name = "port2",
description = "Port 2",
required = true, multiValued = false)
+ @Completion(PortNumberCompleter.class)
private String port2Str;
@Override
- protected void execute() {
+ protected void doExecute() {
DeviceId deviceId = DeviceId.deviceId(deviceIdStr);
VlanId vlanId = VlanId.vlanId(vlanIdStr);
PortNumber port1 = PortNumber.portNumber(port1Str);
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/XconnectListCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/XconnectListCommand.java
index 43919c4..44a7d37 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/XconnectListCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/XconnectListCommand.java
@@ -15,17 +15,19 @@
*/
package org.onosproject.segmentrouting.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.cli.AbstractShellCommand;
import org.onosproject.segmentrouting.xconnect.api.XconnectService;
/**
* Lists Xconnects.
*/
+@Service
@Command(scope = "onos", name = "sr-xconnect", description = "Lists all Xconnects")
public class XconnectListCommand extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
XconnectService xconnectService = get(XconnectService.class);
xconnectService.getXconnects().forEach(desc -> print("%s", desc));
}
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/XconnectNextListCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/XconnectNextListCommand.java
index 18b2033..0b81186 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/XconnectNextListCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/XconnectNextListCommand.java
@@ -16,7 +16,8 @@
package org.onosproject.segmentrouting.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.cli.AbstractShellCommand;
import org.onosproject.segmentrouting.xconnect.api.XconnectKey;
import org.onosproject.segmentrouting.xconnect.api.XconnectService;
@@ -28,11 +29,12 @@
/**
* Command to read the current state of the xconnect next stores.
*/
+@Service
@Command(scope = "onos", name = "sr-next-xconnect",
description = "Displays the current next-id for xconnect")
public class XconnectNextListCommand extends AbstractShellCommand {
@Override
- protected void execute() {
+ protected void doExecute() {
XconnectService xconnectService =
AbstractShellCommand.get(XconnectService.class);
print(xconnectService.getNext());
diff --git a/app/src/main/java/org/onosproject/segmentrouting/cli/XconnectRemoveCommand.java b/app/src/main/java/org/onosproject/segmentrouting/cli/XconnectRemoveCommand.java
index 224a600..e651338 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/XconnectRemoveCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/XconnectRemoveCommand.java
@@ -15,30 +15,37 @@
*/
package org.onosproject.segmentrouting.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.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.packet.VlanId;
import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.cli.PlaceholderCompleter;
+import org.onosproject.cli.net.DeviceIdCompleter;
import org.onosproject.net.DeviceId;
import org.onosproject.segmentrouting.xconnect.api.XconnectService;
/**
* Deletes Xconnect.
*/
+@Service
@Command(scope = "onos", name = "sr-xconnect-remove", description = "Remove Xconnect")
public class XconnectRemoveCommand extends AbstractShellCommand {
@Argument(index = 0, name = "deviceId",
description = "Device ID",
required = true, multiValued = false)
+ @Completion(DeviceIdCompleter.class)
private String deviceIdStr;
@Argument(index = 1, name = "vlanId",
description = "VLAN ID",
required = true, multiValued = false)
+ @Completion(PlaceholderCompleter.class)
private String vlanIdStr;
@Override
- protected void execute() {
+ protected void doExecute() {
DeviceId deviceId = DeviceId.deviceId(deviceIdStr);
VlanId vlanId = VlanId.vlanId(vlanIdStr);
diff --git a/app/src/main/java/org/onosproject/segmentrouting/xconnect/api/XconnectService.java b/app/src/main/java/org/onosproject/segmentrouting/xconnect/api/XconnectService.java
index 4e82524..9ef7672 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/xconnect/api/XconnectService.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/xconnect/api/XconnectService.java
@@ -16,7 +16,6 @@
package org.onosproject.segmentrouting.xconnect.api;
import com.google.common.collect.ImmutableMap;
-import org.apache.felix.scr.annotations.Service;
import org.onlab.packet.VlanId;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
@@ -28,7 +27,6 @@
/**
* VLAN cross connect between exactly two ports.
*/
-@Service
public interface XconnectService {
/**
diff --git a/app/src/main/java/org/onosproject/segmentrouting/xconnect/impl/XconnectManager.java b/app/src/main/java/org/onosproject/segmentrouting/xconnect/impl/XconnectManager.java
index 1f41fda..be1dafc 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/xconnect/impl/XconnectManager.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/xconnect/impl/XconnectManager.java
@@ -18,12 +18,6 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferenceCardinality;
-import org.apache.felix.scr.annotations.Service;
import org.onlab.packet.Ethernet;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
@@ -74,6 +68,11 @@
import org.onosproject.store.service.Serializer;
import org.onosproject.store.service.StorageService;
import org.onosproject.store.service.Versioned;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -93,37 +92,36 @@
import static org.onlab.util.Tools.groupedThreads;
-@Service
-@Component(immediate = true)
+@Component(immediate = true, service = XconnectService.class)
public class XconnectManager implements XconnectService {
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
private CoreService coreService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
private CodecService codecService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
private StorageService storageService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
public NetworkConfigService netCfgService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
public DeviceService deviceService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
public FlowObjectiveService flowObjectiveService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
public MastershipService mastershipService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.OPTIONAL)
public SegmentRoutingService srService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
public InterfaceService interfaceService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
HostService hostService;
private static final String APP_NAME = "org.onosproject.xconnect";
diff --git a/web/BUCK b/web/BUCK
deleted file mode 100644
index 9706438..0000000
--- a/web/BUCK
+++ /dev/null
@@ -1,16 +0,0 @@
-COMPILE_DEPS = [
- '//lib:CORE_DEPS',
- '//lib:JACKSON',
- '//lib:javax.ws.rs-api',
- '//utils/rest:onlab-rest',
- '//apps/segmentrouting/app:onos-apps-segmentrouting-app',
-]
-
-osgi_jar_with_tests (
- deps = COMPILE_DEPS,
- web_context = '/onos/segmentrouting',
- api_title = 'Segment Routing REST API',
- api_version = '1.0',
- api_description = 'REST API for Segment Routing Application',
- api_package = 'org.onosproject.segmentrouting.web',
-)