From 63ab62675e9db9c956f7a676e2f0230f01d8ce9a Mon Sep 17 00:00:00 2001 From: tierno Date: Tue, 14 Jan 2020 22:58:53 +0000 Subject: [PATCH] remove deprecated hidden option not available for all click versions. Adding new timeout instantiation parameter Change-Id: I836a614790660e1828a30e698b4f5e2d3838a0a9 Signed-off-by: tierno --- osmclient/scripts/osm.py | 28 ++++++++++++++-------------- osmclient/sol005/ns.py | 2 ++ osmclient/sol005/nsi.py | 2 ++ 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index ab90dd7..99cbd47 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -1151,7 +1151,7 @@ def nsd_create(ctx, filename, overwrite): @cli_osm.command(name='nsd-create', short_help='creates a new NSD/NSpkg') @click.argument('filename') -@click.option('--overwrite', 'overwrite', default=None, hidden=True, +@click.option('--overwrite', 'overwrite', default=None, # hidden=True, help='Deprecated. Use override') @click.option('--override', 'overwrite', default=None, help='overrides fields in descriptor, format: ' @@ -1168,7 +1168,7 @@ def nsd_create1(ctx, filename, overwrite): @cli_osm.command(name='nspkg-create', short_help='creates a new NSD/NSpkg') @click.argument('filename') -@click.option('--overwrite', 'overwrite', default=None, hidden=True, +@click.option('--overwrite', 'overwrite', default=None, # hidden=True, help='Deprecated. Use override') @click.option('--override', 'overwrite', default=None, help='overrides fields in descriptor, format: ' @@ -1212,7 +1212,7 @@ def vnfd_create1(ctx, filename, overwrite): @cli_osm.command(name='vnfpkg-create', short_help='creates a new VNFD/VNFpkg') @click.argument('filename') -@click.option('--overwrite', 'overwrite', default=None, hidden=True, +@click.option('--overwrite', 'overwrite', default=None, # hidden=True, help='Deprecated. Use override') @click.option('--override', 'overwrite', default=None, help='overrides fields in descriptor, format: ' @@ -1229,7 +1229,7 @@ def vnfd_create2(ctx, filename, overwrite): @cli_osm.command(name='nfpkg-create', short_help='creates a new NFpkg') @click.argument('filename') -@click.option('--overwrite', 'overwrite', default=None, hidden=True, +@click.option('--overwrite', 'overwrite', default=None, # hidden=True, help='Deprecated. Use override') @click.option('--override', 'overwrite', default=None, help='overrides fields in descriptor, format: ' @@ -1312,7 +1312,7 @@ def nst_create(ctx, filename, overwrite): @cli_osm.command(name='nst-create', short_help='creates a new Network Slice Template (NST)') @click.argument('filename') -@click.option('--overwrite', 'overwrite', default=None, hidden=True, +@click.option('--overwrite', 'overwrite', default=None, # hidden=True, help='Deprecated. Use override') @click.option('--override', 'overwrite', default=None, help='overrides fields in descriptor, format: ' @@ -1329,7 +1329,7 @@ def nst_create1(ctx, filename, overwrite): @cli_osm.command(name='netslice-template-create', short_help='creates a new Network Slice Template (NST)') @click.argument('filename') -@click.option('--overwrite', 'overwrite', default=None, hidden=True, +@click.option('--overwrite', 'overwrite', default=None, # hidden=True, help='Deprecated. Use override') @click.option('--override', 'overwrite', default=None, help='overrides fields in descriptor, format: ' @@ -2227,15 +2227,15 @@ def wim_show(ctx, name): @click.option('--type', prompt=True, help='SDN controller type') -@click.option('--sdn_controller_version', hidden=True, +@click.option('--sdn_controller_version', # hidden=True, help='Deprecated. Use --config {version: sdn_controller_version}') @click.option('--url', help='URL in format http[s]://HOST:IP/') -@click.option('--ip_address', hidden=True, +@click.option('--ip_address', # hidden=True, help='Deprecated. Use --url') -@click.option('--port', hidden=True, +@click.option('--port', # hidden=True, help='Deprecated. Use --url') -@click.option('--switch_dpid', hidden=True, +@click.option('--switch_dpid', # hidden=True, help='Deprecated. Use --config {dpid: DPID}') @click.option('--config', help='Extra information for SDN in yaml format, as {dpid: (Openflow Datapath ID), version: version}') @@ -2286,10 +2286,10 @@ def sdnc_create(ctx, **kwargs): '{dpid: (Openflow Datapath ID), version: version}') @click.option('--user', help='SDN controller username') @click.option('--password', help='SDN controller password') -@click.option('--ip_address', hidden=True, help='Deprecated. Use --url') -@click.option('--port', hidden=True, help='Deprecated. Use --url') -@click.option('--switch_dpid', hidden=True, help='Deprecated. Use --config {switch_dpid: DPID}') -@click.option('--sdn_controller_version', hidden=True, help='Deprecated. Use --config {version: VERSION}') +@click.option('--ip_address', help='Deprecated. Use --url') # hidden=True +@click.option('--port', help='Deprecated. Use --url') # hidden=True +@click.option('--switch_dpid', help='Deprecated. Use --config {switch_dpid: DPID}') # hidden=True +@click.option('--sdn_controller_version', help='Deprecated. Use --config {version: VERSION}') # hidden=True @click.option('--wait', required=False, default=False, is_flag=True, help='do not return the control immediately, but keep it until the operation is completed, or timeout') @click.pass_context diff --git a/osmclient/sol005/ns.py b/osmclient/sol005/ns.py index 381ad42..12c5416 100644 --- a/osmclient/sol005/ns.py +++ b/osmclient/sol005/ns.py @@ -212,6 +212,8 @@ class Ns(object): wim_account = ns_config.pop("wim_account") if wim_account is not None: ns['wimAccountId'] = get_wim_account_id(wim_account) + if "timeout_ns_deploy" in ns_config: + ns["timeout_ns_deploy"] = ns_config.pop("timeout_ns_deploy") # print(yaml.safe_dump(ns)) try: diff --git a/osmclient/sol005/nsi.py b/osmclient/sol005/nsi.py index 7995595..c01b4e9 100644 --- a/osmclient/sol005/nsi.py +++ b/osmclient/sol005/nsi.py @@ -212,6 +212,8 @@ class Nsi(object): not additional_param_subnet.get("additionalParamsForVnf"): raise ValueError("Error at --config 'additionalParamsForSubnet' items must contain " "'additionalParamsForNs' and/or 'additionalParamsForVnf'") + if "timeout_nsi_deploy" in nsi_config: + nsi["timeout_nsi_deploy"] = nsi_config.pop("timeout_nsi_deploy") # print(yaml.safe_dump(nsi)) try: -- 2.25.1