Merge remote-tracking branch 'origin/master' into merge-master
Change-Id: I4608093c4400a313b253508ac6bc8a84ecba5c7e
diff --git a/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java b/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
index a41c58d..e759020 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;
@@ -165,101 +161,100 @@
/**
* Segment routing manager.
*/
-@Service
-@Component(immediate = true)
+@Component(immediate = true, service = SegmentRoutingService.class)
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.")
+ //@Property(name = "activeProbing", boolValue = true,
+ // label = "Enable active probing to discover dual-homed hosts.")
boolean activeProbing = true;
- @Property(name = "singleHomedDown", boolValue = false,
- label = "Enable administratively taking down single-homed hosts "
- + "when all uplinks are gone")
+ //@Property(name = "singleHomedDown", boolValue = false,
+ // label = "Enable administratively taking down single-homed hosts "
+ // + "when all uplinks are gone")
boolean singleHomedDown = false;
- @Property(name = "respondToUnknownHosts", boolValue = true,
- label = "Enable this to respond to ARP/NDP requests from unknown hosts.")
+ //@Property(name = "respondToUnknownHosts", boolValue = true,
+ // label = "Enable this to respond to ARP/NDP requests from unknown hosts.")
boolean respondToUnknownHosts = true;
- @Property(name = "routeDoubleTaggedHosts", boolValue = false,
- label = "Program flows and groups to pop and route double tagged hosts")
+ //@Property(name = "routeDoubleTaggedHosts", boolValue = false,
+ // label = "Program flows and groups to pop and route double tagged hosts")
boolean routeDoubleTaggedHosts = false;
private static final int DEFAULT_INTERNAL_VLAN = 4094;
- @Property(name = "defaultInternalVlan", intValue = DEFAULT_INTERNAL_VLAN,
- label = "internal vlan assigned by default to unconfigured ports")
+ //@Property(name = "defaultInternalVlan", intValue = DEFAULT_INTERNAL_VLAN,
+ // label = "internal vlan assigned by default to unconfigured ports")
private int defaultInternalVlan = DEFAULT_INTERNAL_VLAN;
private static final int PW_TRANSPORT_VLAN = 4090;
- @Property(name = "pwTransportVlan", intValue = PW_TRANSPORT_VLAN,
- label = "vlan used for transport of pseudowires between switches")
+ //@Property(name = "pwTransportVlan", intValue = PW_TRANSPORT_VLAN,
+ // label = "vlan used for transport of pseudowires between switches")
private int pwTransportVlan = PW_TRANSPORT_VLAN;
ArpHandler arpHandler = null;
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..337a65d 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,9 @@
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.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 +32,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 {
@@ -48,7 +50,7 @@
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..aad9a7e 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,9 @@
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.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 +38,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 {
@@ -54,7 +56,7 @@
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..a00663b 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/McastRoleListCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/McastRoleListCommand.java
@@ -19,8 +19,9 @@
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.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.packet.IpAddress;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.mcast.cli.McastGroupCompleter;
@@ -40,6 +41,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 {
@@ -63,7 +65,7 @@
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..2d08196 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/McastTreeListCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/McastTreeListCommand.java
@@ -21,8 +21,9 @@
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.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.onlab.packet.IpAddress;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.mcast.cli.McastGroupCompleter;
@@ -38,6 +39,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 {
@@ -63,7 +65,7 @@
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..fb1705c 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,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.SegmentRoutingManager;
import org.onosproject.segmentrouting.SegmentRoutingService;
@@ -29,6 +30,7 @@
/**
* Command to remove a pseudowire.
*/
+@Service
@Command(scope = "onos", name = "sr-pw-remove",
description = "Remove a pseudowire")
public class PseudowireRemoveCommand extends AbstractShellCommand {
@@ -39,7 +41,7 @@
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..59b4315 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/VerifyGroupsCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/VerifyGroupsCommand.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.Device;
import org.onosproject.net.DeviceId;
@@ -29,6 +30,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 "
@@ -40,7 +42,7 @@
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..01c3001 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/XconnectAddCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/XconnectAddCommand.java
@@ -16,8 +16,9 @@
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.lifecycle.Service;
import org.onlab.packet.VlanId;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
@@ -29,6 +30,7 @@
/**
* Creates Xconnect.
*/
+@Service
@Command(scope = "onos", name = "sr-xconnect-add", description = "Create Xconnect")
public class XconnectAddCommand extends AbstractShellCommand {
@Argument(index = 0, name = "deviceId",
@@ -53,7 +55,7 @@
@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..e0f77de 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/XconnectRemoveCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/XconnectRemoveCommand.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.onlab.packet.VlanId;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.net.DeviceId;
@@ -25,6 +26,7 @@
/**
* Deletes Xconnect.
*/
+@Service
@Command(scope = "onos", name = "sr-xconnect-remove", description = "Remove Xconnect")
public class XconnectRemoveCommand extends AbstractShellCommand {
@Argument(index = 0, name = "deviceId",
@@ -38,7 +40,7 @@
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 b65faa9..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.OPTIONAL_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";