X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=osmclient%2Fscripts%2Fosm.py;h=58b34c5713688a5875bdddfc0f8ecf10603f9e6e;hb=8f4936bbd22fc700b9d1e64eb6b056bf7744b0a4;hp=44bc7be378f0997d9127ba05d1e29ce449db3052;hpb=2c087a32de17a0f5f386bab6513df2e3847ba3da;p=osm%2Fosmclient.git diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index 44bc7be..58b34c5 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -5551,6 +5551,53 @@ def vnf_scale( # exit(1) +@cli_osm.command( + name="ns-update", short_help="executes an update of a Network Service." +) +@click.argument("ns_name") +@click.option( + "--updatetype", required=True, type=str, help="available types: CHANGE_VNFPKG" +) +@click.option( + "--config", + required=True, + type=str, + help="extra information for update operation as YAML/JSON inline string as --config" + " '{changeVnfPackageData:[{vnfInstanceId: xxx, vnfdId: yyy}]}'", +) +@click.option( + "--timeout", required=False, default=None, type=int, help="timeout in seconds" +) +@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 +def update(ctx, ns_name, updatetype, config, timeout, wait): + """Executes an update of a Network Service. + + The update will check new revisions of the Network Functions that are part of the + Network Service, and it will update them if needed. + Sample update command: osm ns-update ns_instance_id --updatetype CHANGE_VNFPKG + --config '{changeVnfPackageData: [{vnfInstanceId: id_x,vnfdId: id_y}]}' --timeout 300 --wait + + NS_NAME: Network service instance name or ID. + + """ + op_data = { + "timeout": timeout, + "updateType": updatetype, + } + if config: + op_data["config"] = yaml.safe_load(config) + + check_client_version(ctx.obj, ctx.command.name) + ctx.obj.ns.update(ns_name, op_data, wait=wait) + + @cli_osm.command(name="alarm-show", short_help="show alarm details") @click.argument("uuid") @click.pass_context