Add support for list data type

In ETSI tosca definition, node type “tosca.nodes.nfv.VNF” has
property “vnfm_info” that is defined as of type list.

Definition given in etsi_nfv_sol001_vnfd_types.yaml:
tosca.nodes.nfv.VNF:
    properties:
      vnfm_info:
        type: list
        required: true

Example:
tosca.nodes.nfv.VNF:
    properties:
      vnfm_info: [vnfm1, vnfm2]

Added translation support for list data type.

Change-Id: I02a4ba46da588ef7c1ac36a15d7cd537187e3ecc
This commit is contained in:
Niraj 2020-03-17 12:52:24 +05:30 committed by tpatil
parent ece660b232
commit 7be4cd79e8
2 changed files with 33 additions and 1 deletions

View File

@ -349,3 +349,34 @@ class ToscaTemplateInputValidationTest(TestCase):
('default', '18.0.1')])}]
self._translate_input_test(tpl_snippet, input_params, expectedmessage,
expected_hot_params)
def test_valid_input_vnfm_info(self):
tpl_snippet = '''
inputs:
vnfm_info:
type: list
entry_schema:
type: string
constraints: [ valid_values: [ Tacker ] ]
default: [ Tacker ]
'''
input_params = {'vnfm_info': ['Tacker']}
expected_msg = _("vnfm_info type should be list")
self._translate_input_test(tpl_snippet, input_params, expected_msg)
def test_invalid_input_vnfm_info(self):
tpl_snippet = '''
inputs:
vnfm_info:
type: list
entry_schema:
type: string
constraints: [ valid_values: [ Tacker ] ]
default: [ Tacker ]
'''
parameter = 'Tacker'
input_params = {'vnfm_info': parameter}
expected_msg = _('"%s" is not a list.')
self._translate_input_test(tpl_snippet, input_params,
expected_msg % parameter)

View File

@ -53,7 +53,8 @@ TOSCA_TO_HOT_INPUT_TYPES = {'string': 'string',
'scalar-unit.size': 'number',
'version': 'string',
'null': 'string',
'PortDef': 'number'}
'PortDef': 'number',
'list': 'list'}
log = logging.getLogger('heat-translator')