diff options
author | stark, steven <ss820f@att.com> | 2018-04-23 08:49:34 -0700 |
---|---|---|
committer | stark, steven <ss820f@att.com> | 2018-04-23 08:49:34 -0700 |
commit | 655f39713cca2595a812ccd60cc738301aef8b2f (patch) | |
tree | b643a746b17ed00575b980c2bb233ce7cbf2109b /ice_validator/tests | |
parent | 671ada85afbb8112a7ae854950cea24756be4dd3 (diff) |
[VVP] add bug fixes and reserve port updates
Adding test script updates and reserve port
Change-Id: I2af5263a48a53117021f166d08395685e89fd122
Issue-ID: VVP-56
Signed-off-by: stark, steven <ss820f@att.com>
Diffstat (limited to 'ice_validator/tests')
36 files changed, 1378 insertions, 164 deletions
diff --git a/ice_validator/tests/fixtures/test_allowed_address_pair_format/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_allowed_address_pair_format/pass/valid_heat_template.yaml index 9a66ae5..47343c3 100644 --- a/ice_validator/tests/fixtures/test_allowed_address_pair_format/pass/valid_heat_template.yaml +++ b/ice_validator/tests/fixtures/test_allowed_address_pair_format/pass/valid_heat_template.yaml @@ -122,4 +122,26 @@ resources: properties: network: { get_param: extnet_net_id } allowed_address_pairs: - - ip_address: { get_param: [lb_2_extnet_v6_ips, 0] }
\ No newline at end of file + - ip_address: { get_param: [lb_2_extnet_v6_ips, 0] } + int_oam_net: + type: OS::Neutron::Net + properties: + name: { get_param: int_oam_net_name } + vm_type_1_int_intranet_10_port: + type: OS::Neutron::Port + properties: + network: { get_resource: int_oam_net } + allowed_address_pairs: + - ip_address: { get_param: [lb_2_int_intranet_v6_ips, 1] } + vm_type_1_int_intranet_11_port: + type: OS::Neutron::Port + properties: + network: { get_resource: int_oam_net } + allowed_address_pairs: + - ip_address: { get_param: [lb_2_int_intranet_ips, 1] } + vm_type_1_int_intranet_10_port: + type: OS::Neutron::Port + properties: + network: { get_resource: int_oam_net } + allowed_address_pairs: + - ip_address: { get_param: lb_2_int_intranet_v6_ip_1 } diff --git a/ice_validator/tests/fixtures/test_base_template_names/pass/base_well_named_4/base.yaml b/ice_validator/tests/fixtures/test_base_template_names/pass/base_well_named_4/base.yaml new file mode 100644 index 0000000..24b4c8f --- /dev/null +++ b/ice_validator/tests/fixtures/test_base_template_names/pass/base_well_named_4/base.yaml @@ -0,0 +1,57 @@ +# -*- 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============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +--- +description: + base +parameters: + vm_type_volume_name_0: + type: string + vm_type_volume_size_0: + type: number + +resources: + server_0: + type: OS::Nova::Server + properties: + name: {get_param: server_name_0} + +outputs: + vm_type_volume_id_0: + value: {get_resource: vm_type_volume_0}
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_fixed_ips_format/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_fixed_ips_format/pass/valid_heat_template.yaml index f1b4f4d..46cfdab 100644 --- a/ice_validator/tests/fixtures/test_fixed_ips_format/pass/valid_heat_template.yaml +++ b/ice_validator/tests/fixtures/test_fixed_ips_format/pass/valid_heat_template.yaml @@ -91,4 +91,40 @@ resources: network: { get_param: extnet_net_id } fixed_ips: - subnet_id: { get_param: extnet_subnet_id } - - subnet_id: { get_param: extnet_v6_subnet_id }
\ No newline at end of file + - 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 } + 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 } + int_oam_net: + type: OS::Neutron::Net + properties: + name: { get_param: int_oam_net_name } + vm_type_1_int_vpnnet_8_port: + type: OS::Neutron::Port + properties: + network: { get_resource: int_oam_net } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - ip_address: { get_param: [db_1_int_vpnnet_ips, 1] } + vm_type_1_int_vpnnet_9_port: + type: OS::Neutron::Port + properties: + network: { get_resource: int_oam_net } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - subnet_id: { get_resource: int_vpnnet_subnet_id } + vm_type_1_int_vpnnet_10_port: + type: OS::Neutron::Port + properties: + network: { get_resource: int_oam_net } + fixed_ips: + - ip_address: { get_param: lb_0_int_intranet_ip_0 } diff --git a/ice_validator/tests/fixtures/test_fixed_ips_format_use_get_param/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_fixed_ips_format_use_get_param/pass/valid_heat_template.yaml index f1b4f4d..b08c671 100644 --- a/ice_validator/tests/fixtures/test_fixed_ips_format_use_get_param/pass/valid_heat_template.yaml +++ b/ice_validator/tests/fixtures/test_fixed_ips_format_use_get_param/pass/valid_heat_template.yaml @@ -91,4 +91,16 @@ resources: network: { get_param: extnet_net_id } fixed_ips: - subnet_id: { get_param: extnet_subnet_id } - - subnet_id: { get_param: extnet_v6_subnet_id }
\ No newline at end of file + - 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 } + 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 }
\ No newline at end of file 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 f67b794..48b0080 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 @@ -211,3 +211,15 @@ 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 } + 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 } diff --git a/ice_validator/tests/fixtures/test_network_format/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_network_format/pass/valid_heat_template.yaml index 422a979..ef28f27 100644 --- a/ice_validator/tests/fixtures/test_network_format/pass/valid_heat_template.yaml +++ b/ice_validator/tests/fixtures/test_network_format/pass/valid_heat_template.yaml @@ -59,7 +59,11 @@ resources: properties: network: { get_param: extnet_net_id } + int_oam_net: + type: OS::Neutron::Net + properties: + name: { get_param: int_oam_net_name } vm_type_1_int_oam_1_port: type: OS::Neutron::Port properties: - network: { get_resource: int_oam_net_id } + network: { get_resource: int_oam_net } diff --git a/ice_validator/tests/fixtures/test_port_resource_ids/pass/valid_template.yaml b/ice_validator/tests/fixtures/test_port_resource_ids/pass/valid_template.yaml index dd5d768..a16badc 100644 --- a/ice_validator/tests/fixtures/test_port_resource_ids/pass/valid_template.yaml +++ b/ice_validator/tests/fixtures/test_port_resource_ids/pass/valid_template.yaml @@ -95,6 +95,9 @@ parameters: int_vpnnet_net_id: type: string description: network id for the internal network vpnnet + int_oam_net_name: + type: string + description: name for the OAM network to be created in the resources section resources: @@ -126,6 +129,18 @@ resources: vnf_id: { get_param: vnf_id } vf_module_id: { get_param: vf_module_id } + admin_server_2: + type: OS::Nova::Server + properties: + availability_zone: { get_param: availability_zone_0 } + name: { get_param: [admin_names, 2] } + flavor: { get_param: admin_flavor_name} + networks: + - port: { get_resource: admin_2_int_vpnnet_0_port } + metadata: + vnf_name: { get_param: vnf_name } + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } lb_server_0: type: OS::Nova::Server properties: @@ -155,4 +170,15 @@ resources: admin_1_extnet_1_port: type: OS::Neutron::Port properties: - network: { get_param: extnet_net_id }
\ No newline at end of file + network: { get_param: extnet_net_id } + int_oam_net: + type: OS::Neutron::Net + properties: + name: { get_param: int_oam_net_name } + admin_2_int_vpnnet_0_port: + type: OS::Neutron::Port + properties: + network: { get_resource: int_oam_net } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] } + - ip_address: { get_param: [db_1_int_vpnnet_ips, 1] } diff --git a/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/fail/missing_param_reference.yaml b/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/fail/missing_param_reference.yaml deleted file mode 100644 index 78632b8..0000000 --- a/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/fail/missing_param_reference.yaml +++ /dev/null @@ -1,134 +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============================================ -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -# ---- -heat_template_version: 2013-05-23 - -description: Simple template to deploy a single compute instance - -parameters: - vnf_id: - description: Unique ID for this VNF - type: string - vf_module_id: - description: Unique ID for this VF module - type: string - vnf_name: - type: string - description: Unique name for this VNF instance - ex_image_name: - type: string - label: Image name or ID - description: Image to be used for compute instance - ex_key: - type: string - label: key pair - description: Name of the key apir the nova server will use - ex_vm_name: - type: string - description: Name of the VM - ex1_vm_names: - type: comma_delimited_list - description: Name of the VM - ex1_image_name: - type: string - label: Image name or ID - description: Image to be used for compute instance - ex1_flavor_name: - type: string - label: Flavor - description: Type of instance (flavor) to be used - ex1_key: - type: string - label: key pair - description: Name of the key apir the nova server will use - ex1_server_index: - type: number - label: server index - description: Index of server - constraint: - - range: { min: 1, max: 100 } - -resources: - ex_software_config_0: - type: OS::Heat::SoftwareConfig - properties: - group: ungrouped - config: - params: - $stack_name: { get_param: 'OS::stack_name' } - - ex_nova_server_0: - type: OS::Nova::Server - properties: - name: { get_param: ex_vm_name } - metadata: - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - vnf_name: { get_param: vnf_name } - image: { get_param: ex_image_name } - flavor: { get_param: ex_flavor_name } - key_name: { get_param: ex_key } - user_data: - get_resource: ex_software_config_0 - - ex1_nova_server_0: - type: OS::Nova::Server - properties: - name: { get_param: [ ex1_vm_names, 0 ] } - metadata: - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - vnf_name: { get_param: vnf_name } - project_id: { get_param: "OS::project_id" } - image: { get_param: ex1_image_name } - flavor: { get_param: ex1_flavor_name } - key_name: { get_param: ex1_key } - - ex1_nova_server_1: - type: OS::Nova::Server - properties: - name: { get_param: [ ex1_vm_names, { get_param: ex1_server_index } ] } - metadata: - vnf_id: { get_param: vnf_id } - vf_module_id: { get_param: vf_module_id } - vnf_name: { get_param: vnf_name } - image: { get_param: ex1_image_name} - flavor: { get_param: ex1_flavor_name } - key_name: { get_param: ex1_key }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/pass/params_referenced_are_defined_and_vice_versa_1.yaml b/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/pass/params_referenced_are_defined_and_vice_versa_1.yaml index 3080018..cf9e241 100644 --- a/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/pass/params_referenced_are_defined_and_vice_versa_1.yaml +++ b/ice_validator/tests/fixtures/test_referenced_and_defined_parameters_match/pass/params_referenced_are_defined_and_vice_versa_1.yaml @@ -82,12 +82,16 @@ parameters: type: string label: key pair description: Name of the key apir the nova server will use - ex1_server_index: + ex1_server_index_0: type: number label: server index description: Index of server constraint: - range: { min: 1, max: 100 } + ex1_server_info: + type: json + label: Json containing server index + description: Json containing the index of server resources: ex_software_config_0: @@ -129,7 +133,24 @@ resources: ex1_nova_server_1: type: OS::Nova::Server properties: - name: { get_param: [ ex1_vm_names, { get_param: ex1_server_index } ] } + name: { get_param: [ ex1_vm_names, { get_param: ex1_server_index_0 } ] } + metadata: + vnf_id: { get_param: vnf_id } + vf_module_id: { get_param: vf_module_id } + vnf_name: { get_param: vnf_name } + image: { get_param: ex1_image_name} + flavor: { get_param: ex1_flavor_name } + key_name: { get_param: ex1_key } + ex1_nova_server_2: + type: OS::Nova::Server + properties: + name: + get_param: + - ex1_vm_names + - get_param: + - ex1_server_info + - ex1_server_metadata + - ex1_server_index_1 metadata: vnf_id: { get_param: vnf_id } vf_module_id: { get_param: vf_module_id } diff --git a/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_format/fail/invalid_base_naming_for_fixed_ips.yaml b/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_format/fail/invalid_base_naming_for_fixed_ips.yaml new file mode 100644 index 0000000..d686e65 --- /dev/null +++ b/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_format/fail/invalid_base_naming_for_fixed_ips.yaml @@ -0,0 +1,69 @@ +# -*- 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============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +--- +resources: + + reserve_port_lb_1_int_intranet_floating_ip_0: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_int_intranet_floating_ips } + + reserve_port_lb_2_int_intranet_floating_v6_ip_0: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_int_intranet_v6_ip } + + reserve_port_lb_1_extnet_floating_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_floating_ip } + + reserve_port_lb_2_extnet_floating_v6_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_extnet_floating_v6_ip }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_format/pass/valid_base_heat_template.yaml b/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_format/pass/valid_base_heat_template.yaml new file mode 100644 index 0000000..2efaa5d --- /dev/null +++ b/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_format/pass/valid_base_heat_template.yaml @@ -0,0 +1,69 @@ +# -*- 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============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +--- +resources: + + reserve_port_lb_1_int_intranet_floating_ip_0: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_int_intranet_floating_ip } + + reserve_port_lb_2_int_intranet_floating_v6_ip_0: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_int_intranet_floating_v6_ip } + + reserve_port_lb_1_extnet_floating_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_floating_ip } + + reserve_port_lb_2_extnet_floating_v6_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_extnet_floating_v6_ip }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_has_base_outputs/fail/invalid_base_heat_template_1.yaml b/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_has_base_outputs/fail/invalid_base_heat_template_1.yaml new file mode 100644 index 0000000..1fd21a2 --- /dev/null +++ b/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_has_base_outputs/fail/invalid_base_heat_template_1.yaml @@ -0,0 +1,90 @@ +# -*- 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============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +--- +resources: + + reserve_port_lb_1_extnet_floating_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_floating_ip } + + reserve_port_lb_2_extnet_floating_v6_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_extnet_floating_v6_ip } + + reserve_port_lb_1_extnet_floating_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_floating_ip } + + reserve_port_lb_2_extnet_floating_v6_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_extnet_floating_v6_ip } + + lb_3_extnet_floating_v6_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_3_extnet_floating_v6_ip } + +outputs: + + lb_1_int_intranet_vip: + description: "vip for lb_1_int_intranet_floating_ip" + value: { get_param: lb_1_int_intranet_floating_ip } + + lb_2_int_intranet_v6_vip: + description: "vip for lb_2_int_intranet_v6_vip" + value: { get_param: lb_2_int_intranet_floating_v6_ip } + + lb_1_extnet_vip: + description: "vip for lb_1_extnet_floating_ip" + value: { get_param: lb_1_extnet_floating_ip }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_has_base_outputs/fail/invalid_base_heat_template_2.yaml b/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_has_base_outputs/fail/invalid_base_heat_template_2.yaml new file mode 100644 index 0000000..d4e38e6 --- /dev/null +++ b/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_has_base_outputs/fail/invalid_base_heat_template_2.yaml @@ -0,0 +1,95 @@ +# -*- 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============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +--- +resources: + + reserve_port_lb_1_extnet_floating_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_floating_ip } + + reserve_port_lb_2_extnet_floating_v6_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_extnet_floating_v6_ip } + + reserve_port_lb_1_extnet_floating_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_floating_ip } + + reserve_port_lb_2_extnet_floating_v6_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_extnet_floating_v6_ip } + + lb_3_extnet_floating_v6_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_3_extnet_floating_v6_ip } + +outputs: + + + lb_1_int_intranet_vip: + description: "vip for lb_1_int_intranet_floating_ip" + value: { get_param: lb_1_int_intranet_floating_ip } + + lb_2_int_intranet_v6_vip: + description: "vip for lb_2_int_intranet_v6_vip" + value: { get_param: lb_2_int_intranet_floating_v6_ip } + + lb_1_extnet_vip: + description: "vip for lb_1_extnet_floating_ip" + value: { get_param: lb_1_extnet_floating_ip } + + lb_2_extnet_v6_vip: + description: "vip for lb_2_extnet_floating_v6_ip" + value: { get_param: lb_2_extnet_floating_v6_ips }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_has_base_outputs/pass/valid_base_heat_template_1.yaml b/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_has_base_outputs/pass/valid_base_heat_template_1.yaml new file mode 100644 index 0000000..9d52e98 --- /dev/null +++ b/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_has_base_outputs/pass/valid_base_heat_template_1.yaml @@ -0,0 +1,94 @@ +# -*- 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============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +--- +resources: + + reserve_port_lb_1_extnet_floating_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_floating_ip } + + reserve_port_lb_2_extnet_floating_v6_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_extnet_floating_v6_ip } + + reserve_port_lb_1_extnet_floating_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_floating_ip } + + reserve_port_lb_2_extnet_floating_v6_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_extnet_floating_v6_ip } + + lb_3_extnet_floating_v6_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_3_extnet_floating_v6_ip } + +outputs: + + lb_1_int_intranet_vip: + description: "vip for lb_1_int_intranet_floating_ip" + value: { get_param: lb_1_int_intranet_floating_ip } + + lb_2_int_intranet_v6_vip: + description: "vip for lb_2_int_intranet_v6_vip" + value: { get_param: lb_2_int_intranet_floating_v6_ip } + + lb_1_extnet_vip: + description: "vip for lb_1_extnet_floating_ip" + value: { get_param: lb_1_extnet_floating_ip } + + lb_2_extnet_v6_vip: + description: "vip for lb_2_extnet_floating_v6_ip" + value: { get_param: lb_2_extnet_floating_v6_ip }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_has_base_outputs/pass/valid_base_heat_template_2.yaml b/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_has_base_outputs/pass/valid_base_heat_template_2.yaml new file mode 100644 index 0000000..ebec57b --- /dev/null +++ b/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_has_base_outputs/pass/valid_base_heat_template_2.yaml @@ -0,0 +1,76 @@ +# -*- 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============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +--- +resources: + + lb_1_extnet_floating_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_floating_ip } + + lb_2_extnet_floating_v6_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_extnet_floating_v6_ip } + + lb_1_extnet_floating_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_floating_ip } + + lb_2_extnet_floating_v6_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_extnet_floating_v6_ip } + + lb_3_extnet_floating_v6_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_3_extnet_floating_v6_ip } diff --git a/ice_validator/tests/fixtures/test_network_format/fail/invalid_naming_used_for_internal_network_resource.yaml b/ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/fail/invalid_base_naming_for_fixed_ips.yaml index 26d0709..9d9be46 100644 --- a/ice_validator/tests/fixtures/test_network_format/fail/invalid_naming_used_for_internal_network_resource.yaml +++ b/ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/fail/invalid_base_naming_for_fixed_ips.yaml @@ -6,7 +6,7 @@ # =================================================================== # # Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the “License”); +# 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 # @@ -21,7 +21,7 @@ # # # Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +# 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 # @@ -39,27 +39,31 @@ # --- resources: - vm_type_1_int_intranet_0_port: + + lb_1_int_intranet_port: type: OS::Neutron::Port properties: network: { get_param: int_intranet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_int_intranet_ip } - vm_type_1_int_vpnnet_0_port: + lb_2_int_intranet_port: type: OS::Neutron::Port properties: - network: { get_param: int_vpnnet_net_id } + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_int_intranet_floating_v6_ips } - vm_type_1_extnet_net_0_port: + lb_1_extnet_port: type: OS::Neutron::Port properties: network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_floating_ip } - vm_type_1_extnet_0_port: + lb_2_extnet_port: type: OS::Neutron::Port properties: network: { get_param: extnet_net_id } - - vm_type_1_int_oam_1_port: - type: OS::Neutron::Port - properties: - network: { get_resource: int_oam_net } + fixed_ips: + - ip_address: { get_param: lb_2_extnet_floating_v6_ip }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/pass/valid_base_heat_template_1.yaml b/ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/pass/valid_base_heat_template_1.yaml new file mode 100644 index 0000000..2efaa5d --- /dev/null +++ b/ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/pass/valid_base_heat_template_1.yaml @@ -0,0 +1,69 @@ +# -*- 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============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +--- +resources: + + reserve_port_lb_1_int_intranet_floating_ip_0: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_int_intranet_floating_ip } + + reserve_port_lb_2_int_intranet_floating_v6_ip_0: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_int_intranet_floating_v6_ip } + + reserve_port_lb_1_extnet_floating_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_floating_ip } + + reserve_port_lb_2_extnet_floating_v6_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_extnet_floating_v6_ip }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/pass/valid_base_heat_template_2.yaml b/ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/pass/valid_base_heat_template_2.yaml new file mode 100644 index 0000000..90d46c3 --- /dev/null +++ b/ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/pass/valid_base_heat_template_2.yaml @@ -0,0 +1,69 @@ +# -*- 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============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +--- +resources: + + lb_1_int_intranet_floating_ip_0: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_int_intranet_floating_ip } + + lb_2_int_intranet_floating_v6_ip_0: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_int_intranet_floating_v6_ip } + + lb_1_extnet_floating_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_floating_ip } + + lb_2_extnet_floating_v6_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_extnet_floating_v6_ip }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/pass/valid_base_heat_template_3.yaml b/ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/pass/valid_base_heat_template_3.yaml new file mode 100644 index 0000000..6cb3fb4 --- /dev/null +++ b/ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/pass/valid_base_heat_template_3.yaml @@ -0,0 +1,69 @@ +# -*- 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============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +--- +resources: + + reserve_port_lb_1_int_intranet_floating_ip_0: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_int_intranet_floating_ip } + + lb_2_int_intranet_floating_v6_ip_0: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_int_intranet_floating_v6_ip } + + lb_1_extnet_floating_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_floating_ip } + + lb_2_extnet_floating_v6_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_extnet_floating_v6_ip }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/pass/valid_module_heat_template.yaml b/ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/pass/valid_module_heat_template.yaml new file mode 100644 index 0000000..90d46c3 --- /dev/null +++ b/ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/pass/valid_module_heat_template.yaml @@ -0,0 +1,69 @@ +# -*- 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============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +--- +resources: + + lb_1_int_intranet_floating_ip_0: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_int_intranet_floating_ip } + + lb_2_int_intranet_floating_v6_ip_0: + type: OS::Neutron::Port + properties: + network: { get_param: int_intranet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_int_intranet_floating_v6_ip } + + lb_1_extnet_floating_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_name } + fixed_ips: + - ip_address: { get_param: lb_1_extnet_floating_ip } + + lb_2_extnet_floating_v6_ip_1: + type: OS::Neutron::Port + properties: + network: { get_param: extnet_net_id } + fixed_ips: + - ip_address: { get_param: lb_2_extnet_floating_v6_ip }
\ No newline at end of file diff --git a/ice_validator/tests/fixtures/test_subnet_format/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_subnet_format/pass/valid_heat_template.yaml index 76f92e6..5251083 100644 --- a/ice_validator/tests/fixtures/test_subnet_format/pass/valid_heat_template.yaml +++ b/ice_validator/tests/fixtures/test_subnet_format/pass/valid_heat_template.yaml @@ -84,3 +84,14 @@ resources: properties: network: { get_param: extnet_net_id } + int_oam_net: + type: OS::Neutron::Net + properties: + name: { get_param: int_oam_net_name } + vm_type_1_int_vpnnet_3_port: + type: OS::Neutron::Port + properties: + network: { get_resource: int_oam_net } + fixed_ips: + - ip_address: { get_param: [db_1_int_vpnnet_ips, 1] } + - subnet_id: { get_resource: int_vpnnet_subnet_id } diff --git a/ice_validator/tests/test_allowed_address_pair_format.py b/ice_validator/tests/test_allowed_address_pair_format.py index c8a84c6..683d560 100644 --- a/ice_validator/tests/test_allowed_address_pair_format.py +++ b/ice_validator/tests/test_allowed_address_pair_format.py @@ -40,7 +40,8 @@ import pytest import yaml -from .utils.network_roles import get_network_role_from_port +from .utils.network_roles import get_network_role_from_port,\ + property_uses_get_resource import re @@ -93,6 +94,8 @@ def test_allowed_address_pairs_format(heat_template): continue if v1.get("type") != "OS::Neutron::Port": continue + if property_uses_get_resource(v1, "network"): + continue network_role = get_network_role_from_port(v1) for k2, v2 in v1["properties"].items(): diff --git a/ice_validator/tests/test_base_template_names.py b/ice_validator/tests/test_base_template_names.py index 0f903bd..d3fd7b4 100644 --- a/ice_validator/tests/test_base_template_names.py +++ b/ice_validator/tests/test_base_template_names.py @@ -60,6 +60,7 @@ def test_base_template_names(template_dir): if (filename.endswith("_base") or filename.startswith("base_") or + filename == "base" or filename.find("_base_") > 0): base_template_count += 1 assert base_template_count == 1 diff --git a/ice_validator/tests/test_fixed_ips_format.py b/ice_validator/tests/test_fixed_ips_format.py index 039c619..8e159ba 100644 --- a/ice_validator/tests/test_fixed_ips_format.py +++ b/ice_validator/tests/test_fixed_ips_format.py @@ -40,7 +40,9 @@ import pytest import yaml -from .utils.network_roles import get_network_role_from_port +from .utils.ports import is_reserved_port +from .utils.network_roles import get_network_role_from_port,\ + property_uses_get_resource import re @@ -76,13 +78,17 @@ def test_fixed_ips_format(heat_template): pytest.skip("No resources specified in the heat template") invalid_fixed_ips = [] - for v1 in yml["resources"].values(): + for k1, v1 in yml["resources"].items(): if not isinstance(v1, dict): continue if "properties" not in v1: continue if v1.get("type") != "OS::Neutron::Port": continue + if is_reserved_port(k1): + continue + if property_uses_get_resource(v1, "network"): + continue network_role = get_network_role_from_port(v1) for k2, v2 in v1["properties"].items(): diff --git a/ice_validator/tests/test_fixed_ips_format_use_get_param.py b/ice_validator/tests/test_fixed_ips_format_use_get_param.py index afd52e5..13f028d 100644 --- a/ice_validator/tests/test_fixed_ips_format_use_get_param.py +++ b/ice_validator/tests/test_fixed_ips_format_use_get_param.py @@ -40,6 +40,7 @@ import pytest import yaml +from .utils.ports import is_reserved_port def test_fixed_ips_format_use_get_parm(heat_template): @@ -61,6 +62,8 @@ def test_fixed_ips_format_use_get_parm(heat_template): continue if v.get("type") != "OS::Neutron::Port": continue + if is_reserved_port(k): + continue valid_fixed_ip = True for k2, v2 in v["properties"].items(): diff --git a/ice_validator/tests/test_heat_parameter_section.py b/ice_validator/tests/test_heat_parameter_section.py index 7559ee6..c5d0b4c 100644 --- a/ice_validator/tests/test_heat_parameter_section.py +++ b/ice_validator/tests/test_heat_parameter_section.py @@ -63,7 +63,7 @@ def test_parameter_valid_keys(yaml_file): continue detected_keys = set(v1) & set(key_values) if set(v1) != set(detected_keys): - invalid_params.append(v1) + invalid_params.append(str(v1)) assert not set(invalid_params) @@ -84,6 +84,6 @@ def test_default_values(yaml_file): if not isinstance(v1, dict): continue if any(k == 'default' for k in v1): - invalid_params.append(v1) + invalid_params.append(str(v1)) assert not set(invalid_params) diff --git a/ice_validator/tests/test_network_format.py b/ice_validator/tests/test_network_format.py index 28144d3..17d000c 100644 --- a/ice_validator/tests/test_network_format.py +++ b/ice_validator/tests/test_network_format.py @@ -40,7 +40,8 @@ import pytest import yaml -from .utils.network_roles import get_network_role_from_port +from .utils.network_roles import get_network_role_from_port,\ + property_uses_get_resource def test_network_format(heat_template): @@ -61,6 +62,8 @@ def test_network_format(heat_template): continue if "properties" not in v: continue + if property_uses_get_resource(v, "network"): + continue if v.get("type") != "OS::Neutron::Port": continue if not get_network_role_from_port(v): diff --git a/ice_validator/tests/test_port_resource_ids.py b/ice_validator/tests/test_port_resource_ids.py index 78a6751..f7bf1e8 100644 --- a/ice_validator/tests/test_port_resource_ids.py +++ b/ice_validator/tests/test_port_resource_ids.py @@ -43,7 +43,8 @@ import pytest import yaml from .utils.vm_types import get_vm_type_for_nova_server from .utils.network_roles import get_network_role_from_port,\ - get_network_type_from_port + get_network_type_from_port,\ + property_uses_get_resource def test_port_resource_ids(heat_template): @@ -111,6 +112,8 @@ def test_port_resource_ids(heat_template): has_vm_type = vm_type+"_" in port_id if port_resource: + if property_uses_get_resource(v, "network"): + continue network_role = get_network_role_from_port(port_resource) if not network_role: continue diff --git a/ice_validator/tests/test_reserve_port_fixed_ips_format.py b/ice_validator/tests/test_reserve_port_fixed_ips_format.py new file mode 100644 index 0000000..42d9a61 --- /dev/null +++ b/ice_validator/tests/test_reserve_port_fixed_ips_format.py @@ -0,0 +1,118 @@ +# -*- 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============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# + +import pytest +import yaml +from .utils.network_roles import get_network_role_from_port +from .utils.ports import is_reserved_port +import re + + +def test_reserve_port_fixed_ips_format(heat_template): + ''' + Make sure all fixed_ips properties for a reserved port + follow the allowed naming conventions + ''' + allowed_formats = [ + ["fixed_ips", "string", "internal", + re.compile(r'(.+?)_int_(.+?)_floating_v6_ip')], + ["fixed_ips", "string", "internal", + re.compile(r'(.+?)_int_(.+?)_floating_ip')], + ["fixed_ips", "string", "external", + re.compile(r'(.+?)_floating_v6_ip')], + ["fixed_ips", "string", "external", + re.compile(r'(.+?)_floating_ip')], + ] + + with open(heat_template) 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") + + # check both valid and invalid patterns to catch edge cases + invalid_fixed_ips = [] + + for k1, v1 in yml["resources"].items(): + if not isinstance(v1, dict): + continue + if "properties" not in v1: + continue + if v1.get("type") != "OS::Neutron::Port": + continue + if not is_reserved_port(k1): + continue + + network_role = get_network_role_from_port(v1) + + for k2, v2 in v1["properties"].items(): + if k2 != "fixed_ips": + continue + for v3 in v2: + if "ip_address" not in v3: + continue + if "get_param" not in v3["ip_address"]: + continue + + valid_fixed_ip = False + for v4 in allowed_formats: + param = v3["ip_address"]["get_param"] + if isinstance(param, list): + param = param[0] + + # check if pattern matches + m = v4[3].match(param) + if m: + if v4[2] == "internal" and\ + len(m.groups()) > 1 and\ + m.group(2) == network_role: + valid_fixed_ip = True + break + elif v4[2] == "external" and\ + len(m.groups()) > 0 and\ + m.group(1).endswith("_" + network_role): + valid_fixed_ip = True + break + + if not valid_fixed_ip: + invalid_fixed_ips.append(param) + + assert not set(invalid_fixed_ips) diff --git a/ice_validator/tests/test_reserve_port_fixed_ips_has_base_outputs.py b/ice_validator/tests/test_reserve_port_fixed_ips_has_base_outputs.py new file mode 100644 index 0000000..7245ba8 --- /dev/null +++ b/ice_validator/tests/test_reserve_port_fixed_ips_has_base_outputs.py @@ -0,0 +1,114 @@ +# -*- 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============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# + +import pytest +from os import path, sep +import yaml +from .utils.ports import is_reserved_port + + +def test_reserve_port_fixed_ips_has_base_outputs(heat_template): + ''' + Make sure all fixed ips specified in reserved ports are + also exported as outputs in the same base template + ''' + basename = path.splitext(heat_template)[0].rsplit(sep, 1)[1] + if not (basename.endswith("_base") or + basename.startswith("base_") or + basename.find("_base_") > 0): + pytest.skip("Skipping as it is not a base template") + + # parse the yml + with open(heat_template) as fh: + yml = yaml.load(fh) + + # get the outputs + try: + outputs = yml["outputs"] + except (TypeError, KeyError): + outputs = {} + + # skip if resources are not defined + if "resources" not in yml: + pytest.skip("No resources specified in the heat template") + + invalid_fixed_ips = [] + for k1, v1 in yml["resources"].items(): + if not isinstance(v1, dict): + continue + if "properties" not in v1: + continue + if v1.get("type") != "OS::Neutron::Port": + continue + if not is_reserved_port(k1): + continue + + for k2, v2 in v1["properties"].items(): + if k2 != "fixed_ips": + continue + for v3 in v2: + if "ip_address" not in v3: + continue + if "get_param" not in v3["ip_address"]: + continue + + param = v3["ip_address"]["get_param"] + + # construct the expected output param + if 'v6' in param: + output_param = param.replace('floating_v6_ip', 'v6_vip') + else: + output_param = param.replace('floating_ip', 'vip') + + # check the output is constructed correctly + try: + output_vip = outputs[output_param] + if not output_vip: + invalid_fixed_ips.append(param) + else: + # make sure the value is set properly using the + # original param value + output_value_param = output_vip["value"]["get_param"] + if output_value_param != param: + invalid_fixed_ips.append(param) + except (TypeError, KeyError): + invalid_fixed_ips.append(param) + + assert not set(invalid_fixed_ips) diff --git a/ice_validator/tests/test_reserve_port_only_in_base_template.py b/ice_validator/tests/test_reserve_port_only_in_base_template.py new file mode 100644 index 0000000..52cbec2 --- /dev/null +++ b/ice_validator/tests/test_reserve_port_only_in_base_template.py @@ -0,0 +1,78 @@ +# -*- 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============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# + +import pytest +from os import path, sep +import yaml +from .utils.ports import is_reserved_port + + +def test_reserve_port_only_in_base_template(heat_template): + ''' + Make sure reserved ports are only specified in the base template + ''' + basename = path.splitext(heat_template)[0].rsplit(sep, 1)[1] + if (basename.endswith("_base") or + basename.startswith("base_") or + basename.find("_base_") > 0): + pytest.skip("A base template may or may not have reserved ports") + + # parse the yaml + with open(heat_template) 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") + + has_reserved_ports = False + for k1, v1 in yml["resources"].items(): + if not isinstance(v1, dict): + continue + if "properties" not in v1: + continue + if v1.get("type") != "OS::Neutron::Port": + continue + if not is_reserved_port(k1): + continue + + has_reserved_ports = True + + assert not has_reserved_ports diff --git a/ice_validator/tests/test_subnet_format.py b/ice_validator/tests/test_subnet_format.py index f1bab44..e5f28cc 100644 --- a/ice_validator/tests/test_subnet_format.py +++ b/ice_validator/tests/test_subnet_format.py @@ -40,7 +40,8 @@ import pytest import yaml -from .utils.network_roles import get_network_role_from_port +from .utils.network_roles import get_network_role_from_port,\ + property_uses_get_resource import re @@ -75,6 +76,8 @@ def test_subnet_format(heat_template): continue if v1.get("type") != "OS::Neutron::Port": continue + if property_uses_get_resource(v1, "network"): + continue network_role = get_network_role_from_port(v1) # get the network param to define the network_type diff --git a/ice_validator/tests/test_unique_resources_across_all_templates.py b/ice_validator/tests/test_unique_resources_across_all_templates.py index 13b4121..7682782 100644 --- a/ice_validator/tests/test_unique_resources_across_all_templates.py +++ b/ice_validator/tests/test_unique_resources_across_all_templates.py @@ -39,6 +39,7 @@ # import yaml +import collections def test_unique_resources_across_all_yaml_files(yaml_files): @@ -54,4 +55,8 @@ def test_unique_resources_across_all_yaml_files(yaml_files): continue resources_ids.extend(yml['resources'].keys()) - assert len(resources_ids) == len(set(resources_ids)) + dup_ids = [item + for item, count in collections.Counter(resources_ids).items() + if count > 1] + + assert not dup_ids diff --git a/ice_validator/tests/utils/nested_iterables.py b/ice_validator/tests/utils/nested_iterables.py index 19290c0..eea6e19 100644 --- a/ice_validator/tests/utils/nested_iterables.py +++ b/ice_validator/tests/utils/nested_iterables.py @@ -73,11 +73,13 @@ def find_all_get_param_in_yml(yml): params = [] for k, v in yml.items(): if k == 'get_param' and v not in os_pseudo_parameters: + if isinstance(v, list) and not isinstance(v[0], dict): + params.append(v[0]) + elif not isinstance(v, dict) and isinstance(v, str): + params.append(v) for item in (v if isinstance(v, list) else [v]): if isinstance(item, dict): params.extend(find_all_get_param_in_yml(item)) - elif isinstance(item, str): - params.append(item) continue elif k == 'list_join': for item in (v if isinstance(v, list) else [v]): diff --git a/ice_validator/tests/utils/network_roles.py b/ice_validator/tests/utils/network_roles.py index 5a551ab..fbe6dce 100644 --- a/ice_validator/tests/utils/network_roles.py +++ b/ice_validator/tests/utils/network_roles.py @@ -161,3 +161,20 @@ def is_valid_ipv6_address(ip_address): except (OSError, socket.error): return False return True + + +def property_uses_get_resource(resource, property_name): + ''' + returns true if a port's network property + uses the get_resource function + ''' + if not isinstance(resource, dict): + return False + if 'properties' not in resource: + return False + for k1, v1 in resource["properties"].items(): + if k1 != property_name: + continue + if "get_resource" in v1: + return True + return False diff --git a/ice_validator/tests/utils/ports.py b/ice_validator/tests/utils/ports.py index 51e920a..4d0b4ca 100644 --- a/ice_validator/tests/utils/ports.py +++ b/ice_validator/tests/utils/ports.py @@ -177,3 +177,21 @@ def get_invalid_ip_addresses(resources, port_property): invalid_ip_addresses.append(ip_address) return invalid_ip_addresses + + +def is_reserved_port(port_id): + ''' + Checks to see if the resource id for a port follows + the reserve port concept + ''' + formats = [ + ["port_id", + re.compile(r'reserve_port_(.+?)_floating_ip_\d+')], + ["port_id", + re.compile(r'reserve_port_(.+?)_floating_v6_ip_\d+')], + ] + for f in formats: + m = f[1].match(port_id.lower()) + if m and m.group(1): + return True + return False |