- # For other entities, 'detailed-status' a leaf node to '_admin':
- return resp.get('_admin', {}).get('detailed-status')
+ # For VIM, WIM, SDN, 'detailed-status' is either:
+ # - a leaf node to '_admin' (operations NOT supported)
+ # - a leaf node of the Nth element in the list '_admin.operations[]' (operations supported by LCM and NBI)
+ # https://osm.etsi.org/gerrit/#/c/7767 : LCM support for operations
+ # https://osm.etsi.org/gerrit/#/c/7734 : NBI support for current_operation
+ ops = resp.get('_admin', {}).get('operations')
+ op_index = resp.get('_admin', {}).get('current_operation')
+ if ops and op_index:
+ # Operations are supported, verify operation index
+ if isinstance(op_index, (int)) or op_index.isdigit():
+ op_index = int(op_index)
+ if op_index > 0 and op_index < len(ops) and ops[op_index] and ops[op_index]["detailed-status"]:
+ return ops[op_index]["detailed-status"]
+ # operation index is either non-numeric or out-of-range
+ return 'Unexpected error when getting detailed-status!'
+ else:
+ # Operations are NOT supported
+ return resp.get('_admin', {}).get('detailed-status')