- is_dict = 0
- should_be_dict = 0
- is_not_dict = 0
- should_not_be_dict = 0
- for key_value in key_values:
- if key_value in yml:
- if isinstance(yml[key_value], dict):
- is_dict += 1
- if key_value not in key_values_not_dicts:
- should_be_dict += 1
- elif not isinstance(yml[key_value], list):
- is_not_dict += 1
- if key_value in key_values_not_dicts:
- should_not_be_dict += 1
- assert (is_dict == should_be_dict and
- is_not_dict == should_not_be_dict)
+
+@validates("R-11441")
+def test_parameter_type(yaml_file):
+ """A VNF's Heat Orchestration Template's parameter type **MUST**
+ be one of the following values:
+ """
+ types = ["string", "number", "json", "comma_delimited_list", "boolean"]
+ with open(yaml_file) as fh:
+ yml = yaml.load(fh)
+ for key, param in yml.get("parameters", {}).items():
+ assert isinstance(param, dict), "%s parameter %s is not dict" % (yaml_file, key)
+ if "type" not in param:
+ continue
+ typ = param["type"]
+ assert typ in types, '%s parameter %s has invalid type "%s"' % (
+ yaml_file,
+ key,
+ typ,
+ )