2 # ============LICENSE_START=======================================================
3 # org.onap.vvp/validation-scripts
4 # ===================================================================
5 # Copyright © 2017 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============================================
42 from .helpers import validates
43 from .utils.ports import check_ip_format
46 RE_EXTERNAL_PARAM_FIP = re.compile( # match pattern
47 r"(?P<vm_type>.+)_(?P<network_role>.+[^(v6)])(_v6)?_ip_(?P<ip_index>.+)$"
50 RE_EXTERNAL_PARAM_FIPS = re.compile( # match pattern
51 r"(?P<vm_type>.+)_(?P<network_role>.+[^(v6)])(_v6)?_ips$"
54 RE_INTERNAL_PARAM_FIP = re.compile( # match pattern
55 r"(?P<vm_type>.+)_int_(?P<network_role>.+[^(v6)])(_v6)?_ip_(?P<ip_index>.+)$"
58 RE_INTERNAL_PARAM_FIPS = re.compile( # match pattern
59 r"(?P<vm_type>.+)_int_(?P<network_role>.+[^(v6)])(_v6)?_ips$"
65 "readable": "{vm-type}_{network-role}_ip_{ip-index} or {vm-type}_{network-role}_v6_ip_{ip-index}",
66 "machine": RE_EXTERNAL_PARAM_FIP,
68 "comma_delimited_list": {
69 "readable": "{vm-type}_{network-role}_ips or {vm-type}_{network-role}_v6_ips",
70 "machine": RE_EXTERNAL_PARAM_FIPS,
75 "readable": "{vm-type}_int_{network-role}_ip_{ip-index} or {vm-type}_int_{network-role}_v6_ip_{ip-index}",
76 "machine": RE_INTERNAL_PARAM_FIP,
78 "comma_delimited_list": {
79 "readable": "{vm-type}_int_{network-role}_ips or {vm-type}_int_{network-role}_v6_ips",
80 "machine": RE_INTERNAL_PARAM_FIPS,
83 "parameter_to_resource_comparisons": ["vm_type", "network_role"],
87 @validates("R-40971", "R-35735", "R-23503", "R-71577", "R-04697", "R-34037")
88 def test_external_fip_format(yaml_file):
89 check_ip_format(yaml_file, fip_regx_dict, "external", "fixed_ips", "ip_address")
92 @validates("R-27818", "R-29765", "R-85235", "R-78380", "R-34037")
93 def test_internal_fip_format(yaml_file):
94 check_ip_format(yaml_file, fip_regx_dict, "internal", "fixed_ips", "ip_address")