####################
@cli_osm.command(name='ns-list', short_help='list all NS instances')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the NS instances matching the filter.')
@click.option('--long', is_flag=True,
help='get more details of the NS (project, vim, deployment status, configuration status.')
logger.debug("")
if filter:
check_client_version(ctx.obj, '--filter')
+ filter='&'.join(filter)
resp = ctx.obj.ns.list(filter)
else:
resp = ctx.obj.ns.list()
logger.debug("")
if filter:
check_client_version(ctx.obj, '--filter')
+ filter='&'.join(filter)
resp = ctx.obj.nsd.list(filter)
else:
resp = ctx.obj.nsd.list()
@cli_osm.command(name='nsd-list', short_help='list all NS packages')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the NSD/NSpkg matching the filter')
@click.option('--long', is_flag=True, help='get more details')
@click.pass_context
@cli_osm.command(name='nspkg-list', short_help='list all NS packages')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the NSD/NSpkg matching the filter')
@click.option('--long', is_flag=True, help='get more details')
@click.pass_context
def pkg_repo_list(ctx, pkgtype, filter, repo, long):
+ if filter:
+ filter='&'.join(filter)
resp = ctx.obj.osmrepo.pkg_list(pkgtype, filter, repo)
if long:
table = PrettyTable(['nfpkg name', 'vendor', 'version', 'latest', 'description', 'repository'])
check_client_version(ctx.obj, '--nf_type')
elif filter:
check_client_version(ctx.obj, '--filter')
+ if filter:
+ filter='&'.join(filter)
if nf_type:
if nf_type == "vnf":
nf_filter = "_admin.type=vnfd"
@cli_osm.command(name='vnfd-list', short_help='list all xNF packages (VNF, HNF, PNF)')
@click.option('--nf_type', help='type of NF (vnf, pnf, hnf)')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the NF pkg matching the filter')
@click.option('--long', is_flag=True, help='get more details')
@click.pass_context
@cli_osm.command(name='vnfpkg-list', short_help='list all xNF packages (VNF, HNF, PNF)')
@click.option('--nf_type', help='type of NF (vnf, pnf, hnf)')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the NFpkg matching the filter')
@click.option('--long', is_flag=True, help='get more details')
@click.pass_context
@cli_osm.command(name='nfpkg-list', short_help='list all xNF packages (VNF, HNF, PNF)')
@click.option('--nf_type', help='type of NF (vnf, pnf, hnf)')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the NFpkg matching the filter')
@click.option('--long', is_flag=True, help='get more details')
@click.pass_context
# exit(1)
@cli_osm.command(name='vnfpkg-repo-list', short_help='list all xNF from OSM repositories')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the NFpkg matching the filter')
@click.option('--repo', default=None,
help='restricts the list to a particular OSM repository')
pkg_repo_list(ctx, pkgtype, filter, repo, long)
@cli_osm.command(name='nfpkg-repo-list', short_help='list all xNF from OSM repositories')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the NFpkg matching the filter')
@click.option('--repo', default=None,
help='restricts the list to a particular OSM repository')
if ns:
check_client_version(ctx.obj, '--ns')
if filter:
+ filter='&'.join(filter)
check_client_version(ctx.obj, '--filter')
resp = ctx.obj.vnf.list(ns, filter)
else:
@cli_osm.command(name='vnf-list', short_help='list all NF instances')
@click.option('--ns', default=None, help='NS instance id or name to restrict the NF list')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the NF instances matching the filter.')
@click.option('--long', is_flag=True, help='get more details')
@click.pass_context
vnf_list(ctx, ns, filter, long)
@cli_osm.command(name='nsd-repo-list', short_help='list all NS from OSM repositories')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the NS matching the filter')
@click.option('--repo', default=None,
help='restricts the list to a particular OSM repository')
pkg_repo_list(ctx, pkgtype, filter, repo, long)
@cli_osm.command(name='nspkg-repo-list', short_help='list all NS from OSM repositories')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the NS matching the filter')
@click.option('--repo', default=None,
help='restricts the list to a particular OSM repository')
@cli_osm.command(name='nf-list', short_help='list all NF instances')
@click.option('--ns', default=None, help='NS instance id or name to restrict the NF list')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the NF instances matching the filter.')
@click.option('--long', is_flag=True, help='get more details')
@click.pass_context
logger.debug("")
# try:
check_client_version(ctx.obj, ctx.command.name)
+ if filter:
+ filter='&'.join(filter)
resp = ctx.obj.nsi.list(filter)
# except ClientException as e:
# print(str(e))
@cli_osm.command(name='nsi-list', short_help='list all Network Slice Instances (NSI)')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the Network Slice Instances matching the filter')
@click.pass_context
def nsi_list1(ctx, filter):
@cli_osm.command(name='netslice-instance-list', short_help='list all Network Slice Instances (NSI)')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the Network Slice Instances matching the filter')
@click.pass_context
def nsi_list2(ctx, filter):
logger.debug("")
# try:
check_client_version(ctx.obj, ctx.command.name)
+ if filter:
+ filter='&'.join(filter)
resp = ctx.obj.nst.list(filter)
# except ClientException as e:
# print(str(e))
@cli_osm.command(name='nst-list', short_help='list all Network Slice Templates (NST)')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the NST matching the filter')
@click.pass_context
def nst_list1(ctx, filter):
@cli_osm.command(name='netslice-template-list', short_help='list all Network Slice Templates (NST)')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the NST matching the filter')
@click.pass_context
def nst_list2(ctx, filter):
@cli_osm.command(name='pdu-list', short_help='list all Physical Deployment Units (PDU)')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the Physical Deployment Units matching the filter')
@click.pass_context
def pdu_list(ctx, filter):
logger.debug("")
# try:
check_client_version(ctx.obj, ctx.command.name)
+ if filter:
+ filter='&'.join(filter)
resp = ctx.obj.pdu.list(filter)
# except ClientException as e:
# print(str(e))
def pkg_repo_show(ctx, pkgtype, name, repo, version, filter, literal):
logger.debug("")
+ if filter:
+ filter='&'.join(filter)
# try:
resp = ctx.obj.osmrepo.pkg_get(pkgtype, name, repo, version, filter)
table.align = 'l'
print(table)
+
@cli_osm.command(name='vnfd-show', short_help='shows the details of a NF package')
@click.option('--literal', is_flag=True,
help='print literally, no pretty table')
logger.debug("")
vnfd_show(ctx, name, literal)
+
@cli_osm.command(name='vnfpkg-repo-show', short_help='shows the details of a NF package in an OSM repository')
@click.option('--literal', is_flag=True,
help='print literally, no pretty table')
required=True,
help='Repository name')
@click.argument('name')
-@click.option('--filter',
+@click.option('--filter', default=None, multiple=True,
help='filter by fields')
@click.option('--version',
default='latest',
required=True,
help='Repository name')
@click.argument('name')
-@click.option('--filter',
+@click.option('--filter', default=None, multiple=True,
help='filter by fields')
@click.option('--version',
default='latest',
pkgtype = 'ns'
pkg_repo_show(ctx, pkgtype, name, repo, version, filter, literal)
+
@cli_osm.command(name='nspkg-repo-show', short_help='shows the details of a NS package in an OSM repository')
@click.option('--literal', is_flag=True,
help='print literally, no pretty table')
required=True,
help='Repository name')
@click.argument('name')
-@click.option('--filter',
+@click.option('--filter', default=None, multiple=True,
help='filter by fields')
@click.option('--version',
default='latest',
pkgtype = 'ns'
pkg_repo_show(ctx, pkgtype, name, repo, version, filter, literal)
+
@cli_osm.command(name='nfpkg-show', short_help='shows the details of a NF package')
@click.option('--literal', is_flag=True,
help='print literally, no pretty table')
required=True,
help='Repository name')
@click.argument('name')
-@click.option('--filter',
+@click.option('--filter', default=None, multiple=True,
help='filter by fields')
@click.option('--version',
default='latest',
@click.argument('name')
@click.option('--literal', is_flag=True,
help='print literally, no pretty table')
-@click.option('--filter', default=None)
+@click.option('--filter', multiple=True,
+ help='restricts the information to the fields in the filter')
@click.pass_context
def ns_show(ctx, name, literal, filter):
"""shows the info of a NS instance
table = PrettyTable(['field', 'value'])
for k, v in list(ns.items()):
- if filter is None or filter in k:
+ if not filter or k in filter:
table.add_row([k, wrap_text(text=json.dumps(v, indent=2),width=100)])
fullclassname = ctx.obj.__module__ + "." + ctx.obj.__class__.__name__
nsopdata = ctx.obj.ns.get_opdata(ns['id'])
nsr_optdata = nsopdata['nsr:nsr']
for k, v in list(nsr_optdata.items()):
- if filter is None or filter in k:
+ if not filter or k in filter:
table.add_row([k, wrap_text(json.dumps(v, indent=2),width=100)])
table.align = 'l'
print(table)
@click.argument('name')
@click.option('--literal', is_flag=True,
help='print literally, no pretty table')
-@click.option('--filter', default=None, help='restricts the information to the fields in the filter')
+@click.option('--filter', multiple=True,
+ help='restricts the information to the fields in the filter')
@click.option('--kdu', default=None, help='KDU name (whose status will be shown)')
@click.pass_context
def vnf_show(ctx, name, literal, filter, kdu):
table = PrettyTable(['field', 'value'])
for k, v in list(resp.items()):
- if filter is None or filter in k:
+ if not filter or k in filter:
table.add_row([k, wrap_text(text=json.dumps(v,indent=2),width=100)])
table.align = 'l'
print(table)
@cli_osm.command(name='ns-op-show', short_help='shows the info of a NS operation')
@click.argument('id')
-@click.option('--filter', default=None)
+@click.option('--filter', multiple=True,
+ help='restricts the information to the fields in the filter')
@click.option('--literal', is_flag=True,
help='print literally, no pretty table')
@click.pass_context
table = PrettyTable(['field', 'value'])
for k, v in list(op_info.items()):
- if filter is None or filter in k:
+ if not filter or k in filter:
table.add_row([k, wrap_text(json.dumps(v, indent=2), 100)])
table.align = 'l'
print(table)
table = PrettyTable(['field', 'value'])
for k, v in list(nsi.items()):
- if filter is None or filter in k:
+ if not filter or k in filter:
table.add_row([k, json.dumps(v, indent=2)])
table.align = 'l'
@click.argument('name')
@click.option('--literal', is_flag=True,
help='print literally, no pretty table')
-@click.option('--filter', default=None)
+@click.option('--filter', multiple=True,
+ help='restricts the information to the fields in the filter')
@click.pass_context
def nsi_show1(ctx, name, literal, filter):
"""shows the content of a Network Slice Instance (NSI)
@click.argument('name')
@click.option('--literal', is_flag=True,
help='print literally, no pretty table')
-@click.option('--filter', default=None)
+@click.option('--filter', multiple=True,
+ help='restricts the information to the fields in the filter')
@click.pass_context
def nsi_show2(ctx, name, literal, filter):
"""shows the content of a Network Slice Instance (NSI)
table = PrettyTable(['field', 'value'])
for k, v in list(op_info.items()):
- if filter is None or filter in k:
+ if not filter or k in filter:
table.add_row([k, json.dumps(v, indent=2)])
table.align = 'l'
print(table)
@cli_osm.command(name='nsi-op-show', short_help='shows the info of an operation over a Network Slice Instance(NSI)')
@click.argument('id')
-@click.option('--filter', default=None)
+@click.option('--filter', multiple=True,
+ help='restricts the information to the fields in the filter')
@click.pass_context
def nsi_op_show1(ctx, id, filter):
"""shows the info of an operation over a Network Slice Instance(NSI)
@cli_osm.command(name='netslice-instance-op-show', short_help='shows the info of an operation over a Network Slice Instance(NSI)')
@click.argument('id')
-@click.option('--filter', default=None)
+@click.option('--filter', multiple=True,
+ help='restricts the information to the fields in the filter')
@click.pass_context
def nsi_op_show2(ctx, id, filter):
"""shows the info of an operation over a Network Slice Instance(NSI)
@click.argument('name')
@click.option('--literal', is_flag=True,
help='print literally, no pretty table')
-@click.option('--filter', default=None)
+@click.option('--filter', multiple=True,
+ help='restricts the information to the fields in the filter')
@click.pass_context
def pdu_show(ctx, name, literal, filter):
"""shows the content of a Physical Deployment Unit (PDU)
table = PrettyTable(['field', 'value'])
for k, v in list(pdu.items()):
- if filter is None or filter in k:
+ if not filter or k in filter:
table.add_row([k, json.dumps(v, indent=2)])
table.align = 'l'
#@click.option('--ro_update/--no_ro_update',
# default=False,
# help='update list from RO')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the VIM accounts matching the filter')
@click.option('--long', is_flag=True,
help='get more details of the NS (project, vim, deployment status, configuration status.')
"""list all VIM accounts"""
logger.debug("")
if filter:
+ filter='&'.join(filter)
check_client_version(ctx.obj, '--filter')
# if ro_update:
# check_client_version(ctx.obj, '--ro_update', 'v1')
@cli_osm.command(name='wim-list', short_help='list all WIM accounts')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the WIM accounts matching the filter')
@click.pass_context
def wim_list(ctx, filter):
logger.debug("")
# try:
check_client_version(ctx.obj, ctx.command.name)
+ if filter:
+ filter='&'.join(filter)
resp = ctx.obj.wim.list(filter)
table = PrettyTable(['wim name', 'uuid'])
for wim in resp:
@cli_osm.command(name='sdnc-list', short_help='list all SDN controllers')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help="restricts the list to the SDN controllers matching the filter with format: 'k[.k..]=v[&k[.k]=v2]'")
@click.pass_context
def sdnc_list(ctx, filter):
logger.debug("")
# try:
check_client_version(ctx.obj, ctx.command.name)
+ if filter:
+ filter='&'.join(filter)
resp = ctx.obj.sdnc.list(filter)
# except ClientException as e:
# print(str(e))
@cli_osm.command(name='k8scluster-list')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the K8s clusters matching the filter')
@click.option('--literal', is_flag=True,
help='print literally, no pretty table')
"""list all K8s clusters"""
# try:
check_client_version(ctx.obj, ctx.command.name)
+ if filter:
+ filter='&'.join(filter)
resp = ctx.obj.k8scluster.list(filter)
if literal:
print(yaml.safe_dump(resp, indent=4, default_flow_style=False))
@cli_osm.command(name='repo-list')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the repos matching the filter')
@click.option('--literal', is_flag=True,
help='print literally, no pretty table')
# try:
# K8s Repositories
check_client_version(ctx.obj, ctx.command.name)
+ if filter:
+ filter='&'.join(filter)
resp = ctx.obj.repo.list(filter)
resp += ctx.obj.osmrepo.list(filter)
if literal:
@cli_osm.command(name='project-list', short_help='list all projects')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the projects matching the filter')
@click.pass_context
def project_list(ctx, filter):
logger.debug("")
# try:
check_client_version(ctx.obj, ctx.command.name)
+ if filter:
+ filter='&'.join(filter)
resp = ctx.obj.project.list(filter)
# except ClientException as e:
# print(str(e))
@cli_osm.command(name='user-list', short_help='list all users')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the users matching the filter')
@click.pass_context
def user_list(ctx, filter):
"""list all users"""
# try:
check_client_version(ctx.obj, ctx.command.name)
+ if filter:
+ filter='&'.join(filter)
resp = ctx.obj.user.list(filter)
# except ClientException as e:
# print(str(e))
@cli_osm.command(name='role-list', short_help='list all roles')
-@click.option('--filter', default=None,
+@click.option('--filter', default=None, multiple=True,
help='restricts the list to the projects matching the filter')
@click.pass_context
def role_list(ctx, filter):
logger.debug("")
# try:
check_client_version(ctx.obj, ctx.command.name)
+ if filter:
+ filter='&'.join(filter)
resp = ctx.obj.role.list(filter)
# except ClientException as e:
# print(str(e))