Added command to display VNFD's template
Change-Id: I1e1a1674680e9f7c03e519b85930b8e51478b011
This commit is contained in:
parent
56b3e8aea0
commit
83db572f62
@ -121,6 +121,7 @@ COMMAND_V1 = {
|
||||
'vnfd-delete': vnfd.DeleteVNFD,
|
||||
'vnfd-list': vnfd.ListVNFD,
|
||||
'vnfd-show': vnfd.ShowVNFD,
|
||||
'vnfd-template-show': vnfd.ShowTemplateVNFD,
|
||||
|
||||
'vnf-create': vnf.CreateVNF,
|
||||
'vnf-update': vnf.UpdateVNF,
|
||||
|
@ -19,6 +19,11 @@
|
||||
#
|
||||
# @author: Isaku Yamahata, Intel
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
from tackerclient.i18n import _
|
||||
from tackerclient.tacker import v1_0 as tackerV10
|
||||
|
||||
|
||||
@ -72,3 +77,21 @@ class CreateVNFD(tackerV10.CreateCommand):
|
||||
class DeleteVNFD(tackerV10.DeleteCommand):
|
||||
"""Delete a given VNFD."""
|
||||
resource = _VNFD
|
||||
|
||||
|
||||
class ShowTemplateVNFD(tackerV10.ShowCommand):
|
||||
"""Show template of a given VNFD."""
|
||||
|
||||
resource = _VNFD
|
||||
|
||||
def run(self, parsed_args):
|
||||
self.log.debug('run(%s)', parsed_args)
|
||||
template = None
|
||||
data = self.get_data(parsed_args)
|
||||
try:
|
||||
attributes_index = data[0].index('attributes')
|
||||
attributes_json = data[1][attributes_index]
|
||||
template = jsonutils.loads(attributes_json).get('vnfd', None)
|
||||
except (IndexError, TypeError, ValueError) as e:
|
||||
self.log.debug('Data handling error: %s', str(e))
|
||||
print(template or _('Unable to display VNFD template!'))
|
||||
|
Loading…
Reference in New Issue
Block a user