2 # ============LICENSE_START====================================================
3 # org.onap.vvp/validation-scripts
4 # ===================================================================
5 # Copyright © 2019 AT&T Intellectual Property. All rights reserved.
6 # ===================================================================
8 # Unless otherwise specified, all software contained herein is licensed
9 # under the Apache License, Version 2.0 (the "License");
10 # you may not use this software except in compliance with the License.
11 # You may obtain a copy of the License at
13 # http://www.apache.org/licenses/LICENSE-2.0
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
23 # Unless otherwise specified, all documentation contained herein is licensed
24 # under the Creative Commons License, Attribution 4.0 Intl. (the "License");
25 # you may not use this documentation except in compliance with the License.
26 # You may obtain a copy of the License at
28 # https://creativecommons.org/licenses/by/4.0/
30 # Unless required by applicable law or agreed to in writing, documentation
31 # distributed under the License is distributed on an "AS IS" BASIS,
32 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33 # See the License for the specific language governing permissions and
34 # limitations under the License.
36 # ============LICENSE_END============================================
41 from tests.structures import ContrailV2InstanceIpProcessor
42 from tests.helpers import validates
43 from tests.utils.ports import check_parameter_format
45 RE_EXTERNAL_PARAM_IIP = re.compile( # match pattern
46 r"(?P<vm_type>.+)_(?P<network_role>.+?)(_v6)?_ip_(?P<ip_index>.+)$"
49 RE_EXTERNAL_PARAM_IIPS = re.compile( # match pattern
50 r"(?P<vm_type>.+)_(?P<network_role>.+?)(_v6)?_ips$"
53 RE_INTERNAL_PARAM_IIP = re.compile( # match pattern
54 r"(?P<vm_type>.+)_int_(?P<network_role>.+?)(_v6)?_ip_(?P<ip_index>.+)$"
57 RE_INTERNAL_PARAM_IIPS = re.compile( # match pattern
58 r"(?P<vm_type>.+)_int_(?P<network_role>.+?)(_v6)?_ips$"
64 "readable": "{vm-type}_{network-role}_ip_{ip-index} or {vm-type}_{network-role}_v6_ip_{ip-index}",
65 "machine": RE_EXTERNAL_PARAM_IIP,
67 "comma_delimited_list": {
68 "readable": "{vm-type}_{network-role}_ips or {vm-type}_{network-role}_v6_ips",
69 "machine": RE_EXTERNAL_PARAM_IIPS,
74 "readable": "{vm-type}_int_{network-role}_ip_{ip-index} or {vm-type}_int_{network-role}_v6_ip_{ip-index}",
75 "machine": RE_INTERNAL_PARAM_IIP,
77 "comma_delimited_list": {
78 "readable": "{vm-type}_int_{network-role}_ips or {vm-type}_int_{network-role}_v6_ips",
79 "machine": RE_INTERNAL_PARAM_IIPS,
82 "parameter_to_resource_comparisons": ["vm_type", "network_role"],
86 RE_EXTERNAL_PARAM_SID = re.compile( # match pattern
87 r"(?P<network_role>.+?)(_v6)?_subnet_id$"
90 RE_INTERNAL_PARAM_SID = re.compile( # match pattern
91 r"int_(?P<network_role>.+?)(_v6)?_subnet_id$"
97 "readable": "{network-role}_subnet_id or {network-role}_v6_subnet_id",
98 "machine": RE_EXTERNAL_PARAM_SID,
103 "readable": "int_{network-role}_subnet_id or int_{network-role}_v6_subnet_id",
104 "machine": RE_INTERNAL_PARAM_SID,
107 "parameter_to_resource_comparisons": ["network_role"],
111 @validates("R-100000", "R-100010", "R-100030", "R-100150", "R-100070")
112 def test_contrail_external_instance_ip_address_parameter(yaml_file):
113 check_parameter_format(yaml_file, iip_regx_dict, "external", ContrailV2InstanceIpProcessor, "instance_ip_address")
116 @validates("R-100000", "R-100090", "R-100110", "R-100130", "R-100180")
117 def test_contrail_internal_instance_ip_address_parameter(yaml_file):
118 check_parameter_format(yaml_file, iip_regx_dict, "internal", ContrailV2InstanceIpProcessor, "instance_ip_address")
121 @validates("R-100190", "R-100200", "R-100220")
122 def test_contrail_external_instance_subnet_id_parameter(yaml_file):
123 check_parameter_format(yaml_file, sid_regx_dict, "external", ContrailV2InstanceIpProcessor, "subnet_uuid")
126 @validates("R-100190", "R-100240", "R-100260")
127 def test_contrail_internal_instance_subnet_id_parameter(yaml_file):
128 check_parameter_format(yaml_file, sid_regx_dict, "internal", ContrailV2InstanceIpProcessor, "subnet_uuid")