X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=osmclient%2Fscripts%2Fosm.py;h=6161e43420ae5972dff3aaf3fad14217351b9e3d;hb=c4959d198c1e6c49465b9bc01f90f1fba40e0a8e;hp=d405d6dc0d1f40812235cb3ee7011c81917c9c86;hpb=70a202f07cc014070a1a31708366ef2f165d0eb8;p=osm%2Fosmclient.git diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index d405d6d..6161e43 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -370,9 +370,9 @@ def ns_list(ctx, filter, long): project = '-' deployment_status = nsr['operational-status'] if 'operational-status' in nsr else 'Not found' ns_state = deployment_status - config_status = nsr['config-status'] if 'config-status' in nsr else 'Not found' + config_status = nsr.get('config-status', 'Not found') current_operation = "Unknown" - error_details = nsr['detailed-status'] if 'detailed-status' in nsr else 'Not found' + error_details = nsr.get('detailed-status', 'Not found') if config_status == "config_not_needed": config_status = "configured (no charms)" @@ -1446,11 +1446,13 @@ def nsd_create2(ctx, filename, overwrite, skip_charm_build): nsd_create(ctx, filename, overwrite=overwrite, skip_charm_build=skip_charm_build) -def vnfd_create(ctx, filename, overwrite, skip_charm_build): +def vnfd_create(ctx, filename, overwrite, skip_charm_build, override_epa, override_nonepa, override_paravirt): logger.debug("") # try: check_client_version(ctx.obj, ctx.command.name) - ctx.obj.vnfd.create(filename, overwrite=overwrite, skip_charm_build=skip_charm_build) + ctx.obj.vnfd.create(filename, overwrite=overwrite, skip_charm_build=skip_charm_build, + override_epa=override_epa, override_nonepa=override_nonepa, + override_paravirt=override_paravirt) # except ClientException as e: # print(str(e)) # exit(1) @@ -1465,14 +1467,21 @@ def vnfd_create(ctx, filename, overwrite, skip_charm_build): '"key1.key2...=value[;key3...=value;...]"') @click.option('--skip-charm-build', default=False, is_flag=True, help='The charm will not be compiled, it is assumed to already exist') -@click.pass_context -def vnfd_create1(ctx, filename, overwrite, skip_charm_build): +@click.option('--override-epa', required=False, default=False, is_flag=True, + help='adds guest-epa parameters to all VDU') +@click.option('--override-nonepa', required=False, default=False, is_flag=True, + help='removes all guest-epa parameters from all VDU') +@click.option('--override-paravirt', required=False, default=False, is_flag=True, + help='overrides all VDU interfaces to PARAVIRT') +@click.pass_context +def vnfd_create1(ctx, filename, overwrite, skip_charm_build, override_epa, override_nonepa, override_paravirt): """creates a new VNFD/VNFpkg FILENAME: VNFD yaml file or VNFpkg tar.gz file """ logger.debug("") - vnfd_create(ctx, filename, overwrite=overwrite, skip_charm_build=skip_charm_build) + vnfd_create(ctx, filename, overwrite=overwrite, skip_charm_build=skip_charm_build, + override_epa=override_epa, override_nonepa=override_nonepa, override_paravirt=override_paravirt) @cli_osm.command(name='vnfpkg-create', short_help='creates a new VNFD/VNFpkg') @@ -1484,14 +1493,21 @@ def vnfd_create1(ctx, filename, overwrite, skip_charm_build): '"key1.key2...=value[;key3...=value;...]"') @click.option('--skip-charm-build', default=False, is_flag=True, help='The charm will not be compiled, it is assumed to already exist') -@click.pass_context -def vnfd_create2(ctx, filename, overwrite, skip_charm_build): +@click.option('--override-epa', required=False, default=False, is_flag=True, + help='adds guest-epa parameters to all VDU') +@click.option('--override-nonepa', required=False, default=False, is_flag=True, + help='removes all guest-epa parameters from all VDU') +@click.option('--override-paravirt', required=False, default=False, is_flag=True, + help='overrides all VDU interfaces to PARAVIRT') +@click.pass_context +def vnfd_create2(ctx, filename, overwrite, skip_charm_build, override_epa, override_nonepa, override_paravirt): """creates a new VNFD/VNFpkg FILENAME: NF Package Folder, NF Descriptor yaml file or NFpkg tar.gz file """ logger.debug("") - vnfd_create(ctx, filename, overwrite=overwrite, skip_charm_build=skip_charm_build) + vnfd_create(ctx, filename, overwrite=overwrite, skip_charm_build=skip_charm_build, + override_epa=override_epa, override_nonepa=override_nonepa, override_paravirt=override_paravirt) @cli_osm.command(name='nfpkg-create', short_help='creates a new NFpkg') @@ -1503,14 +1519,21 @@ def vnfd_create2(ctx, filename, overwrite, skip_charm_build): '"key1.key2...=value[;key3...=value;...]"') @click.option('--skip-charm-build', default=False, is_flag=True, help='The charm will not be compiled, it is assumed to already exist') -@click.pass_context -def nfpkg_create(ctx, filename, overwrite, skip_charm_build): +@click.option('--override-epa', required=False, default=False, is_flag=True, + help='adds guest-epa parameters to all VDU') +@click.option('--override-nonepa', required=False, default=False, is_flag=True, + help='removes all guest-epa parameters from all VDU') +@click.option('--override-paravirt', required=False, default=False, is_flag=True, + help='overrides all VDU interfaces to PARAVIRT') +@click.pass_context +def nfpkg_create(ctx, filename, overwrite, skip_charm_build, override_epa, override_nonepa, override_paravirt): """creates a new NFpkg FILENAME: NF Package Folder, NF Descriptor yaml file or NFpkg tar.gz filems to build """ logger.debug("") - vnfd_create(ctx, filename, overwrite=overwrite, skip_charm_build=skip_charm_build) + vnfd_create(ctx, filename, overwrite=overwrite, skip_charm_build=skip_charm_build, + override_epa=override_epa, override_nonepa=override_nonepa, override_paravirt=override_paravirt) @cli_osm.command(name='ns-create', short_help='creates a new Network Service instance') @@ -2258,8 +2281,10 @@ def vim_delete(ctx, name, force, wait): # help='update list from RO') @click.option('--filter', default=None, help='restricts the list to the VIM accounts matching the filter') +@click.option('--long', is_flag=True, + help='get more details of the NS (project, vim, deployment status, configuration status.') @click.pass_context -def vim_list(ctx, filter): +def vim_list(ctx, filter, long): """list all VIM accounts""" logger.debug("") if filter: @@ -2271,9 +2296,23 @@ def vim_list(ctx, filter): resp = ctx.obj.vim.list(filter) # else: # resp = ctx.obj.vim.list(ro_update) - table = PrettyTable(['vim name', 'uuid']) + if long: + table = PrettyTable(['vim name', 'uuid', 'operational state', 'error details']) + else: + table = PrettyTable(['vim name', 'uuid']) for vim in resp: - table.add_row([vim['name'], vim['uuid']]) + if long: + vim_details = ctx.obj.vim.get(vim['uuid']) + if 'vim_password' in vim_details: + vim_details['vim_password']='********' + logger.debug('VIM details: {}'.format(yaml.safe_dump(vim_details))) + vim_state = vim_details['_admin'].get('operationalState', '-') + error_details = 'N/A' + if vim_state == 'ERROR': + error_details = vim_details['_admin'].get('detailed-status', 'Not found') + table.add_row([vim['name'], vim['uuid'], vim_state, wrap_text(text=error_details, width=80)]) + else: + table.add_row([vim['name'], vim['uuid']]) table.align = 'l' print(table)