Various pseudowire fixes and improvements.
- Co-ordination when creating - removing pseudowires from
different instances with a use of a DistributedLock.
- Fixed REST API To return json with specific error for
the single pw instantiation.
- Fixed REST API to return specific error also for pseudowires
that could not be decoded.
- Minor bug fix to return appropriate error when instantiating
a pw from the command line that could not be decoded.
- Fixed bug when creating spine-leaf-leaf pseudowire where we observed flows in pending state.
- Improved logging.
Change-Id: I60dd0ebf8af63ca74d18cfe4801d01846641fb7b
diff --git a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireAddCommand.java b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireAddCommand.java
index 277a1c3..d7d22b4 100644
--- a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireAddCommand.java
+++ b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireAddCommand.java
@@ -100,8 +100,9 @@
try {
tun = new DefaultL2Tunnel(parseMode(mode), parseVlan(sDTag), parsePwId(pwId), parsePWLabel(pwLabel));
- } catch (Exception e) {
- print("Exception while parsing L2Tunnel : {}", e);
+ } catch (IllegalArgumentException e) {
+ log.error("Exception while parsing L2Tunnel : \n\t %s", e.getMessage());
+ print("Exception while parsing L2Tunnel : \n\t %s", e.getMessage());
return;
}
@@ -111,13 +112,15 @@
parseVlan(cP1OuterVlan), ConnectPoint.deviceConnectPoint(cP2),
parseVlan(cP2InnerVlan), parseVlan(cP2OuterVlan));
- } catch (Exception e) {
- print("Exception while parsing L2TunnelPolicy : {}", e);
+ } catch (IllegalArgumentException e) {
+ log.error("Exception while parsing L2TunnelPolicy : \n\t %s", e.getMessage());
+ print("Exception while parsing L2TunnelPolicy : \n\t %s", e.getMessage());
return;
}
L2TunnelDescription pw = new DefaultL2TunnelDescription(tun, policy);
L2TunnelHandler.Result res = srService.addPseudowire(pw);
+ log.info("Deploying pseudowire {} via the command line.", pw);
switch (res) {
case WRONG_PARAMETERS:
print("Pseudowire could not be added , error in the parameters : \n\t%s",
diff --git a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireRemoveCommand.java b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireRemoveCommand.java
index 362ebbb..d0f217d 100644
--- a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireRemoveCommand.java
+++ b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/cli/PseudowireRemoveCommand.java
@@ -49,11 +49,13 @@
int pwIntId;
try {
pwIntId = parsePwId(pwId);
- } catch (Exception e) {
- print("Exception while parsing pseudowire id : {}", e);
+ } catch (IllegalArgumentException e) {
+ log.error("Exception while parsing pseudowire id : \n\t %s", e.getMessage());
+ print("Exception while parsing pseudowire id : \n\t %s", e.getMessage());
return;
}
+ log.info("Removing pseudowire {} from the command line.", pwIntId);
L2TunnelHandler.Result res = mngr.removePseudowire(pwIntId);
switch (res) {
case WRONG_PARAMETERS: