diff options
author | Steven Wright <sw3588@att.com> | 2019-05-09 17:49:44 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-05-09 17:49:44 +0000 |
commit | 3f3f20e30f1012b4c3c7d9e306ccb7fb1cc47b33 (patch) | |
tree | bb99aa311f41647f8155e74d9e3317d811554b45 /ice_validator | |
parent | e4d14d1e0d1d676c881637351010821633c1aa4b (diff) | |
parent | b4faced895883a6a6f93bec02d7df4b165a6e75c (diff) |
Merge "[VVP] adding list support for non-server-name uniqueness"
Diffstat (limited to 'ice_validator')
-rw-r--r-- | ice_validator/tests/fixtures/test_non_server_name/pass/pass0.yaml | 20 | ||||
-rw-r--r-- | ice_validator/tests/structures.py | 12 |
2 files changed, 29 insertions, 3 deletions
diff --git a/ice_validator/tests/fixtures/test_non_server_name/pass/pass0.yaml b/ice_validator/tests/fixtures/test_non_server_name/pass/pass0.yaml index ca80c87..267d0b2 100644 --- a/ice_validator/tests/fixtures/test_non_server_name/pass/pass0.yaml +++ b/ice_validator/tests/fixtures/test_non_server_name/pass/pass0.yaml @@ -52,6 +52,26 @@ parameters: resources: + testr0: + type: testr + properties: + name: + str_replace: + template: vnfname_param + params: + vnfname: { get_param: vnf_name } + param: { get_param: [params, 0]} + + testr1: + type: testr + properties: + name: + str_replace: + template: vnfname_param + params: + vnfname: { get_param: vnf_name } + param: { get_param: [params, 1]} + vm_typeX_0_bialy_port_2: type: OS::Neutron::Port properties: diff --git a/ice_validator/tests/structures.py b/ice_validator/tests/structures.py index e81f3a1..a6b2015 100644 --- a/ice_validator/tests/structures.py +++ b/ice_validator/tests/structures.py @@ -85,13 +85,19 @@ class HeatProcessor(object): # regex parses the proper resource id format. @staticmethod - def get_param_value(value): + def get_param_value(value, withIndex=False): """Return get_param value of `value` """ if isinstance(value, dict) and len(value) == 1: v = value.get("get_param") if isinstance(v, list) and v: - v = v[0] + if withIndex and len(v) > 1: + idx = v[1] + if isinstance(idx, dict): + idx = idx.get("get_param", idx) + v = "{}{}".format(v[0], idx) + else: + v = v[0] else: v = None return v @@ -161,7 +167,7 @@ class HeatProcessor(object): # are replaced in the template in arbitrary order. name = template for key, value in params.items(): - param = cls.get_param_value(value) + param = cls.get_param_value(value, withIndex=True) if param is None: return None name = name.replace(key, str(param)) |