1 # Copyright ETSI Contributors and Others.
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may
5 # not use this file except in compliance with the License. You may obtain
6 # a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations
17 from osmclient
.cli_commands
import utils
18 from prettytable
import PrettyTable
22 logger
= logging
.getLogger("osmclient")
25 def nsi_op_list(ctx
, name
):
27 utils
.check_client_version(ctx
.obj
, ctx
.command
.name
)
28 resp
= ctx
.obj
.nsi
.list_op(name
)
29 table
= PrettyTable(["id", "operation", "status"])
31 table
.add_row([op
["id"], op
["lcmOperationType"], op
["operationState"]])
38 short_help
="shows the history of operations over a Network Slice Instance (NSI)",
40 @click.argument("name")
42 def nsi_op_list1(ctx
, name
):
43 """shows the history of operations over a Network Slice Instance (NSI)
45 NAME: name or ID of the Network Slice Instance
48 nsi_op_list(ctx
, name
)
52 name
="netslice-instance-op-list",
53 short_help
="shows the history of operations over a Network Slice Instance (NSI)",
55 @click.argument("name")
57 def nsi_op_list2(ctx
, name
):
58 """shows the history of operations over a Network Slice Instance (NSI)
60 NAME: name or ID of the Network Slice Instance
63 nsi_op_list(ctx
, name
)
66 def nsi_op_show(ctx
, id, filter):
68 utils
.check_client_version(ctx
.obj
, ctx
.command
.name
)
69 op_info
= ctx
.obj
.nsi
.get_op(id)
71 table
= PrettyTable(["field", "value"])
72 for k
, v
in list(op_info
.items()):
73 if not filter or k
in filter:
74 table
.add_row([k
, json
.dumps(v
, indent
=2)])
81 short_help
="shows the info of an operation over a Network Slice Instance(NSI)",
87 help="restricts the information to the fields in the filter",
90 def nsi_op_show1(ctx
, id, filter):
91 """shows the info of an operation over a Network Slice Instance(NSI)
93 ID: operation identifier
96 nsi_op_show(ctx
, id, filter)
100 name
="netslice-instance-op-show",
101 short_help
="shows the info of an operation over a Network Slice Instance(NSI)",
103 @click.argument("id")
107 help="restricts the information to the fields in the filter",
110 def nsi_op_show2(ctx
, id, filter):
111 """shows the info of an operation over a Network Slice Instance(NSI)
113 ID: operation identifier
116 nsi_op_show(ctx
, id, filter)