From 1b6558ac63fb9dbea7e5bb1df4edbfa78d5e3b31 Mon Sep 17 00:00:00 2001 From: tierno Date: Fri, 21 Jun 2019 09:48:31 +0000 Subject: [PATCH] bug 773: allow ns-action without primitive_params allow execute primitives over a vdu Change-Id: Ie72516f409d2613df0ba8bc9544424669d379813 Signed-off-by: tierno --- osmclient/scripts/osm.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index 83b4727..fbc14d7 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -2779,9 +2779,11 @@ def vcs_list(ctx): @cli.command(name='ns-action') @click.argument('ns_name') -@click.option('--vnf_name', default=None) +@click.option('--vnf_name', default=None, help='member-vnf-index if the target is a vnf instead of a ns)') +@click.option('--vdu_id', default=None, help='vdu-id if the target is a vdu o a vnf') +@click.option('--vdu_count', default=None, help='number of vdu instance of this vdu_id') @click.option('--action_name', prompt=True) -@click.option('--params', prompt=True) +@click.option('--params', default=None) @click.option('--wait', required=False, default=False, @@ -2792,6 +2794,8 @@ def vcs_list(ctx): def ns_action(ctx, ns_name, vnf_name, + vdu_id, + vdu_count, action_name, params, wait): @@ -2801,15 +2805,22 @@ def ns_action(ctx, """ try: check_client_version(ctx.obj, ctx.command.name) - op_data={} + op_data = {} if vnf_name: - op_data['vnf_member_index'] = vnf_name + op_data['member_vnf_index'] = vnf_name + if vdu_id: + op_data['vdu_id'] = vdu_id + if vdu_count: + op_data['vdu_count_index'] = vdu_count op_data['primitive'] = action_name - op_data['primitive_params'] = yaml.load(params) + if params: + op_data['primitive_params'] = yaml.load(params) + else: + op_data['primitive_params'] = {} ctx.obj.ns.exec_op(ns_name, op_name='action', op_data=op_data, wait=wait) except ClientException as inst: - print((inst.message)) + print(inst.message) exit(1) -- 2.25.1