From: garciadeblas Date: Tue, 28 Apr 2020 06:55:45 +0000 (+0000) Subject: Fixed ns-list for pre-7.0 version X-Git-Tag: v7.1.0rc1^2~4 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F26%2F8826%2F1;p=osm%2Fosmclient.git Fixed ns-list for pre-7.0 version Change-Id: I3a7814753997a925de28b19770e95612a656726f Signed-off-by: garciadeblas --- diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index 59ecebd..a17340b 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -302,6 +302,7 @@ def ns_list(ctx, filter, long): summary += "{}: {}".format(elementType, message) summary += "TOTAL Exec. Env.: {}".format(n_ee) return summary + logger.debug("") if filter: check_client_version(ctx.obj, '--filter') @@ -334,10 +335,11 @@ def ns_list(ctx, filter, long): fullclassname = ctx.obj.__module__ + "." + ctx.obj.__class__.__name__ if fullclassname == 'osmclient.sol005.client.Client': nsr = ns + logger.debug('NS info: {}'.format(nsr)) nsr_name = nsr['name'] nsr_id = nsr['_id'] date = datetime.fromtimestamp(nsr['create-time']).strftime("%Y-%m-%dT%H:%M:%S") - ns_state = nsr['nsState'] + ns_state = nsr.get('nsState', nsr['_admin']['nsState']) if long: deployment_status = summarize_deployment_status(nsr['deploymentStatus']) config_status = summarize_config_status(nsr['configurationStatus']) @@ -357,9 +359,12 @@ def ns_list(ctx, filter, long): break #vim = '{} ({})'.format(vim_name, vim_id) vim = vim_name - current_operation = "{} ({})".format(nsr['currentOperation'],nsr['currentOperationID']) + if 'currentOperation' in nsr: + current_operation = "{} ({})".format(nsr['currentOperation'],nsr['currentOperationID']) + else: + current_operation = "{} ({})".format(nsr['_admin'].get('current-operation','-'), nsr['_admin']['nslcmop']) error_details = "N/A" - if ns_state == "BROKEN" or ns_state == "DEGRADED" or nsr['errorDescription']: + if ns_state == "BROKEN" or ns_state == "DEGRADED" or nsr.get('errorDescription'): error_details = "{}\nDetail: {}".format(nsr['errorDescription'], nsr['errorDetail']) else: nsopdata = ctx.obj.ns.get_opdata(ns['id'])