1 # Copyright 2017-2018 Sandvine
2 # Copyright 2018 Telefonica
6 # Licensed under the Apache License, Version 2.0 (the "License"); you may
7 # not use this file except in compliance with the License. You may obtain
8 # a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 # License for the specific language governing permissions and limitations
22 from osmclient
import client
23 from osmclient
.common
.exceptions
import ClientException
24 from prettytable
import PrettyTable
29 def check_client_version(obj
, what
, version
='sol005'):
31 Checks the version of the client object and raises error if it not the expected.
33 :param obj: the client object
34 :what: the function or command under evaluation (used when an error is raised)
36 :raises ClientError: if the specified version does not match the client version
38 fullclassname
= obj
.__module
__ + "." + obj
.__class
__.__name
__
39 message
= 'the following commands or options are only supported with the option "--sol005": {}'.format(what
)
41 message
= 'the following commands or options are not supported when using option "--sol005": {}'.format(what
)
42 if fullclassname
!= 'osmclient.{}.client.Client'.format(version
):
43 raise ClientException(message
)
47 @click.option('--hostname',
49 envvar
='OSM_HOSTNAME',
50 help='hostname of server. ' +
51 'Also can set OSM_HOSTNAME in environment')
52 @click.option('--so-port',
55 help='hostname of server. ' +
56 'Also can set OSM_SO_PORT in environment')
57 @click.option('--so-project',
59 envvar
='OSM_SO_PROJECT',
60 help='Project Name in SO. ' +
61 'Also can set OSM_SO_PROJECT in environment')
62 @click.option('--ro-hostname',
64 envvar
='OSM_RO_HOSTNAME',
65 help='hostname of RO server. ' +
66 'Also can set OSM_RO_HOSTNAME in environment')
67 @click.option('--ro-port',
70 help='hostname of RO server. ' +
71 'Also can set OSM_RO_PORT in environment')
72 @click.option('--sol005',
75 help='Use ETSI NFV SOL005 API')
77 def cli(ctx
, hostname
, so_port
, so_project
, ro_hostname
, ro_port
, sol005
):
80 "either hostname option or OSM_HOSTNAME " +
81 "environment variable needs to be specified")
84 if so_port
is not None:
85 kwargs
['so_port']=so_port
86 if so_project
is not None:
87 kwargs
['so_project']=so_project
88 if ro_hostname
is not None:
89 kwargs
['ro_host']=ro_hostname
90 if ro_port
is not None:
91 kwargs
['ro_port']=ro_port
93 ctx
.obj
= client
.Client(host
=hostname
, sol005
=sol005
, **kwargs
)
100 @cli.command(name
='ns-list')
101 @click.option('--filter', default
=None,
102 help='restricts the list to the NS instances matching the filter')
104 def ns_list(ctx
, filter):
105 '''list all NS instances'''
107 check_client_version(ctx
.obj
, '--filter')
108 resp
= ctx
.obj
.ns
.list(filter)
110 resp
= ctx
.obj
.ns
.list()
114 'operational status',
117 fullclassname
= ctx
.obj
.__module
__ + "." + ctx
.obj
.__class
__.__name
__
118 if fullclassname
== 'osmclient.sol005.client.Client':
120 nsr_name
= nsr
['name']
123 nsopdata
= ctx
.obj
.ns
.get_opdata(ns
['id'])
124 nsr
= nsopdata
['nsr:nsr']
125 nsr_name
= nsr
['name-ref']
126 nsr_id
= nsr
['ns-instance-config-ref']
127 opstatus
= nsr
['operational-status'] if 'operational-status' in nsr
else 'Not found'
128 configstatus
= nsr
['config-status'] if 'config-status' in nsr
else 'Not found'
129 if configstatus
== "config_not_needed":
130 configstatus
= "configured (no charms)"
140 def nsd_list(ctx
, filter):
142 check_client_version(ctx
.obj
, '--filter')
143 resp
= ctx
.obj
.nsd
.list(filter)
145 resp
= ctx
.obj
.nsd
.list()
146 #print yaml.safe_dump(resp)
147 table
= PrettyTable(['nsd name', 'id'])
148 fullclassname
= ctx
.obj
.__module
__ + "." + ctx
.obj
.__class
__.__name
__
149 if fullclassname
== 'osmclient.sol005.client.Client':
151 name
= ns
['name'] if 'name' in ns
else '-'
152 table
.add_row([name
, ns
['_id']])
155 table
.add_row([ns
['name'], ns
['id']])
160 @cli.command(name
='nsd-list')
161 @click.option('--filter', default
=None,
162 help='restricts the list to the NSD/NSpkg matching the filter')
164 def nsd_list1(ctx
, filter):
165 '''list all NSD/NSpkg in the system'''
169 @cli.command(name
='nspkg-list')
170 @click.option('--filter', default
=None,
171 help='restricts the list to the NSD/NSpkg matching the filter')
173 def nsd_list2(ctx
, filter):
174 '''list all NSD/NSpkg in the system'''
178 def vnfd_list(ctx
, filter):
180 check_client_version(ctx
.obj
, '--filter')
181 resp
= ctx
.obj
.vnfd
.list(filter)
183 resp
= ctx
.obj
.vnfd
.list()
184 #print yaml.safe_dump(resp)
185 table
= PrettyTable(['vnfd name', 'id'])
186 fullclassname
= ctx
.obj
.__module
__ + "." + ctx
.obj
.__class
__.__name
__
187 if fullclassname
== 'osmclient.sol005.client.Client':
189 name
= vnfd
['name'] if 'name' in vnfd
else '-'
190 table
.add_row([name
, vnfd
['_id']])
193 table
.add_row([vnfd
['name'], vnfd
['id']])
198 @cli.command(name
='vnfd-list')
199 @click.option('--filter', default
=None,
200 help='restricts the list to the VNFD/VNFpkg matching the filter')
202 def vnfd_list1(ctx
, filter):
203 '''list all VNFD/VNFpkg in the system'''
204 vnfd_list(ctx
,filter)
207 @cli.command(name
='vnfpkg-list')
208 @click.option('--filter', default
=None,
209 help='restricts the list to the VNFD/VNFpkg matching the filter')
211 def vnfd_list2(ctx
, filter):
212 '''list all VNFD/VNFpkg in the system'''
213 vnfd_list(ctx
,filter)
216 @cli.command(name
='vnf-list')
219 ''' list all VNF instances'''
220 resp
= ctx
.obj
.vnf
.list()
224 'operational status',
227 if 'mgmt-interface' not in vnfr
:
228 vnfr
['mgmt-interface'] = {}
229 vnfr
['mgmt-interface']['ip-address'] = None
233 vnfr
['operational-status'],
234 vnfr
['config-status']])
243 def nsd_show(ctx
, name
, literal
):
245 resp
= ctx
.obj
.nsd
.get(name
)
246 #resp = ctx.obj.nsd.get_individual(name)
247 except ClientException
as inst
:
252 print yaml
.safe_dump(resp
)
255 table
= PrettyTable(['field', 'value'])
256 for k
, v
in resp
.items():
257 table
.add_row([k
, json
.dumps(v
, indent
=2)])
262 @cli.command(name
='nsd-show', short_help
='shows the content of a NSD')
263 @click.option('--literal', is_flag
=True,
264 help='print literally, no pretty table')
265 @click.argument('name')
267 def nsd_show1(ctx
, name
, literal
):
268 '''shows the content of a NSD
270 NAME: name or ID of the NSD/NSpkg
272 nsd_show(ctx
, name
, literal
)
275 @cli.command(name
='nspkg-show', short_help
='shows the content of a NSD')
276 @click.option('--literal', is_flag
=True,
277 help='print literally, no pretty table')
278 @click.argument('name')
280 def nsd_show2(ctx
, name
, literal
):
281 '''shows the content of a NSD
283 NAME: name or ID of the NSD/NSpkg
285 nsd_show(ctx
, name
, literal
)
288 def vnfd_show(ctx
, name
, literal
):
290 resp
= ctx
.obj
.vnfd
.get(name
)
291 #resp = ctx.obj.vnfd.get_individual(name)
292 except ClientException
as inst
:
297 print yaml
.safe_dump(resp
)
300 table
= PrettyTable(['field', 'value'])
301 for k
, v
in resp
.items():
302 table
.add_row([k
, json
.dumps(v
, indent
=2)])
307 @cli.command(name
='vnfd-show', short_help
='shows the content of a VNFD')
308 @click.option('--literal', is_flag
=True,
309 help='print literally, no pretty table')
310 @click.argument('name')
312 def vnfd_show1(ctx
, name
, literal
):
313 '''shows the content of a VNFD
315 NAME: name or ID of the VNFD/VNFpkg
317 vnfd_show(ctx
, name
, literal
)
320 @cli.command(name
='vnfpkg-show', short_help
='shows the content of a VNFD')
321 @click.option('--literal', is_flag
=True,
322 help='print literally, no pretty table')
323 @click.argument('name')
325 def vnfd_show2(ctx
, name
, literal
):
326 '''shows the content of a VNFD
328 NAME: name or ID of the VNFD/VNFpkg
330 vnfd_show(ctx
, name
, literal
)
333 @cli.command(name
='ns-show', short_help
='shows the info of a NS instance')
334 @click.argument('name')
335 @click.option('--literal', is_flag
=True,
336 help='print literally, no pretty table')
337 @click.option('--filter', default
=None)
339 def ns_show(ctx
, name
, literal
, filter):
340 '''shows the info of a NS instance
342 NAME: name or ID of the NS instance
345 ns
= ctx
.obj
.ns
.get(name
)
346 except ClientException
as inst
:
351 print yaml
.safe_dump(resp
)
354 table
= PrettyTable(['field', 'value'])
356 for k
, v
in ns
.items():
357 if filter is None or filter in k
:
358 table
.add_row([k
, json
.dumps(v
, indent
=2)])
360 fullclassname
= ctx
.obj
.__module
__ + "." + ctx
.obj
.__class
__.__name
__
361 if fullclassname
!= 'osmclient.sol005.client.Client':
362 nsopdata
= ctx
.obj
.ns
.get_opdata(ns
['id'])
363 nsr_optdata
= nsopdata
['nsr:nsr']
364 for k
, v
in nsr_optdata
.items():
365 if filter is None or filter in k
:
366 table
.add_row([k
, json
.dumps(v
, indent
=2)])
371 @cli.command(name
='vnf-show', short_help
='shows the info of a VNF instance')
372 @click.argument('name')
373 @click.option('--literal', is_flag
=True,
374 help='print literally, no pretty table')
375 @click.option('--filter', default
=None)
377 def vnf_show(ctx
, name
, literal
, filter):
378 '''shows the info of a VNF instance
380 NAME: name or ID of the VNF instance
383 check_client_version(ctx
.obj
, ctx
.command
.name
, 'v1')
384 resp
= ctx
.obj
.vnf
.get(name
)
385 except ClientException
as inst
:
390 print yaml
.safe_dump(resp
)
393 table
= PrettyTable(['field', 'value'])
394 for k
, v
in resp
.items():
395 if filter is None or filter in k
:
396 table
.add_row([k
, json
.dumps(v
, indent
=2)])
401 @cli.command(name
='vnf-monitoring-show')
402 @click.argument('vnf_name')
404 def vnf_monitoring_show(ctx
, vnf_name
):
406 check_client_version(ctx
.obj
, ctx
.command
.name
, 'v1')
407 resp
= ctx
.obj
.vnf
.get_monitoring(vnf_name
)
408 except ClientException
as inst
:
412 table
= PrettyTable(['vnf name', 'monitoring name', 'value', 'units'])
418 monitor
['value-integer'],
424 @cli.command(name
='ns-monitoring-show')
425 @click.argument('ns_name')
427 def ns_monitoring_show(ctx
, ns_name
):
429 check_client_version(ctx
.obj
, ctx
.command
.name
, 'v1')
430 resp
= ctx
.obj
.ns
.get_monitoring(ns_name
)
431 except ClientException
as inst
:
435 table
= PrettyTable(['vnf name', 'monitoring name', 'value', 'units'])
436 for key
, val
in resp
.items():
441 monitor
['value-integer'],
451 def nsd_create(ctx
, filename
, overwrite
):
453 check_client_version(ctx
.obj
, ctx
.command
.name
)
454 ctx
.obj
.nsd
.create(filename
, overwrite
)
455 except ClientException
as inst
:
460 @cli.command(name
='nsd-create', short_help
='creates a new NSD/NSpkg')
461 @click.argument('filename')
462 @click.option('--overwrite', default
=None,
463 help='overwrites some fields in NSD')
465 def nsd_create1(ctx
, filename
, overwrite
):
466 '''creates a new NSD/NSpkg
468 FILENAME: NSD yaml file or NSpkg tar.gz file
470 nsd_create(ctx
, filename
, overwrite
)
473 @cli.command(name
='nspkg-create', short_help
='creates a new NSD/NSpkg')
474 @click.argument('filename')
475 @click.option('--overwrite', default
=None,
476 help='overwrites some fields in NSD')
478 def nsd_create2(ctx
, filename
, overwrite
):
479 '''creates a new NSD/NSpkg
481 FILENAME: NSD yaml file or NSpkg tar.gz file
483 nsd_create(ctx
, filename
, overwrite
)
486 def vnfd_create(ctx
, filename
, overwrite
):
488 check_client_version(ctx
.obj
, ctx
.command
.name
)
489 ctx
.obj
.vnfd
.create(filename
, overwrite
)
490 except ClientException
as inst
:
495 @cli.command(name
='vnfd-create', short_help
='creates a new VNFD/VNFpkg')
496 @click.argument('filename')
497 @click.option('--overwrite', default
=None,
498 help='overwrites some fields in VNFD')
500 def vnfd_create1(ctx
, filename
, overwrite
):
501 '''creates a new VNFD/VNFpkg
503 FILENAME: VNFD yaml file or VNFpkg tar.gz file
505 vnfd_create(ctx
, filename
, overwrite
)
508 @cli.command(name
='vnfpkg-create', short_help
='creates a new VNFD/VNFpkg')
509 @click.argument('filename')
510 @click.option('--overwrite', default
=None,
511 help='overwrites some fields in VNFD')
513 def vnfd_create2(ctx
, filename
, overwrite
):
514 '''creates a new VNFD/VNFpkg
516 FILENAME: VNFD yaml file or VNFpkg tar.gz file
518 vnfd_create(ctx
, filename
, overwrite
)
521 @cli.command(name
='ns-create')
522 @click.option('--ns_name',
524 @click.option('--nsd_name',
526 @click.option('--vim_account',
528 @click.option('--admin_status',
530 help='administration status')
531 @click.option('--ssh_keys',
533 help='comma separated list of keys to inject to vnfs')
534 @click.option('--config',
536 help='ns specific yaml configuration')
545 '''creates a new NS instance'''
548 check_client_version(ctx
.obj
, '--config', 'v1')
555 except ClientException
as inst
:
564 def nsd_update(ctx
, name
, content
):
566 check_client_version(ctx
.obj
, ctx
.command
.name
)
567 ctx
.obj
.nsd
.update(name
, content
)
568 except ClientException
as inst
:
572 @cli.command(name
='nsd-update', short_help
='updates a NSD/NSpkg')
573 @click.argument('name')
574 @click.option('--content', default
=None,
575 help='filename with the NSD/NSpkg replacing the current one')
577 def nsd_update1(ctx
, name
, content
):
578 '''updates a NSD/NSpkg
580 NAME: name or ID of the NSD/NSpkg
582 nsd_update(ctx
, name
, content
)
585 @cli.command(name
='nspkg-update', short_help
='updates a NSD/NSpkg')
586 @click.argument('name')
587 @click.option('--content', default
=None,
588 help='filename with the NSD/NSpkg replacing the current one')
590 def nsd_update2(ctx
, name
, content
):
591 '''updates a NSD/NSpkg
593 NAME: name or ID of the NSD/NSpkg
595 nsd_update(ctx
, name
, content
)
598 def vnfd_update(ctx
, name
, content
):
600 check_client_version(ctx
.obj
, ctx
.command
.name
)
601 ctx
.obj
.vnfd
.update(name
, content
)
602 except ClientException
as inst
:
607 @cli.command(name
='vnfd-update', short_help
='updates a new VNFD/VNFpkg')
608 @click.argument('name')
609 @click.option('--content', default
=None,
610 help='filename with the VNFD/VNFpkg replacing the current one')
612 def vnfd_update1(ctx
, name
, content
):
613 '''updates a VNFD/VNFpkg
615 NAME: name or ID of the VNFD/VNFpkg
617 vnfd_update(ctx
, name
, content
)
620 @cli.command(name
='vnfpkg-update', short_help
='updates a VNFD/VNFpkg')
621 @click.argument('name')
622 @click.option('--content', default
=None,
623 help='filename with the VNFD/VNFpkg replacing the current one')
625 def vnfd_update2(ctx
, name
, content
):
626 '''updates a VNFD/VNFpkg
628 NAME: VNFD yaml file or VNFpkg tar.gz file
630 vnfd_update(ctx
, name
, content
)
637 def nsd_delete(ctx
, name
):
639 ctx
.obj
.nsd
.delete(name
)
640 except ClientException
as inst
:
645 @cli.command(name
='nsd-delete', short_help
='deletes a NSD/NSpkg')
646 @click.argument('name')
648 def nsd_delete1(ctx
, name
):
649 '''deletes a NSD/NSpkg
651 NAME: name or ID of the NSD/NSpkg to be deleted
653 nsd_delete(ctx
, name
)
656 @cli.command(name
='nspkg-delete', short_help
='deletes a NSD/NSpkg')
657 @click.argument('name')
659 def nsd_delete2(ctx
, name
):
660 '''deletes a NSD/NSpkg
662 NAME: name or ID of the NSD/NSpkg to be deleted
664 nsd_delete(ctx
, name
)
667 def vnfd_delete(ctx
, name
):
669 ctx
.obj
.vnfd
.delete(name
)
670 except ClientException
as inst
:
675 @cli.command(name
='vnfd-delete', short_help
='deletes a VNFD/VNFpkg')
676 @click.argument('name')
678 def vnfd_delete1(ctx
, name
):
679 '''deletes a VNFD/VNFpkg
681 NAME: name or ID of the VNFD/VNFpkg to be deleted
683 vnfd_delete(ctx
, name
)
686 @cli.command(name
='vnfpkg-delete', short_help
='deletes a VNFD/VNFpkg')
687 @click.argument('name')
689 def vnfd_delete2(ctx
, name
):
690 '''deletes a VNFD/VNFpkg
692 NAME: name or ID of the VNFD/VNFpkg to be deleted
694 vnfd_delete(ctx
, name
)
697 @cli.command(name
='ns-delete', short_help
='deletes a NS instance')
698 @click.argument('name')
700 def ns_delete(ctx
, name
):
701 '''deletes a NS instance
703 NAME: name or ID of the NS instance to be deleted
706 ctx
.obj
.ns
.delete(name
)
707 except ClientException
as inst
:
716 @cli.command(name
='vim-create')
717 @click.option('--name',
719 help='Name to create datacenter')
720 @click.option('--user',
723 @click.option('--password',
726 confirmation_prompt
=True,
728 @click.option('--auth_url',
731 @click.option('--tenant',
733 help='VIM tenant name')
734 @click.option('--config',
736 help='VIM specific config parameters')
737 @click.option('--account_type',
740 @click.option('--description',
741 default
='no description',
742 help='human readable description')
753 '''creates a new VIM account
756 vim
['vim-username'] = user
757 vim
['vim-password'] = password
758 vim
['vim-url'] = auth_url
759 vim
['vim-tenant-name'] = tenant
760 vim
['config'] = config
761 vim
['vim-type'] = account_type
762 vim
['description'] = description
764 ctx
.obj
.vim
.create(name
, vim
)
765 except ClientException
as inst
:
770 @cli.command(name
='vim-update', short_help
='updates a VIM account')
771 @click.argument('name')
772 @click.option('--newname', default
=None, help='New name for the VIM account')
773 @click.option('--user', default
=None, help='VIM username')
774 @click.option('--password', default
=None, help='VIM password')
775 @click.option('--auth_url', default
=None, help='VIM url')
776 @click.option('--tenant', default
=None, help='VIM tenant name')
777 @click.option('--config', default
=None, help='VIM specific config parameters')
778 @click.option('--account_type', default
=None, help='VIM type')
779 @click.option('--description', default
=None, help='human readable description')
791 '''updates a VIM account
793 NAME: name or ID of the VIM account
797 vim
['name'] = newname
798 vim
['vim_user'] = user
799 vim
['vim_password'] = password
800 vim
['vim_url'] = auth_url
801 vim
['vim-tenant-name'] = tenant
802 vim
['config'] = config
803 vim
['vim_type'] = account_type
804 vim
['description'] = description
806 check_client_version(ctx
.obj
, ctx
.command
.name
)
807 ctx
.obj
.vim
.update(name
, vim
)
808 except ClientException
as inst
:
813 @cli.command(name
='vim-delete')
814 @click.argument('name')
816 def vim_delete(ctx
, name
):
817 '''deletes a VIM account
819 NAME: name or ID of the VIM account to be deleted
822 ctx
.obj
.vim
.delete(name
)
823 except ClientException
as inst
:
828 @cli.command(name
='vim-list')
829 @click.option('--ro_update/--no_ro_update',
831 help='update list from RO')
832 @click.option('--filter', default
=None,
833 help='restricts the list to the VIM accounts matching the filter')
835 def vim_list(ctx
, ro_update
, filter):
836 '''list all VIM accounts'''
838 check_client_version(ctx
.obj
, '--filter')
840 check_client_version(ctx
.obj
, '--ro_update', 'v1')
841 fullclassname
= ctx
.obj
.__module
__ + "." + ctx
.obj
.__class
__.__name
__
842 if fullclassname
== 'osmclient.sol005.client.Client':
843 resp
= ctx
.obj
.vim
.list(filter)
845 resp
= ctx
.obj
.vim
.list(ro_update
)
846 table
= PrettyTable(['vim name', 'uuid'])
848 table
.add_row([vim
['name'], vim
['uuid']])
853 @cli.command(name
='vim-show')
854 @click.argument('name')
856 def vim_show(ctx
, name
):
857 '''shows the details of a VIM account
859 NAME: name or ID of the VIM account
862 resp
= ctx
.obj
.vim
.get(name
)
863 except ClientException
as inst
:
867 table
= PrettyTable(['key', 'attribute'])
868 for k
, v
in resp
.items():
869 table
.add_row([k
, json
.dumps(v
, indent
=2)])
878 @cli.command(name
='upload-package')
879 @click.argument('filename')
881 def upload_package(ctx
, filename
):
882 '''uploads a VNF package or NS package
884 FILENAME: VNF or NS package file (tar.gz)
887 ctx
.obj
.package
.upload(filename
)
888 fullclassname
= ctx
.obj
.__module
__ + "." + ctx
.obj
.__class
__.__name
__
889 if fullclassname
!= 'osmclient.sol005.client.Client':
890 ctx
.obj
.package
.wait_for_upload(filename
)
891 except ClientException
as inst
:
896 @cli.command(name
='ns-scaling-show')
897 @click.argument('ns_name')
899 def show_ns_scaling(ctx
, ns_name
):
900 check_client_version(ctx
.obj
, ctx
.command
.name
, 'v1')
901 resp
= ctx
.obj
.ns
.list()
906 'operational status',
911 if ns_name
== ns
['name']:
912 nsopdata
= ctx
.obj
.ns
.get_opdata(ns
['id'])
913 scaling_records
= nsopdata
['nsr:nsr']['scaling-group-record']
914 for record
in scaling_records
:
915 if 'instance' in record
:
916 instances
= record
['instance']
917 for inst
in instances
:
919 [record
['scaling-group-name-ref'],
922 time
.strftime('%Y-%m-%d %H:%M:%S',
924 inst
['create-time'])),
930 @cli.command(name
='ns-scale')
931 @click.argument('ns_name')
932 @click.option('--ns_scale_group', prompt
=True)
933 @click.option('--index', prompt
=True)
935 def ns_scale(ctx
, ns_name
, ns_scale_group
, index
):
936 check_client_version(ctx
.obj
, ctx
.command
.name
, 'v1')
937 ctx
.obj
.ns
.scale(ns_name
, ns_scale_group
, index
)
940 @cli.command(name
='config-agent-list')
942 def config_agent_list(ctx
):
943 check_client_version(ctx
.obj
, ctx
.command
.name
, 'v1')
944 table
= PrettyTable(['name', 'account-type', 'details'])
945 for account
in ctx
.obj
.vca
.list():
948 account
['account-type'],
954 @cli.command(name
='config-agent-delete')
955 @click.argument('name')
957 def config_agent_delete(ctx
, name
):
959 check_client_version(ctx
.obj
, ctx
.command
.name
, 'v1')
960 ctx
.obj
.vca
.delete(name
)
961 except ClientException
as inst
:
966 @cli.command(name
='config-agent-add')
967 @click.option('--name',
969 @click.option('--account_type',
971 @click.option('--server',
973 @click.option('--user',
975 @click.option('--secret',
978 confirmation_prompt
=True)
980 def config_agent_add(ctx
, name
, account_type
, server
, user
, secret
):
982 check_client_version(ctx
.obj
, ctx
.command
.name
, 'v1')
983 ctx
.obj
.vca
.create(name
, account_type
, server
, user
, secret
)
984 except ClientException
as inst
:
988 @cli.command(name
='ro-dump')
991 check_client_version(ctx
.obj
, ctx
.command
.name
, 'v1')
992 resp
= ctx
.obj
.vim
.get_resource_orchestrator()
993 table
= PrettyTable(['key', 'attribute'])
994 for k
, v
in resp
.items():
995 table
.add_row([k
, json
.dumps(v
, indent
=2)])
1000 @cli.command(name
='vcs-list')
1003 check_client_version(ctx
.obj
, ctx
.command
.name
, 'v1')
1004 resp
= ctx
.obj
.utils
.get_vcs_info()
1005 table
= PrettyTable(['component name', 'state'])
1006 for component
in resp
:
1007 table
.add_row([component
['component_name'], component
['state']])
1012 if __name__
== '__main__':