- Adds error handling for Segment routing CLI
- Removes SegmentRoutingManager reference from TunnelHandler and PolicyHandler
Change-Id: Iab6acdc489d41a63ebf6b37b65d0e82448a8b25a
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/cli/PolicyRemoveCommand.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/cli/PolicyRemoveCommand.java
index b4f3b35..34fe40d 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/cli/PolicyRemoveCommand.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/cli/PolicyRemoveCommand.java
@@ -19,6 +19,7 @@
import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.segmentrouting.PolicyHandler;
import org.onosproject.segmentrouting.SegmentRoutingService;
import org.onosproject.segmentrouting.TunnelPolicy;
@@ -41,6 +42,9 @@
AbstractShellCommand.get(SegmentRoutingService.class);
TunnelPolicy.Builder tpb = TunnelPolicy.builder().setPolicyId(policyId);
- srService.removePolicy(tpb.build());
+ PolicyHandler.Result result = srService.removePolicy(tpb.build());
+ if (result == PolicyHandler.Result.POLICY_NOT_FOUND) {
+ print("ERROR: the policy is not found");
+ }
}
}
\ No newline at end of file