REST API for pseudowire addition / deletion.
Refactored pseudowire code to use REST in order
to add or delete pseudowires individually. Previous implementation
used the network configuration, which is now completely
removed from the code. Further, I re-organized the code
and create a utility class that holds all the necessary
functionality for verifying pseudowires.
Further, I removed all mastership checks in the pw code
since now a specific pseudowire creation is sent to a single
instance, which will handle the call.
Change-Id: I1eb5e7cc7730ad792ea84dd389475768153e2b68
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 098bbf9..0f027b2 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireRemoveCommand.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireRemoveCommand.java
@@ -23,6 +23,8 @@
import org.onosproject.segmentrouting.SegmentRoutingService;
import org.onosproject.segmentrouting.pwaas.L2TunnelHandler;
+import static org.onosproject.segmentrouting.pwaas.PwaasUtil.parsePwId;
+
/**
* Command to remove a pseudowire.
@@ -44,8 +46,15 @@
// remove the pseudowire
SegmentRoutingManager mngr = (SegmentRoutingManager) srService;
- L2TunnelHandler.Result res = mngr.removePseudowire(pwId);
+ int pwIntId;
+ try {
+ pwIntId = parsePwId(pwId);
+ } catch (Exception e) {
+ print("Exception while parsing pseudowire id : {}", e);
+ return;
+ }
+ L2TunnelHandler.Result res = mngr.removePseudowire(pwIntId);
switch (res) {
case REMOVAL_ERROR:
error("Error in deletion, pseudowire not found!");