X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osmclient%2Fscripts%2Fosm.py;h=66d1f32e858a583a70ccbf90d4eb966a2ff75733;hb=cf95eefc01755e1f18459ffd921ebcfe4fba5cc1;hp=fd92477d3750faa587eec24a1f884d0aeaf3ebda;hpb=9c79a482e22b9004d7a86fca1781ad4bf7bd32fc;p=osm%2Fosmclient.git diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index fd92477..66d1f32 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -230,20 +230,39 @@ def vnf_list(ctx, ns): except ClientException as inst: print(inst.message) exit(1) - table = PrettyTable( - ['vnf name', - 'id', - 'operational status', - 'config status']) - for vnfr in resp: - if 'mgmt-interface' not in vnfr: - vnfr['mgmt-interface'] = {} - vnfr['mgmt-interface']['ip-address'] = None - table.add_row( - [vnfr['name'], - vnfr['id'], - vnfr['operational-status'], - vnfr['config-status']]) + fullclassname = ctx.obj.__module__ + "." + ctx.obj.__class__.__name__ + if fullclassname == 'osmclient.sol005.client.Client': + table = PrettyTable( + ['vnf id', + 'name', + 'ns id', + 'vnf member index', + 'vnfd name', + 'ip address']) + for vnfr in resp: + name = vnfr['name'] if 'name' in vnfr else '-' + table.add_row( + [vnfr['_id'], + name, + vnfr['nsr-id-ref'], + vnfr['member-vnf-index-ref'], + vnfr['vnfd-ref'], + vnfr['ip-address']]) + else: + table = PrettyTable( + ['vnf name', + 'id', + 'operational status', + 'config status']) + for vnfr in resp: + if 'mgmt-interface' not in vnfr: + vnfr['mgmt-interface'] = {} + vnfr['mgmt-interface']['ip-address'] = None + table.add_row( + [vnfr['name'], + vnfr['id'], + vnfr['operational-status'], + vnfr['config-status']]) table.align = 'l' print(table)