X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ice_validator%2Ftests%2Ftest_neutron_port_fixed_ips_subnet.py;h=a6c9f91f860f03553552cc92e2342d5df556574e;hb=ed4e48f967b1fccdd3fb142c0a166ee04ad6c2b0;hp=857fbff5545c830176e808c5aca83c88fb95b1b6;hpb=f257796cdb575d5079dce9738e31808c089f4cf3;p=vvp%2Fvalidation-scripts.git diff --git a/ice_validator/tests/test_neutron_port_fixed_ips_subnet.py b/ice_validator/tests/test_neutron_port_fixed_ips_subnet.py index 857fbff..a6c9f91 100644 --- a/ice_validator/tests/test_neutron_port_fixed_ips_subnet.py +++ b/ice_validator/tests/test_neutron_port_fixed_ips_subnet.py @@ -36,48 +36,23 @@ # ============LICENSE_END============================================ # # - -""" -resources: -{vm-type}_{vm-type_index}_{network-role}_port_{port-index}: - type: OS::Neutron::Port - properties: - network: { get_param: ...} - fixed_ips: [ { "ipaddress": { get_param: ... } } ] - binding:vnic_type: direct #only SR-IOV ports, not OVS ports - value_specs: { - vlan_filter: { get_param: ... }, #all NC ports - public_vlans: { get_param: ... }, #all NC ports - private_vlans: { get_param: ... },#all NC ports - guest_vlans: { get_param: ... }, #SR-IOV Trunk Port only - vlan_mirror: { get_param: ... }, #SRIOV Trunk Port - # Receiving Mirrored Traffic only - ATT_FABRIC_CONFIGURATION_REQUIRED: true #all NC ports - } - metadata: - port_type: SR-IOV_Trunk #SR-IOV Trunk Port - port_type: SR-IOV_Non_Trunk #SR-IOV Non Trunk Port - port_type: OVS #OVS Port - port_type: SR-IOV_Mirrored_Trunk #SR-IOV Trunk Port - # Receiving Mirrored Traffic -""" import re -from tests.utils.network_roles import get_network_type_from_port -from tests.parametrizers import get_nested_files -from .structures import Heat -from .helpers import validates, load_yaml, get_base_template_from_yaml_files -from .utils.ports import check_ip_format +from tests.utils.network_roles import get_network_type_from_port -VERSION = "1.3.0" +from tests.structures import Heat +from tests.helpers import validates, load_yaml, get_base_template_from_yaml_files, get_param +from tests.utils.nested_files import get_nested_files +from .utils.ports import check_parameter_format +from tests.structures import NeutronPortProcessor RE_EXTERNAL_PARAM_SUBNET = re.compile( # match pattern - r"(?P.+[^(v6)])(_v6)?_subnet_id$" + r"(?P.+?)(_v6)?_subnet_id$" ) RE_INTERNAL_PARAM_SUBNET = re.compile( # match pattern - r"int_(?P.+[^(v6)])(_v6)?_subnet_id$" + r"int_(?P.+?)(_v6)?_subnet_id$" ) fip_regx_dict = { @@ -99,40 +74,30 @@ fip_regx_dict = { @validates("R-38236", "R-84123", "R-76160") def test_internal_subnet_format(yaml_file): - check_ip_format(yaml_file, fip_regx_dict, "internal", "fixed_ips", "subnet") + check_parameter_format( + yaml_file, + fip_regx_dict, + "internal", + NeutronPortProcessor, + "fixed_ips", + "subnet", + ) @validates("R-38236", "R-62802", "R-15287") def test_external_subnet_format(yaml_file): - check_ip_format(yaml_file, fip_regx_dict, "external", "fixed_ips", "subnet") + check_parameter_format( + yaml_file, + fip_regx_dict, + "external", + NeutronPortProcessor, + "fixed_ips", + "subnet", + ) @validates("R-84123", "R-76160") def test_neutron_port_internal_fixed_ips_subnet_in_base(yaml_files): - """ - Only check parent incremental modules, because nested file parameter - name may have been changed. - - When - - * the VNF's Heat Orchestration Template's - resource ``OS::Neutron::Port`` in an Incremental Module is attaching - to an internal network - that is created in the Base Module, AND - * an IPv4 address is being cloud assigned by OpenStack's DHCP Service AND - * the internal network IPv4 subnet is to be specified - using the property ``fixed_ips`` map property ``subnet``/``subnet_id``, - - the parameter **MUST** follow the naming convention - - * ``int_{network-role}_subnet_id`` - an IPv6 address is being cloud assigned by OpenStack's DHCP Service AND - * ``int_{network-role}_v6_subnet_id`` - - Note that the parameter MUST be defined as an output parameter in - the base module. - """ - base_path = get_base_template_from_yaml_files(yaml_files) base_heat = load_yaml(base_path) base_outputs = base_heat.get("outputs") or {} @@ -160,11 +125,12 @@ def test_neutron_port_internal_fixed_ips_subnet_in_base(yaml_files): if "get_param" not in subnet: continue - param = subnet.get("get_param") + param = get_param(subnet) if param not in base_outputs: errors.append( ( - "Internal fixed_ips/subnet parameter {} is attached to port {}, but the subnet parameter " + "Internal fixed_ips/subnet parameter {} is attached to " + "port {}, but the subnet parameter " "is not defined as an output in the base module ({})." ).format(param, r_id, base_path) )