diff options
author | 2019-09-19 14:03:55 -0500 | |
---|---|---|
committer | 2019-09-20 09:52:15 -0500 | |
commit | 8fbae03a8758bb7c5aff28b0d7334db8c81b2d0f (patch) | |
tree | 48519171b2897e6acc0c8b2ee0c26153299e10be /ice_validator/tests/test_environment_file_parameters.py | |
parent | ff44cf54a9661597443f4f0a9ae9c5328aa4f22e (diff) |
[VVP] Misc tweaks and fixes to preload generation
* Use VALUE_FOR if value is still CHANGE me in .env file
* Fix issues with improper parameters being put in VNF parameters in
the preload
* Fix issue where lists of parameter values pulled from env file could
only be put in one template
* Exclude platform provided parameters from VNF parameters in preload
* Fixed issues with parameter validations
* Updated heat requirements
* implemented missing test for new requirement that all incremental
modules must have a nova server
Issue-ID: VVP-312
Signed-off-by: Lovett, Trevor <trevor.lovett@att.com>
Change-Id: I1a1225097544b690fb9b854c8a3d9e036f694d6a
Diffstat (limited to 'ice_validator/tests/test_environment_file_parameters.py')
-rw-r--r-- | ice_validator/tests/test_environment_file_parameters.py | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/ice_validator/tests/test_environment_file_parameters.py b/ice_validator/tests/test_environment_file_parameters.py index 9744b49..99d76a0 100644 --- a/ice_validator/tests/test_environment_file_parameters.py +++ b/ice_validator/tests/test_environment_file_parameters.py @@ -59,13 +59,13 @@ from tests.utils.nested_files import file_is_a_nested_template # at the end of a property to make it a tuple. ENV_PARAMETER_SPEC = { "PLATFORM PROVIDED": [ - {"property": ("vnf_id",), "persistent": False, "kwargs": {}}, - {"property": ("vnf_name",), "persistent": False, "kwargs": {}}, - {"property": ("vf_module_id",), "persistent": False, "kwargs": {}}, - {"property": ("vf_module_index",), "persistent": False, "kwargs": {}}, - {"property": ("vf_module_name",), "persistent": False, "kwargs": {}}, - {"property": ("workload_context",), "persistent": False, "kwargs": {}}, - {"property": ("environment_context",), "persistent": False, "kwargs": {}}, + {"property": ("metadata", "vnf_id",), "persistent": False, "kwargs": {}}, + {"property": ("metadata", "vnf_name",), "persistent": False, "kwargs": {}}, + {"property": ("metadata", "vf_module_id",), "persistent": False, "kwargs": {}}, + {"property": ("metadata", "vf_module_index",), "persistent": False, "kwargs": {}}, + {"property": ("metadata", "vf_module_name",), "persistent": False, "kwargs": {}}, + {"property": ("metadata", "workload_context",), "persistent": False, "kwargs": {}}, + {"property": ("metadata", "environment_context",), "persistent": False, "kwargs": {}}, {"property": (r"^(.+?)_net_fqdn$",), "persistent": False, "kwargs": {}}, ], "ALL": [{"property": ("name",), "persistent": False, "kwargs": {}}], @@ -90,13 +90,13 @@ ENV_PARAMETER_SPEC = { }, {"property": ("fixed_ips", "subnet"), "persistent": False, "kwargs": {}}, { - "property": ("fixed_ips", "allowed_address_pairs"), + "property": ("allowed_address_pairs", "ip_address"), "persistent": False, "network_type": "external", "kwargs": {"exclude_parameter": re.compile(r"^(.+?)_int_(.+?)$")}, }, { - "property": ("fixed_ips", "allowed_address_pairs"), + "property": ("allowed_address_pairs", "ip_address"), "persistent": True, "network_type": "internal", "kwargs": {"exclude_parameter": re.compile(r"^((?!_int_).)*$")}, @@ -234,21 +234,26 @@ def get_preload_excluded_parameters(yaml_file, persistent_only=False, env_spec=N for spec in specs: if persistent_only and not spec.get("persistent"): continue - results.extend( - get_template_parameters(yaml_file, resource_type, spec, all_resources) - ) - return {item["param"] for item in results} - - -def get_template_parameters(yaml_file, resource_type, spec, all_resources=False): + results.extend(get_template_parameters(yaml_file, resource_type, + spec, all_resources, nested_resources=True)) + results = {item["param"] for item in results} + for param in Heat(yaml_file).parameters: + # AZs often are manipulated and passed into nested templates making + # them difficult to detect by looking for the assignment. We'll + # just extract them from the parameters if they are there to be safe + if re.match(r"availability_zone_\d+", param): + results.add(param) + return results + + +def get_template_parameters(yaml_file, resource_type, spec, all_resources=False, nested_resources=False): parameters = [] heat = Heat(yaml_file) if all_resources: - resources = heat.resources + resources = heat.resources if not nested_resources else heat.get_all_resources() else: - resources = heat.get_resource_by_type(resource_type) - + resources = heat.get_resource_by_type(resource_type, all_resources=nested_resources) for rid, resource_props in resources.items(): for param in prop_iterator(resource_props, *spec.get("property")): if param and get_param(param) and param_helper(spec, get_param(param), rid): @@ -256,7 +261,6 @@ def get_template_parameters(yaml_file, resource_type, spec, all_resources=False) # then checking if its actually using get_param # then checking a custom helper function (mostly for internal vs external networks) parameters.append({"resource": rid, "param": get_param(param)}) - return parameters |