Browse Source

Merge "Add support for list data type"

tags/2.0.0^0
Zuul 3 months ago
committed by Gerrit Code Review
parent
commit
2a57298dce
2 changed files with 33 additions and 1 deletions
  1. +31
    -0
      translator/hot/tests/test_translate_inputs.py
  2. +2
    -1
      translator/hot/translate_inputs.py

+ 31
- 0
translator/hot/tests/test_translate_inputs.py 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)

+ 2
- 1
translator/hot/translate_inputs.py 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')



Loading…
Cancel
Save