From f257796cdb575d5079dce9738e31808c089f4cf3 Mon Sep 17 00:00:00 2001 From: "stark, steven" Date: Tue, 19 Mar 2019 18:14:28 -0700 Subject: [VVP] updating OS::Neutron::Port parameter tests AAP, FIP/IP, FIP/Subnet parameters use same validation (ports.py) REGEX moved to specific tests Added tests for R-159016, R-717227, R-805572 Removed mapping for R-98748 Updated env file test to exclude internal AAP params Change-Id: Iddde8ee42400b8df9be49b8c15718b451101b37b Issue-ID: VVP-181 Signed-off-by: stark, steven --- ...al_network_network_role_wrong_in_parameter.yaml | 258 ------------------ ...xternal_network_vm_type_wrong_in_parameter.yaml | 258 ------------------ .../fail/fail.yaml | 139 ++++++++++ ...al_network_network_role_wrong_in_parameter.yaml | 258 ------------------ ...nternal_network_vm_type_wrong_in_parameter.yaml | 258 ------------------ .../fail/mismatch_vm_type_exernal_nova_server.yaml | 258 ------------------ .../mismatch_vm_type_internal_nova_server.yaml | 258 ------------------ .../external_mismatch_vm_type_nova_server.yaml | 212 --------------- .../fail/external_wrong_network_role_param.yaml | 212 --------------- .../fail/external_wrong_vm_type_param.yaml | 212 --------------- .../fail/fail.yaml | 168 ++++++++++++ .../internal_mismatch_vm_type_nova_server.yaml | 212 --------------- .../fail/internal_wrong_network_role_param.yaml | 212 --------------- .../fail/internal_wrong_vm_type_param.yaml | 212 --------------- .../pass/valid_template.yaml | 10 +- .../pass/pass0.yaml | 6 +- .../pass/pass0_base.yaml | 3 + ice_validator/tests/helpers.py | 20 ++ ...d_address_pairs_include_vm_type_network_role.py | 68 +++-- .../tests/test_environment_file_parameters.py | 3 +- .../test_fixed_ips_include_vm_type_network_role.py | 79 +++--- .../tests/test_neutron_port_fixed_ips_subnet.py | 253 +++++------------- ice_validator/tests/utils/ports.py | 289 ++++++++------------- 23 files changed, 601 insertions(+), 3257 deletions(-) delete mode 100644 ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/external_network_network_role_wrong_in_parameter.yaml delete mode 100644 ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/external_network_vm_type_wrong_in_parameter.yaml create mode 100644 ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/fail.yaml delete mode 100644 ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/internal_network_network_role_wrong_in_parameter.yaml delete mode 100644 ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/internal_network_vm_type_wrong_in_parameter.yaml delete mode 100644 ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/mismatch_vm_type_exernal_nova_server.yaml delete mode 100644 ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/mismatch_vm_type_internal_nova_server.yaml delete mode 100644 ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/external_mismatch_vm_type_nova_server.yaml delete mode 100644 ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/external_wrong_network_role_param.yaml delete mode 100644 ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/external_wrong_vm_type_param.yaml create mode 100644 ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/fail.yaml delete mode 100644 ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/internal_mismatch_vm_type_nova_server.yaml delete mode 100644 ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/internal_wrong_network_role_param.yaml delete mode 100644 ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/internal_wrong_vm_type_param.yaml diff --git a/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/external_network_network_role_wrong_in_parameter.yaml b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/external_network_network_role_wrong_in_parameter.yaml deleted file mode 100644 index fccd0ae..0000000 --- a/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/external_network_network_role_wrong_in_parameter.yaml +++ /dev/null @@ -1,258 +0,0 @@ -# -*- coding: utf8 -*- -# ============LICENSE_START======================================================= -# org.onap.vvp/validation-scripts -# =================================================================== -# Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# =================================================================== -# -# Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the "License"); -# you may not use this software except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# -# Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the "License"); -# you may not use this documentation except in compliance with the License. -# You may obtain a copy of the License at -# -# https://creativecommons.org/licenses/by/4.0/ -# -# Unless required by applicable law or agreed to in writing, documentation -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============LICENSE_END============================================ -# -# ---- -heat_template_version: 2015-04-30 - -description: Heat template description - -parameters: - - vnf_id: - type: string - description: Unique ID for this VNF instance - - vf_module_id: - type: string - description: Unique ID for this VF module - - vnf_name: - type: string - description: Unique name for this VNF instance - - db_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - db_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - availability_zone_0: - type: string - description: availability zone to be used - - exnet_net_name: - type: string - description: network name for the external network extnet - - exnet_net_id: - type: string - description: network id for the external network extnet - - int_intranet_net_id: - type: string - description: network id for the internal network intranet - - db_int_intranet_ip_0: - type: string - description: db_int_intranet_ip_0 - - db_int_intranet_v6_ip_0: - type: string - description: db_int_intranet_v6_ip_0 - - db_int_intranet_ips: - type: string - description: db_int_intranet_ips - - db_int_intranet_v6_ips: - type: string - description: db_int_intranet_v6_ips - - db_int_intranet_floating_ip: - type: string - description: db_int_intranet_floating_ip - - db_int_intranet_floating_v6_ip: - type: string - description: db_int_intranet_floating_v6_ip - - lb_extnet_ip_0: - type: string - description: lb_extnet_ip_0 - - lb_extnet_v6_ip_0: - type: string - description: lb_extnet_v6_ip_0 - - lb_extnet_ips: - type: string - description: lb_extnet_ips - - lb_extnet_v6_ips: - type: string - description: lb_extnet_v6_ips - - lb_extnet_floating_ip: - type: string - description: lb_extnet_floating_ip - - lb_extnet_floating_v6_ip: - type: string - description: lb_extnet_floating_v6_ip - -resources: - - lb_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [lb_names, 0] } - flavor: { get_param: lb_flavor_name} - networks: - - port: { get_resource: lb_0_extnet_0_port } - - port: { get_resource: lb_1_extnet_0_port } - - port: { get_resource: lb_2_extnet_0_port } - - port: { get_resource: lb_3_extnet_0_port } - - port: { get_resource: lb_4_extnet_0_port } - - port: { get_resource: lb_5_extnet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [db_names, 1] } - flavor: { get_param: db_flavor_name} - networks: - - port: { get_resource: db_0_int_intranet_0_port } - - port: { get_resource: db_1_int_intranet_0_port } - - port: { get_resource: db_2_int_intranet_0_port } - - port: { get_resource: db_3_int_intranet_0_port } - - port: { get_resource: db_4_int_intranet_0_port } - - port: { get_resource: db_5_int_intranet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_0_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_ip_0 } - - db_1_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_v6_ip_0 } - - db_2_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: [db_int_intranet_ips, 0] } - - db_3_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } - - db_4_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_floating_ip } - - db_5_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_floating_v6_ip } - - lb_0_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_ip_0 } - - lb_1_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_v6_ip_0 } - - lb_2_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - allowed_address_pairs: - - ip_address: { get_param: [lb_extnet_ips, 0] } - - lb_3_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - allowed_address_pairs: - - ip_address: { get_param: [lb_extnet1_v6_ips, 0] } - - lb_4_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_floating_ip } - - lb_5_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_floating_v6_ip } diff --git a/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/external_network_vm_type_wrong_in_parameter.yaml b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/external_network_vm_type_wrong_in_parameter.yaml deleted file mode 100644 index 088db06..0000000 --- a/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/external_network_vm_type_wrong_in_parameter.yaml +++ /dev/null @@ -1,258 +0,0 @@ -# -*- coding: utf8 -*- -# ============LICENSE_START======================================================= -# org.onap.vvp/validation-scripts -# =================================================================== -# Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# =================================================================== -# -# Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the "License"); -# you may not use this software except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# -# Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the "License"); -# you may not use this documentation except in compliance with the License. -# You may obtain a copy of the License at -# -# https://creativecommons.org/licenses/by/4.0/ -# -# Unless required by applicable law or agreed to in writing, documentation -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============LICENSE_END============================================ -# -# ---- -heat_template_version: 2015-04-30 - -description: Heat template description - -parameters: - - vnf_id: - type: string - description: Unique ID for this VNF instance - - vf_module_id: - type: string - description: Unique ID for this VF module - - vnf_name: - type: string - description: Unique name for this VNF instance - - db_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - db_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - availability_zone_0: - type: string - description: availability zone to be used - - exnet_net_name: - type: string - description: network name for the external network extnet - - exnet_net_id: - type: string - description: network id for the external network extnet - - int_intranet_net_id: - type: string - description: network id for the internal network intranet - - db_int_intranet_ip_0: - type: string - description: db_int_intranet_ip_0 - - db_int_intranet_v6_ip_0: - type: string - description: db_int_intranet_v6_ip_0 - - db_int_intranet_ips: - type: string - description: db_int_intranet_ips - - db_int_intranet_v6_ips: - type: string - description: db_int_intranet_v6_ips - - db_int_intranet_floating_ip: - type: string - description: db_int_intranet_floating_ip - - db_int_intranet_floating_v6_ip: - type: string - description: db_int_intranet_floating_v6_ip - - lb_extnet_ip_0: - type: string - description: lb_extnet_ip_0 - - lb_extnet_v6_ip_0: - type: string - description: lb_extnet_v6_ip_0 - - lb_extnet_ips: - type: string - description: lb_extnet_ips - - lb_extnet_v6_ips: - type: string - description: lb_extnet_v6_ips - - lb_extnet_floating_ip: - type: string - description: lb_extnet_floating_ip - - lb_extnet_floating_v6_ip: - type: string - description: lb_extnet_floating_v6_ip - -resources: - - lb_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [lb_names, 0] } - flavor: { get_param: lb_flavor_name} - networks: - - port: { get_resource: lb_0_extnet_0_port } - - port: { get_resource: lb_1_extnet_0_port } - - port: { get_resource: lb_2_extnet_0_port } - - port: { get_resource: lb_3_extnet_0_port } - - port: { get_resource: lb_4_extnet_0_port } - - port: { get_resource: lb_5_extnet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [db_names, 1] } - flavor: { get_param: db_flavor_name} - networks: - - port: { get_resource: db_0_int_intranet_0_port } - - port: { get_resource: db_1_int_intranet_0_port } - - port: { get_resource: db_2_int_intranet_0_port } - - port: { get_resource: db_3_int_intranet_0_port } - - port: { get_resource: db_4_int_intranet_0_port } - - port: { get_resource: db_5_int_intranet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_0_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_ip_0 } - - db_1_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_v6_ip_0 } - - db_2_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: [db_int_intranet_ips, 0] } - - db_3_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } - - db_4_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_floating_ip } - - db_5_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_floating_v6_ip } - - lb_0_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_ip_0 } - - lb_1_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - allowed_address_pairs: - - ip_address: { get_param: lb1_extnet_v6_ip_0 } - - lb_2_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - allowed_address_pairs: - - ip_address: { get_param: [lb_extnet_ips, 0] } - - lb_3_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - allowed_address_pairs: - - ip_address: { get_param: [lb_extnet_v6_ips, 0] } - - lb_4_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_floating_ip } - - lb_5_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_floating_v6_ip } diff --git a/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/fail.yaml b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/fail.yaml new file mode 100644 index 0000000..4a3093b --- /dev/null +++ b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/fail.yaml @@ -0,0 +1,139 @@ +# -*- coding: utf8 -*- +# ============LICENSE_START======================================================= +# org.onap.vvp/validation-scripts +# =================================================================== +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# =================================================================== +# +# Unless otherwise specified, all software contained herein is licensed +# under the Apache License, Version 2.0 (the "License"); +# you may not use this software except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# +# Unless otherwise specified, all documentation contained herein is licensed +# under the Creative Commons License, Attribution 4.0 Intl. (the "License"); +# you may not use this documentation except in compliance with the License. +# You may obtain a copy of the License at +# +# https://creativecommons.org/licenses/by/4.0/ +# +# Unless required by applicable law or agreed to in writing, documentation +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ============LICENSE_END============================================ +# +# +--- +heat_template_version: 2015-04-30 + +description: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + db_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + availability_zone_0: + type: string + description: availability zone to be used + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_intranet_net_id: + type: string + description: network id for the internal network intranet + + db_int_intaranet_floating_ip: + type: string + description: db_int_intaranet_ip_0 + + lb_extanet_floating_ip: + type: string + description: lb_extanet_floating_ip + +resources: + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb_names, 0] } + flavor: { get_param: lb_flavor_name} + networks: + - port: { get_resource: db_0_int_intranet_port_0 } + - port: { get_resource: lb_0_extnet_port_0 } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db_names, 1] } + flavor: { get_param: db_flavor_name} + networks: + - port: { get_resource: db_0_int_intranet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_0_int_intranet_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + allowed_address_pairs: + - ip_address: { get_param: db_int_intaranet_floating_ip } + + lb_0_extnet_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + allowed_address_pairs: + - ip_address: { get_param: lb_extanet_floating_ip } diff --git a/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/internal_network_network_role_wrong_in_parameter.yaml b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/internal_network_network_role_wrong_in_parameter.yaml deleted file mode 100644 index e462fb5..0000000 --- a/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/internal_network_network_role_wrong_in_parameter.yaml +++ /dev/null @@ -1,258 +0,0 @@ -# -*- coding: utf8 -*- -# ============LICENSE_START======================================================= -# org.onap.vvp/validation-scripts -# =================================================================== -# Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# =================================================================== -# -# Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the "License"); -# you may not use this software except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# -# Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the "License"); -# you may not use this documentation except in compliance with the License. -# You may obtain a copy of the License at -# -# https://creativecommons.org/licenses/by/4.0/ -# -# Unless required by applicable law or agreed to in writing, documentation -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============LICENSE_END============================================ -# -# ---- -heat_template_version: 2015-04-30 - -description: Heat template description - -parameters: - - vnf_id: - type: string - description: Unique ID for this VNF instance - - vf_module_id: - type: string - description: Unique ID for this VF module - - vnf_name: - type: string - description: Unique name for this VNF instance - - db_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - db_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - availability_zone_0: - type: string - description: availability zone to be used - - exnet_net_name: - type: string - description: network name for the external network extnet - - exnet_net_id: - type: string - description: network id for the external network extnet - - int_intranet_net_id: - type: string - description: network id for the internal network intranet - - db_int_intranet_ip_0: - type: string - description: db_int_intranet_ip_0 - - db_int_intranet_v6_ip_0: - type: string - description: db_int_intranet_v6_ip_0 - - db_int_intranet_ips: - type: string - description: db_int_intranet_ips - - db_int_intranet_v6_ips: - type: string - description: db_int_intranet_v6_ips - - db_int_intranet_floating_ip: - type: string - description: db_int_intranet_floating_ip - - db_int_intranet_floating_v6_ip: - type: string - description: db_int_intranet_floating_v6_ip - - lb_extnet_ip_0: - type: string - description: lb_extnet_ip_0 - - lb_extnet_v6_ip_0: - type: string - description: lb_extnet_v6_ip_0 - - lb_extnet_ips: - type: string - description: lb_extnet_ips - - lb_extnet_v6_ips: - type: string - description: lb_extnet_v6_ips - - lb_extnet_floating_ip: - type: string - description: lb_extnet_floating_ip - - lb_extnet_floating_v6_ip: - type: string - description: lb_extnet_floating_v6_ip - -resources: - - lb_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [lb_names, 0] } - flavor: { get_param: lb_flavor_name} - networks: - - port: { get_resource: lb_0_extnet_0_port } - - port: { get_resource: lb_1_extnet_0_port } - - port: { get_resource: lb_2_extnet_0_port } - - port: { get_resource: lb_3_extnet_0_port } - - port: { get_resource: lb_4_extnet_0_port } - - port: { get_resource: lb_5_extnet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [db_names, 1] } - flavor: { get_param: db_flavor_name} - networks: - - port: { get_resource: db_0_int_intranet_0_port } - - port: { get_resource: db_1_int_intranet_0_port } - - port: { get_resource: db_2_int_intranet_0_port } - - port: { get_resource: db_3_int_intranet_0_port } - - port: { get_resource: db_4_int_intranet_0_port } - - port: { get_resource: db_5_int_intranet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_0_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_ip_0 } - - db_1_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_v6_ip_0 } - - db_2_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: [db_int_intranet_ips, 0] } - - db_3_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } - - db_4_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_floating_ip } - - db_5_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet1_floating_v6_ip } - - lb_0_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_ip_0 } - - lb_1_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_v6_ip_0 } - - lb_2_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - allowed_address_pairs: - - ip_address: { get_param: [lb_extnet_ips, 0] } - - lb_3_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - allowed_address_pairs: - - ip_address: { get_param: [lb_extnet_v6_ips, 0] } - - lb_4_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_floating_ip } - - lb_5_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_floating_v6_ip } diff --git a/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/internal_network_vm_type_wrong_in_parameter.yaml b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/internal_network_vm_type_wrong_in_parameter.yaml deleted file mode 100644 index dc92556..0000000 --- a/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/internal_network_vm_type_wrong_in_parameter.yaml +++ /dev/null @@ -1,258 +0,0 @@ -# -*- coding: utf8 -*- -# ============LICENSE_START======================================================= -# org.onap.vvp/validation-scripts -# =================================================================== -# Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# =================================================================== -# -# Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the "License"); -# you may not use this software except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# -# Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the "License"); -# you may not use this documentation except in compliance with the License. -# You may obtain a copy of the License at -# -# https://creativecommons.org/licenses/by/4.0/ -# -# Unless required by applicable law or agreed to in writing, documentation -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============LICENSE_END============================================ -# -# ---- -heat_template_version: 2015-04-30 - -description: Heat template description - -parameters: - - vnf_id: - type: string - description: Unique ID for this VNF instance - - vf_module_id: - type: string - description: Unique ID for this VF module - - vnf_name: - type: string - description: Unique name for this VNF instance - - db_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - db_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - availability_zone_0: - type: string - description: availability zone to be used - - exnet_net_name: - type: string - description: network name for the external network extnet - - exnet_net_id: - type: string - description: network id for the external network extnet - - int_intranet_net_id: - type: string - description: network id for the internal network intranet - - db_int_intranet_ip_0: - type: string - description: db_int_intranet_ip_0 - - db_int_intranet_v6_ip_0: - type: string - description: db_int_intranet_v6_ip_0 - - db_int_intranet_ips: - type: string - description: db_int_intranet_ips - - db_int_intranet_v6_ips: - type: string - description: db_int_intranet_v6_ips - - db_int_intranet_floating_ip: - type: string - description: db_int_intranet_floating_ip - - db_int_intranet_floating_v6_ip: - type: string - description: db_int_intranet_floating_v6_ip - - lb_extnet_ip_0: - type: string - description: lb_extnet_ip_0 - - lb_extnet_v6_ip_0: - type: string - description: lb_extnet_v6_ip_0 - - lb_extnet_ips: - type: string - description: lb_extnet_ips - - lb_extnet_v6_ips: - type: string - description: lb_extnet_v6_ips - - lb_extnet_floating_ip: - type: string - description: lb_extnet_floating_ip - - lb_extnet_floating_v6_ip: - type: string - description: lb_extnet_floating_v6_ip - -resources: - - lb_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [lb_names, 0] } - flavor: { get_param: lb_flavor_name} - networks: - - port: { get_resource: lb_0_extnet_0_port } - - port: { get_resource: lb_1_extnet_0_port } - - port: { get_resource: lb_2_extnet_0_port } - - port: { get_resource: lb_3_extnet_0_port } - - port: { get_resource: lb_4_extnet_0_port } - - port: { get_resource: lb_5_extnet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [db_names, 1] } - flavor: { get_param: db_flavor_name} - networks: - - port: { get_resource: db_0_int_intranet_0_port } - - port: { get_resource: db_1_int_intranet_0_port } - - port: { get_resource: db_2_int_intranet_0_port } - - port: { get_resource: db_3_int_intranet_0_port } - - port: { get_resource: db_4_int_intranet_0_port } - - port: { get_resource: db_5_int_intranet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_0_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_ip_0 } - - db_1_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_v6_ip_0 } - - db_2_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: [db_int_intranet_ips, 0] } - - db_3_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } - - db_4_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db1_int_intranet_floating_ip } - - db_5_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_floating_v6_ip } - - lb_0_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_ip_0 } - - lb_1_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_v6_ip_0 } - - lb_2_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - allowed_address_pairs: - - ip_address: { get_param: [lb_extnet_ips, 0] } - - lb_3_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - allowed_address_pairs: - - ip_address: { get_param: [lb_extnet_v6_ips, 0] } - - lb_4_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_floating_ip } - - lb_5_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_floating_v6_ip } diff --git a/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/mismatch_vm_type_exernal_nova_server.yaml b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/mismatch_vm_type_exernal_nova_server.yaml deleted file mode 100644 index 56b2440..0000000 --- a/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/mismatch_vm_type_exernal_nova_server.yaml +++ /dev/null @@ -1,258 +0,0 @@ -# -*- coding: utf8 -*- -# ============LICENSE_START======================================================= -# org.onap.vvp/validation-scripts -# =================================================================== -# Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# =================================================================== -# -# Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the "License"); -# you may not use this software except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# -# Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the "License"); -# you may not use this documentation except in compliance with the License. -# You may obtain a copy of the License at -# -# https://creativecommons.org/licenses/by/4.0/ -# -# Unless required by applicable law or agreed to in writing, documentation -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============LICENSE_END============================================ -# -# ---- -heat_template_version: 2015-04-30 - -description: Heat template description - -parameters: - - vnf_id: - type: string - description: Unique ID for this VNF instance - - vf_module_id: - type: string - description: Unique ID for this VF module - - vnf_name: - type: string - description: Unique name for this VNF instance - - db_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb1_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb1_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - db_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - availability_zone_0: - type: string - description: availability zone to be used - - exnet_net_name: - type: string - description: network name for the external network extnet - - exnet_net_id: - type: string - description: network id for the external network extnet - - int_intranet_net_id: - type: string - description: network id for the internal network intranet - - db_int_intranet_ip_0: - type: string - description: db_int_intranet_ip_0 - - db_int_intranet_v6_ip_0: - type: string - description: db_int_intranet_v6_ip_0 - - db_int_intranet_ips: - type: string - description: db_int_intranet_ips - - db_int_intranet_v6_ips: - type: string - description: db_int_intranet_v6_ips - - db_int_intranet_floating_ip: - type: string - description: db_int_intranet_floating_ip - - db_int_intranet_floating_v6_ip: - type: string - description: db_int_intranet_floating_v6_ip - - lb_extnet_ip_0: - type: string - description: lb_extnet_ip_0 - - lb_extnet_v6_ip_0: - type: string - description: lb_extnet_v6_ip_0 - - lb_extnet_ips: - type: string - description: lb_extnet_ips - - lb_extnet_v6_ips: - type: string - description: lb_extnet_v6_ips - - lb_extnet_floating_ip: - type: string - description: lb_extnet_floating_ip - - lb_extnet_floating_v6_ip: - type: string - description: lb_extnet_floating_v6_ip - -resources: - - lb1_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [lb1_names, 0] } - flavor: { get_param: lb1_flavor_name} - networks: - - port: { get_resource: lb_0_extnet_0_port } - - port: { get_resource: lb_1_extnet_0_port } - - port: { get_resource: lb_2_extnet_0_port } - - port: { get_resource: lb_3_extnet_0_port } - - port: { get_resource: lb_4_extnet_0_port } - - port: { get_resource: lb_5_extnet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [db_names, 1] } - flavor: { get_param: db_flavor_name} - networks: - - port: { get_resource: db_0_int_intranet_0_port } - - port: { get_resource: db_1_int_intranet_0_port } - - port: { get_resource: db_2_int_intranet_0_port } - - port: { get_resource: db_3_int_intranet_0_port } - - port: { get_resource: db_4_int_intranet_0_port } - - port: { get_resource: db_5_int_intranet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_0_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_ip_0 } - - db_1_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_v6_ip_0 } - - db_2_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: [db_int_intranet_ips, 0] } - - db_3_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } - - db_4_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_floating_ip } - - db_5_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_floating_v6_ip } - - lb_0_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_ip_0 } - - lb_1_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_v6_ip_0 } - - lb_2_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - allowed_address_pairs: - - ip_address: { get_param: [lb_extnet_ips, 0] } - - lb_3_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - allowed_address_pairs: - - ip_address: { get_param: [lb_extnet_v6_ips, 0] } - - lb_4_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_floating_ip } - - lb_5_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_floating_v6_ip } diff --git a/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/mismatch_vm_type_internal_nova_server.yaml b/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/mismatch_vm_type_internal_nova_server.yaml deleted file mode 100644 index 40724f4..0000000 --- a/ice_validator/tests/fixtures/test_allowed_address_pairs_include_vm_type_network_role/fail/mismatch_vm_type_internal_nova_server.yaml +++ /dev/null @@ -1,258 +0,0 @@ -# -*- coding: utf8 -*- -# ============LICENSE_START======================================================= -# org.onap.vvp/validation-scripts -# =================================================================== -# Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# =================================================================== -# -# Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the "License"); -# you may not use this software except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# -# Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the "License"); -# you may not use this documentation except in compliance with the License. -# You may obtain a copy of the License at -# -# https://creativecommons.org/licenses/by/4.0/ -# -# Unless required by applicable law or agreed to in writing, documentation -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============LICENSE_END============================================ -# -# ---- -heat_template_version: 2015-04-30 - -description: Heat template description - -parameters: - - vnf_id: - type: string - description: Unique ID for this VNF instance - - vf_module_id: - type: string - description: Unique ID for this VF module - - vnf_name: - type: string - description: Unique name for this VNF instance - - db1_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - db1_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - availability_zone_0: - type: string - description: availability zone to be used - - exnet_net_name: - type: string - description: network name for the external network extnet - - exnet_net_id: - type: string - description: network id for the external network extnet - - int_intranet_net_id: - type: string - description: network id for the internal network intranet - - db_int_intranet_ip_0: - type: string - description: db_int_intranet_ip_0 - - db_int_intranet_v6_ip_0: - type: string - description: db_int_intranet_v6_ip_0 - - db_int_intranet_ips: - type: string - description: db_int_intranet_ips - - db_int_intranet_v6_ips: - type: string - description: db_int_intranet_v6_ips - - db_int_intranet_floating_ip: - type: string - description: db_int_intranet_floating_ip - - db_int_intranet_floating_v6_ip: - type: string - description: db_int_intranet_floating_v6_ip - - lb_extnet_ip_0: - type: string - description: lb_extnet_ip_0 - - lb_extnet_v6_ip_0: - type: string - description: lb_extnet_v6_ip_0 - - lb_extnet_ips: - type: string - description: lb_extnet_ips - - lb_extnet_v6_ips: - type: string - description: lb_extnet_v6_ips - - lb_extnet_floating_ip: - type: string - description: lb_extnet_floating_ip - - lb_extnet_floating_v6_ip: - type: string - description: lb_extnet_floating_v6_ip - -resources: - - lb_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [lb_names, 0] } - flavor: { get_param: lb_flavor_name} - networks: - - port: { get_resource: lb_0_extnet_0_port } - - port: { get_resource: lb_1_extnet_0_port } - - port: { get_resource: lb_2_extnet_0_port } - - port: { get_resource: lb_3_extnet_0_port } - - port: { get_resource: lb_4_extnet_0_port } - - port: { get_resource: lb_5_extnet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [db1_names, 1] } - flavor: { get_param: db1_flavor_name} - networks: - - port: { get_resource: db_0_int_intranet_0_port } - - port: { get_resource: db_1_int_intranet_0_port } - - port: { get_resource: db_2_int_intranet_0_port } - - port: { get_resource: db_3_int_intranet_0_port } - - port: { get_resource: db_4_int_intranet_0_port } - - port: { get_resource: db_5_int_intranet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_0_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_ip_0 } - - db_1_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_v6_ip_0 } - - db_2_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: [db_int_intranet_ips, 0] } - - db_3_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } - - db_4_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_floating_ip } - - db_5_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - allowed_address_pairs: - - ip_address: { get_param: db_int_intranet_floating_v6_ip } - - lb_0_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_ip_0 } - - lb_1_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_v6_ip_0 } - - lb_2_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - allowed_address_pairs: - - ip_address: { get_param: [lb_extnet_ips, 0] } - - lb_3_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - allowed_address_pairs: - - ip_address: { get_param: [lb_extnet_v6_ips, 0] } - - lb_4_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_floating_ip } - - lb_5_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - allowed_address_pairs: - - ip_address: { get_param: lb_extnet_floating_v6_ip } diff --git a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/external_mismatch_vm_type_nova_server.yaml b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/external_mismatch_vm_type_nova_server.yaml deleted file mode 100644 index b3ed228..0000000 --- a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/external_mismatch_vm_type_nova_server.yaml +++ /dev/null @@ -1,212 +0,0 @@ -# -*- coding: utf8 -*- -# ============LICENSE_START======================================================= -# org.onap.vvp/validation-scripts -# =================================================================== -# Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# =================================================================== -# -# Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the "License"); -# you may not use this software except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# -# Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the "License"); -# you may not use this documentation except in compliance with the License. -# You may obtain a copy of the License at -# -# https://creativecommons.org/licenses/by/4.0/ -# -# Unless required by applicable law or agreed to in writing, documentation -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============LICENSE_END============================================ -# -# ---- -heat_template_version: 2015-04-30 - -description: Heat template description - -parameters: - - vnf_id: - type: string - description: Unique ID for this VNF instance - - vf_module_id: - type: string - description: Unique ID for this VF module - - vnf_name: - type: string - description: Unique name for this VNF instance - - db_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb1_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb1_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - db_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - availability_zone_0: - type: string - description: availability zone to be used - - exnet_net_name: - type: string - description: network name for the external network extnet - - exnet_net_id: - type: string - description: network id for the external network extnet - - int_intranet_net_id: - type: string - description: network id for the internal network intranet - - db_int_intranet_ip_0: - type: string - description: db_int_intranet_ip_0 - - db_int_intranet_v6_ip_0: - type: string - description: db_int_intranet_v6_ip_0 - - db_int_intranet_ips: - type: string - description: db_int_intranet_ips - - db_int_intranet_v6_ips: - type: string - description: db_int_intranet_v6_ips - - lb_extnet_ip_0: - type: string - description: lb_extnet_ip_0 - - lb_extnet_ip_1: - type: string - description: lb_extnet_ip_1 - - lb_extnet_v6_ip_0: - type: string - description: lb_extnet_v6_ip_0 - - lb_extnet_ips: - type: string - description: lb_extnet_ips - - lb_extnet_v6_ips: - type: string - description: lb_extnet_v6_ips - -resources: - - lb_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [lb1_names, 0] } - flavor: { get_param: lb1_flavor_name} - networks: - - port: { get_resource: lb_0_extnet_0_port } - - port: { get_resource: lb_1_extnet_0_port } - - port: { get_resource: lb_2_extnet_0_port } - - port: { get_resource: lb_3_extnet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [db_names, 1] } - flavor: { get_param: db_flavor_name} - networks: - - port: { get_resource: db_0_int_intranet_0_port } - - port: { get_resource: db_1_int_intranet_0_port } - - port: { get_resource: db_2_int_intranet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_0_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - fixed_ips: - - ip_address: { get_param: db_int_intranet_ip_0 } - - ip_address: { get_param: db_int_intranet_v6_ip_0 } - - db_1_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - fixed_ips: - - ip_address: { get_param: [db_int_intranet_ips, 0] } - - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } - - db_2_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - fixed_ips: - - ip_address: { get_param: [db_int_intranet_ips, 1] } - - lb_0_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - fixed_ips: - - ip_address: { get_param: lb_extnet_ip_0 } - - ip_address: { get_param: lb_extnet_v6_ip_0 } - - lb_1_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - fixed_ips: - - ip_address: { get_param: [lb_extnet_ips, 0] } - - ip_address: { get_param: [lb_extnet_v6_ips, 0] } - - lb_2_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - fixed_ips: - - ip_address: { get_param: lb_extnet_ip_1 } - - subnet_id: { get_param: extnet_subnet_id } - - lb_3_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - fixed_ips: - - subnet_id: { get_param: extnet_subnet_id } - - subnet_id: { get_param: extnet_v6_subnet_id } diff --git a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/external_wrong_network_role_param.yaml b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/external_wrong_network_role_param.yaml deleted file mode 100644 index 7abd9d3..0000000 --- a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/external_wrong_network_role_param.yaml +++ /dev/null @@ -1,212 +0,0 @@ -# -*- coding: utf8 -*- -# ============LICENSE_START======================================================= -# org.onap.vvp/validation-scripts -# =================================================================== -# Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# =================================================================== -# -# Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the "License"); -# you may not use this software except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# -# Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the "License"); -# you may not use this documentation except in compliance with the License. -# You may obtain a copy of the License at -# -# https://creativecommons.org/licenses/by/4.0/ -# -# Unless required by applicable law or agreed to in writing, documentation -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============LICENSE_END============================================ -# -# ---- -heat_template_version: 2015-04-30 - -description: Heat template description - -parameters: - - vnf_id: - type: string - description: Unique ID for this VNF instance - - vf_module_id: - type: string - description: Unique ID for this VF module - - vnf_name: - type: string - description: Unique name for this VNF instance - - db_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - db_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - availability_zone_0: - type: string - description: availability zone to be used - - exnet_net_name: - type: string - description: network name for the external network extnet - - exnet_net_id: - type: string - description: network id for the external network extnet - - int_intranet_net_id: - type: string - description: network id for the internal network intranet - - db_int_intranet_ip_0: - type: string - description: db_int_intranet_ip_0 - - db_int_intranet_v6_ip_0: - type: string - description: db_int_intranet_v6_ip_0 - - db_int_intranet_ips: - type: string - description: db_int_intranet_ips - - db_int_intranet_v6_ips: - type: string - description: db_int_intranet_v6_ips - - lb_extnet_ip_0: - type: string - description: lb_extnet_ip_0 - - lb_extnet_ip_1: - type: string - description: lb_extnet_ip_1 - - lb_extnet_v6_ip_0: - type: string - description: lb_extnet_v6_ip_0 - - lb_extnet_ips: - type: string - description: lb_extnet_ips - - lb_extnet_v6_ips: - type: string - description: lb_extnet_v6_ips - -resources: - - lb_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [lb_names, 0] } - flavor: { get_param: lb_flavor_name} - networks: - - port: { get_resource: lb_0_extnet_0_port } - - port: { get_resource: lb_1_extnet_0_port } - - port: { get_resource: lb_2_extnet_0_port } - - port: { get_resource: lb_3_extnet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [db_names, 1] } - flavor: { get_param: db_flavor_name} - networks: - - port: { get_resource: db_0_int_intranet_0_port } - - port: { get_resource: db_1_int_intranet_0_port } - - port: { get_resource: db_2_int_intranet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_0_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - fixed_ips: - - ip_address: { get_param: db_int_intranet_ip_0 } - - ip_address: { get_param: db_int_intranet_v6_ip_0 } - - db_1_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - fixed_ips: - - ip_address: { get_param: [db_int_intranet_ips, 0] } - - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } - - db_2_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - fixed_ips: - - ip_address: { get_param: [db_int_intranet_ips, 1] } - - lb_0_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - fixed_ips: - - ip_address: { get_param: lb_extnet1_ip_0 } - - ip_address: { get_param: lb_extnet_v6_ip_0 } - - lb_1_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - fixed_ips: - - ip_address: { get_param: [lb_extnet_ips, 0] } - - ip_address: { get_param: [lb_extnet_v6_ips, 0] } - - lb_2_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - fixed_ips: - - ip_address: { get_param: lb_extnet_ip_1 } - - subnet_id: { get_param: extnet_subnet_id } - - lb_3_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - fixed_ips: - - subnet_id: { get_param: extnet_subnet_id } - - subnet_id: { get_param: extnet_v6_subnet_id } diff --git a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/external_wrong_vm_type_param.yaml b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/external_wrong_vm_type_param.yaml deleted file mode 100644 index 2ec72e6..0000000 --- a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/external_wrong_vm_type_param.yaml +++ /dev/null @@ -1,212 +0,0 @@ -# -*- coding: utf8 -*- -# ============LICENSE_START======================================================= -# org.onap.vvp/validation-scripts -# =================================================================== -# Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# =================================================================== -# -# Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the "License"); -# you may not use this software except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# -# Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the "License"); -# you may not use this documentation except in compliance with the License. -# You may obtain a copy of the License at -# -# https://creativecommons.org/licenses/by/4.0/ -# -# Unless required by applicable law or agreed to in writing, documentation -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============LICENSE_END============================================ -# -# ---- -heat_template_version: 2015-04-30 - -description: Heat template description - -parameters: - - vnf_id: - type: string - description: Unique ID for this VNF instance - - vf_module_id: - type: string - description: Unique ID for this VF module - - vnf_name: - type: string - description: Unique name for this VNF instance - - db_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - db_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - availability_zone_0: - type: string - description: availability zone to be used - - exnet_net_name: - type: string - description: network name for the external network extnet - - exnet_net_id: - type: string - description: network id for the external network extnet - - int_intranet_net_id: - type: string - description: network id for the internal network intranet - - db_int_intranet_ip_0: - type: string - description: db_int_intranet_ip_0 - - db_int_intranet_v6_ip_0: - type: string - description: db_int_intranet_v6_ip_0 - - db_int_intranet_ips: - type: string - description: db_int_intranet_ips - - db_int_intranet_v6_ips: - type: string - description: db_int_intranet_v6_ips - - lb_extnet_ip_0: - type: string - description: lb_extnet_ip_0 - - lb_extnet_ip_1: - type: string - description: lb_extnet_ip_1 - - lb_extnet_v6_ip_0: - type: string - description: lb_extnet_v6_ip_0 - - lb_extnet_ips: - type: string - description: lb_extnet_ips - - lb_extnet_v6_ips: - type: string - description: lb_extnet_v6_ips - -resources: - - lb_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [lb_names, 0] } - flavor: { get_param: lb_flavor_name} - networks: - - port: { get_resource: lb_0_extnet_0_port } - - port: { get_resource: lb_1_extnet_0_port } - - port: { get_resource: lb_2_extnet_0_port } - - port: { get_resource: lb_3_extnet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [db_names, 1] } - flavor: { get_param: db_flavor_name} - networks: - - port: { get_resource: db_0_int_intranet_0_port } - - port: { get_resource: db_1_int_intranet_0_port } - - port: { get_resource: db_2_int_intranet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_0_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - fixed_ips: - - ip_address: { get_param: db_int_intranet_ip_0 } - - ip_address: { get_param: db_int_intranet_v6_ip_0 } - - db_1_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - fixed_ips: - - ip_address: { get_param: [db_int_intranet_ips, 0] } - - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } - - db_2_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - fixed_ips: - - ip_address: { get_param: [db_int_intranet_ips, 1] } - - lb_0_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - fixed_ips: - - ip_address: { get_param: lb_extnet_ip_0 } - - ip_address: { get_param: lb_extnet_v6_ip_0 } - - lb_1_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - fixed_ips: - - ip_address: { get_param: [lb_extnet_ips, 0] } - - ip_address: { get_param: [lb_extnet_v6_ips, 0] } - - lb_2_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - fixed_ips: - - ip_address: { get_param: lb1_extnet_ip_1 } - - subnet_id: { get_param: extnet_subnet_id } - - lb_3_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - fixed_ips: - - subnet_id: { get_param: extnet_subnet_id } - - subnet_id: { get_param: extnet_v6_subnet_id } diff --git a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/fail.yaml b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/fail.yaml new file mode 100644 index 0000000..a361933 --- /dev/null +++ b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/fail.yaml @@ -0,0 +1,168 @@ +# -*- coding: utf8 -*- +# ============LICENSE_START======================================================= +# org.onap.vvp/validation-scripts +# =================================================================== +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# =================================================================== +# +# Unless otherwise specified, all software contained herein is licensed +# under the Apache License, Version 2.0 (the "License"); +# you may not use this software except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# +# Unless otherwise specified, all documentation contained herein is licensed +# under the Creative Commons License, Attribution 4.0 Intl. (the "License"); +# you may not use this documentation except in compliance with the License. +# You may obtain a copy of the License at +# +# https://creativecommons.org/licenses/by/4.0/ +# +# Unless required by applicable law or agreed to in writing, documentation +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ============LICENSE_END============================================ +# +# +--- +heat_template_version: 2015-04-30 + +description: Heat template description + +parameters: + + vnf_id: + type: string + description: Unique ID for this VNF instance + + vf_module_id: + type: string + description: Unique ID for this VF module + + vnf_name: + type: string + description: Unique name for this VNF instance + + db_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb1_names: + type: comma_delimited_list + description: Names attribute for the VMs + + lb1_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + db_flavor_name: + type: string + description: flavor to be used to create this vm must be one of the following flavors + + availability_zone_0: + type: string + description: availability zone to be used + + exnet_net_name: + type: string + description: network name for the external network extnet + + exnet_net_id: + type: string + description: network id for the external network extnet + + int_intranet_net_id: + type: string + description: network id for the internal network intranet + + db_int_intaranet_ip_0: + type: string + description: db_int_intaranet_ip_0 + + db_int_intranet_v6_ip_0: + type: string + description: db_int_intranet_v6_ip_0 + + db_int_intranet_ips: + type: string + description: db_int_intranet_ips + + db_int_intranet_v6_ips: + type: string + description: db_int_intranet_v6_ips + + my_ip: + type: string + description: my_ip + + lb_extnet_ip_1: + type: string + description: lb_extnet_ip_1 + + lb_extnet_v6_ip_0: + type: string + description: lb_extnet_v6_ip_0 + + lb_extnet_ips: + type: string + description: lb_extnet_ips + + lb_extnet_v6_ips: + type: string + description: lb_extnet_v6_ips + +resources: + + lb_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [lb1_names, 0] } + flavor: { get_param: lb1_flavor_name} + networks: + - port: { get_resource: lb_0_extnet_port_0 } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_server_0: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [db_names, 1] } + flavor: { get_param: db_flavor_name} + networks: + - port: { get_resource: db_0_int_intranet_port_0 } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + + db_0_int_intranet_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: db_int_intaranet_ip_0 } + - ip_address: { get_param: db_int_intranet_v6_ip_0 } + + lb_0_extnet_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: my_ip } + - ip_address: { get_param: lb_extnet_v6_ip_0 } diff --git a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/internal_mismatch_vm_type_nova_server.yaml b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/internal_mismatch_vm_type_nova_server.yaml deleted file mode 100644 index 7fb9880..0000000 --- a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/internal_mismatch_vm_type_nova_server.yaml +++ /dev/null @@ -1,212 +0,0 @@ -# -*- coding: utf8 -*- -# ============LICENSE_START======================================================= -# org.onap.vvp/validation-scripts -# =================================================================== -# Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# =================================================================== -# -# Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the "License"); -# you may not use this software except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# -# Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the "License"); -# you may not use this documentation except in compliance with the License. -# You may obtain a copy of the License at -# -# https://creativecommons.org/licenses/by/4.0/ -# -# Unless required by applicable law or agreed to in writing, documentation -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============LICENSE_END============================================ -# -# ---- -heat_template_version: 2015-04-30 - -description: Heat template description - -parameters: - - vnf_id: - type: string - description: Unique ID for this VNF instance - - vf_module_id: - type: string - description: Unique ID for this VF module - - vnf_name: - type: string - description: Unique name for this VNF instance - - db1_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - db1_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - availability_zone_0: - type: string - description: availability zone to be used - - exnet_net_name: - type: string - description: network name for the external network extnet - - exnet_net_id: - type: string - description: network id for the external network extnet - - int_intranet_net_id: - type: string - description: network id for the internal network intranet - - db_int_intranet_ip_0: - type: string - description: db_int_intranet_ip_0 - - db_int_intranet_v6_ip_0: - type: string - description: db_int_intranet_v6_ip_0 - - db_int_intranet_ips: - type: string - description: db_int_intranet_ips - - db_int_intranet_v6_ips: - type: string - description: db_int_intranet_v6_ips - - lb_extnet_ip_0: - type: string - description: lb_extnet_ip_0 - - lb_extnet_ip_1: - type: string - description: lb_extnet_ip_1 - - lb_extnet_v6_ip_0: - type: string - description: lb_extnet_v6_ip_0 - - lb_extnet_ips: - type: string - description: lb_extnet_ips - - lb_extnet_v6_ips: - type: string - description: lb_extnet_v6_ips - -resources: - - lb_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [lb_names, 0] } - flavor: { get_param: lb_flavor_name} - networks: - - port: { get_resource: lb_0_extnet_0_port } - - port: { get_resource: lb_1_extnet_0_port } - - port: { get_resource: lb_2_extnet_0_port } - - port: { get_resource: lb_3_extnet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [db1_names, 1] } - flavor: { get_param: db1_flavor_name} - networks: - - port: { get_resource: db_0_int_intranet_0_port } - - port: { get_resource: db_1_int_intranet_0_port } - - port: { get_resource: db_2_int_intranet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_0_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - fixed_ips: - - ip_address: { get_param: db_int_intranet_ip_0 } - - ip_address: { get_param: db_int_intranet_v6_ip_0 } - - db_1_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - fixed_ips: - - ip_address: { get_param: [db_int_intranet_ips, 0] } - - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } - - db_2_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - fixed_ips: - - ip_address: { get_param: [db_int_intranet_ips, 1] } - - lb_0_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - fixed_ips: - - ip_address: { get_param: lb_extnet_ip_0 } - - ip_address: { get_param: lb_extnet_v6_ip_0 } - - lb_1_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - fixed_ips: - - ip_address: { get_param: [lb_extnet_ips, 0] } - - ip_address: { get_param: [lb_extnet_v6_ips, 0] } - - lb_2_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - fixed_ips: - - ip_address: { get_param: lb_extnet_ip_1 } - - subnet_id: { get_param: extnet_subnet_id } - - lb_3_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - fixed_ips: - - subnet_id: { get_param: extnet_subnet_id } - - subnet_id: { get_param: extnet_v6_subnet_id } diff --git a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/internal_wrong_network_role_param.yaml b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/internal_wrong_network_role_param.yaml deleted file mode 100644 index c71ee0d..0000000 --- a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/internal_wrong_network_role_param.yaml +++ /dev/null @@ -1,212 +0,0 @@ -# -*- coding: utf8 -*- -# ============LICENSE_START======================================================= -# org.onap.vvp/validation-scripts -# =================================================================== -# Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# =================================================================== -# -# Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the "License"); -# you may not use this software except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# -# Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the "License"); -# you may not use this documentation except in compliance with the License. -# You may obtain a copy of the License at -# -# https://creativecommons.org/licenses/by/4.0/ -# -# Unless required by applicable law or agreed to in writing, documentation -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============LICENSE_END============================================ -# -# ---- -heat_template_version: 2015-04-30 - -description: Heat template description - -parameters: - - vnf_id: - type: string - description: Unique ID for this VNF instance - - vf_module_id: - type: string - description: Unique ID for this VF module - - vnf_name: - type: string - description: Unique name for this VNF instance - - db_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - db_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - availability_zone_0: - type: string - description: availability zone to be used - - exnet_net_name: - type: string - description: network name for the external network extnet - - exnet_net_id: - type: string - description: network id for the external network extnet - - int_intranet_net_id: - type: string - description: network id for the internal network intranet - - db_int_intranet_ip_0: - type: string - description: db_int_intranet_ip_0 - - db_int_intranet_v6_ip_0: - type: string - description: db_int_intranet_v6_ip_0 - - db_int_intranet_ips: - type: string - description: db_int_intranet_ips - - db_int_intranet_v6_ips: - type: string - description: db_int_intranet_v6_ips - - lb_extnet_ip_0: - type: string - description: lb_extnet_ip_0 - - lb_extnet_ip_1: - type: string - description: lb_extnet_ip_1 - - lb_extnet_v6_ip_0: - type: string - description: lb_extnet_v6_ip_0 - - lb_extnet_ips: - type: string - description: lb_extnet_ips - - lb_extnet_v6_ips: - type: string - description: lb_extnet_v6_ips - -resources: - - lb_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [lb_names, 0] } - flavor: { get_param: lb_flavor_name} - networks: - - port: { get_resource: lb_0_extnet_0_port } - - port: { get_resource: lb_1_extnet_0_port } - - port: { get_resource: lb_2_extnet_0_port } - - port: { get_resource: lb_3_extnet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [db_names, 1] } - flavor: { get_param: db_flavor_name} - networks: - - port: { get_resource: db_0_int_intranet_0_port } - - port: { get_resource: db_1_int_intranet_0_port } - - port: { get_resource: db_2_int_intranet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_0_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - fixed_ips: - - ip_address: { get_param: db_int_intranet1_ip_0 } - - ip_address: { get_param: db_int_intranet_v6_ip_0 } - - db_1_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - fixed_ips: - - ip_address: { get_param: [db_int_intranet_ips, 0] } - - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } - - db_2_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - fixed_ips: - - ip_address: { get_param: [db_int_intranet_ips, 1] } - - lb_0_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - fixed_ips: - - ip_address: { get_param: lb_extnet_ip_0 } - - ip_address: { get_param: lb_extnet_v6_ip_0 } - - lb_1_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - fixed_ips: - - ip_address: { get_param: [lb_extnet_ips, 0] } - - ip_address: { get_param: [lb_extnet_v6_ips, 0] } - - lb_2_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - fixed_ips: - - ip_address: { get_param: lb_extnet_ip_1 } - - subnet_id: { get_param: extnet_subnet_id } - - lb_3_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - fixed_ips: - - subnet_id: { get_param: extnet_subnet_id } - - subnet_id: { get_param: extnet_v6_subnet_id } diff --git a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/internal_wrong_vm_type_param.yaml b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/internal_wrong_vm_type_param.yaml deleted file mode 100644 index 99860e8..0000000 --- a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/fail/internal_wrong_vm_type_param.yaml +++ /dev/null @@ -1,212 +0,0 @@ -# -*- coding: utf8 -*- -# ============LICENSE_START======================================================= -# org.onap.vvp/validation-scripts -# =================================================================== -# Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# =================================================================== -# -# Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the "License"); -# you may not use this software except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# -# Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the "License"); -# you may not use this documentation except in compliance with the License. -# You may obtain a copy of the License at -# -# https://creativecommons.org/licenses/by/4.0/ -# -# Unless required by applicable law or agreed to in writing, documentation -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============LICENSE_END============================================ -# -# ---- -heat_template_version: 2015-04-30 - -description: Heat template description - -parameters: - - vnf_id: - type: string - description: Unique ID for this VNF instance - - vf_module_id: - type: string - description: Unique ID for this VF module - - vnf_name: - type: string - description: Unique name for this VNF instance - - db_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb_names: - type: comma_delimited_list - description: Names attribute for the VMs - - lb_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - db_flavor_name: - type: string - description: flavor to be used to create this vm must be one of the following flavors - - availability_zone_0: - type: string - description: availability zone to be used - - exnet_net_name: - type: string - description: network name for the external network extnet - - exnet_net_id: - type: string - description: network id for the external network extnet - - int_intranet_net_id: - type: string - description: network id for the internal network intranet - - db_int_intranet_ip_0: - type: string - description: db_int_intranet_ip_0 - - db_int_intranet_v6_ip_0: - type: string - description: db_int_intranet_v6_ip_0 - - db_int_intranet_ips: - type: string - description: db_int_intranet_ips - - db_int_intranet_v6_ips: - type: string - description: db_int_intranet_v6_ips - - lb_extnet_ip_0: - type: string - description: lb_extnet_ip_0 - - lb_extnet_ip_1: - type: string - description: lb_extnet_ip_1 - - lb_extnet_v6_ip_0: - type: string - description: lb_extnet_v6_ip_0 - - lb_extnet_ips: - type: string - description: lb_extnet_ips - - lb_extnet_v6_ips: - type: string - description: lb_extnet_v6_ips - -resources: - - lb_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [lb_names, 0] } - flavor: { get_param: lb_flavor_name} - networks: - - port: { get_resource: lb_0_extnet_0_port } - - port: { get_resource: lb_1_extnet_0_port } - - port: { get_resource: lb_2_extnet_0_port } - - port: { get_resource: lb_3_extnet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_server_0: - type: OS::Nova::Server - properties: - availability_zone: { get_param: availability_zone_0 } - name: { get_param: [db_names, 1] } - flavor: { get_param: db_flavor_name} - networks: - - port: { get_resource: db_0_int_intranet_0_port } - - port: { get_resource: db_1_int_intranet_0_port } - - port: { get_resource: db_2_int_intranet_0_port } - metadata: - vnf_name: { get_param: vnf_name } - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - - db_0_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - fixed_ips: - - ip_address: { get_param: db_int_intranet_ip_0 } - - ip_address: { get_param: db_int_intranet_v6_ip_0 } - - db_1_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - fixed_ips: - - ip_address: { get_param: [db1_int_intranet_ips, 0] } - - ip_address: { get_param: [db_int_intranet_v6_ips, 0] } - - db_2_int_intranet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: int_intranet_net_id } - fixed_ips: - - ip_address: { get_param: [db_int_intranet_ips, 1] } - - lb_0_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - fixed_ips: - - ip_address: { get_param: lb_extnet_ip_0 } - - ip_address: { get_param: lb_extnet_v6_ip_0 } - - lb_1_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - fixed_ips: - - ip_address: { get_param: [lb_extnet_ips, 0] } - - ip_address: { get_param: [lb_extnet_v6_ips, 0] } - - lb_2_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_name } - fixed_ips: - - ip_address: { get_param: lb_extnet_ip_1 } - - subnet_id: { get_param: extnet_subnet_id } - - lb_3_extnet_0_port: - type: OS::Neutron::Port - properties: - network: { get_param: extnet_net_id } - fixed_ips: - - subnet_id: { get_param: extnet_subnet_id } - - subnet_id: { get_param: extnet_v6_subnet_id } diff --git a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/pass/valid_template.yaml b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/pass/valid_template.yaml index 88d06f2..255392c 100644 --- a/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/pass/valid_template.yaml +++ b/ice_validator/tests/fixtures/test_fixed_ips_include_vm_type_network_role/pass/valid_template.yaml @@ -123,6 +123,10 @@ parameters: type: comma_delimited_list description: lb_extnet_v6_ips + vm_type_1_network_role_a_ip_0: + type: string + description: nsadjfsa + resources: lb_server_0: @@ -210,15 +214,17 @@ resources: fixed_ips: - subnet_id: { get_param: extnet_subnet_id } - subnet_id: { get_param: extnet_v6_subnet_id } + reserve_port_vm_type_1_network_role_a_floating_ip_0: type: OS::Neutron::Port properties: network: { get_param: network_role_a_net_id } fixed_ips: - - ip_address : { get_param: vm_type_1_network_role_a_floating_ip } + - ip_address : { get_param: vm_type_1_network_role_a_ip_0 } + reserve_port_vm_type_1_network_role_a_floating_v6_ip_0: type: OS::Neutron::Port properties: network: { get_param: network_role_a_net_id } fixed_ips: - - ip_address : { get_param: vm_type_1_network_role_a_floating_v6_ip } + - ip_address : { get_param: vm_type_1_network_role_a_ip_0 } diff --git a/ice_validator/tests/fixtures/test_neutron_port_fixed_ips_subnet/pass/pass0.yaml b/ice_validator/tests/fixtures/test_neutron_port_fixed_ips_subnet/pass/pass0.yaml index 2a651b1..2b4e9c7 100644 --- a/ice_validator/tests/fixtures/test_neutron_port_fixed_ips_subnet/pass/pass0.yaml +++ b/ice_validator/tests/fixtures/test_neutron_port_fixed_ips_subnet/pass/pass0.yaml @@ -51,7 +51,7 @@ parameters: type: comma_delimited_list bialy_subnet: type: string - bialy_subnet_id: + int_bialy_subnet_id: type: string resources: @@ -62,7 +62,7 @@ resources: network: { get_param: int_intranet_net_name } fixed_ips: - ip_address: { get_param: lb_1_int_intranet_floating_ip } - subnet: { get_param: bialy_subnet_id } + subnet: { get_param: int_bialy_subnet_id } binding:vnic_type: direct value_specs: vlan_filter: {get_param: vm_typeX_bialy_vlan_filter} @@ -80,7 +80,7 @@ resources: network: { get_param: extnet_net_id } fixed_ips: - ip_address: { get_param: lb_2_extnet_floating_v6_ip } - subnet_id: { get_param: bialy_subnet_id } + subnet_id: { get_param: int_bialy_subnet_id } binding:vnic_type: direct value_specs: vlan_filter: {get_param: vm_typeX_bialy_vlan_filter} diff --git a/ice_validator/tests/fixtures/test_neutron_port_fixed_ips_subnet/pass/pass0_base.yaml b/ice_validator/tests/fixtures/test_neutron_port_fixed_ips_subnet/pass/pass0_base.yaml index 04919c3..4f92923 100644 --- a/ice_validator/tests/fixtures/test_neutron_port_fixed_ips_subnet/pass/pass0_base.yaml +++ b/ice_validator/tests/fixtures/test_neutron_port_fixed_ips_subnet/pass/pass0_base.yaml @@ -46,3 +46,6 @@ resources: vm_typeX_0_bialy_port_2: type: OS::Neutron::Net +outputs: + int_bialy_subnet_id: + value: sanfdkl diff --git a/ice_validator/tests/helpers.py b/ice_validator/tests/helpers.py index 12a7a12..5744945 100644 --- a/ice_validator/tests/helpers.py +++ b/ice_validator/tests/helpers.py @@ -287,3 +287,23 @@ def get_base_template_from_yaml_file(yaml_file): ): return os.path.join(dirname, "{}{}".format(basename, __)) return None + + +def parameter_type_to_heat_type(parameter): + # getting parameter format + if isinstance(parameter, list): + parameter_type = "comma_delimited_list" + elif isinstance(parameter, str): + parameter_type = "string" + elif isinstance(parameter, dict): + parameter_type = "json" + elif isinstance(parameter, int): + parameter_type = "number" + elif isinstance(parameter, float): + parameter_type = "number" + elif isinstance(parameter, bool): + parameter_type = "boolean" + else: + parameter_type = None + + return parameter_type 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 714e555..4654333 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 @@ -36,43 +36,57 @@ # ============LICENSE_END============================================ # # - -""" -test_allowed_address_pairs_include_vm_type_network_role -""" - -import pytest -from tests import cached_yaml as yaml +import re from .helpers import validates -from .utils.ports import get_invalid_ip_addresses +from .utils.ports import check_ip_format VERSION = "1.0.0" # pylint: disable=invalid-name +RE_EXTERNAL_PARAM_AAP = re.compile( # match pattern + r"(?P.+)_(?P.+)_floating(_v6)?_ip$" +) + +RE_INTERNAL_PARAM_AAP = re.compile( # match pattern + r"(?P.+)_int_(?P.+)_floating(_v6)?_ip$" +) -@validates("R-41492", "R-35735", "R-98748") -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(yaml_file) as fh: - yml = yaml.load(fh) +RE_INTERNAL_PARAM_AAPS = re.compile( # match pattern + r"(?P.+)_int_(?P.+)_floating(_v6)?_ips$" +) - # skip if resources are not defined - if "resources" not in yml: - pytest.skip("No resources specified in the heat template") +aap_regx_dict = { + "external": { + "string": { + "readable": "{vm-type}_{network-role}_floating_ip or {vm-type}_{network-role}_floating_v6_ip", + "machine": RE_EXTERNAL_PARAM_AAP, + } + }, + "internal": { + "string": { + "readable": "{vm-type}_int_{network-role}_floating_ip or {vm-type}_int_{network-role}_floating_v6_ip", + "machine": RE_INTERNAL_PARAM_AAP, + }, + "comma_delimited_list": { + "readable": "{vm-type}_int_{network-role}_floating_ips or {vm-type}_int_{network-role}_floating_v6_ips", + "machine": RE_INTERNAL_PARAM_AAPS, + }, + }, + "parameter_to_resource_comparisons": ["vm_type", "network_role"], +} - if "parameters" not in yml: - pytest.skip("No parameters specified in the heat template") - invalid_ip_addresses = get_invalid_ip_addresses( - yml["resources"], "allowed_address_pairs", yml["parameters"] +@validates("R-41492", "R-35735", "R-159016") +def test_external_aap_format(yaml_file): + check_ip_format( + yaml_file, aap_regx_dict, "external", "allowed_address_pairs", "ip_address" ) - assert not set( - invalid_ip_addresses - ), "invalid ip addresses allowed address pairs %s" % list(set(invalid_ip_addresses)) + +@validates("R-717227", "R-805572") +def test_internal_aap_format(yaml_file): + check_ip_format( + yaml_file, aap_regx_dict, "internal", "allowed_address_pairs", "ip_address" + ) diff --git a/ice_validator/tests/test_environment_file_parameters.py b/ice_validator/tests/test_environment_file_parameters.py index 3a3bf22..694ea22 100644 --- a/ice_validator/tests/test_environment_file_parameters.py +++ b/ice_validator/tests/test_environment_file_parameters.py @@ -364,13 +364,14 @@ def test_neutron_port_fixedips_subnet_parameter_doesnt_exist_in_environment_file @categories("environment_file") @validates("R-83412", "R-83418") -def test_neutron_port_aap_ip_parameter_doesnt_exist_in_environment_file(yaml_file): +def test_neutron_port_external_aap_ip_parameter_doesnt_exist_in_environment_file(yaml_file): run_check_resource_parameter( yaml_file, "allowed_address_pairs", False, "OS::Neutron::Port", nested_prop="ip_address", + exclude_parameter=re.compile(r"^(.+?)_int_(.+?)$"), ) 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 58351e5..83dd5e3 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 @@ -37,45 +37,58 @@ # # -import pytest -from tests import cached_yaml as yaml +import re from .helpers import validates -from .utils.ports import get_invalid_ip_addresses +from .utils.ports import check_ip_format -@validates( - "R-40971", - "R-27818", - "R-29765", - "R-85235", - "R-78380", - "R-23503", - "R-71577", - "R-04697", - "R-34037", +RE_EXTERNAL_PARAM_FIP = re.compile( # match pattern + r"(?P.+)_(?P.+[^(v6)])(_v6)?_ip_(?P.+)$" ) -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(yaml_file) as fh: - yml = yaml.load(fh) - # skip if resources are not defined - if "resources" not in yml: - pytest.skip("No resources specified in the heat template") +RE_EXTERNAL_PARAM_FIPS = re.compile( # match pattern + r"(?P.+)_(?P.+[^(v6)])(_v6)?_ips$" +) + +RE_INTERNAL_PARAM_FIP = re.compile( # match pattern + r"(?P.+)_int_(?P.+[^(v6)])(_v6)?_ip_(?P.+)$" +) + +RE_INTERNAL_PARAM_FIPS = re.compile( # match pattern + r"(?P.+)_int_(?P.+[^(v6)])(_v6)?_ips$" +) + +fip_regx_dict = { + "external": { + "string": { + "readable": "{vm-type}_{network-role}_ip_{ip-index} or {vm-type}_{network-role}_v6_ip_{ip-index}", + "machine": RE_EXTERNAL_PARAM_FIP, + }, + "comma_delimited_list": { + "readable": "{vm-type}_{network-role}_ips or {vm-type}_{network-role}_v6_ips", + "machine": RE_EXTERNAL_PARAM_FIPS, + }, + }, + "internal": { + "string": { + "readable": "{vm-type}_int_{network-role}_ip_{ip-index} or {vm-type}_int_{network-role}_v6_ip_{ip-index}", + "machine": RE_INTERNAL_PARAM_FIP, + }, + "comma_delimited_list": { + "readable": "{vm-type}_int_{network-role}_ips or {vm-type}_int_{network-role}_v6_ips", + "machine": RE_INTERNAL_PARAM_FIPS, + }, + }, + "parameter_to_resource_comparisons": ["vm_type", "network_role"], +} + - if "parameters" not in yml: - pytest.skip("No parameters specified in the heat template") +@validates("R-40971", "R-35735", "R-23503", "R-71577", "R-04697", "R-34037") +def test_external_fip_format(yaml_file): + check_ip_format(yaml_file, fip_regx_dict, "external", "fixed_ips", "ip_address") - invalid_ip_addresses = get_invalid_ip_addresses( - yml["resources"], "fixed_ips", yml["parameters"] - ) - msg = "The following fixed_ips are declared incorrectly: {}".format( - ", ".join(invalid_ip_addresses) - ) - assert not set(invalid_ip_addresses), msg +@validates("R-27818", "R-29765", "R-85235", "R-78380", "R-34037") +def test_internal_fip_format(yaml_file): + check_ip_format(yaml_file, fip_regx_dict, "internal", "fixed_ips", "ip_address") 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 7b9bf3b..857fbff 100644 --- a/ice_validator/tests/test_neutron_port_fixed_ips_subnet.py +++ b/ice_validator/tests/test_neutron_port_fixed_ips_subnet.py @@ -63,206 +63,52 @@ resources: """ import re -import pytest +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, get_base_template_from_yaml_file +from .helpers import validates, load_yaml, get_base_template_from_yaml_files +from .utils.ports import check_ip_format VERSION = "1.3.0" -RE_BASE = re.compile(r"(^base$)|(^base_)|(_base_)|(_base$)") # search pattern - RE_EXTERNAL_PARAM_SUBNET = re.compile( # match pattern - r"(?P.+)(_v6)?_subnet_id$" + r"(?P.+[^(v6)])(_v6)?_subnet_id$" ) RE_INTERNAL_PARAM_SUBNET = re.compile( # match pattern - r"int_(?P.+)(_v6)?_subnet_id$" + r"int_(?P.+[^(v6)])(_v6)?_subnet_id$" ) +fip_regx_dict = { + "external": { + "string": { + "readable": "{network-role}_subnet_id or {network-role}_v6_subnet_id", + "machine": RE_EXTERNAL_PARAM_SUBNET, + } + }, + "internal": { + "string": { + "readable": "int_{network-role}_subnet_id or int_{network-role}_v6_subnet_id", + "machine": RE_INTERNAL_PARAM_SUBNET, + } + }, + "parameter_to_resource_comparisons": ["network_role"], +} -def get_base(base_template_filepath): - """Return the base template's Heat instance. - """ - if base_template_filepath is None: - pytest.skip("No base template found") - base_template = Heat(filepath=base_template_filepath) - return base_template - - -def run_test(heat_template, validate, validator=None): - """call validate for each fixed_ips - """ - heat = Heat(filepath=heat_template) - base_template = get_base_template_from_yaml_file(heat_template) - if not heat.resources: - pytest.skip("No resources found") - - neutron_ports = heat.neutron_port_resources - if not neutron_ports: - pytest.skip("No OS::Neutron::Port resources found") - - bad = {} - for rid, resource in neutron_ports.items(): - fixed_ips = heat.nested_get(resource, "properties", "fixed_ips") - if fixed_ips is None: - continue - if not isinstance(fixed_ips, list): - bad[rid] = "properties.fixed_ips must be a list." - continue - for fixed_ip in fixed_ips: - error = validate(heat, fixed_ip, base_template, validator) - if error: - bad[rid] = error - break - if bad: - # raise RuntimeError( - raise AssertionError( - "%s" - % (", ".join("%s: %s" % (rid, error) for rid, error in bad.items())) - ) - -def validate_external_fixed_ip_subnet(heat, fixed_ip, base_template, validator): - """ensure fixed_ip subnet for external network - match the pattern. - Returns error message string or None. - """ - subnet = heat.nested_get(fixed_ip, "subnet", "get_param") - if subnet: - error = validator(subnet, RE_EXTERNAL_PARAM_SUBNET) - else: - error = None - return error +@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") -def validate_external_subnet_parameter_format(subnet, regx): - """ensure subnet matches template. - Returns error message string or None. - """ - if subnet and not subnet.startswith("int_") and regx.match(subnet) is None: - return ( - 'fixed_ip subnet parameter "%s" does not match ' - "{network-role}_subnet_id or {network-role}_v6_subnet_id" % (subnet) - ) - return None - - -def validate_internal_fixed_ip_subnet(heat, fixed_ip, base_template, validator): - """ensure fixed_ip subnet for internal network - match the pattern. - Returns error message string or None. - """ - base_module = get_base(base_template) - subnet = heat.nested_get(fixed_ip, "subnet", "get_param") - if subnet: - error = validator(heat, base_module, subnet, RE_INTERNAL_PARAM_SUBNET) - else: - error = None - return error - - -def validate_internal_subnet_parameter_format(heat, base_module, subnet, regx): - """ensure if subnet matches template then its parameter exists. - Returns error message string or None. - """ - if subnet and subnet.startswith("int_") and regx.match(subnet) is None: - return ( - 'fixed_ip subnet parameter "%s" does not match ' - "int_{network-role}_subnet_id or int_{network-role}_v6_subnet_id" % (subnet) - ) - return None - - -def validate_internal_subnet_exists_in_base_output(heat, base_module, subnet, regx): - """ensure if subnet matches template then its parameter exists. - Returns error message string or None. - """ - if ( - subnet - and subnet.startswith("int_") - and regx.match(subnet) - and heat.nested_get(base_module.outputs, subnet) is None - ): - return 'fixed_ip subnet(_id) parameter "%s" not in base outputs"' % (subnet) - return None - - -def validate_fixed_ip_subnet(heat, fixed_ip, base_template, validator): - """ensure fixed_ip has proper parameters - Returns error message string or None. - """ - subnet = heat.nested_get(fixed_ip, "subnet", "get_param") - if subnet and heat.nested_get(heat.parameters, subnet, "type") != "string": - error = 'subnet parameter "%s" must be type "string"' % subnet - else: - error = None - return error - - -@validates("R-38236") -def test_neutron_port_fixed_ips_subnet(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(yaml_file, validate_fixed_ip_subnet) - - -@validates("R-62802", "R-15287") -def test_neutron_port_external_fixed_ips_subnet(yaml_file): - """ - When the VNF's Heat Orchestration Template's - resource ``OS::Neutron::Port`` is attaching - to an external network, - and an IPv4 address is being cloud assigned by OpenStack's DHCP Service - and the external network IPv4 subnet is to be specified - using the property ``fixed_ips`` - map property ``subnet``/``subnet_id``, the parameter - **MUST** follow the naming convention - - * ``{network-role}_subnet_id`` - and the external network IPv6 subnet is to be specified - * ``{network-role}_v6_subnet_id`` - """ - run_test( - yaml_file, - validate_external_fixed_ip_subnet, - validate_external_subnet_parameter_format, - ) - - -@validates("R-84123", "R-76160") -def test_neutron_port_internal_fixed_ips_subnet(yaml_file): - """ - 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`` - - """ - run_test( - yaml_file, - validate_internal_fixed_ip_subnet, - validate_internal_subnet_parameter_format, - ) +@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") @validates("R-84123", "R-76160") -def test_neutron_port_internal_fixed_ips_subnet_in_base(heat_template): +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. @@ -286,8 +132,41 @@ def test_neutron_port_internal_fixed_ips_subnet_in_base(heat_template): Note that the parameter MUST be defined as an output parameter in the base module. """ - run_test( - heat_template, - validate_internal_fixed_ip_subnet, - validate_internal_subnet_exists_in_base_output, - ) + + base_path = get_base_template_from_yaml_files(yaml_files) + base_heat = load_yaml(base_path) + base_outputs = base_heat.get("outputs") or {} + nested_template_paths = get_nested_files(yaml_files) + errors = [] + + for yaml_file in yaml_files: + if yaml_file == base_path or yaml_file in nested_template_paths: + continue # Only applies to incremental modules + heat = Heat(filepath=yaml_file) + internal_ports = { + r_id: p + for r_id, p in heat.neutron_port_resources.items() + if get_network_type_from_port(p) == "internal" + } + for r_id, port in internal_ports.items(): + props = port.get("properties") or {} + fip_list = props.get("fixed_ips") or [] + if not isinstance(fip_list, list): + continue + for ip in fip_list: + subnet = ip.get("subnet") + if not subnet: + continue + + if "get_param" not in subnet: + continue + param = subnet.get("get_param") + if param not in base_outputs: + errors.append( + ( + "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) + ) + + assert not errors, " ".join(errors) diff --git a/ice_validator/tests/utils/ports.py b/ice_validator/tests/utils/ports.py index 89440eb..c005e32 100644 --- a/ice_validator/tests/utils/ports.py +++ b/ice_validator/tests/utils/ports.py @@ -36,199 +36,120 @@ # ============LICENSE_END============================================ # # - from .network_roles import get_network_role_and_type -from .vm_types import get_vm_type_for_nova_server -import re - - -def is_valid_ip_address( - ip_address, vm_type, network_role, port_property, parameter_type, network_type -): - """ - Check the ip_address to make sure it is properly formatted and - also contains {vm_type} and {network_role} - """ - - allowed_formats = [ - [ - "allowed_address_pairs", - "string", - "internal", - re.compile(r"(.+?)_int_(.+?)_floating_v6_ip"), - ], - [ - "allowed_address_pairs", - "string", - "internal", - re.compile(r"(.+?)_int_(.+?)_floating_ip"), - ], - [ - "allowed_address_pairs", - "string", - "external", - re.compile(r"(.+?)_floating_v6_ip"), - ], - [ - "allowed_address_pairs", - "string", - "external", - re.compile(r"(.+?)_floating_ip"), - ], - [ - "allowed_address_pairs", - "string", - "internal", - re.compile(r"(.+?)_int_(.+?)_v6_ip_\d+"), - ], - [ - "allowed_address_pairs", - "string", - "internal", - re.compile(r"(.+?)_int_(.+?)_ip_\d+"), - ], - ["allowed_address_pairs", "string", "external", re.compile(r"(.+?)_v6_ip_\d+")], - ["allowed_address_pairs", "string", "external", re.compile(r"(.+?)_ip_\d+")], - [ - "allowed_address_pairs", - "comma_delimited_list", - "internal", - re.compile(r"(.+?)_int_(.+?)_v6_ips"), - ], - [ - "allowed_address_pairs", - "comma_delimited_list", - "internal", - re.compile(r"(.+?)_int_(.+?)_ips"), - ], - [ - "allowed_address_pairs", - "comma_delimited_list", - "external", - re.compile(r"(.+?)_v6_ips"), - ], - [ - "allowed_address_pairs", - "comma_delimited_list", - "external", - re.compile(r"(.+?)_ips"), - ], - ["fixed_ips", "string", "internal", re.compile(r"(.+?)_int_(.+?)_v6_ip_\d+")], - ["fixed_ips", "string", "internal", re.compile(r"(.+?)_int_(.+?)_ip_\d+")], - ["fixed_ips", "string", "external", re.compile(r"(.+?)_v6_ip_\d+")], - ["fixed_ips", "string", "external", re.compile(r"(.+?)_ip_\d+")], - [ - "fixed_ips", - "comma_delimited_list", - "internal", - re.compile(r"(.+?)_int_(.+?)_v6_ips"), - ], - [ - "fixed_ips", - "comma_delimited_list", - "internal", - re.compile(r"(.+?)_int_(.+?)_ips"), - ], - ["fixed_ips", "comma_delimited_list", "external", re.compile(r"(.+?)_v6_ips")], - ["fixed_ips", "comma_delimited_list", "external", re.compile(r"(.+?)_ips")], - ] - - for v3 in allowed_formats: - if v3[1] != parameter_type: - continue - if v3[0] != port_property: - continue - if v3[2] != network_type: - continue - # check if pattern matches - m = v3[3].match(ip_address) - if m: - if v3[2] == "internal" and len(m.groups()) > 1: - return m.group(1) == vm_type and m.group(2) == network_role - elif v3[2] == "external" and len(m.groups()) > 0: - return m.group(1) == vm_type + "_" + network_role +from tests.structures import Heat, NeutronPortProcessor +from tests.helpers import parameter_type_to_heat_type +from . import nested_dict - return False - -def get_invalid_ip_addresses(resources, port_property, parameters): +def check_ip_format(yaml_file, regx, port_type, resource_property, nested_property): """ - Get a list of valid ip addresses for a heat resources section + yaml_file: input file to check + regx: dictionary containing the regex to use to validate parameter + port_type: internal or external + resource_property: OS::Neutron::Port property to check for parameter + nested_property: resource_property will be a list of dicts, this is the key to index into """ - invalid_ip_addresses = [] - - for k, v in resources.items(): - if not isinstance(v, dict): - continue - if "type" not in v: + invalid_ips = [] + heat = Heat(filepath=yaml_file) + ports = heat.get_resource_by_type("OS::Neutron::Port") + heat_parameters = heat.parameters + + for rid, resource in ports.items(): + network_role, network_type = get_network_role_and_type(resource) + if ( + network_type != port_type + ): # skipping if port type (internal/external) doesn't match continue - if v["type"] not in "OS::Nova::Server": - continue - if "properties" not in v: - continue - if "networks" not in v["properties"]: - continue - - port_resource = None - - vm_type = get_vm_type_for_nova_server(v) - if not vm_type: - continue - - # get all ports associated with the nova server - properties = v["properties"] - for network in properties["networks"]: - for k3, v3 in network.items(): - if k3 != "port": - continue - if not isinstance(v3, dict): - continue - - if "get_resource" in v3: - port_id = v3["get_resource"] - if not resources[port_id]: - continue - port_resource = resources[port_id] - else: - continue - network_role, network_type = get_network_role_and_type(port_resource) - if not network_role or not network_type: + name, port_match = NeutronPortProcessor.get_rid_match_tuple(rid) + if not port_match: + continue # port resource ID not formatted correctely + + params = nested_dict.get(resource, "properties", resource_property, default={}) + + for param in params: + prop = nested_dict.get(param, nested_property) + if ( + not prop + or not isinstance(prop, dict) + or "get_resource" in prop + or "get_attr" in prop + # or "str_replace" in prop - should str_replace be checked? + ): + continue # lets only check parameters shall we? + + # checking parameter uses get_param + parameter = nested_dict.get(prop, "get_param") + if not parameter: + msg = ( + "Unexpected parameter format for OS::Neutron::Port {} property {}: {}. " + + "Please consult the heat guidelines documentation for details." + ).format(rid, resource_property, prop) + invalid_ips.append(msg) # should this be a failure? + continue + + # getting parameter if the get_param uses list, and getting official HEAT parameter type + parameter_type = parameter_type_to_heat_type(parameter) + if parameter_type == "comma_delimited_list": + parameter = parameter[0] + elif parameter_type != "string": + continue + + # checking parameter format = type defined in template + heat_parameter_type = nested_dict.get(heat_parameters, parameter, "type") + if not heat_parameter_type or heat_parameter_type != parameter_type: + msg = ( + "OS::Neutron::Port {} parameter {} defined as type {} " + + "is being used as type {} in the heat template" + ).format( + resource_property, parameter, heat_parameter_type, parameter_type + ) + invalid_ips.append(msg) + continue + + # if parameter type is not in regx dict, then it is not supported by automation + regx_dict = regx[port_type].get(parameter_type) + if not regx_dict: + msg = ( + "WARNING: OS::Neutron::Port {} parameter {} defined as type {} " + + "is not supported by platform automation. If this VNF is not able " + + "to adhere to this requirement, please consult the Heat Orchestration " + + "Template guidelines for alternative solutions. If already adhering to " + + "an alternative provided by the heat guidelines, please disregard this " + + "message." + ).format(resource_property, parameter, parameter_type) + invalid_ips.append(msg) + continue + + # checking if param adheres to guidelines format + regexp = regx[port_type][parameter_type]["machine"] + readable_format = regx[port_type][parameter_type]["readable"] + match = regexp.match(parameter) + if not match: + msg = "{} parameter {} does not follow format {}".format( + resource_property, parameter, readable_format + ) + invalid_ips.append(msg) + continue + + # checking that parameter includes correct vm_type/network_role + parameter_checks = regx.get("parameter_to_resource_comparisons", []) + for check in parameter_checks: + resource_match = port_match.group(check) + if ( + resource_match + and not parameter.startswith(resource_match) + and parameter.find("_{}_".format(resource_match)) == -1 + ): + msg = ( + "OS::Neutron::Port {0} property {1} parameter " + + "{2} {3} does match resource {3} {4}" + ).format(rid, resource_property, parameter, check, resource_match) + invalid_ips.append(msg) continue - for k1, v1 in port_resource["properties"].items(): - if k1 != port_property: - continue - for v2 in v1: - if "ip_address" not in v2: - continue - if "get_param" not in v2["ip_address"]: - continue - ip_address = v2["ip_address"]["get_param"] - - if isinstance(ip_address, list): - ip_address = ip_address[0] - - if ip_address not in parameters: - continue - - parameter_type = parameters[ip_address].get("type") - if not parameter_type: - continue - - valid_ip_address = is_valid_ip_address( - ip_address, - vm_type, - network_role, - port_property, - parameter_type, - network_type, - ) - - if not valid_ip_address: - invalid_ip_addresses.append(ip_address) - - return invalid_ip_addresses + assert not invalid_ips, "%s" % "\n".join(invalid_ips) def get_list_of_ports_attached_to_nova_server(nova_server): -- cgit 1.2.3-korg