[CORD-2486] Improve Mcast CLI APIs
It adds following commands:
- sr-mcast-tree which shows the mapping group-tree
- sr-mcast-next which shows the mapping device-next
- mcast-routes which is similar to the unicast command (routes)
It improve following commands:
- mcast-join adds completer and improves output
- mcast-delete adds completer and improves output
- mcast-show improves output and adds completer
Change-Id: I4e273ac23b05142026b6b77317b0c9b7af76c3ec
diff --git a/cli/src/main/java/org/onosproject/cli/net/McastJoinCommand.java b/cli/src/main/java/org/onosproject/cli/net/McastJoinCommand.java
index f0dc33e..83969a8 100644
--- a/cli/src/main/java/org/onosproject/cli/net/McastJoinCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/McastJoinCommand.java
@@ -30,6 +30,10 @@
description = "Installs a source, multicast group flow")
public class McastJoinCommand extends AbstractShellCommand {
+ // Format for group line
+ private static final String FORMAT_MAPPING = "Added the mcast route: " +
+ "origin=%s, group=%s, source=%s";
+
@Argument(index = 0, name = "sAddr",
description = "IP Address of the multicast source. '*' can be used for any source (*, G) entry",
required = true, multiValued = false)
@@ -54,7 +58,6 @@
protected void execute() {
MulticastRouteService mcastRouteManager = get(MulticastRouteService.class);
- //McastRoute mRoute = McastForwarding.createStaticRoute(sAddr, gAddr);
McastRoute mRoute = new McastRoute(IpAddress.valueOf(sAddr),
IpAddress.valueOf(gAddr), McastRoute.Type.STATIC);
mcastRouteManager.add(mRoute);
@@ -66,12 +69,15 @@
if (ports != null) {
for (String egCP : ports) {
- log.debug("Egress port provided: " + egCP);
ConnectPoint egress = ConnectPoint.deviceConnectPoint(egCP);
mcastRouteManager.addSink(mRoute, egress);
}
}
- print("Added the mcast route: %s", mRoute);
+ printMcastRoute(mRoute);
+ }
+
+ private void printMcastRoute(McastRoute mcastRoute) {
+ print(FORMAT_MAPPING, mcastRoute.type(), mcastRoute.group(), mcastRoute.source());
}
}