Feature 10996: Adds ns-op-cancel command
[osm/osmclient.git] / osmclient / common / wait.py
index d3f673c..3f5b51f 100644 (file)
@@ -58,6 +58,8 @@ def _get_finished_states(entity):
     """
     if entity == "NS" or entity == "NSI":
         return ("COMPLETED", "PARTIALLY_COMPLETED"), ("FAILED_TEMP", "FAILED")
+    elif entity == "OPCANCEL":
+        return ("FAILED_TEMP"), ("COMPLETED",)
     else:
         return ("ENABLED",), ("ERROR",)
 
@@ -72,7 +74,7 @@ def _get_operational_state(resp, entity):
     :param entity: can be NS, NSI, or other
     :return: status of the operation
     """
-    if entity == "NS" or entity == "NSI":
+    if entity in ["NS", "NSI", "OPCANCEL"]:
         return resp.get("operationState")
     else:
         return resp.get("_admin", {}).get("operationalState")
@@ -111,7 +113,7 @@ def _get_detailed_status(resp, entity):
     :param entity: can be NS, NSI, or other
     :return:
     """
-    if entity in ("NS", "NSI"):
+    if entity in ("NS", "NSI", "OPCANCEL"):
         # For NS and NSI, 'detailed-status' is a JSON "root" member:
         return resp.get("detailed-status")
     else: