X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osmclient%2Fcli_commands%2Fnslcm_ops.py;h=9528d0845831b1b08f8ddfafd8bccf0ee57edee1;hb=c0420cf86aaed737f59666516dd9e4de5c5db16c;hp=46197d040e7b7b4e23d658615d4747d92ff66252;hpb=00bc0353583beab960fb853375dc1e8f4a77840d;p=osm%2Fosmclient.git diff --git a/osmclient/cli_commands/nslcm_ops.py b/osmclient/cli_commands/nslcm_ops.py index 46197d0..9528d08 100755 --- a/osmclient/cli_commands/nslcm_ops.py +++ b/osmclient/cli_commands/nslcm_ops.py @@ -149,3 +149,31 @@ def ns_op_show(ctx, id, filter, literal): table.add_row([k, utils.wrap_text(json.dumps(v, indent=2), 100)]) table.align = "l" print(table) + + +@click.command(name="ns-op-cancel", short_help="cancels an ongoing NS operation") +@click.argument("id") +@click.option( + "--cancel_mode", + required=False, + default="GRACEFUL", + show_default=True, + help="Mode of cancellation, can be FORCEFUL or GRACEFUL", +) +@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 ns_op_cancel(ctx, id, cancel_mode, wait): + """Cancels an ongoing NS operation + + ID: operation identifier + """ + logger.debug("") + utils.check_client_version(ctx.obj, ctx.command.name) + ctx.obj.ns.cancel_op(id, cancel_mode, wait)