Better error handling in pseudowire implementation.
I refactored the pw handler to return meaningful very specific
errors for failures. As a result, I modified also the cli and rest
api implementations to use these fine grain errors accordingly.
Change-Id: I2429532f747c4560378c40be325b039ca0f5c925
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 4e2c4b7..277a1c3 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
@@ -119,14 +119,26 @@
L2TunnelDescription pw = new DefaultL2TunnelDescription(tun, policy);
L2TunnelHandler.Result res = srService.addPseudowire(pw);
switch (res) {
- case ADDITION_ERROR:
- print("Pseudowire could not be added!");
+ case WRONG_PARAMETERS:
+ print("Pseudowire could not be added , error in the parameters : \n\t%s",
+ res.getSpecificError());
+ break;
+ case CONFIGURATION_ERROR:
+ print("Pseudowire could not be added, configuration error : \n\t%s",
+ res.getSpecificError());
+ break;
+ case PATH_NOT_FOUND:
+ print("Pseudowire path not found : \n\t%s",
+ res.getSpecificError());
+ break;
+ case INTERNAL_ERROR:
+ print("Pseudowire could not be added, internal error : \n\t%s",
+ res.getSpecificError());
break;
case SUCCESS:
break;
default:
break;
}
-
}
}
\ No newline at end of file