route-remove cli command with source type addition
Change-Id: I420d7d0273c3b0c883c69c9f64fbe854fa1b6c65
diff --git a/apps/route-service/app/src/main/java/org/onosproject/routeservice/cli/RouteRemoveCommand.java b/apps/route-service/app/src/main/java/org/onosproject/routeservice/cli/RouteRemoveCommand.java
index 9fef2ec..24ecc71 100644
--- a/apps/route-service/app/src/main/java/org/onosproject/routeservice/cli/RouteRemoveCommand.java
+++ b/apps/route-service/app/src/main/java/org/onosproject/routeservice/cli/RouteRemoveCommand.java
@@ -41,6 +41,10 @@
required = true)
String nextHopString = null;
+ @Argument(index = 2, name = "source", description = "Source type of the route",
+ required = false)
+ String source = null;
+
@Override
protected void execute() {
RouteAdminService service = AbstractShellCommand.get(RouteAdminService.class);
@@ -48,7 +52,14 @@
IpPrefix prefix = IpPrefix.valueOf(prefixString);
IpAddress nextHop = IpAddress.valueOf(nextHopString);
- service.withdraw(Collections.singleton(new Route(Route.Source.STATIC, prefix, nextHop)));
+ // Routes through cli without mentioning source then it is created as STATIC,
+ // otherwise routes are created with corresponding source.
+
+ Route route = source == null ?
+ new Route(Route.Source.STATIC, prefix, nextHop) :
+ new Route(Route.Source.valueOf(source), prefix, nextHop);
+
+ service.withdraw(Collections.singleton(route));
}
}