diff options
author | stark, steven <steven.stark@att.com> | 2019-02-04 16:20:15 -0800 |
---|---|---|
committer | stark, steven <steven.stark@att.com> | 2019-02-04 16:37:13 -0800 |
commit | 10535815da964c683e5f91030934652bfb3f53b8 (patch) | |
tree | 129390448c758b104b677a4c89e2aac89ecdfd73 /ice_validator/tests | |
parent | 912ea4cdf9721f66339c47bbfdcf4315ca7bd424 (diff) |
[VVP] enhance tests for nested templates
Change-Id: I17047fa3df555fafcdae566fad50b8c19ddca16f
Issue-ID: VVP-158
Signed-off-by: stark, steven <steven.stark@att.com>
Diffstat (limited to 'ice_validator/tests')
42 files changed, 129 insertions, 129 deletions
diff --git a/ice_validator/tests/fixtures/test_availability_zone_params_start_at_0/pass/nested.yaml b/ice_validator/tests/fixtures/test_availability_zone_params_start_at_0/pass/nested.yaml index 910cdf3..fc88415 100644 --- a/ice_validator/tests/fixtures/test_availability_zone_params_start_at_0/pass/nested.yaml +++ b/ice_validator/tests/fixtures/test_availability_zone_params_start_at_0/pass/nested.yaml @@ -40,7 +40,7 @@ heat_template_version: 2015-04-30 description: Simple template to deploy a single compute instance parameters: - availability_zone_9: + availability_zone_0: type: string label: Key Name description: Name of key-pair to be used for compute instance diff --git a/ice_validator/tests/fixtures/test_ip_parameters_start_at_0/pass/nested.yaml b/ice_validator/tests/fixtures/test_ip_parameters_start_at_0/pass/nested.yaml index 9283663..d033d0a 100644 --- a/ice_validator/tests/fixtures/test_ip_parameters_start_at_0/pass/nested.yaml +++ b/ice_validator/tests/fixtures/test_ip_parameters_start_at_0/pass/nested.yaml @@ -40,7 +40,7 @@ heat_template_version: 2015-04-30 description: Simple template to deploy a single compute instance parameters: - vm1_nr1_ip_4: + vm1_nr1_ip_0: type: string label: Key Name description: Name of key-pair to be used for compute instance diff --git a/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/pass/nested.yaml b/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/pass/nested.yaml index 71d5419..1a9cccf 100644 --- a/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/pass/nested.yaml +++ b/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/pass/nested.yaml @@ -40,7 +40,7 @@ heat_template_version: 2015-04-30 description: Simple template to deploy a single compute instance parameters: - vm1_name_16: + vm1_name_0: type: string label: Key Name description: Name of key-pair to be used for compute instance diff --git a/ice_validator/tests/test_allowed_address_pairs_include_vm_type_network_role.py b/ice_validator/tests/test_allowed_address_pairs_include_vm_type_network_role.py index 5b1570e..714e555 100644 --- a/ice_validator/tests/test_allowed_address_pairs_include_vm_type_network_role.py +++ b/ice_validator/tests/test_allowed_address_pairs_include_vm_type_network_role.py @@ -53,13 +53,13 @@ VERSION = "1.0.0" @validates("R-41492", "R-35735", "R-98748") -def test_allowed_address_pairs_include_vm_type_network_role(heat_template): +def test_allowed_address_pairs_include_vm_type_network_role(yaml_file): """ Check that all allowed_address_pairs include the {vm_type} of the nova server it is associated to and also contains the {network_role} of the network it is associated with """ - with open(heat_template) as fh: + with open(yaml_file) as fh: yml = yaml.load(fh) # skip if resources are not defined diff --git a/ice_validator/tests/test_availability_zone.py b/ice_validator/tests/test_availability_zone.py index ba71d14..f22111a 100644 --- a/ice_validator/tests/test_availability_zone.py +++ b/ice_validator/tests/test_availability_zone.py @@ -50,12 +50,12 @@ VERSION = "1.1.0" @validates("R-98450") -def test_availability_zone_naming(heat_template): +def test_availability_zone_naming(yaml_file): """ Make sure all availability zones are properly formatted """ - with open(heat_template) as fh: + with open(yaml_file) as fh: yml = yaml.load(fh) # skip if resources are not defined diff --git a/ice_validator/tests/test_availability_zone_params_start_at_0.py b/ice_validator/tests/test_availability_zone_params_start_at_0.py index 32a7484..c9d74e4 100644 --- a/ice_validator/tests/test_availability_zone_params_start_at_0.py +++ b/ice_validator/tests/test_availability_zone_params_start_at_0.py @@ -44,7 +44,7 @@ AZ_PATTERN = re.compile(r"^(availability_zone_)(\d+)$") @validates("R-98450") -def test_availability_zones_start_at_0(heat_template): - params = Heat(heat_template).parameters +def test_availability_zones_start_at_0(yaml_file): + params = Heat(yaml_file).parameters invalid_params = check_indices(AZ_PATTERN, params, "Availability Zone Parameters") assert not invalid_params, ". ".join(invalid_params) diff --git a/ice_validator/tests/test_cloud_config_resource_id.py b/ice_validator/tests/test_cloud_config_resource_id.py index 74937b6..c78fe71 100644 --- a/ice_validator/tests/test_cloud_config_resource_id.py +++ b/ice_validator/tests/test_cloud_config_resource_id.py @@ -52,10 +52,10 @@ VERSION = "1.0.0" @validates("R-04747") -def test_cloud_config(heat_template): +def test_cloud_config(yaml_file): """validate resource ids """ - h = Heat(filepath=heat_template) + h = Heat(filepath=yaml_file) if not h.resources: pytest.skip("No resources in this template") diff --git a/ice_validator/tests/test_contrail_fqdn.py b/ice_validator/tests/test_contrail_fqdn.py index 65ab9e4..f90553f 100644 --- a/ice_validator/tests/test_contrail_fqdn.py +++ b/ice_validator/tests/test_contrail_fqdn.py @@ -124,7 +124,7 @@ def validate_virtual_network_refs(heat, virtual_network_refs, network_role): @validates("R-02164") -def test_contrail_fqdn(heat_template): +def test_contrail_fqdn(yaml_file): """ When a VNF's Heat Orchestration Template's Contrail resource has a property that @@ -134,4 +134,4 @@ def test_contrail_fqdn(heat_template): * **MUST** follow the format ``{network-role}_net_fqdn`` * **MUST** be declared as type ``string`` """ - run_test(heat_template, validate_virtual_network_refs) + run_test(yaml_file, validate_virtual_network_refs) diff --git a/ice_validator/tests/test_contrail_instance_ip_resource_id.py b/ice_validator/tests/test_contrail_instance_ip_resource_id.py index 13f1b8e..d08938e 100644 --- a/ice_validator/tests/test_contrail_instance_ip_resource_id.py +++ b/ice_validator/tests/test_contrail_instance_ip_resource_id.py @@ -79,7 +79,7 @@ def run_test(heat_template, regex_names, network_flavor): @validates("R-53310", "R-46128") -def test_contrail_instance_ip_resource_id_external(heat_template): +def test_contrail_instance_ip_resource_id_external(yaml_file): """ A VNF's Heat Orchestration Template's Resource OS::ContrailV2::InstanceIp that is configuring an IPv4 Address on a port attached to an external @@ -100,14 +100,14 @@ def test_contrail_instance_ip_resource_id_external(heat_template): """ run_test( - heat_template, + yaml_file, regex_names=("ip", "v6_ip"), network_flavor=ContrailV2InstanceIpProcessor.network_flavor_external, ) @validates("R-62187", "R-87563") -def test_contrail_instance_ip_resource_id_internal(heat_template): +def test_contrail_instance_ip_resource_id_internal(yaml_file): """ internal {vm-type}_{vm-type_index}_int_{network-role}_vmi_{vmi_index} @@ -116,14 +116,14 @@ def test_contrail_instance_ip_resource_id_internal(heat_template): _v6_IP_{index} """ run_test( - heat_template, + yaml_file, regex_names=("int_ip", "int_v6_ip"), network_flavor=ContrailV2InstanceIpProcessor.network_flavor_internal, ) @validates("R-20947", "R-88540") -def test_contrail_instance_ip_resource_id_subint(heat_template): +def test_contrail_instance_ip_resource_id_subint(yaml_file): """ subint {vm-type}_{vm-type_index}_subint_{network-role}_vmi_{vmi_index} @@ -132,7 +132,7 @@ def test_contrail_instance_ip_resource_id_subint(heat_template): _v6_IP_{index} """ run_test( - heat_template, + yaml_file, regex_names=("subint_ip", "subint_v6_ip"), network_flavor=ContrailV2InstanceIpProcessor.network_flavor_subint, ) diff --git a/ice_validator/tests/test_contrail_irt_routes.py b/ice_validator/tests/test_contrail_irt_routes.py index e5a95dd..29d1af2 100644 --- a/ice_validator/tests/test_contrail_irt_routes.py +++ b/ice_validator/tests/test_contrail_irt_routes.py @@ -146,7 +146,7 @@ def validate_irt_route_param_type(heat, routes_route): @validates("R-28222") -def test_contrail_irt_route_param_format(heat_template): +def test_contrail_irt_route_param_format(yaml_file): """ If a VNF's Heat Orchestration Template ``OS::ContrailV2::InterfaceRouteTable`` resource @@ -154,13 +154,13 @@ def test_contrail_irt_route_param_format(heat_template): ``interface_route_table_routes_route`` map property parameter name **MUST** follow the format """ - run_test(heat_template, validate_irt_route_param_format) + run_test(yaml_file, validate_irt_route_param_format) @validates("R-19756") -def test_contrail_irt_route_param_type(heat_template): +def test_contrail_irt_route_param_type(yaml_file): """ * ``{vm-type}_{network-role}_route_prefixes`` **MUST** be defined as type ``json``. """ - run_test(heat_template, validate_irt_route_param_type) + run_test(yaml_file, validate_irt_route_param_type) diff --git a/ice_validator/tests/test_contrail_resource_id.py b/ice_validator/tests/test_contrail_resource_id.py index e0e9dce..06b41b4 100644 --- a/ice_validator/tests/test_contrail_resource_id.py +++ b/ice_validator/tests/test_contrail_resource_id.py @@ -88,7 +88,7 @@ def run_test(heat_template, contrail_class, get_parts, part_name): @validates("R-81214") -def test_contrail_interfaceroutetable_resource_id(heat_template): +def test_contrail_interfaceroutetable_resource_id(yaml_file): """ A VNF's Heat Orchestration Template's Resource ``OS::ContrailV2::InterfaceRouteTable`` @@ -97,7 +97,7 @@ def test_contrail_interfaceroutetable_resource_id(heat_template): contain the ``{network-role}``. """ run_test( - heat_template, + yaml_file, ContrailV2InterfaceRouteTableProcessor, get_network_roles, "network_role", @@ -105,7 +105,7 @@ def test_contrail_interfaceroutetable_resource_id(heat_template): @validates("R-30753") -def test_contrail_networkipam_resource_id(heat_template): +def test_contrail_networkipam_resource_id(yaml_file): """ A VNF's Heat Orchestration Template's Resource ``OS::ContrailV2::NetworkIpam`` @@ -114,12 +114,12 @@ def test_contrail_networkipam_resource_id(heat_template): contain the ``{network-role}``. """ run_test( - heat_template, ContrailV2NetworkIpamProcessor, get_network_roles, "network_role" + yaml_file, ContrailV2NetworkIpamProcessor, get_network_roles, "network_role" ) @validates("R-20065") -def test_contrail_porttuple_resource_id(heat_template): +def test_contrail_porttuple_resource_id(yaml_file): """ A VNF's Heat Orchestration Template's Resource ``OS::ContrailV2::PortTuple`` @@ -127,11 +127,11 @@ def test_contrail_porttuple_resource_id(heat_template): **MUST** contain the ``{vm-type}``. """ - run_test(heat_template, ContrailV2PortTupleProcessor, get_vm_types, "vm_type") + run_test(yaml_file, ContrailV2PortTupleProcessor, get_vm_types, "vm_type") @validates("R-76014") -def test_contrail_servicehealthcheck_resource_id(heat_template): +def test_contrail_servicehealthcheck_resource_id(yaml_file): """ A VNF's Heat Orchestration Template's Resource ``OS::ContrailV2::ServiceHealthCheck`` @@ -140,12 +140,12 @@ def test_contrail_servicehealthcheck_resource_id(heat_template): contain the ``{vm-type}``. """ run_test( - heat_template, ContrailV2ServiceHealthCheckProcessor, get_vm_types, "vm_type" + yaml_file, ContrailV2ServiceHealthCheckProcessor, get_vm_types, "vm_type" ) @validates("R-16437") -def test_contrail_servicetemplate_resource_id(heat_template): +def test_contrail_servicetemplate_resource_id(yaml_file): """ A VNF's Heat Orchestration Template's Resource ``OS::ContrailV2::ServiceTemplate`` @@ -153,4 +153,4 @@ def test_contrail_servicetemplate_resource_id(heat_template): **MUST** contain the ``{vm-type}``. """ - run_test(heat_template, ContrailV2ServiceTemplateProcessor, get_vm_types, "vm_type") + run_test(yaml_file, ContrailV2ServiceTemplateProcessor, get_vm_types, "vm_type") diff --git a/ice_validator/tests/test_contrail_vmi_resource_id.py b/ice_validator/tests/test_contrail_vmi_resource_id.py index 67f929b..4d1efb8 100644 --- a/ice_validator/tests/test_contrail_vmi_resource_id.py +++ b/ice_validator/tests/test_contrail_vmi_resource_id.py @@ -81,7 +81,7 @@ def run_test(heat_template, regex_name, network_flavor): @validates("R-96253") -def test_contrail_instance_ip_resource_id_external(heat_template): +def test_contrail_instance_ip_resource_id_external(yaml_file): """ A VNF's Heat Orchestration Template's Resource OS::ContrailV2::VirtualMachineInterface that is attaching to an @@ -91,14 +91,14 @@ def test_contrail_instance_ip_resource_id_external(heat_template): {vm-type}_{vm-type_index}_{network-role}_vmi_{vmi_index} """ run_test( - heat_template, + yaml_file, regex_name="vmi_external", network_flavor=ContrailV2VirtualMachineInterfaceProcessor.network_flavor_external, ) @validates("R-50468") -def test_contrail_instance_ip_resource_id_internal(heat_template): +def test_contrail_instance_ip_resource_id_internal(yaml_file): """ A VNF's Heat Orchestration Template's Resource OS::ContrailV2::VirtualMachineInterface that is attaching to an @@ -108,14 +108,14 @@ def test_contrail_instance_ip_resource_id_internal(heat_template): {vm-type}_{vm-type_index}_int_{network-role}_vmi_{vmi_index} """ run_test( - heat_template, + yaml_file, regex_name="vmi_internal", network_flavor=ContrailV2VirtualMachineInterfaceProcessor.network_flavor_internal, ) @validates("R-54458") -def test_contrail_instance_ip_resource_id_subint(heat_template): +def test_contrail_instance_ip_resource_id_subint(yaml_file): """ A VNF's Heat Orchestration Template's Resource OS::ContrailV2::VirtualMachineInterface that is attaching to an @@ -125,7 +125,7 @@ def test_contrail_instance_ip_resource_id_subint(heat_template): {vm-type}_{vm-type_index}_subint_{network-role}_vmi_{vmi_index} """ run_test( - heat_template, + yaml_file, regex_name="vmi_subint", network_flavor=ContrailV2VirtualMachineInterfaceProcessor.network_flavor_subint, ) diff --git a/ice_validator/tests/test_contrail_vn_resource_id.py b/ice_validator/tests/test_contrail_vn_resource_id.py index b316fb7..07eece5 100644 --- a/ice_validator/tests/test_contrail_vn_resource_id.py +++ b/ice_validator/tests/test_contrail_vn_resource_id.py @@ -53,7 +53,7 @@ VERSION = "2.0.0" @validates("R-99110") -def test_neutron_net_resource_id(heat_template): +def test_neutron_net_resource_id(yaml_file): """ A VNF's Heat Orchestration Template's Resource OS::ContrailV2::VirtualNetwork Resource ID @@ -63,7 +63,7 @@ def test_neutron_net_resource_id(heat_template): or 2) int_{network-role}_RVN`` where RVN represents Resource Virtual """ - heat = Heat(filepath=heat_template) + heat = Heat(filepath=yaml_file) heat_object_class = ContrailV2VirtualNetworkProcessor resource_type = heat_object_class.resource_type resources = heat.get_resource_by_type(resource_type) diff --git a/ice_validator/tests/test_fixed_ips_include_vm_type_network_role.py b/ice_validator/tests/test_fixed_ips_include_vm_type_network_role.py index e0e6b31..58351e5 100644 --- a/ice_validator/tests/test_fixed_ips_include_vm_type_network_role.py +++ b/ice_validator/tests/test_fixed_ips_include_vm_type_network_role.py @@ -55,13 +55,13 @@ from .utils.ports import get_invalid_ip_addresses "R-04697", "R-34037", ) -def test_fixed_ips_include_vm_type_network_role(heat_template): +def test_fixed_ips_include_vm_type_network_role(yaml_file): """ Check that all fixed_ips ip addresses include the {vm_type} of the nova server it is associated to and also contains the {network_role} of the network it is associated with """ - with open(heat_template) as fh: + with open(yaml_file) as fh: yml = yaml.load(fh) # skip if resources are not defined diff --git a/ice_validator/tests/test_forbidden_resources.py b/ice_validator/tests/test_forbidden_resources.py index 205dfcd..d24eb50 100644 --- a/ice_validator/tests/test_forbidden_resources.py +++ b/ice_validator/tests/test_forbidden_resources.py @@ -63,18 +63,18 @@ def run_test(heat_template, forbidden): @validates("R-05257") -def test_neutron_floating_ip_resource_type(heat_template): +def test_neutron_floating_ip_resource_type(yaml_file): """ A VNF's Heat Orchestration Template's **MUST NOT** contain the Resource ``OS::Neutron::FloatingIP``. """ - run_test(heat_template, "OS::Neutron::FloatingIP") + run_test(yaml_file, "OS::Neutron::FloatingIP") @validates("R-76449") -def test_neutron_floating_ip_association_resource_type(heat_template): +def test_neutron_floating_ip_association_resource_type(yaml_file): """ A VNF's Heat Orchestration Template's **MUST NOT** contain the Resource ``OS::Neutron::FloatingIPAssociation``. """ - run_test(heat_template, "OS::Neutron::FloatingIPAssociation") + run_test(yaml_file, "OS::Neutron::FloatingIPAssociation") diff --git a/ice_validator/tests/test_heat_template_structure.py b/ice_validator/tests/test_heat_template_structure.py index 192f45a..a988aea 100644 --- a/ice_validator/tests/test_heat_template_structure.py +++ b/ice_validator/tests/test_heat_template_structure.py @@ -97,18 +97,18 @@ def test_heat_template_structure_contains_parameters(yaml_file): @validates("R-23664") -def test_heat_template_structure_contains_resources(heat_template): +def test_heat_template_structure_contains_resources(yaml_file): """ Check that all heat templates have the required sections """ required_key_values = ["resources"] - with open(heat_template) as fh: + with open(yaml_file) as fh: yml = yaml.load(fh) assert all( [k in yml for k in required_key_values] ), "{} doesn't contain the {} section, but it is required".format( - heat_template, required_key_values[0] + yaml_file, required_key_values[0] ) diff --git a/ice_validator/tests/test_initial_configuration.py b/ice_validator/tests/test_initial_configuration.py index 83f887c..3ecfb59 100644 --- a/ice_validator/tests/test_initial_configuration.py +++ b/ice_validator/tests/test_initial_configuration.py @@ -184,11 +184,11 @@ def test_05_all_get_param_have_defined_parameter(yaml_file): @validates("R-90152") @pytest.mark.base -def test_06_heat_template_resource_section_has_resources(heat_template): +def test_06_heat_template_resource_section_has_resources(yaml_file): found_resource = False - with open(heat_template) as fh: + with open(yaml_file) as fh: yml = yaml.load(fh) resources = yml.get("resources") diff --git a/ice_validator/tests/test_ip_parameters_start_at_0.py b/ice_validator/tests/test_ip_parameters_start_at_0.py index e16c161..e163b09 100644 --- a/ice_validator/tests/test_ip_parameters_start_at_0.py +++ b/ice_validator/tests/test_ip_parameters_start_at_0.py @@ -44,7 +44,7 @@ IP_PARAM_PATTERN = re.compile(r"^(.*_ip_)(\d+)$") @validates("R-71577", "R-40971") -def test_ips_start_at_0(heat_template): - params = Heat(heat_template).parameters +def test_ips_start_at_0(yaml_file): + params = Heat(yaml_file).parameters invalid_params = check_indices(IP_PARAM_PATTERN, params, "IP Parameters") assert not invalid_params, ". ".join(invalid_params) diff --git a/ice_validator/tests/test_multipart_mime_resource_id.py b/ice_validator/tests/test_multipart_mime_resource_id.py index 52f8723..a69100b 100644 --- a/ice_validator/tests/test_multipart_mime_resource_id.py +++ b/ice_validator/tests/test_multipart_mime_resource_id.py @@ -52,10 +52,10 @@ VERSION = "1.0.1" @validates("R-30804") -def test_multipart_mime(heat_template): +def test_multipart_mime(yaml_file): """validate resource ids """ - h = Heat(filepath=heat_template) + h = Heat(filepath=yaml_file) if not h.resources: pytest.skip("No resources in this template") diff --git a/ice_validator/tests/test_nested_parameter_args.py b/ice_validator/tests/test_nested_parameter_args.py index b0a0337..62c22d7 100644 --- a/ice_validator/tests/test_nested_parameter_args.py +++ b/ice_validator/tests/test_nested_parameter_args.py @@ -51,7 +51,7 @@ VERSION = "1.0.0" @validates("R-10834") -def test_nested_parameter_args(heat_template): +def test_nested_parameter_args(yaml_file): """ If a VNF’s Heat Orchestration Template resource attribute property metadata uses a nested get_param, then the "outer" @@ -75,7 +75,7 @@ def test_nested_parameter_args(heat_template): vf_module_id: get_param: [ cdl, { get_param: num }] """ - heat = Heat(filepath=heat_template) + heat = Heat(filepath=yaml_file) if not heat.resources: pytest.skip("No resources found") has_nested_parameters = False diff --git a/ice_validator/tests/test_nested_template_parameters.py b/ice_validator/tests/test_nested_template_parameters.py index 3bc52d7..8f5acc8 100644 --- a/ice_validator/tests/test_nested_template_parameters.py +++ b/ice_validator/tests/test_nested_template_parameters.py @@ -71,14 +71,14 @@ def validate_parms(dirname, basename, nested, nested_props, prop_type): @validates("R-11041") -def test_nested_template_parameters(heat_template): +def test_nested_template_parameters(yaml_file): """ All parameters defined in a VNFs Nested YAML file **MUST** be passed in as properties of the resource calling the nested yaml file. """ - dirname, basename = os.path.split(heat_template) - heat = Heat(filepath=heat_template) + dirname, basename = os.path.split(yaml_file) + heat = Heat(filepath=yaml_file) if not heat.resources: pytest.skip("No resources found") nested_type = nested_files.get_type_nested_files(heat.yml, dirname) diff --git a/ice_validator/tests/test_network_format.py b/ice_validator/tests/test_network_format.py index 514e83e..df49e66 100644 --- a/ice_validator/tests/test_network_format.py +++ b/ice_validator/tests/test_network_format.py @@ -52,12 +52,12 @@ NETWORK_RESOURCE_TYPES = ["OS::Neutron::Net", "OS::ContrailV2::VirtualNetwork"] @validates("R-62983", "R-86182") -def test_network_format(heat_template): +def test_network_format(yaml_file): """ Make sure all network properties use the allowed naming conventions """ - with open(heat_template) as fh: + with open(yaml_file) as fh: yml = yaml.load(fh) # skip if resources are not defined diff --git a/ice_validator/tests/test_network_format_use_get_param_or_get_resource.py b/ice_validator/tests/test_network_format_use_get_param_or_get_resource.py index 770d1f6..e10e873 100644 --- a/ice_validator/tests/test_network_format_use_get_param_or_get_resource.py +++ b/ice_validator/tests/test_network_format_use_get_param_or_get_resource.py @@ -44,13 +44,13 @@ from .helpers import validates @validates("R-93177") -def test_network_format_use_get_param_or_get_resource(heat_template): +def test_network_format_use_get_param_or_get_resource(yaml_file): """ Make sure all network properties only use get_param or get_resource of an internal network """ - with open(heat_template) as fh: + with open(yaml_file) as fh: yml = yaml.load(fh) # skip if resources are not defined diff --git a/ice_validator/tests/test_neutron_net_resource_id.py b/ice_validator/tests/test_neutron_net_resource_id.py index 59556a5..d86cf7a 100644 --- a/ice_validator/tests/test_neutron_net_resource_id.py +++ b/ice_validator/tests/test_neutron_net_resource_id.py @@ -53,14 +53,14 @@ VERSION = "2.0.0" @validates("R-25720") -def test_neutron_net_resource_id(heat_template): +def test_neutron_net_resource_id(yaml_file): """ A VNF's Heat Orchestration Template's Resource OS::Neutron::Net Resource ID **MUST** use the naming convention * int_{network-role}_network """ - heat = Heat(filepath=heat_template) + heat = Heat(filepath=yaml_file) neutron_nets = heat.get_resource_by_type(NeutronNetProcessor.resource_type) if not neutron_nets: pytest.skip("No neutron nets found") diff --git a/ice_validator/tests/test_neutron_port_addresses.py b/ice_validator/tests/test_neutron_port_addresses.py index 95b8ddc..05b0223 100644 --- a/ice_validator/tests/test_neutron_port_addresses.py +++ b/ice_validator/tests/test_neutron_port_addresses.py @@ -197,23 +197,23 @@ def validate_external_ipaddress_v6(heat, allowed_address_pairs): @validates("R-91810") -def test_neutron_port_external_ipaddress(heat_template): +def test_neutron_port_external_ipaddress(yaml_file): """ If a VNF requires ONAP to assign a Virtual IP (VIP) Address to ports connected an external network, the port **MUST NOT** have more than one IPv4 VIP address. """ - run_test(heat_template, validate_external_ipaddress) + run_test(yaml_file, validate_external_ipaddress) @validates("R-41956") -def test_neutron_port_external_ipaddress_v6(heat_template): +def test_neutron_port_external_ipaddress_v6(yaml_file): """ If a VNF requires ONAP to assign a Virtual IP (VIP) Address to ports connected an external network, the port **MUST NOT** have more than one IPv6 VIP address. """ - run_test(heat_template, validate_external_ipaddress_v6) + run_test(yaml_file, validate_external_ipaddress_v6) @validates("R-10754") diff --git a/ice_validator/tests/test_neutron_port_fixed_ips.py b/ice_validator/tests/test_neutron_port_fixed_ips.py index 474c545..6e2d562 100644 --- a/ice_validator/tests/test_neutron_port_fixed_ips.py +++ b/ice_validator/tests/test_neutron_port_fixed_ips.py @@ -270,18 +270,18 @@ def get_base_template(heat_template): @validates("R-38236") -def test_neutron_port_fixed_ips(heat_template): +def test_neutron_port_fixed_ips(yaml_file): """ The VNF's Heat Orchestration Template's resource ``OS::Neutron::Port`` property ``fixed_ips`` map property ``subnet``/``subnet_id`` parameter **MUST** be declared type ``string``. """ - run_test(heat_template, validate_fixed_ip) + run_test(yaml_file, validate_fixed_ip) @validates("R-62802", "R-15287") -def test_neutron_port_external_fixed_ips(heat_template): +def test_neutron_port_external_fixed_ips(yaml_file): """ When the VNF's Heat Orchestration Template's resource ``OS::Neutron::Port`` is attaching @@ -296,11 +296,11 @@ def test_neutron_port_external_fixed_ips(heat_template): and the external network IPv6 subnet is to be specified * ``{network-role}_v6_subnet_id`` """ - run_test(heat_template, validate_external_fixed_ip) + run_test(yaml_file, validate_external_fixed_ip) @validates("R-84123", "R-76160") -def test_neutron_port_internal_fixed_ips(heat_template): +def test_neutron_port_internal_fixed_ips(yaml_file): """ When @@ -319,4 +319,4 @@ def test_neutron_port_internal_fixed_ips(heat_template): * ``int_{network-role}_v6_subnet_id`` """ - run_test(heat_template, validate_internal_fixed_ip) + run_test(yaml_file, validate_internal_fixed_ip) diff --git a/ice_validator/tests/test_neutron_port_network_parameter.py b/ice_validator/tests/test_neutron_port_network_parameter.py index 99f90ae..10f26ad 100644 --- a/ice_validator/tests/test_neutron_port_network_parameter.py +++ b/ice_validator/tests/test_neutron_port_network_parameter.py @@ -45,12 +45,12 @@ from .utils.network_roles import property_uses_get_resource @validates("R-18008") -def test_neutron_port_network_param_is_string(heat_template): +def test_neutron_port_network_param_is_string(yaml_file): """ Make sure all network properties use the allowed naming conventions """ - with open(heat_template) as fh: + with open(yaml_file) as fh: yml = yaml.load(fh) # skip if resources are not defined diff --git a/ice_validator/tests/test_non_server_name.py b/ice_validator/tests/test_non_server_name.py index f56eef3..c435916 100644 --- a/ice_validator/tests/test_non_server_name.py +++ b/ice_validator/tests/test_non_server_name.py @@ -65,7 +65,7 @@ def get_non_servers(heat): @validates("R-85734") -def test_non_server_name(heat_template): +def test_non_server_name(yaml_file): """ If a VNF's Heat Orchestration Template contains the property ``name`` for a non ``OS::Nova::Server`` resource, the intrinsic function @@ -73,7 +73,7 @@ def test_non_server_name(heat_template): supplied metadata parameter ``vnf_name`` to generate a unique value. """ - h = Heat(filepath=heat_template) + h = Heat(filepath=yaml_file) if not h.resources: pytest.skip("No resources in this template") diff --git a/ice_validator/tests/test_nova_server_name_parameters_start_at_0.py b/ice_validator/tests/test_nova_server_name_parameters_start_at_0.py index 91258e1..646d7d3 100644 --- a/ice_validator/tests/test_nova_server_name_parameters_start_at_0.py +++ b/ice_validator/tests/test_nova_server_name_parameters_start_at_0.py @@ -44,8 +44,8 @@ SERVER_NAME_PARAM = re.compile(r"(.*_name_)(\d+)") @validates("R-54171") -def test_nova_server_name_parameter_starts_at(heat_template): - params = Heat(heat_template).parameters +def test_nova_server_name_parameter_starts_at(yaml_file): + params = Heat(yaml_file).parameters invalid_params = check_indices( SERVER_NAME_PARAM, params, "OS::Nova::Server Name Parameters" ) diff --git a/ice_validator/tests/test_nova_server_resource_id.py b/ice_validator/tests/test_nova_server_resource_id.py index be38af5..d8d9754 100644 --- a/ice_validator/tests/test_nova_server_resource_id.py +++ b/ice_validator/tests/test_nova_server_resource_id.py @@ -51,7 +51,7 @@ VERSION = "2.0.0" @validates("R-29751") -def test_nova_server_resource_id(heat_template): +def test_nova_server_resource_id(yaml_file): """ A VNF's Heat Orchestration Template's Resource OS::Nova::Server Resource ID @@ -60,7 +60,7 @@ def test_nova_server_resource_id(heat_template): * ``{vm-type}_server_{index}`` """ - heat = Heat(filepath=heat_template) + heat = Heat(filepath=yaml_file) resources = heat.nova_server_resources if not resources: pytest.skip("No Nova Server resources found") diff --git a/ice_validator/tests/test_nova_servers_environment_context.py b/ice_validator/tests/test_nova_servers_environment_context.py index 95baa3a..0da97f2 100644 --- a/ice_validator/tests/test_nova_servers_environment_context.py +++ b/ice_validator/tests/test_nova_servers_environment_context.py @@ -49,7 +49,7 @@ VERSION = "1.0.0" @validates("R-20308") -def test_environment_context(heat_template): +def test_environment_context(yaml_file): """ A VNF's Heat Orchestration Template's OS::Nova::Server Resource **MUST** @@ -59,7 +59,7 @@ def test_environment_context(heat_template): metadata map value parameter 'environment_context' **MUST** be declared as type: 'string'. """ - with open(heat_template) as fh: + with open(yaml_file) as fh: yml = yaml.load(fh) if "parameters" not in yml: @@ -79,7 +79,7 @@ def test_environment_context(heat_template): continue error = validate_metadata(metadata, yml["parameters"]) if error: - assert False, '%s resource "%s" %s' % (heat_template, resource, error) + assert False, '%s resource "%s" %s' % (yaml_file, resource, error) def validate_metadata(metadata, parameters): diff --git a/ice_validator/tests/test_nova_servers_vm_types.py b/ice_validator/tests/test_nova_servers_vm_types.py index 97b6418..d3d0dbb 100644 --- a/ice_validator/tests/test_nova_servers_vm_types.py +++ b/ice_validator/tests/test_nova_servers_vm_types.py @@ -50,12 +50,12 @@ from .utils.network_roles import get_network_roles @validates("R-57282") -def test_vm_type_consistent_on_nova_servers(heat_template): +def test_vm_type_consistent_on_nova_servers(yaml_file): """ Make sure all nova servers have properly formatted properties for their name, image and flavor """ - with open(heat_template) as fh: + with open(yaml_file) as fh: yml = yaml.load(fh) # skip if resources are not defined diff --git a/ice_validator/tests/test_nova_servers_vm_types_use_get_param.py b/ice_validator/tests/test_nova_servers_vm_types_use_get_param.py index fcc354d..63698f1 100644 --- a/ice_validator/tests/test_nova_servers_vm_types_use_get_param.py +++ b/ice_validator/tests/test_nova_servers_vm_types_use_get_param.py @@ -44,11 +44,11 @@ from .helpers import validates @validates("R-901331", "R-481670", "R-663631") -def test_vm_type_assignments_on_nova_servers_only_use_get_param(heat_template): +def test_vm_type_assignments_on_nova_servers_only_use_get_param(yaml_file): """ Make sure all nova servers only use get_param for their properties """ - with open(heat_template) as fh: + with open(yaml_file) as fh: yml = yaml.load(fh) # skip if resources are not defined diff --git a/ice_validator/tests/test_nova_servers_workload_context.py b/ice_validator/tests/test_nova_servers_workload_context.py index 9daa45d..4c2ec10 100644 --- a/ice_validator/tests/test_nova_servers_workload_context.py +++ b/ice_validator/tests/test_nova_servers_workload_context.py @@ -49,7 +49,7 @@ VERSION = "1.0.0" @validates("R-74978") -def test_workload_context(heat_template): +def test_workload_context(yaml_file): """ A VNF's Heat Orchestration Template's OS::Nova::Server Resource **MUST** @@ -59,7 +59,7 @@ def test_workload_context(heat_template): metadata map value parameter 'workload_context' **MUST** be declared as type: 'string'. """ - with open(heat_template) as fh: + with open(yaml_file) as fh: yml = yaml.load(fh) if "parameters" not in yml: @@ -79,7 +79,7 @@ def test_workload_context(heat_template): continue error = validate_metadata(metadata, yml["parameters"]) if error: - assert False, '%s resource "%s" %s' % (heat_template, resource, error) + assert False, '%s resource "%s" %s' % (yaml_file, resource, error) def validate_metadata(metadata, parameters): diff --git a/ice_validator/tests/test_port_resource_ids.py b/ice_validator/tests/test_port_resource_ids.py index 1b98bff..6bd2a4e 100644 --- a/ice_validator/tests/test_port_resource_ids.py +++ b/ice_validator/tests/test_port_resource_ids.py @@ -52,14 +52,14 @@ from .utils.vm_types import get_vm_type_for_nova_server @validates("R-20453", "R-26351", "R-26506", "R-681859") -def test_port_resource_ids(heat_template): +def test_port_resource_ids(yaml_file): """ Check that all resource ids for ports follow the right naming convention to include the {vm_type} of the nova server it is associated to and also contains the {network_role} of the network it is associated with """ - with open(heat_template) as fh: + with open(yaml_file) as fh: yml = yaml.load(fh) # skip if resources are not defined diff --git a/ice_validator/tests/test_server_parameters.py b/ice_validator/tests/test_server_parameters.py index 793051c..7eb84cb 100644 --- a/ice_validator/tests/test_server_parameters.py +++ b/ice_validator/tests/test_server_parameters.py @@ -137,41 +137,41 @@ def check_server_parameter_name(heat_template, parameter, parameter_name): @validates("R-23311") -def test_availability_zone_parameter_type(heat_template): - check_parameter_type(heat_template, "availability_zone_", "string") +def test_availability_zone_parameter_type(yaml_file): + check_parameter_type(yaml_file, "availability_zone_", "string") @validates("R-07507") -def test_vnf_id_parameter_type_and_parameter_name(heat_template): - check_parameter_type(heat_template, "vnf_id", "string") - check_server_parameter_name(heat_template, "vnf_id", "vnf_id") +def test_vnf_id_parameter_type_and_parameter_name(yaml_file): + check_parameter_type(yaml_file, "vnf_id", "string") + check_server_parameter_name(yaml_file, "vnf_id", "vnf_id") @validates("R-82134") -def test_vf_module_id_parameter_type_and_parameter_name(heat_template): - check_parameter_type(heat_template, "vf_module_id", "string") - check_server_parameter_name(heat_template, "vf_module_id", "vf_module_id") +def test_vf_module_id_parameter_type_and_parameter_name(yaml_file): + check_parameter_type(yaml_file, "vf_module_id", "string") + check_server_parameter_name(yaml_file, "vf_module_id", "vf_module_id") @validates("R-62428") -def test_vnf_name_parameter_type_and_parameter_name(heat_template): - check_parameter_type(heat_template, "vnf_name", "string") - check_server_parameter_name(heat_template, "vnf_name", "vnf_name") +def test_vnf_name_parameter_type_and_parameter_name(yaml_file): + check_parameter_type(yaml_file, "vnf_name", "string") + check_server_parameter_name(yaml_file, "vnf_name", "vnf_name") @validates("R-39067") -def test_vf_module_name_parameter_type_and_parameter_name(heat_template): - check_parameter_type(heat_template, "vf_module_name", "string") - check_server_parameter_name(heat_template, "vf_module_name", "vf_module_name") +def test_vf_module_name_parameter_type_and_parameter_name(yaml_file): + check_parameter_type(yaml_file, "vf_module_name", "string") + check_server_parameter_name(yaml_file, "vf_module_name", "vf_module_name") @validates("R-95430") -def test_vm_role_parameter_type_and_parameter_name(heat_template): - check_parameter_type(heat_template, "vm_role", "string") - check_server_parameter_name(heat_template, "vm_role", "vm_role") +def test_vm_role_parameter_type_and_parameter_name(yaml_file): + check_parameter_type(yaml_file, "vm_role", "string") + check_server_parameter_name(yaml_file, "vm_role", "vm_role") @validates("R-54340") -def test_vf_module_index_parameter_type_and_parameter_name(heat_template): - check_parameter_type(heat_template, "vf_module_index", "number") - check_server_parameter_name(heat_template, "vf_module_index", "vf_module_index") +def test_vf_module_index_parameter_type_and_parameter_name(yaml_file): + check_parameter_type(yaml_file, "vf_module_index", "number") + check_server_parameter_name(yaml_file, "vf_module_index", "vf_module_index") diff --git a/ice_validator/tests/test_software_config_resource_id.py b/ice_validator/tests/test_software_config_resource_id.py index 2c266ac..d75b924 100644 --- a/ice_validator/tests/test_software_config_resource_id.py +++ b/ice_validator/tests/test_software_config_resource_id.py @@ -53,12 +53,12 @@ VERSION = "1.1.0" @validates("R-08975") -def test_software_config_vm_type(heat_template): +def test_software_config_vm_type(yaml_file): """ A VNF's Heat Orchestration Template's Resource OS::Heat::SoftwareConfig Resource ID **MUST** contain the {vm-type}. """ - heat = Heat(filepath=heat_template) + heat = Heat(filepath=yaml_file) software_configs = heat.get_resource_by_type("OS::Heat::SoftwareConfig") if not software_configs: pytest.skip("No SoftwareConfig resources found") diff --git a/ice_validator/tests/test_vm_role_value.py b/ice_validator/tests/test_vm_role_value.py index e7da73d..5f43a14 100644 --- a/ice_validator/tests/test_vm_role_value.py +++ b/ice_validator/tests/test_vm_role_value.py @@ -74,11 +74,11 @@ def test_vm_role_hardcoded(yaml_file): @validates("R-86476") -def test_vm_role_from_env_file(heat_template): +def test_vm_role_from_env_file(yaml_file): """ Validate vm_role when using parameters and env file """ - pair = get_environment_pair(heat_template) + pair = get_environment_pair(yaml_file) if not pair: pytest.skip("Unable to resolve environment pair") template_params = pair["yyml"].get("parameters") or {} diff --git a/ice_validator/tests/test_vm_type_case.py b/ice_validator/tests/test_vm_type_case.py index 34d0a6f..3ecd8de 100644 --- a/ice_validator/tests/test_vm_type_case.py +++ b/ice_validator/tests/test_vm_type_case.py @@ -94,12 +94,12 @@ def case_mismatch(vm_type, param): @validates("R-32394") -def test_vm_type_case(heat_template): +def test_vm_type_case(yaml_file): """ A VNF's Heat Orchestration Template's use of ``{vm-type}`` in all Resource property parameter names **MUST** be the same case. """ - heat = Heat(filepath=heat_template) + heat = Heat(filepath=yaml_file) resources = heat.resources if not resources: pytest.skip("No resources found") diff --git a/ice_validator/tests/test_vm_type_resource_id.py b/ice_validator/tests/test_vm_type_resource_id.py index f500daf..03bb85b 100644 --- a/ice_validator/tests/test_vm_type_resource_id.py +++ b/ice_validator/tests/test_vm_type_resource_id.py @@ -50,13 +50,13 @@ VERSION = "1.1.0" @validates("R-46839") -def test_vm_type_resource_id(heat_template): +def test_vm_type_resource_id(yaml_file): """ A VNF's Heat Orchestration Template's use of ``{vm-type}`` in all Resource IDs **MUST** be the same case. """ bad = {} - h = Heat(filepath=heat_template) + h = Heat(filepath=yaml_file) if not h.resources: pytest.skip("No resources specified in the heat template") vm_types = { diff --git a/ice_validator/tests/test_vm_type_syntax.py b/ice_validator/tests/test_vm_type_syntax.py index b7ea48b..d6b14d1 100644 --- a/ice_validator/tests/test_vm_type_syntax.py +++ b/ice_validator/tests/test_vm_type_syntax.py @@ -55,7 +55,7 @@ RE_VM_TYPE_NG = re.compile(r".*_int|_?int_.*$") @validates("R-98407") -def test_vm_type_syntax(heat_template): +def test_vm_type_syntax(yaml_file): """ A VNF's Heat Orchestration Template's ``{vm-type}`` **MUST** contain only @@ -63,7 +63,7 @@ def test_vm_type_syntax(heat_template): contain any of the following strings: ``_int`` or ``int_`` or ``_int_``. """ - v = Heat(filepath=heat_template) + v = Heat(filepath=yaml_file) if not v.resources: pytest.skip("No resources") t = set() diff --git a/ice_validator/tests/test_volume_resource_ids.py b/ice_validator/tests/test_volume_resource_ids.py index 4fe6e09..c6af6a7 100644 --- a/ice_validator/tests/test_volume_resource_ids.py +++ b/ice_validator/tests/test_volume_resource_ids.py @@ -42,13 +42,13 @@ from tests import cached_yaml as yaml from .utils.vm_types import get_vm_type_for_nova_server -def test_volume_resource_ids(heat_template): +def test_volume_resource_ids(yaml_file): """ Check that all resource ids for cinder volumes follow the right naming convention to include the {vm_type} of the nova server it is associated to """ - with open(heat_template) as fh: + with open(yaml_file) as fh: yml = yaml.load(fh) # skip if resources are not defined |