aboutsummaryrefslogtreecommitdiffstats
path: root/ice_validator/tests
diff options
context:
space:
mode:
authorstark, steven <steven.stark@att.com>2018-12-17 12:43:02 -0800
committerstark, steven <steven.stark@att.com>2018-12-17 13:04:00 -0800
commit1f4df7c7ad27b23773ad9cdbe4db1632ce388cf1 (patch)
tree8092104f8be23051ff81c9f71ee34116df4d33ba /ice_validator/tests
parentca9085f0f77d442d3741a8c754e65cc45b6a318d (diff)
[VVP] updating validation scripts in dublin
- adding backlog of new validation scripts for dublin - updating existing tests - removing outdated tests Issue-ID: VVP-123 Change-Id: Ib8260889ac957c1dd28d8ede450fc8edc6fb0ec0 Signed-off-by: stark, steven <steven.stark@att.com>
Diffstat (limited to 'ice_validator/tests')
-rw-r--r--ice_validator/tests/cached_yaml.py5
-rw-r--r--ice_validator/tests/conftest.py2
-rw-r--r--ice_validator/tests/fixtures/test_all_parameters_used_in_template/fail/fail.yaml15
-rw-r--r--ice_validator/tests/fixtures/test_all_parameters_used_in_template/pass/pass.yaml19
-rw-r--r--ice_validator/tests/fixtures/test_availability_zone_params_start_at_0/fail/fail.yaml55
-rw-r--r--ice_validator/tests/fixtures/test_availability_zone_params_start_at_0/fail/nested.yaml46
-rw-r--r--ice_validator/tests/fixtures/test_availability_zone_params_start_at_0/pass/nested.yaml46
-rw-r--r--ice_validator/tests/fixtures/test_availability_zone_params_start_at_0/pass/pass.yaml55
-rw-r--r--ice_validator/tests/fixtures/test_contrail_fqdn/fail/fail0.yaml51
-rw-r--r--ice_validator/tests/fixtures/test_contrail_fqdn/fail/fail1.yaml54
-rw-r--r--ice_validator/tests/fixtures/test_contrail_fqdn/fail/fail2.yaml56
-rw-r--r--ice_validator/tests/fixtures/test_contrail_fqdn/pass/pass0.yaml56
-rw-r--r--ice_validator/tests/fixtures/test_contrail_instance_ip_resource_id/fail/fail0.yaml75
-rw-r--r--ice_validator/tests/fixtures/test_contrail_instance_ip_resource_id/pass/pass0.yaml78
-rw-r--r--ice_validator/tests/fixtures/test_contrail_irt_routes/fail/fail0.yaml55
-rw-r--r--ice_validator/tests/fixtures/test_contrail_irt_routes/pass/pass0.yaml55
-rw-r--r--ice_validator/tests/fixtures/test_contrail_resource_id/fail/fail0.yaml70
-rw-r--r--ice_validator/tests/fixtures/test_contrail_resource_id/pass/pass0.yaml70
-rw-r--r--ice_validator/tests/fixtures/test_contrail_vmi_resource_id/fail/fail0.yaml75
-rw-r--r--ice_validator/tests/fixtures/test_contrail_vmi_resource_id/pass/pass0.yaml75
-rw-r--r--ice_validator/tests/fixtures/test_contrail_vn_resource_id/fail/fail0.yaml56
-rw-r--r--ice_validator/tests/fixtures/test_contrail_vn_resource_id/pass/pass0.yaml50
-rw-r--r--ice_validator/tests/fixtures/test_env_parameters_defined_in_template/fail/fail.env3
-rw-r--r--ice_validator/tests/fixtures/test_env_parameters_defined_in_template/fail/fail.yaml4
-rw-r--r--ice_validator/tests/fixtures/test_env_parameters_defined_in_template/pass/pass.env2
-rw-r--r--ice_validator/tests/fixtures/test_env_parameters_defined_in_template/pass/pass.yaml4
-rw-r--r--ice_validator/tests/fixtures/test_environment_file_parameters/fail/fail.env5
-rw-r--r--ice_validator/tests/fixtures/test_environment_file_parameters/fail/fail.yaml26
-rw-r--r--ice_validator/tests/fixtures/test_filename_is_vmtype_dot_yaml/fail/testvm.yaml51
-rw-r--r--ice_validator/tests/fixtures/test_filename_is_vmtype_dot_yaml/pass/test_vm.yaml51
-rw-r--r--ice_validator/tests/fixtures/test_files_in_flat_dir/fail/nested/test2.yaml36
-rw-r--r--ice_validator/tests/fixtures/test_files_in_flat_dir/fail/test.yaml36
-rw-r--r--ice_validator/tests/fixtures/test_files_in_flat_dir/pass/test.yaml36
-rw-r--r--ice_validator/tests/fixtures/test_files_in_flat_dir/pass/test2.yaml36
-rw-r--r--ice_validator/tests/fixtures/test_forbidden_resources/fail/fail1.yaml49
-rw-r--r--ice_validator/tests/fixtures/test_forbidden_resources/pass/pass0.yaml49
-rw-r--r--ice_validator/tests/fixtures/test_get_attr_usage/fail/fail_get_attr.yaml60
-rw-r--r--ice_validator/tests/fixtures/test_get_attr_usage/fail/nested.yaml54
-rw-r--r--ice_validator/tests/fixtures/test_get_attr_usage/pass/nested.yaml54
-rw-r--r--ice_validator/tests/fixtures/test_get_attr_usage/pass/pass_get_attr.yaml60
-rw-r--r--ice_validator/tests/fixtures/test_get_file_only_reference_local_files/pass/new.txt0
-rw-r--r--ice_validator/tests/fixtures/test_get_file_only_reference_local_files/pass/user_data.sh0
-rw-r--r--ice_validator/tests/fixtures/test_initial_configuration/pass/good_yaml_eg.yaml48
-rw-r--r--ice_validator/tests/fixtures/test_ip_parameters_start_at_0/fail/fail.yaml (renamed from ice_validator/tests/test_unique_resources_across_template.py)45
-rw-r--r--ice_validator/tests/fixtures/test_ip_parameters_start_at_0/fail/fail2.yaml55
-rw-r--r--ice_validator/tests/fixtures/test_ip_parameters_start_at_0/fail/nested.yaml46
-rw-r--r--ice_validator/tests/fixtures/test_ip_parameters_start_at_0/pass/nested.yaml46
-rw-r--r--ice_validator/tests/fixtures/test_ip_parameters_start_at_0/pass/pass.yaml (renamed from ice_validator/tests/test_volume_format_outputs.py)46
-rw-r--r--ice_validator/tests/fixtures/test_ip_parameters_start_at_0/pass/pass2.yaml55
-rw-r--r--ice_validator/tests/fixtures/test_nested_parameter_args/fail/fail0.yaml59
-rw-r--r--ice_validator/tests/fixtures/test_nested_parameter_args/pass/pass0.yaml59
-rw-r--r--ice_validator/tests/fixtures/test_nested_parameters/fail/heat_template.yaml25
-rw-r--r--ice_validator/tests/fixtures/test_nested_template_parameters/fail/bad-heat_template.yaml59
-rw-r--r--ice_validator/tests/fixtures/test_nested_template_parameters/pass/heat_template.yaml62
-rw-r--r--ice_validator/tests/fixtures/test_nested_template_parameters/pass/nested_template_1.yaml (renamed from ice_validator/tests/fixtures/test_nested_parameters/fail/nested_template_1.yaml)8
-rw-r--r--ice_validator/tests/fixtures/test_nesting_level/fail/bad-level0.yaml (renamed from ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/fail/invalid_base_naming_for_fixed_ips.yaml)36
-rw-r--r--ice_validator/tests/fixtures/test_nesting_level/fail/bad-level1.yaml (renamed from ice_validator/tests/fixtures/test_volume_format_outputs/fail/use_get_param_volume.yml)34
-rw-r--r--ice_validator/tests/fixtures/test_nesting_level/fail/bad-level2.yaml (renamed from ice_validator/tests/fixtures/test_volume_format_outputs/pass/valid_template_volume.yml)41
-rw-r--r--ice_validator/tests/fixtures/test_nesting_level/fail/bad-level3.yaml60
-rw-r--r--ice_validator/tests/fixtures/test_nesting_level/pass/level0.yaml51
-rw-r--r--ice_validator/tests/fixtures/test_nesting_level/pass/level1.yaml63
-rw-r--r--ice_validator/tests/fixtures/test_nesting_level/pass/level2.yaml (renamed from ice_validator/tests/fixtures/test_volume_format_outputs/fail/no_value_volume.yaml)42
-rw-r--r--ice_validator/tests/fixtures/test_nesting_level/pass/level3.yaml60
-rw-r--r--ice_validator/tests/fixtures/test_nesting_nova_server/fail/bad-17528_0.yaml50
-rw-r--r--ice_validator/tests/fixtures/test_nesting_nova_server/fail/bad-17528_1.yaml65
-rw-r--r--ice_validator/tests/fixtures/test_nesting_nova_server/fail/bad-17528_2.yaml60
-rw-r--r--ice_validator/tests/fixtures/test_nesting_nova_server/pass/17528_0.yaml50
-rw-r--r--ice_validator/tests/fixtures/test_nesting_nova_server/pass/17528_1.yaml64
-rw-r--r--ice_validator/tests/fixtures/test_nesting_nova_server/pass/17528_2.yaml60
-rw-r--r--ice_validator/tests/fixtures/test_nesting_nova_server/pass/17528_3.yaml63
-rw-r--r--ice_validator/tests/fixtures/test_network_format/fail/invalid_naming_used_for_network.yaml14
-rw-r--r--ice_validator/tests/fixtures/test_network_format/pass/valid_heat_template.yaml8
-rw-r--r--ice_validator/tests/fixtures/test_neutron_net_resource_id/fail/fail.yaml53
-rw-r--r--ice_validator/tests/fixtures/test_neutron_net_resource_id/pass/pass.yaml53
-rw-r--r--ice_validator/tests/fixtures/test_neutron_port_addresses/fail/fail0.yaml86
-rw-r--r--ice_validator/tests/fixtures/test_neutron_port_addresses/fail/fail1.yaml86
-rw-r--r--ice_validator/tests/fixtures/test_neutron_port_addresses/fail/fail2.yaml86
-rw-r--r--ice_validator/tests/fixtures/test_neutron_port_addresses/fail/fail3.yaml86
-rw-r--r--ice_validator/tests/fixtures/test_neutron_port_addresses/fail/other0.yaml53
-rw-r--r--ice_validator/tests/fixtures/test_neutron_port_addresses/pass/other0.yaml55
-rw-r--r--ice_validator/tests/fixtures/test_neutron_port_addresses/pass/pass0.yaml86
-rw-r--r--ice_validator/tests/fixtures/test_neutron_port_fixed_ips/fail/fail0.yaml97
-rw-r--r--ice_validator/tests/fixtures/test_neutron_port_fixed_ips/fail/fail1.yaml97
-rw-r--r--ice_validator/tests/fixtures/test_neutron_port_fixed_ips/pass/pass0.yaml95
-rw-r--r--ice_validator/tests/fixtures/test_neutron_port_fixed_ips/pass/pass0_base.yaml49
-rw-r--r--ice_validator/tests/fixtures/test_neutron_port_internal_network/fail/fail0.yaml100
-rw-r--r--ice_validator/tests/fixtures/test_neutron_port_internal_network/fail/fail0_base.yaml63
-rw-r--r--ice_validator/tests/fixtures/test_neutron_port_internal_network/pass/pass0.yaml100
-rw-r--r--ice_validator/tests/fixtures/test_neutron_port_internal_network/pass/pass0_base.yaml63
-rw-r--r--ice_validator/tests/fixtures/test_neutron_port_network_parameter/fail/fail.yaml16
-rw-r--r--ice_validator/tests/fixtures/test_neutron_port_network_parameter/pass/pass.yaml16
-rw-r--r--ice_validator/tests/fixtures/test_no_http_resources/fail/fail.yaml94
-rw-r--r--ice_validator/tests/fixtures/test_no_http_resources/pass/valid_template.yaml (renamed from ice_validator/tests/fixtures/test_reserve_port_fixed_ips_format/pass/valid_base_heat_template.yaml)73
-rw-r--r--ice_validator/tests/fixtures/test_no_image_files/fail/image.ami0
-rw-r--r--ice_validator/tests/fixtures/test_no_image_files/fail/image2.ISO0
-rw-r--r--ice_validator/tests/fixtures/test_no_image_files/fail/pass.sh1
-rw-r--r--ice_validator/tests/fixtures/test_no_image_files/fail/pass.yaml16
-rw-r--r--ice_validator/tests/fixtures/test_no_image_files/fail/settings1
-rw-r--r--ice_validator/tests/fixtures/test_no_image_files/pass/pass.sh1
-rw-r--r--ice_validator/tests/fixtures/test_no_image_files/pass/pass.yaml16
-rw-r--r--ice_validator/tests/fixtures/test_no_image_files/pass/settings1
-rw-r--r--ice_validator/tests/fixtures/test_non_server_name/fail/fail0.yaml126
-rw-r--r--ice_validator/tests/fixtures/test_non_server_name/fail/fail1.yaml129
-rw-r--r--ice_validator/tests/fixtures/test_non_server_name/fail/fail2.yaml133
-rw-r--r--ice_validator/tests/fixtures/test_non_server_name/fail/fail3.yaml135
-rw-r--r--ice_validator/tests/fixtures/test_non_server_name/pass/pass0.yaml135
-rw-r--r--ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/fail/fail.yaml56
-rw-r--r--ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/fail/fail2.yaml55
-rw-r--r--ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/fail/nested.yaml46
-rw-r--r--ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/pass/nested.yaml46
-rw-r--r--ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/pass/pass.yaml51
-rw-r--r--ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/pass/pass2.yaml54
-rw-r--r--ice_validator/tests/fixtures/test_nova_server_resource_id/fail/fail.yaml56
-rw-r--r--ice_validator/tests/fixtures/test_nova_server_resource_id/pass/pass.yaml56
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet/fail/fail0.yaml55
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet/pass/pass.yaml (renamed from ice_validator/tests/fixtures/test_nova_servers_index/fail/fail0.yaml)28
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail0.yaml69
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail1.yaml69
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail2.yaml69
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail3.yaml69
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail4.yaml69
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail5.yaml69
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail6.yaml64
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/pass/pass0.yaml69
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/pass/pass1.yaml66
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail0.yaml93
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail0c.yaml91
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail1.yaml93
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail1c.yaml91
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail2.yaml93
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail2c.yaml91
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail3.yaml93
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail4.yaml93
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail5.yaml93
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail6.yaml93
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail8.yaml93
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail9.yaml93
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_host/pass/pass0.yaml93
-rw-r--r--ice_validator/tests/fixtures/test_nova_servers_valet_host/pass/pass1.yaml91
-rw-r--r--ice_validator/tests/fixtures/test_port_connected_to_multiple_servers/fail/base_mod.yaml21
-rw-r--r--ice_validator/tests/fixtures/test_port_connected_to_multiple_servers/pass/base_mod.yaml21
-rw-r--r--ice_validator/tests/fixtures/test_port_resource_ids/pass/valid_template.yaml9
-rw-r--r--ice_validator/tests/fixtures/test_required_parameters_no_constraints/fail/heat_template_required_parameters_with_constraints.yaml40
-rw-r--r--ice_validator/tests/fixtures/test_reserve_port_fixed_ips_has_base_outputs/fail/invalid_base_heat_template_1.yaml90
-rw-r--r--ice_validator/tests/fixtures/test_reserve_port_fixed_ips_has_base_outputs/fail/invalid_base_heat_template_2.yaml95
-rw-r--r--ice_validator/tests/fixtures/test_reserve_port_fixed_ips_has_base_outputs/pass/valid_base_heat_template_1.yaml94
-rw-r--r--ice_validator/tests/fixtures/test_reserve_port_fixed_ips_has_base_outputs/pass/valid_base_heat_template_2.yaml76
-rw-r--r--ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/pass/valid_base_heat_template_1.yaml69
-rw-r--r--ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/pass/valid_base_heat_template_2.yaml69
-rw-r--r--ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/pass/valid_base_heat_template_3.yaml69
-rw-r--r--ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/pass/valid_module_heat_template.yaml69
-rw-r--r--ice_validator/tests/fixtures/test_resource_indices/fail/fail0.yaml84
-rw-r--r--ice_validator/tests/fixtures/test_resource_indices/fail/nested.yaml55
-rw-r--r--ice_validator/tests/fixtures/test_resource_indices/pass/nested.yaml (renamed from ice_validator/tests/fixtures/test_nova_servers_index/fail/fail1.yaml)18
-rw-r--r--ice_validator/tests/fixtures/test_resource_indices/pass/pass0.yaml (renamed from ice_validator/tests/fixtures/test_nova_servers_index/pass/pass0.yaml)13
-rw-r--r--ice_validator/tests/fixtures/test_server_parameters/fail/fail.yaml72
-rw-r--r--ice_validator/tests/fixtures/test_server_parameters/pass/pass.yaml72
-rw-r--r--ice_validator/tests/fixtures/test_servers_metadata_use_get_param/fail/not_using_get_param.yaml16
-rw-r--r--ice_validator/tests/fixtures/test_software_config_resource_id/fail/fail.yaml56
-rw-r--r--ice_validator/tests/fixtures/test_software_config_resource_id/pass/pass.yaml56
-rw-r--r--ice_validator/tests/fixtures/test_subnet_format_use_get_param_or_get_resource/fail/get_param_not_used_for_subnet.yaml86
-rw-r--r--ice_validator/tests/fixtures/test_subnet_format_use_get_param_or_get_resource/fail/get_resource_used_for_external_network.yaml86
-rw-r--r--ice_validator/tests/fixtures/test_subnet_format_use_get_param_or_get_resource/pass/valid_heat_template.yaml86
-rw-r--r--ice_validator/tests/fixtures/test_unique_name_resources/fail/heat_template_1.yaml108
-rw-r--r--ice_validator/tests/fixtures/test_unique_name_resources/fail/heat_template_2_identical_to_heat_template_2.yaml108
-rw-r--r--ice_validator/tests/fixtures/test_unique_name_resources/pass/unique_resource_template_1.yml108
-rw-r--r--ice_validator/tests/fixtures/test_unique_name_resources/pass/unique_resource_template_2.yml108
-rw-r--r--ice_validator/tests/fixtures/test_vm_type_case/fail/fail.yaml70
-rw-r--r--ice_validator/tests/fixtures/test_vm_type_case/pass/pass.yaml70
-rw-r--r--ice_validator/tests/fixtures/test_volume_module_naming/fail/module_volumes.yaml52
-rw-r--r--ice_validator/tests/fixtures/test_volume_module_naming/fail/nested_volume1.yaml40
-rw-r--r--ice_validator/tests/fixtures/test_volume_module_naming/fail/nested_volume2.yaml40
-rw-r--r--ice_validator/tests/fixtures/test_volume_module_naming/pass/module2_base.yaml55
-rw-r--r--ice_validator/tests/fixtures/test_volume_module_naming/pass/module_volume.yaml52
-rw-r--r--ice_validator/tests/fixtures/test_volume_module_naming/pass/nested_volume1.yaml40
-rw-r--r--ice_validator/tests/fixtures/test_volume_module_naming/pass/nested_volume2.yaml40
-rw-r--r--ice_validator/tests/helpers.py100
-rw-r--r--ice_validator/tests/parametrizers.py472
-rw-r--r--ice_validator/tests/report.html.jinja22
-rw-r--r--ice_validator/tests/structures.py612
-rw-r--r--ice_validator/tests/test_all_parameters_used_in_template.py (renamed from ice_validator/tests/test_heat_numeric_parameters.py)60
-rw-r--r--ice_validator/tests/test_allowed_address_pairs_include_vm_type_network_role.py27
-rw-r--r--ice_validator/tests/test_availability_zone.py21
-rw-r--r--ice_validator/tests/test_availability_zone_params_start_at_0.py50
-rw-r--r--ice_validator/tests/test_base_template_names.py30
-rw-r--r--ice_validator/tests/test_cloud_config_resource_id.py31
-rw-r--r--ice_validator/tests/test_contrail_fqdn.py138
-rw-r--r--ice_validator/tests/test_contrail_instance_ip_resource_id.py141
-rw-r--r--ice_validator/tests/test_contrail_irt_routes.py167
-rw-r--r--ice_validator/tests/test_contrail_resource_id.py150
-rw-r--r--ice_validator/tests/test_contrail_vmi_resource_id.py132
-rw-r--r--ice_validator/tests/test_contrail_vn_resource_id.py82
-rw-r--r--ice_validator/tests/test_env_and_yaml_same_name.py25
-rw-r--r--ice_validator/tests/test_env_no_resource_registry.py20
-rw-r--r--ice_validator/tests/test_env_parameters_defined_in_template.py (renamed from ice_validator/tests/test_volume_templates_outputs_resources.py)63
-rw-r--r--ice_validator/tests/test_environment_file_parameters.py550
-rw-r--r--ice_validator/tests/test_environment_file_structure.py10
-rw-r--r--ice_validator/tests/test_filename_is_vmtype_dot_yaml.py75
-rw-r--r--ice_validator/tests/test_files_in_flat_dir.py50
-rw-r--r--ice_validator/tests/test_fixed_ips_include_vm_type_network_role.py35
-rw-r--r--ice_validator/tests/test_forbidden_resources.py (renamed from ice_validator/tests/fixtures/test_reserve_port_fixed_ips_format/fail/invalid_base_naming_for_fixed_ips.yaml)66
-rw-r--r--ice_validator/tests/test_get_attr_usage.py86
-rw-r--r--ice_validator/tests/test_get_file_only_reference_local_files.py59
-rw-r--r--ice_validator/tests/test_heat_pairs_provided.py50
-rw-r--r--ice_validator/tests/test_heat_parameter_section.py41
-rw-r--r--ice_validator/tests/test_heat_template_parameters_contain_required_fields.py29
-rw-r--r--ice_validator/tests/test_heat_template_structure.py87
-rw-r--r--ice_validator/tests/test_initial_configuration.py158
-rw-r--r--ice_validator/tests/test_ip_parameters_start_at_0.py50
-rw-r--r--ice_validator/tests/test_multipart_mime_resource_id.py31
-rw-r--r--ice_validator/tests/test_nested_parameter_args.py112
-rw-r--r--ice_validator/tests/test_nested_parameters.py113
-rw-r--r--ice_validator/tests/test_nested_template_parameters.py120
-rw-r--r--ice_validator/tests/test_nesting_level.py64
-rw-r--r--ice_validator/tests/test_nesting_nova_server.py99
-rw-r--r--ice_validator/tests/test_network_format.py112
-rw-r--r--ice_validator/tests/test_network_format_use_get_param_or_get_resource.py45
-rw-r--r--ice_validator/tests/test_neutron_net_resource_id.py73
-rw-r--r--ice_validator/tests/test_neutron_port_addresses.py242
-rw-r--r--ice_validator/tests/test_neutron_port_fixed_ips.py325
-rw-r--r--ice_validator/tests/test_neutron_port_internal_network.py241
-rw-r--r--ice_validator/tests/test_neutron_port_network_parameter.py (renamed from ice_validator/tests/test_unique_name_str_replace_use_params_in_tmpl.py)63
-rw-r--r--ice_validator/tests/test_no_http_resources.py (renamed from ice_validator/tests/test_required_parameters_specified_in_heat_templates.py)49
-rw-r--r--ice_validator/tests/test_no_image_files.py69
-rw-r--r--ice_validator/tests/test_no_unused_parameters_between_env_and_templates.py44
-rw-r--r--ice_validator/tests/test_non_server_name.py143
-rw-r--r--ice_validator/tests/test_nova_server_name_parameters_start_at_0.py52
-rw-r--r--ice_validator/tests/test_nova_server_resource_id.py78
-rw-r--r--ice_validator/tests/test_nova_servergroup_policies.py32
-rw-r--r--ice_validator/tests/test_nova_servers_environment_context.py56
-rw-r--r--ice_validator/tests/test_nova_servers_index.py120
-rw-r--r--ice_validator/tests/test_nova_servers_resource_ids.py34
-rw-r--r--ice_validator/tests/test_nova_servers_vm_types.py94
-rw-r--r--ice_validator/tests/test_nova_servers_vm_types_use_get_param.py22
-rw-r--r--ice_validator/tests/test_nova_servers_workload_context.py55
-rw-r--r--ice_validator/tests/test_port_connected_to_multiple_servers.py71
-rw-r--r--ice_validator/tests/test_port_resource_ids.py107
-rw-r--r--ice_validator/tests/test_required_parameters_no_constraints.py63
-rw-r--r--ice_validator/tests/test_required_parameters_specified_in_env_files.py81
-rw-r--r--ice_validator/tests/test_resource_ids_alphanumeric_only.py22
-rw-r--r--ice_validator/tests/test_resource_indices.py84
-rw-r--r--ice_validator/tests/test_server_parameters.py178
-rw-r--r--ice_validator/tests/test_servers_have_optional_metadata.py93
-rw-r--r--ice_validator/tests/test_servers_have_required_metadata.py30
-rw-r--r--ice_validator/tests/test_servers_metadata_use_get_param.py51
-rw-r--r--ice_validator/tests/test_software_config_resource_id.py (renamed from ice_validator/tests/fixtures/test_nova_servers_index/fail/fail2.yaml)71
-rw-r--r--ice_validator/tests/test_subnet_format.py127
-rw-r--r--ice_validator/tests/test_subnet_format_use_get_param_or_get_resource.py99
-rw-r--r--ice_validator/tests/test_unique_name_resources.py110
-rw-r--r--ice_validator/tests/test_unique_name_str_replace_use_req_params.py35
-rw-r--r--ice_validator/tests/test_unique_resources_across_all_templates.py28
-rw-r--r--ice_validator/tests/test_vm_type_case.py129
-rw-r--r--ice_validator/tests/test_vm_type_resource_id.py25
-rw-r--r--ice_validator/tests/test_vm_type_syntax.py22
-rw-r--r--ice_validator/tests/test_volume_module_naming.py79
-rw-r--r--ice_validator/tests/test_volume_outputs_consumed.py58
-rw-r--r--ice_validator/tests/test_volume_resource_ids.py58
-rw-r--r--ice_validator/tests/test_volume_templates.py68
-rw-r--r--ice_validator/tests/test_volume_templates_outputs.py45
-rw-r--r--ice_validator/tests/utils/nested_dict.py30
-rw-r--r--ice_validator/tests/utils/nested_files.py239
-rw-r--r--ice_validator/tests/utils/nested_iterables.py65
-rw-r--r--ice_validator/tests/utils/network_roles.py189
-rw-r--r--ice_validator/tests/utils/ports.py201
-rw-r--r--ice_validator/tests/utils/vm_types.py33
-rw-r--r--ice_validator/tests/utils/volumes.py18
-rw-r--r--ice_validator/tests/utils/yaml_custom_utils.py7
267 files changed, 14928 insertions, 3838 deletions
diff --git a/ice_validator/tests/cached_yaml.py b/ice_validator/tests/cached_yaml.py
index 99fbd2c..1b977a6 100644
--- a/ice_validator/tests/cached_yaml.py
+++ b/ice_validator/tests/cached_yaml.py
@@ -46,10 +46,7 @@ constructor = yaml.constructor
def add_constructor(tag, constructor):
- yaml.add_constructor(
- tag,
- constructor,
- )
+ yaml.add_constructor(tag, constructor)
def load(fp):
diff --git a/ice_validator/tests/conftest.py b/ice_validator/tests/conftest.py
index 54015d0..95b1289 100644
--- a/ice_validator/tests/conftest.py
+++ b/ice_validator/tests/conftest.py
@@ -593,7 +593,7 @@ def hash_directory(path):
def load_current_requirements():
"""Loads dict of current requirements or empty dict if file doesn't exist"""
- url = 'https://onap.readthedocs.io/en/latest/_downloads/needs.json'
+ url = 'https://onap.readthedocs.io/en/latest/_downloads/789ac64d223325488fb3f120f959d985/needs.json'
try:
r = requests.get(url)
diff --git a/ice_validator/tests/fixtures/test_all_parameters_used_in_template/fail/fail.yaml b/ice_validator/tests/fixtures/test_all_parameters_used_in_template/fail/fail.yaml
new file mode 100644
index 0000000..6064c91
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_all_parameters_used_in_template/fail/fail.yaml
@@ -0,0 +1,15 @@
+heat_template_version: 2015-04-30
+
+description: fdsafsfsa
+
+parameters:
+
+ test_paramassd:
+ type: string
+
+resources:
+
+ test_resource:
+ type: test::resource
+ properties:
+ test_param: { get_param: test_param }
diff --git a/ice_validator/tests/fixtures/test_all_parameters_used_in_template/pass/pass.yaml b/ice_validator/tests/fixtures/test_all_parameters_used_in_template/pass/pass.yaml
new file mode 100644
index 0000000..ee9311f
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_all_parameters_used_in_template/pass/pass.yaml
@@ -0,0 +1,19 @@
+heat_template_version: 2015-04-30
+
+description: fdsafsfsa
+
+parameters:
+
+ test_param:
+ type: string
+
+ availability_zone_1:
+ type: string
+ description: najsf
+
+resources:
+
+ test_resource:
+ type: test::resource
+ properties:
+ test_param: { get_param: test_param }
diff --git a/ice_validator/tests/fixtures/test_availability_zone_params_start_at_0/fail/fail.yaml b/ice_validator/tests/fixtures/test_availability_zone_params_start_at_0/fail/fail.yaml
new file mode 100644
index 0000000..a6c00c3
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_availability_zone_params_start_at_0/fail/fail.yaml
@@ -0,0 +1,55 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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: Simple template to deploy a single compute instance
+
+parameters:
+ availability_zone_0:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
+
+ availability_zone_3:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
+
+resources:
+ vm1_server_0:
+ type: nested.yaml \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_availability_zone_params_start_at_0/fail/nested.yaml b/ice_validator/tests/fixtures/test_availability_zone_params_start_at_0/fail/nested.yaml
new file mode 100644
index 0000000..910cdf3
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_availability_zone_params_start_at_0/fail/nested.yaml
@@ -0,0 +1,46 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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: Simple template to deploy a single compute instance
+
+parameters:
+ availability_zone_9:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
diff --git a/ice_validator/tests/fixtures/test_availability_zone_params_start_at_0/pass/nested.yaml b/ice_validator/tests/fixtures/test_availability_zone_params_start_at_0/pass/nested.yaml
new file mode 100644
index 0000000..910cdf3
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_availability_zone_params_start_at_0/pass/nested.yaml
@@ -0,0 +1,46 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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: Simple template to deploy a single compute instance
+
+parameters:
+ availability_zone_9:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
diff --git a/ice_validator/tests/fixtures/test_availability_zone_params_start_at_0/pass/pass.yaml b/ice_validator/tests/fixtures/test_availability_zone_params_start_at_0/pass/pass.yaml
new file mode 100644
index 0000000..100376b
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_availability_zone_params_start_at_0/pass/pass.yaml
@@ -0,0 +1,55 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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: Simple template to deploy a single compute instance
+
+parameters:
+ availability_zone_0:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
+
+ availability_zone_1:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
+
+resources:
+ vm1_server_0:
+ type: nested.yaml \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_contrail_fqdn/fail/fail0.yaml b/ice_validator/tests/fixtures/test_contrail_fqdn/fail/fail0.yaml
new file mode 100644
index 0000000..6d410e9
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_contrail_fqdn/fail/fail0.yaml
@@ -0,0 +1,51 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+parameters:
+
+resources:
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::ContrailV2::VirtualMachineInterface
+ properties:
+ virtual_network_refs: []
+
diff --git a/ice_validator/tests/fixtures/test_contrail_fqdn/fail/fail1.yaml b/ice_validator/tests/fixtures/test_contrail_fqdn/fail/fail1.yaml
new file mode 100644
index 0000000..8e1aa10
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_contrail_fqdn/fail/fail1.yaml
@@ -0,0 +1,54 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+parameters:
+
+resources:
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::ContrailV2::VirtualMachineInterface
+ properties:
+ virtual_network_refs:
+ - get_param: huey
+ - get_param: dewey
+ - get_param: bialy_net_fqdn
+
diff --git a/ice_validator/tests/fixtures/test_contrail_fqdn/fail/fail2.yaml b/ice_validator/tests/fixtures/test_contrail_fqdn/fail/fail2.yaml
new file mode 100644
index 0000000..7254540
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_contrail_fqdn/fail/fail2.yaml
@@ -0,0 +1,56 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+parameters:
+ bialy_net_fqdn:
+ type: String
+
+resources:
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::ContrailV2::VirtualMachineInterface
+ properties:
+ virtual_network_refs:
+ - get_param: huey
+ - get_param: dewey
+ - get_param: bialy_net_fqdn
+
diff --git a/ice_validator/tests/fixtures/test_contrail_fqdn/pass/pass0.yaml b/ice_validator/tests/fixtures/test_contrail_fqdn/pass/pass0.yaml
new file mode 100644
index 0000000..311fb21
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_contrail_fqdn/pass/pass0.yaml
@@ -0,0 +1,56 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+parameters:
+ bialy_net_fqdn:
+ type: string
+
+resources:
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::ContrailV2::VirtualMachineInterface
+ properties:
+ virtual_network_refs:
+ - get_param: huey
+ - get_param: dewey
+ - get_param: bialy_net_fqdn
+
diff --git a/ice_validator/tests/fixtures/test_contrail_instance_ip_resource_id/fail/fail0.yaml b/ice_validator/tests/fixtures/test_contrail_instance_ip_resource_id/fail/fail0.yaml
new file mode 100644
index 0000000..0df9a0b
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_contrail_instance_ip_resource_id/fail/fail0.yaml
@@ -0,0 +1,75 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+
+resources:
+
+ vm_typeS_0_bialy_port_0:
+ type: OS::ContrailV2::InstanceIp
+ properties:
+ virtual_network_refs:
+ - get_param: huey_int_hooey
+
+ vm_typeX_0_bialy_port_0:
+ type: OS::ContrailV2::InstanceIp
+ properties:
+ virtual_network_refs:
+ - get_param: huey_int_hooey
+
+ vm_typeX_0_bialy_port_1:
+ type: OS::ContrailV2::InstanceIp
+ properties:
+ virtual_network_refs:
+ - get_param: x_subint_dewey
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::ContrailV2::InstanceIp
+ properties:
+ virtual_network_refs:
+ - get_resource: dewey
+
+ vm_typeX_0_bialy_port_3:
+ type: OS::ContrailV2::InstanceIp
+ properties:
+ virtual_network_refs:
+ - get_param: dewey
+
diff --git a/ice_validator/tests/fixtures/test_contrail_instance_ip_resource_id/pass/pass0.yaml b/ice_validator/tests/fixtures/test_contrail_instance_ip_resource_id/pass/pass0.yaml
new file mode 100644
index 0000000..b0f10b0
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_contrail_instance_ip_resource_id/pass/pass0.yaml
@@ -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.
+#
+# VERSION: '1.0.0'
+
+---
+#
+#(?P<vm_type>.+)_(?P<vm_type_index>\\d+)_int_(?P<network_role>.+)_vmi_(?P<vmi_index>\\d+)_v6_IP_(?P<index>\\d+)$
+#
+
+resources:
+
+ vm_typeS_0_int_bialy_vmi_0_IP_0:
+ type: OS::ContrailV2::InstanceIp
+ properties:
+ virtual_network_refs:
+ - get_param: huey_int_hooey
+
+ vm_typeS_0_int_bialy_vmi_0_v6_IP_0:
+ type: OS::ContrailV2::InstanceIp
+ properties:
+ virtual_network_refs:
+ - get_param: huey_int_hooey
+
+ vm_typeS_0_subint_bialy_vmi_0_IP_1:
+ type: OS::ContrailV2::InstanceIp
+ properties:
+ virtual_network_refs:
+ - get_param: x_subint_dewey
+
+ vm_typeS_0_int_bialy_vmi_0_IP_2:
+ type: OS::ContrailV2::InstanceIp
+ properties:
+ virtual_network_refs:
+ - get_resource: dewey
+
+ vm_typeS_0_bialy_vmi_0_IP_2:
+ type: OS::ContrailV2::InstanceIp
+ properties:
+ virtual_network_refs:
+ - get_param: dewey
+
diff --git a/ice_validator/tests/fixtures/test_contrail_irt_routes/fail/fail0.yaml b/ice_validator/tests/fixtures/test_contrail_irt_routes/fail/fail0.yaml
new file mode 100644
index 0000000..2145f3c
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_contrail_irt_routes/fail/fail0.yaml
@@ -0,0 +1,55 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+parameters:
+ bialy_net_fqdn:
+ type: string
+
+resources:
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::ContrailV2::InterfaceRouteTable
+ properties:
+ interface_route_table_routes:
+ interface_route_table_routes_route:
+ get_param: bialy_net_fqdn
+
diff --git a/ice_validator/tests/fixtures/test_contrail_irt_routes/pass/pass0.yaml b/ice_validator/tests/fixtures/test_contrail_irt_routes/pass/pass0.yaml
new file mode 100644
index 0000000..34569f5
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_contrail_irt_routes/pass/pass0.yaml
@@ -0,0 +1,55 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+parameters:
+ big_bialy_route_prefixes:
+ type: json
+
+resources:
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::ContrailV2::InterfaceRouteTable
+ properties:
+ interface_route_table_routes:
+ interface_route_table_routes_route:
+ get_param: big_bialy_route_prefixes
+
diff --git a/ice_validator/tests/fixtures/test_contrail_resource_id/fail/fail0.yaml b/ice_validator/tests/fixtures/test_contrail_resource_id/fail/fail0.yaml
new file mode 100644
index 0000000..2bee0c5
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_contrail_resource_id/fail/fail0.yaml
@@ -0,0 +1,70 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+resources:
+ vm_typeX_b_server_0:
+ type: OS::Nova::Server
+ properties:
+ availability_zone: { get_param: availability_zone_0 }
+ name: { get_param: vm_typex_name_0 }
+
+ vm_typeX_0_bialy_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network:
+ get_param: int_Bialy_net_name
+
+ vm_typeX_0_bialy_port_1:
+ type: OS::ContrailV2::InterfaceRouteTable
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::ContrailV2::NetworkIpam
+
+ vm_typeX_0_bialy_port_3:
+ type: OS::ContrailV2::PortTuple
+
+ vm_typeX_0_bialy_port_4:
+ type: OS::ContrailV2::ServiceHealthCheck
+
+ vm_typeX_0_bialy_port_5:
+ type: OS::ContrailV2::ServiceTemplate
+
diff --git a/ice_validator/tests/fixtures/test_contrail_resource_id/pass/pass0.yaml b/ice_validator/tests/fixtures/test_contrail_resource_id/pass/pass0.yaml
new file mode 100644
index 0000000..c6d6324
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_contrail_resource_id/pass/pass0.yaml
@@ -0,0 +1,70 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+resources:
+ vm_typeX_b_server_0:
+ type: OS::Nova::Server
+ properties:
+ availability_zone: { get_param: availability_zone_0 }
+ name: { get_param: vm_typeX_name_0 }
+
+ vm_typeX_0_bialy_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network:
+ get_param: int_bialy_net_name
+
+ vm_typeX_0_bialy_port_1:
+ type: OS::ContrailV2::InterfaceRouteTable
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::ContrailV2::NetworkIpam
+
+ vm_typeX_0_bialy_port_3:
+ type: OS::ContrailV2::PortTuple
+
+ vm_typeX_0_bialy_port_4:
+ type: OS::ContrailV2::ServiceHealthCheck
+
+ vm_typeX_0_bialy_port_5:
+ type: OS::ContrailV2::ServiceTemplate
+
diff --git a/ice_validator/tests/fixtures/test_contrail_vmi_resource_id/fail/fail0.yaml b/ice_validator/tests/fixtures/test_contrail_vmi_resource_id/fail/fail0.yaml
new file mode 100644
index 0000000..7ee0ec6
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_contrail_vmi_resource_id/fail/fail0.yaml
@@ -0,0 +1,75 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+
+resources:
+
+ vm_typeS_0_int_bialy_vmi_0_IP_0:
+ type: OS::ContrailV2::VirtualMachineInterface
+ properties:
+ virtual_network_refs:
+ - get_param: huey_int_hooey
+
+ vm_typeS_0_int_bialy_vmi_0_v6_IP_0:
+ type: OS::ContrailV2::VirtualMachineInterface
+ properties:
+ virtual_network_refs:
+ - get_param: huey_int_hooey
+
+ vm_typeS_0_subint_bialy_vmi_0_IP_1:
+ type: OS::ContrailV2::VirtualMachineInterface
+ properties:
+ virtual_network_refs:
+ - get_param: x_subint_dewey
+
+ vm_typeS_0_int_bialy_vmi_0_IP_2:
+ type: OS::ContrailV2::VirtualMachineInterface
+ properties:
+ virtual_network_refs:
+ - get_resource: dewey
+
+ vm_typeS_0_bialy_vmi_0_IP_2:
+ type: OS::ContrailV2::VirtualMachineInterface
+ properties:
+ virtual_network_refs:
+ - get_param: dewey
+
diff --git a/ice_validator/tests/fixtures/test_contrail_vmi_resource_id/pass/pass0.yaml b/ice_validator/tests/fixtures/test_contrail_vmi_resource_id/pass/pass0.yaml
new file mode 100644
index 0000000..b8346cb
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_contrail_vmi_resource_id/pass/pass0.yaml
@@ -0,0 +1,75 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+
+resources:
+
+ vm_typeS_0_int_bialy_vmi_0:
+ type: OS::ContrailV2::VirtualMachineInterface
+ properties:
+ virtual_network_refs:
+ - get_param: huey_int_hooey
+
+ vm_typeS_0_int_bialy_vmi_1:
+ type: OS::ContrailV2::VirtualMachineInterface
+ properties:
+ virtual_network_refs:
+ - get_param: huey_int_hooey
+
+ vm_typeS_0_subint_bialy_vmi_0:
+ type: OS::ContrailV2::VirtualMachineInterface
+ properties:
+ virtual_network_refs:
+ - get_param: x_subint_dewey
+
+ vm_typeS_0_int_bialy_vmi_2:
+ type: OS::ContrailV2::VirtualMachineInterface
+ properties:
+ virtual_network_refs:
+ - get_resource: dewey
+
+ vm_typeS_0_bialy_vmi_0:
+ type: OS::ContrailV2::VirtualMachineInterface
+ properties:
+ virtual_network_refs:
+ - get_param: dewey
+
diff --git a/ice_validator/tests/fixtures/test_contrail_vn_resource_id/fail/fail0.yaml b/ice_validator/tests/fixtures/test_contrail_vn_resource_id/fail/fail0.yaml
new file mode 100644
index 0000000..0eabf87
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_contrail_vn_resource_id/fail/fail0.yaml
@@ -0,0 +1,56 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::ContrailV2::VirtualNetwork
+
+ int_0_romeo_network:
+ type: OS::ContrailV2::VirtualNetwork
+
+ int_0_romeo_RVN:
+ type: OS::ContrailV2::VirtualNetwork
+
+ int_0_romeo_rvn:
+ type: OS::ContrailV2::VirtualNetwork
+
diff --git a/ice_validator/tests/fixtures/test_contrail_vn_resource_id/pass/pass0.yaml b/ice_validator/tests/fixtures/test_contrail_vn_resource_id/pass/pass0.yaml
new file mode 100644
index 0000000..5d6c06e
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_contrail_vn_resource_id/pass/pass0.yaml
@@ -0,0 +1,50 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+resources:
+ int_0_romeo_network:
+ type: OS::ContrailV2::VirtualNetwork
+
+ int_0_romeo_RVN:
+ type: OS::ContrailV2::VirtualNetwork
+
diff --git a/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/fail/fail.env b/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/fail/fail.env
new file mode 100644
index 0000000..4ea6ee3
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/fail/fail.env
@@ -0,0 +1,3 @@
+parameters:
+ test123: nsdafjk
+ bad: ndfaskl \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/fail/fail.yaml b/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/fail/fail.yaml
new file mode 100644
index 0000000..90d0f3c
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/fail/fail.yaml
@@ -0,0 +1,4 @@
+parameters:
+ test123:
+ type: string
+ description: ndasfjlansl \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/pass/pass.env b/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/pass/pass.env
new file mode 100644
index 0000000..de8d3e0
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/pass/pass.env
@@ -0,0 +1,2 @@
+parameters:
+ test123: nsdafjk \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/pass/pass.yaml b/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/pass/pass.yaml
new file mode 100644
index 0000000..90d0f3c
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_env_parameters_defined_in_template/pass/pass.yaml
@@ -0,0 +1,4 @@
+parameters:
+ test123:
+ type: string
+ description: ndasfjlansl \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_environment_file_parameters/fail/fail.env b/ice_validator/tests/fixtures/test_environment_file_parameters/fail/fail.env
index 1ce6cc4..9187b10 100644
--- a/ice_validator/tests/fixtures/test_environment_file_parameters/fail/fail.env
+++ b/ice_validator/tests/fixtures/test_environment_file_parameters/fail/fail.env
@@ -22,6 +22,7 @@ parameters:
TESTDB_name: bghbhjb
+ TESTDB_valet_hosts: test
#TESTDB_image_name: sadfadf
@@ -43,7 +44,7 @@ parameters:
availability_zone_0: sadnfjk
- STARKDB_private_v6_ips: ansdfj
+ #STARKDB_int_private_v6_ips: ansdfj
int_priv_subnet_name: safbdjk
@@ -58,3 +59,5 @@ parameters:
STARKDB_crazy_ip_1: fsad
TESTDB_name2: asnjkv
+
+ vf_module_index: nalfs
diff --git a/ice_validator/tests/fixtures/test_environment_file_parameters/fail/fail.yaml b/ice_validator/tests/fixtures/test_environment_file_parameters/fail/fail.yaml
index 23f4e1a..d84cc1f 100644
--- a/ice_validator/tests/fixtures/test_environment_file_parameters/fail/fail.yaml
+++ b/ice_validator/tests/fixtures/test_environment_file_parameters/fail/fail.yaml
@@ -12,7 +12,11 @@ parameters:
type: string
description: nasfln
- STARKDB_private_v6_ips:
+ TESTDB_valet_hosts:
+ type: string
+ description: nsfadl
+
+ STARKDB_int_private_v6_ips:
type: comma_delimited_list
description: ndsajlfn
@@ -144,6 +148,7 @@ resources:
#int_network_id: { get_resource: int_priv_network }
workload_context: { get_param: workload_context }
environment_context: { get_param: environment_context }
+ #valet_groups: "safnkl, sdaflksanl"
networks:
- port: { get_resource: STARKDB_0_int_priv_port_0 }
- port: { get_resource: STARKDB_0_PRIV_port_1}
@@ -165,6 +170,7 @@ resources:
#int_network_id: { get_resource: int_priv_network }
workload_context: { get_param: workload_context }
environment_context: { get_param: environment_context }
+ #valet_groups: "safnkl, sdaflksanl"
networks:
- port: {get_resource: STARKDB_1_int_priv_port_0}
- port: {get_resource: STARKDB_1_crazy_port_0}
@@ -183,6 +189,7 @@ resources:
#int_network_id: { get_resource: int_priv_network }
workload_context: { get_param: workload_context }
environment_context: { get_param: environment_context }
+ #valet_groups: "safnkl, sdaflksanl"
networks:
- port: {get_resource: TESTDB_0_int_priv_port_0}
- network: { get_param: int_priv_net_id }
@@ -203,10 +210,19 @@ resources:
#int_network_id: { get_resource: int_priv_network }
workload_context: { get_param: workload_context }
environment_context: { get_param: environment_context }
+ #valet_groups: "safnkl, sdaflksanl"
networks:
- port: {get_resource: TESTDB_0_int_priv_port_0}
- network: { get_param: int_priv_net_id }
+ availability_zone:
+ str_replace:
+ template: $AZ$VALET_HOST_ASSIGNMENT
+ params:
+ $AZ: { get_param: availability_zone_0 }
+ $VALET_HOST_ASSIGNMENT: { get_param: [ TESTDB_valet_hosts, 0 ] }
+
+
vol_attachment:
type: OS::Cinder::VolumeAttachment
properties:
@@ -239,8 +255,8 @@ resources:
properties:
network: { get_resource: int_private_net_id }
fixed_ips:
- - subnet_id: { get_resource: int_priv_subnet }
- - ip_address: { get_param: STARKDB_private_v6_ips }
+ - subnet: { get_resource: int_priv_subnet }
+ - ip_address: { get_param: STARKDB_int_private_v6_ips }
STARKDB_0_crazy_port_0:
@@ -248,7 +264,7 @@ resources:
properties:
network: { get_param: crazy_net_id }
fixed_ips:
- - subnet_id: { get_param: crazy_subnet_id }
+ - subnet: { get_param: crazy_subnet_id }
- ip_address: { get_param: STARKDB_crazy_ip_0 }
allowed_address_pairs: [ { "ip_address": {get_param:
STARKDB_crazy_floating_ip}}]
@@ -259,7 +275,7 @@ resources:
properties:
network: { get_param: crazy_net_id }
fixed_ips:
- - subnet_id: { get_param: crazy_subnet_id }
+ - subnet: { get_param: crazy_subnet_id }
- ip_address: { get_param: STARKDB_crazy_ip_1 }
allowed_address_pairs: [ { "ip_address": {get_param:
STARKDB_crazy_floating_ip}}]
diff --git a/ice_validator/tests/fixtures/test_filename_is_vmtype_dot_yaml/fail/testvm.yaml b/ice_validator/tests/fixtures/test_filename_is_vmtype_dot_yaml/fail/testvm.yaml
new file mode 100644
index 0000000..87c54e2
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_filename_is_vmtype_dot_yaml/fail/testvm.yaml
@@ -0,0 +1,51 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+resources:
+ testvm_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: testvm_name_0 }
+ flavor: { get_param: testvm_flavor_name}
+ image: { get_param: testvm_image_name}
+
diff --git a/ice_validator/tests/fixtures/test_filename_is_vmtype_dot_yaml/pass/test_vm.yaml b/ice_validator/tests/fixtures/test_filename_is_vmtype_dot_yaml/pass/test_vm.yaml
new file mode 100644
index 0000000..87c54e2
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_filename_is_vmtype_dot_yaml/pass/test_vm.yaml
@@ -0,0 +1,51 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+resources:
+ testvm_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: testvm_name_0 }
+ flavor: { get_param: testvm_flavor_name}
+ image: { get_param: testvm_image_name}
+
diff --git a/ice_validator/tests/fixtures/test_files_in_flat_dir/fail/nested/test2.yaml b/ice_validator/tests/fixtures/test_files_in_flat_dir/fail/nested/test2.yaml
new file mode 100644
index 0000000..330069b
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_files_in_flat_dir/fail/nested/test2.yaml
@@ -0,0 +1,36 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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============================================
diff --git a/ice_validator/tests/fixtures/test_files_in_flat_dir/fail/test.yaml b/ice_validator/tests/fixtures/test_files_in_flat_dir/fail/test.yaml
new file mode 100644
index 0000000..330069b
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_files_in_flat_dir/fail/test.yaml
@@ -0,0 +1,36 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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============================================
diff --git a/ice_validator/tests/fixtures/test_files_in_flat_dir/pass/test.yaml b/ice_validator/tests/fixtures/test_files_in_flat_dir/pass/test.yaml
new file mode 100644
index 0000000..330069b
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_files_in_flat_dir/pass/test.yaml
@@ -0,0 +1,36 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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============================================
diff --git a/ice_validator/tests/fixtures/test_files_in_flat_dir/pass/test2.yaml b/ice_validator/tests/fixtures/test_files_in_flat_dir/pass/test2.yaml
new file mode 100644
index 0000000..330069b
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_files_in_flat_dir/pass/test2.yaml
@@ -0,0 +1,36 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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============================================
diff --git a/ice_validator/tests/fixtures/test_forbidden_resources/fail/fail1.yaml b/ice_validator/tests/fixtures/test_forbidden_resources/fail/fail1.yaml
new file mode 100644
index 0000000..7ae4c65
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_forbidden_resources/fail/fail1.yaml
@@ -0,0 +1,49 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+resources:
+
+ vm_typeX_0_bialy_port_1:
+ type: OS::Neutron::FloatingIPAssociation
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::Neutron::FloatingIP
diff --git a/ice_validator/tests/fixtures/test_forbidden_resources/pass/pass0.yaml b/ice_validator/tests/fixtures/test_forbidden_resources/pass/pass0.yaml
new file mode 100644
index 0000000..a73de94
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_forbidden_resources/pass/pass0.yaml
@@ -0,0 +1,49 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+parameters:
+
+resources:
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::Neutron::Net
+
diff --git a/ice_validator/tests/fixtures/test_get_attr_usage/fail/fail_get_attr.yaml b/ice_validator/tests/fixtures/test_get_attr_usage/fail/fail_get_attr.yaml
new file mode 100644
index 0000000..3bbf508
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_get_attr_usage/fail/fail_get_attr.yaml
@@ -0,0 +1,60 @@
+# -*- 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: Simple template to deploy a single compute instance
+
+resources:
+ my_instance:
+ type: OS::Nova::Server
+ properties:
+ key_name: { get_param: d }
+ image: { get_param: b }
+ flavor: { get_param: c }
+
+ nested_instance:
+ type: nested.yaml
+
+outputs:
+ my_instance_ip:
+ description: The IP address of the deployed instance
+ value: { get_attr: [my_instance, first_address] }
+
+ nested_instance_ip:
+ description: The IP address of the deployed instance
+ value: { get_attr: [nested_instance, nested_instance_ip2] } \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_get_attr_usage/fail/nested.yaml b/ice_validator/tests/fixtures/test_get_attr_usage/fail/nested.yaml
new file mode 100644
index 0000000..9de7aab
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_get_attr_usage/fail/nested.yaml
@@ -0,0 +1,54 @@
+# -*- 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: Simple template to deploy a single compute instance
+
+resources:
+ nested_instance:
+ type: OS::Nova::Server
+ properties:
+ key_name: { get_param: d }
+ image: { get_param: b }
+ flavor: { get_param: c }
+
+outputs:
+
+ nested_instance_ip:
+ description: The IP address of the deployed instance
+ value: { get_attr: [nested_instance2, first_address] } \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_get_attr_usage/pass/nested.yaml b/ice_validator/tests/fixtures/test_get_attr_usage/pass/nested.yaml
new file mode 100644
index 0000000..cbd9234
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_get_attr_usage/pass/nested.yaml
@@ -0,0 +1,54 @@
+# -*- 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: Simple template to deploy a single compute instance
+
+resources:
+ nested_instance:
+ type: OS::Nova::Server
+ properties:
+ key_name: { get_param: d }
+ image: { get_param: b }
+ flavor: { get_param: c }
+
+outputs:
+
+ nested_instance_ip:
+ description: The IP address of the deployed instance
+ value: { get_attr: [nested_instance, first_address] } \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_get_attr_usage/pass/pass_get_attr.yaml b/ice_validator/tests/fixtures/test_get_attr_usage/pass/pass_get_attr.yaml
new file mode 100644
index 0000000..ac26e2b
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_get_attr_usage/pass/pass_get_attr.yaml
@@ -0,0 +1,60 @@
+# -*- 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: Simple template to deploy a single compute instance
+
+resources:
+ my_instance:
+ type: OS::Nova::Server
+ properties:
+ key_name: { get_param: d }
+ image: { get_param: b }
+ flavor: { get_param: c }
+
+ nested_instance:
+ type: nested.yaml
+
+outputs:
+ my_instance_ip:
+ description: The IP address of the deployed instance
+ value: { get_attr: [my_instance, first_address] }
+
+ nested_instance_ip:
+ description: The IP address of the deployed instance
+ value: { get_attr: [nested_instance, nested_instance_ip] } \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_get_file_only_reference_local_files/pass/new.txt b/ice_validator/tests/fixtures/test_get_file_only_reference_local_files/pass/new.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_get_file_only_reference_local_files/pass/new.txt
diff --git a/ice_validator/tests/fixtures/test_get_file_only_reference_local_files/pass/user_data.sh b/ice_validator/tests/fixtures/test_get_file_only_reference_local_files/pass/user_data.sh
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_get_file_only_reference_local_files/pass/user_data.sh
diff --git a/ice_validator/tests/fixtures/test_initial_configuration/pass/good_yaml_eg.yaml b/ice_validator/tests/fixtures/test_initial_configuration/pass/good_yaml_eg.yaml
index 559c598..25ec0b3 100644
--- a/ice_validator/tests/fixtures/test_initial_configuration/pass/good_yaml_eg.yaml
+++ b/ice_validator/tests/fixtures/test_initial_configuration/pass/good_yaml_eg.yaml
@@ -37,16 +37,40 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
----
- a: 1
- b:
- c: 3
- d: 4
- e:
- f: 4
- g:
- h:
- test: test
- k: g
+heat_template_version: 2015-04-30
- test: out \ No newline at end of file
+description: Simple template to deploy a single compute instance
+
+parameter_groups:
+ - label: human-readable label of parameter group
+ description: description of the parameter group
+ parameters:
+ - pga
+ - pgb
+
+parameters:
+ b:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
+ c:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
+ d:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
+
+resources:
+ my_instance:
+ type: OS::Nova::Server
+ properties:
+ key_name: { get_param: d }
+ image: { get_param: b }
+ flavor: { get_param: c }
+
+outputs:
+ instance_ip:
+ description: The IP address of the deployed instance
+ value: { get_attr: [my_instance, first_address] }
diff --git a/ice_validator/tests/test_unique_resources_across_template.py b/ice_validator/tests/fixtures/test_ip_parameters_start_at_0/fail/fail.yaml
index b811cdb..762b9b6 100644
--- a/ice_validator/tests/test_unique_resources_across_template.py
+++ b/ice_validator/tests/fixtures/test_ip_parameters_start_at_0/fail/fail.yaml
@@ -35,34 +35,27 @@
#
# ============LICENSE_END============================================
#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
-
-import yaml
-import pytest
-from .utils import yaml_custom_utils
-from yaml.constructor import ConstructorError
+heat_template_version: 2015-04-30
+description: Simple template to deploy a single compute instance
-def test_unique_resources_across_yaml_file(yaml_file):
- '''
- Check that all instance names are unique within
- a yaml file.
- '''
- yaml.add_constructor(
- yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG,
- yaml_custom_utils.raise_duplicates_keys)
+parameters:
+ vm1_nr1_ip_1:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
- try:
- with open(yaml_file) as fh:
- yaml.load(fh)
+ vm1_nr1_ip_2:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
- # Assert yaml file dont have resources
- # assert len(yml["resources"]) != 0
+ vm1_nr1_v6_ip_0:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
- except ConstructorError as ce:
- print(ce)
- pytest.fail("Unique resources across a yaml file - failed")
- except Exception as e:
- print(e)
- pytest.skip("This yaml file cannot be tested in this test")
+ vm1_nr1_v6_ip_2:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_ip_parameters_start_at_0/fail/fail2.yaml b/ice_validator/tests/fixtures/test_ip_parameters_start_at_0/fail/fail2.yaml
new file mode 100644
index 0000000..582aa5d
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_ip_parameters_start_at_0/fail/fail2.yaml
@@ -0,0 +1,55 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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: Simple template to deploy a single compute instance
+
+parameters:
+ vm1_nr1_ip_1:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
+
+ vm1_nr1_v6_ip_3:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
+
+resources:
+ vm1_server_0:
+ type: nested.yaml
diff --git a/ice_validator/tests/fixtures/test_ip_parameters_start_at_0/fail/nested.yaml b/ice_validator/tests/fixtures/test_ip_parameters_start_at_0/fail/nested.yaml
new file mode 100644
index 0000000..9283663
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_ip_parameters_start_at_0/fail/nested.yaml
@@ -0,0 +1,46 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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: Simple template to deploy a single compute instance
+
+parameters:
+ vm1_nr1_ip_4:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
diff --git a/ice_validator/tests/fixtures/test_ip_parameters_start_at_0/pass/nested.yaml b/ice_validator/tests/fixtures/test_ip_parameters_start_at_0/pass/nested.yaml
new file mode 100644
index 0000000..9283663
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_ip_parameters_start_at_0/pass/nested.yaml
@@ -0,0 +1,46 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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: Simple template to deploy a single compute instance
+
+parameters:
+ vm1_nr1_ip_4:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
diff --git a/ice_validator/tests/test_volume_format_outputs.py b/ice_validator/tests/fixtures/test_ip_parameters_start_at_0/pass/pass.yaml
index 8be3723..b03162b 100644
--- a/ice_validator/tests/test_volume_format_outputs.py
+++ b/ice_validator/tests/fixtures/test_ip_parameters_start_at_0/pass/pass.yaml
@@ -35,35 +35,27 @@
#
# ============LICENSE_END============================================
#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
-
-from tests import cached_yaml as yaml
-import pytest
-
+heat_template_version: 2015-04-30
-def test_volume_format_outputs(volume_template):
- '''
- Check that the values are properly provided to the outputs section
- in a volume template
- '''
- with open(volume_template) as fh:
- yml = yaml.load(fh)
+description: Simple template to deploy a single compute instance
- # skip if resources are not defined
- if "outputs" not in yml:
- pytest.skip("No outputs specified in the volume template")
+parameters:
+ vm1_nr1_ip_0:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
- # Retrieve the volume category parameters usage
- invalid_outputs = []
- for k, v in yml['outputs'].items():
- if not isinstance(v, dict):
- continue
+ vm1_nr1_ip_1:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
- if ('value' in v and
- ('get_resource' in v['value'] or
- 'get_attr' in v['value'])):
- continue
- invalid_outputs.append(k)
+ vm1_nr1_v6_ip_0:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
- assert not set(invalid_outputs)
+ vm1_nr1_v6_ip_1:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_ip_parameters_start_at_0/pass/pass2.yaml b/ice_validator/tests/fixtures/test_ip_parameters_start_at_0/pass/pass2.yaml
new file mode 100644
index 0000000..fdeeb7b
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_ip_parameters_start_at_0/pass/pass2.yaml
@@ -0,0 +1,55 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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: Simple template to deploy a single compute instance
+
+parameters:
+ vm1_nr1_ip_0:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
+
+ vm1_nr1_v6_ip_0:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
+
+resources:
+ vm1_server_0:
+ type: nested.yaml
diff --git a/ice_validator/tests/fixtures/test_nested_parameter_args/fail/fail0.yaml b/ice_validator/tests/fixtures/test_nested_parameter_args/fail/fail0.yaml
new file mode 100644
index 0000000..7f9c76c
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nested_parameter_args/fail/fail0.yaml
@@ -0,0 +1,59 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+parameters:
+ cdl:
+ type: comma_delimited_list
+ num:
+ type: number
+resources:
+ 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_id1:
+ get_param: [ cdl, { get_param: xnum }]
+ vf_module_id2:
+ get_param: [ xcdl, { get_param: num }]
+
diff --git a/ice_validator/tests/fixtures/test_nested_parameter_args/pass/pass0.yaml b/ice_validator/tests/fixtures/test_nested_parameter_args/pass/pass0.yaml
new file mode 100644
index 0000000..3a27e99
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nested_parameter_args/pass/pass0.yaml
@@ -0,0 +1,59 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+parameters:
+ cdl:
+ type: comma_delimited_list
+ num:
+ type: number
+resources:
+ 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_id1:
+ get_param: [ cdl, { get_param: num }]
+ vf_module_id2:
+ get_param: [ cdl, { get_param: num }]
+
diff --git a/ice_validator/tests/fixtures/test_nested_parameters/fail/heat_template.yaml b/ice_validator/tests/fixtures/test_nested_parameters/fail/heat_template.yaml
index a6a8a0e..3785474 100644
--- a/ice_validator/tests/fixtures/test_nested_parameters/fail/heat_template.yaml
+++ b/ice_validator/tests/fixtures/test_nested_parameters/fail/heat_template.yaml
@@ -48,12 +48,37 @@ parameters:
type: string
vm_type_volume_size_0:
type: number
+ vm_role:
+ type: string
+ vnf_id:
+ type: string
+ vf_module_id:
+ type: string
+ vnf_name:
+ type: string
+ vf_module_name:
+ type: string
+ vf_module_index:
+ type: string
+ environment_context:
+ type: string
+ workload_context:
+ type: string
resources:
server_0:
type: nested_template_1.yaml
properties:
name: { get_param: server_name_0 }
+ vm_1role: { get_param: vm_role }
+ vnf_1id: { get_param: vnf_id }
+ vf_module_1id: { get_param: vf_module_id }
+ vnf_1name: { get_param: vnf_name }
+ vf_module_1name: { get_param: vf_module_name }
+ vf_module_1index: { get_param: vf_module_index }
+ environment_cont1ext: { get_param: environment_context }
+ workload_cont1ext: { get_param: workload_context }
+
my_resource_group_1:
type: OS::Heat::ResourceGroup
properties:
diff --git a/ice_validator/tests/fixtures/test_nested_template_parameters/fail/bad-heat_template.yaml b/ice_validator/tests/fixtures/test_nested_template_parameters/fail/bad-heat_template.yaml
new file mode 100644
index 0000000..e948fb0
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nested_template_parameters/fail/bad-heat_template.yaml
@@ -0,0 +1,59 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.1'
+
+---
+
+resources:
+ server_0:
+ type: nested_template_1.yaml
+ properties:
+ para1: 'what me worry'
+ para2: 'what me worry'
+
+ server_1:
+ type: OS::Heat::ResourceGroup
+ properties:
+ resource_def:
+ type: nested_template_1.yaml
+ para2: 'what me worry'
+ para3: 'what me worry'
+
diff --git a/ice_validator/tests/fixtures/test_nested_template_parameters/pass/heat_template.yaml b/ice_validator/tests/fixtures/test_nested_template_parameters/pass/heat_template.yaml
new file mode 100644
index 0000000..315eec4
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nested_template_parameters/pass/heat_template.yaml
@@ -0,0 +1,62 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.2'
+
+---
+
+resources:
+ server_0:
+ type: nested_template_1.yaml
+ properties:
+ para1: 'what me worry'
+ para2: 'what me worry'
+ para3: 'what me worry'
+
+ server_1:
+ type: OS::Heat::ResourceGroup
+ properties:
+ resource_def:
+ type: nested_template_1.yaml
+ properties:
+ para1: 'what me worry'
+ para2: 'what me worry'
+ para3: 'what me worry'
+
diff --git a/ice_validator/tests/fixtures/test_nested_parameters/fail/nested_template_1.yaml b/ice_validator/tests/fixtures/test_nested_template_parameters/pass/nested_template_1.yaml
index 5f2732f..87b03a0 100644
--- a/ice_validator/tests/fixtures/test_nested_parameters/fail/nested_template_1.yaml
+++ b/ice_validator/tests/fixtures/test_nested_template_parameters/pass/nested_template_1.yaml
@@ -41,7 +41,13 @@
# VERSION = '1.0.0'
---
-heat_template_version: 2013-05-23
+parameters:
+ para1:
+ type: string
+ para2:
+ type: string
+ para3:
+ type: string
resources:
volume:
diff --git a/ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/fail/invalid_base_naming_for_fixed_ips.yaml b/ice_validator/tests/fixtures/test_nesting_level/fail/bad-level0.yaml
index 9d9be46..42971ee 100644
--- a/ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/fail/invalid_base_naming_for_fixed_ips.yaml
+++ b/ice_validator/tests/fixtures/test_nesting_level/fail/bad-level0.yaml
@@ -1,5 +1,5 @@
# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
+# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -37,33 +37,15 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
+# VERSION: '1.0.0'
---
resources:
-
- lb_1_int_intranet_port:
- type: OS::Neutron::Port
+ server_0:
+ type: bad-level1.yaml
properties:
- network: { get_param: int_intranet_net_name }
- fixed_ips:
- - ip_address: { get_param: lb_1_int_intranet_ip }
-
- lb_2_int_intranet_port:
- type: OS::Neutron::Port
+ name: { get_param: server_name_0 }
+ my_resource_group_1:
+ type: OS::Heat::ResourceGroup
properties:
- network: { get_param: int_intranet_net_id }
- fixed_ips:
- - ip_address: { get_param: lb_2_int_intranet_floating_v6_ips }
-
- 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 }
-
- lb_2_extnet_port:
- 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
+ count: 5
+ resource_def: { type: bad-level2.yaml }
diff --git a/ice_validator/tests/fixtures/test_volume_format_outputs/fail/use_get_param_volume.yml b/ice_validator/tests/fixtures/test_nesting_level/fail/bad-level1.yaml
index 90ba1ca..9bd513d 100644
--- a/ice_validator/tests/fixtures/test_volume_format_outputs/fail/use_get_param_volume.yml
+++ b/ice_validator/tests/fixtures/test_nesting_level/fail/bad-level1.yaml
@@ -1,5 +1,5 @@
# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
+# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -37,25 +37,27 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
+# VERSION: '1.0.0'
---
+nested_template_description: base
+
+parameters:
+ vm_type_volume_name_0:
+ type: string
+ vm_type_volume_size_0:
+ type: number
+
resources:
- vm_type_volume_id_0:
- type: OS::Cinder::Volume
+ server_0:
+ type: bad-level2.yaml
properties:
- size: { get_param: vm_type_volume_size_0 }
-
- vm_type_volume_id_1:
- type: OS::Cinder::Volume
+ name: {get_param: server_name_0}
+ my_resource_group_1:
+ type: OS::Nova::Server
properties:
- size: { get_param: vm_type_volume_size_0 }
+ count: 5
+ resource_def: { type: bad-level3.yaml }
outputs:
-
vm_type_volume_id_0:
- value: { get_param: vm_type_volume_id_0 }
-
- vm_type_volume_id_1:
- value: { get_resource: vm_type_volume_id_1 }
-
- vm_type_volume_ids_0:
- value: { get_attr: [vm_type_volume_0_RSG, refs] } \ No newline at end of file
+ value: {get_resource: vm_type_volume_0}
diff --git a/ice_validator/tests/fixtures/test_volume_format_outputs/pass/valid_template_volume.yml b/ice_validator/tests/fixtures/test_nesting_level/fail/bad-level2.yaml
index fa016a2..242a0d7 100644
--- a/ice_validator/tests/fixtures/test_volume_format_outputs/pass/valid_template_volume.yml
+++ b/ice_validator/tests/fixtures/test_nesting_level/fail/bad-level2.yaml
@@ -1,5 +1,5 @@
# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
+# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -37,34 +37,27 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
+# VERSION: '1.0.0'
---
-resources:
+nested_template_description: base
- vm_type_volume_0:
- type: OS::Cinder::Volume
- properties:
- size: { get_param: vm_type_volume_size_0 }
+parameters:
+ vm_type_volume_name_0:
+ type: string
+ vm_type_volume_size_0:
+ type: number
- vm_type_volume_1:
- type: OS::Cinder::Volume
+resources:
+ server_0:
+ type: not_a_template_file
properties:
- size: { get_param: vm_type_volume_size_0 }
-
- vm_type_volume_0_RSG:
+ name: {get_param: server_name_0}
+ my_resource_group_1:
type: OS::Heat::ResourceGroup
- count: { get_param: vm_type_volume_count_0_RSG }
- resource_def:
- type: OS::Cinder::Volume
- properties:
- size: { get_param: vm_type_volume_size_0 }
+ properties:
+ count: 5
+ resource_def: { type: bad-level3.yaml }
outputs:
-
vm_type_volume_id_0:
- value: { get_resource: vm_type_volume_0 }
-
- vm_type_volume_id_1:
- value: { get_resource: vm_type_volume_1 }
-
- vm_type_volume_ids_0:
- value: { get_attr: [vm_type_volume_0_RSG, refs] } \ No newline at end of file
+ value: {get_resource: vm_type_volume_0}
diff --git a/ice_validator/tests/fixtures/test_nesting_level/fail/bad-level3.yaml b/ice_validator/tests/fixtures/test_nesting_level/fail/bad-level3.yaml
new file mode 100644
index 0000000..bc762d7
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nesting_level/fail/bad-level3.yaml
@@ -0,0 +1,60 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+---
+heat_template_version: '2013-05-23'
+
+resources:
+ volume:
+ type: OS::Cinder::Volume
+ properties:
+ size: 1
+
+ volume_attachment:
+ type: OS::Cinder::VolumeAttachment
+ properties:
+ volume_id: { get_resource: volume }
+ instance_uuid: { get_resource: instance }
+
+ instance:
+ type: OS::Nova::Server
+ properties:
+ image: myimage
+ flavor: m1.small
diff --git a/ice_validator/tests/fixtures/test_nesting_level/pass/level0.yaml b/ice_validator/tests/fixtures/test_nesting_level/pass/level0.yaml
new file mode 100644
index 0000000..da8815c
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nesting_level/pass/level0.yaml
@@ -0,0 +1,51 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+---
+resources:
+ server_0:
+ type: level1.yaml
+ properties:
+ name: { get_param: server_name_0 }
+ my_resource_group_1:
+ type: OS::Heat::ResourceGroup
+ properties:
+ count: 5
+ resource_def: { type: level2.yaml }
diff --git a/ice_validator/tests/fixtures/test_nesting_level/pass/level1.yaml b/ice_validator/tests/fixtures/test_nesting_level/pass/level1.yaml
new file mode 100644
index 0000000..f51772f
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nesting_level/pass/level1.yaml
@@ -0,0 +1,63 @@
+# -*- 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.
+#
+# VERSION: '1.0.1'
+---
+nested_template_description: base
+
+parameters:
+ vm_type_volume_name_0:
+ type: string
+ vm_type_volume_size_0:
+ type: number
+
+resources:
+ server_0:
+ type: level3.yaml
+ properties:
+ name: {get_param: server_name_0}
+ my_resource_group_1:
+ type: OS::Nova::Server
+ properties:
+ count: 5
+ resource_def: { type: level2.yaml }
+
+outputs:
+ vm_type_volume_id_0:
+ value: {get_resource: vm_type_volume_0}
diff --git a/ice_validator/tests/fixtures/test_volume_format_outputs/fail/no_value_volume.yaml b/ice_validator/tests/fixtures/test_nesting_level/pass/level2.yaml
index eec1fbd..5d21ad8 100644
--- a/ice_validator/tests/fixtures/test_volume_format_outputs/fail/no_value_volume.yaml
+++ b/ice_validator/tests/fixtures/test_nesting_level/pass/level2.yaml
@@ -1,5 +1,5 @@
# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
+# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -37,33 +37,27 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
+# VERSION: '1.0.1'
---
-resources:
- vm_type_volume_id_0:
- type: OS::Cinder::Volume
- properties:
- size: { get_param: vm_type_volume_size_0 }
+nested_template_description: base
- vm_type_volume_id_1:
- type: OS::Cinder::Volume
- properties:
- size: { get_param: vm_type_volume_size_0 }
+parameters:
+ vm_type_volume_name_0:
+ type: string
+ vm_type_volume_size_0:
+ type: number
- vm_type_volume_0_RSG:
+resources:
+ server_0:
+ type: not_a_template_file
+ properties:
+ name: {get_param: server_name_0}
+ my_resource_group_1:
type: OS::Heat::ResourceGroup
- count: { get_param: vm_type_volume_count_0_RSG }
- resource_def:
- type: OS::Cinder::Volume
- properties:
- size: { get_param: vm_type_volume_size_0 }
+ properties:
+ count: 5
+ resource_def: { type: level3.yaml }
outputs:
-
vm_type_volume_id_0:
- value: { get_resource: vm_type_volume_id_0 }
-
- vm_type_volume_id_1:
- resource: { get_resource: vm_type_volume_id_1 }
-
- vm_type_volume_ids_0:
- value: { get_attr: [vm_type_volume_0_RSG, refs] } \ No newline at end of file
+ value: {get_resource: vm_type_volume_0}
diff --git a/ice_validator/tests/fixtures/test_nesting_level/pass/level3.yaml b/ice_validator/tests/fixtures/test_nesting_level/pass/level3.yaml
new file mode 100644
index 0000000..bc762d7
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nesting_level/pass/level3.yaml
@@ -0,0 +1,60 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+---
+heat_template_version: '2013-05-23'
+
+resources:
+ volume:
+ type: OS::Cinder::Volume
+ properties:
+ size: 1
+
+ volume_attachment:
+ type: OS::Cinder::VolumeAttachment
+ properties:
+ volume_id: { get_resource: volume }
+ instance_uuid: { get_resource: instance }
+
+ instance:
+ type: OS::Nova::Server
+ properties:
+ image: myimage
+ flavor: m1.small
diff --git a/ice_validator/tests/fixtures/test_nesting_nova_server/fail/bad-17528_0.yaml b/ice_validator/tests/fixtures/test_nesting_nova_server/fail/bad-17528_0.yaml
new file mode 100644
index 0000000..7485297
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nesting_nova_server/fail/bad-17528_0.yaml
@@ -0,0 +1,50 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+---
+resources:
+ server_0:
+ type: bad-17528_1.yaml
+ properties:
+ name: { get_param: server_name_0 }
+ my_resource_group_1:
+ type: OS::Heat::ResourceGroup
+ properties:
+ count: 5
diff --git a/ice_validator/tests/fixtures/test_nesting_nova_server/fail/bad-17528_1.yaml b/ice_validator/tests/fixtures/test_nesting_nova_server/fail/bad-17528_1.yaml
new file mode 100644
index 0000000..4e79ff3
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nesting_nova_server/fail/bad-17528_1.yaml
@@ -0,0 +1,65 @@
+# -*- 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.
+#
+# VERSION: '1.0.1'
+---
+nested_template_description: base
+
+parameters:
+ vm_type_volume_name_0:
+ type: string
+ vm_type_volume_size_0:
+ type: number
+
+resources:
+ server_0:
+ type: not_a_template_file
+ properties:
+ name: {get_param: server_name_0}
+ my_resource_group_1:
+ type: OS::Nova::Server
+ properties:
+ count: 5
+ resource_def: { type: bad-17528_2.yaml }
+ my_resource_group_2:
+ type: OS::Nova::Server
+
+outputs:
+ vm_type_volume_id_0:
+ value: {get_resource: vm_type_volume_0}
diff --git a/ice_validator/tests/fixtures/test_nesting_nova_server/fail/bad-17528_2.yaml b/ice_validator/tests/fixtures/test_nesting_nova_server/fail/bad-17528_2.yaml
new file mode 100644
index 0000000..172bb2c
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nesting_nova_server/fail/bad-17528_2.yaml
@@ -0,0 +1,60 @@
+# -*- 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.
+#
+# VERSION: '1.0.1'
+---
+heat_template_version: '2013-05-23'
+
+resources:
+ volume:
+ type: OS::Cinder::Volume
+ properties:
+ size: 1
+
+ volume_attachment:
+ type: OS::Cinder::VolumeAttachment
+ properties:
+ volume_id: { get_resource: volume }
+ instance_uuid: { get_resource: instance }
+
+ instance:
+ type: OS::Nova::NotServer
+ properties:
+ image: myimage
+ flavor: m1.small
diff --git a/ice_validator/tests/fixtures/test_nesting_nova_server/pass/17528_0.yaml b/ice_validator/tests/fixtures/test_nesting_nova_server/pass/17528_0.yaml
new file mode 100644
index 0000000..4483411
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nesting_nova_server/pass/17528_0.yaml
@@ -0,0 +1,50 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+---
+resources:
+ server_0:
+ type: 17528_1.yaml
+ properties:
+ name: { get_param: server_name_0 }
+ my_resource_group_1:
+ type: OS::Heat::ResourceGroup
+ properties:
+ count: 5
diff --git a/ice_validator/tests/fixtures/test_nesting_nova_server/pass/17528_1.yaml b/ice_validator/tests/fixtures/test_nesting_nova_server/pass/17528_1.yaml
new file mode 100644
index 0000000..66e9c04
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nesting_nova_server/pass/17528_1.yaml
@@ -0,0 +1,64 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+---
+nested_template_description: base
+
+parameters:
+ vm_type_volume_name_0:
+ type: string
+ vm_type_volume_size_0:
+ type: number
+
+resources:
+ server_0:
+ type: not_a_template_file
+ properties:
+ name: {get_param: server_name_0}
+ my_resource_group_1:
+ type: OS::Nova::Server
+ properties:
+ count: 5
+ #resource_def: { type: 17528_3.yaml }
+ resource_def: { type: 17528_2.yaml }
+
+outputs:
+ vm_type_volume_id_0:
+ value: {get_resource: vm_type_volume_0}
diff --git a/ice_validator/tests/fixtures/test_nesting_nova_server/pass/17528_2.yaml b/ice_validator/tests/fixtures/test_nesting_nova_server/pass/17528_2.yaml
new file mode 100644
index 0000000..00ab275
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nesting_nova_server/pass/17528_2.yaml
@@ -0,0 +1,60 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+---
+heat_template_version: '2013-05-23'
+
+resources:
+ volume:
+ type: OS::Cinder::Volume
+ properties:
+ size: 1
+
+ volume_attachment:
+ type: OS::Cinder::VolumeAttachment
+ properties:
+ volume_id: { get_resource: volume }
+ instance_uuid: { get_resource: instance }
+
+ instance:
+ type: OS::Nova::NotServer
+ properties:
+ image: myimage
+ flavor: m1.small
diff --git a/ice_validator/tests/fixtures/test_nesting_nova_server/pass/17528_3.yaml b/ice_validator/tests/fixtures/test_nesting_nova_server/pass/17528_3.yaml
new file mode 100644
index 0000000..5e7dd2d
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nesting_nova_server/pass/17528_3.yaml
@@ -0,0 +1,63 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+---
+nested_template_description: base
+
+parameters:
+ vm_type_volume_name_0:
+ type: string
+ vm_type_volume_size_0:
+ type: number
+
+resources:
+ server_0:
+ type: not_a_template_file
+ properties:
+ name: {get_param: server_name_0}
+ my_resource_group_1:
+ type: OS::Nova::Server
+ properties:
+ count: 5
+ resource_def: { type: 17528_2.yaml }
+
+outputs:
+ vm_type_volume_id_0:
+ value: {get_resource: vm_type_volume_0}
diff --git a/ice_validator/tests/fixtures/test_network_format/fail/invalid_naming_used_for_network.yaml b/ice_validator/tests/fixtures/test_network_format/fail/invalid_naming_used_for_network.yaml
index 3a60812..7351826 100644
--- a/ice_validator/tests/fixtures/test_network_format/fail/invalid_naming_used_for_network.yaml
+++ b/ice_validator/tests/fixtures/test_network_format/fail/invalid_naming_used_for_network.yaml
@@ -47,14 +47,24 @@ resources:
vm_type_1_int_vpnnet_0_port:
type: OS::Neutron::Port
properties:
- network: { get_param: int_vpnnet_net }
+ network: { get_param: int_vpnnet_net_id }
vm_type_1_extnet_net_0_port:
type: OS::Neutron::Port
properties:
- network: { get_param: extnet_net }
+ network: { get_param: extnet_net_name }
vm_type_1_extnet_0_port:
type: OS::Neutron::Port
properties:
network: { get_param: extnet_net_id }
+
+ int_oam_netork:
+ type: OS::Neutron::Net
+ properties:
+ name: { get_param: int_oam_net_name }
+
+ vm_type_1_int_oam_1_port:
+ type: OS::Neutron::Port
+ properties:
+ gbgdfjk: { get_resource: int_oam_net }
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 83358b2..136e27b 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,10 +59,16 @@ resources:
properties:
network: { get_param: extnet_net_id }
- int_oam_net:
+ int_oam_network:
type: OS::Neutron::Net
properties:
name: { get_param: int_oam_net_name }
+
+ int_oam_subnet:
+ type: OS::Neutron::Subnet
+ properties:
+ network: { get_resource: int_oam_network }
+
vm_type_1_int_oam_1_port:
type: OS::Neutron::Port
properties:
diff --git a/ice_validator/tests/fixtures/test_neutron_net_resource_id/fail/fail.yaml b/ice_validator/tests/fixtures/test_neutron_net_resource_id/fail/fail.yaml
new file mode 100644
index 0000000..b95e5d6
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_neutron_net_resource_id/fail/fail.yaml
@@ -0,0 +1,53 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+
+ int_0_romeo_networK:
+ type: OS::Neutron::Net
+
+ ant_0_romeo_network:
+ type: OS::Neutron::Net
+
diff --git a/ice_validator/tests/fixtures/test_neutron_net_resource_id/pass/pass.yaml b/ice_validator/tests/fixtures/test_neutron_net_resource_id/pass/pass.yaml
new file mode 100644
index 0000000..2b0049a
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_neutron_net_resource_id/pass/pass.yaml
@@ -0,0 +1,53 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+
+ int_0_romeo_network:
+ type: OS::Neutron::Net
+
+ int_0_romeo_network:
+ type: OS::Neutron::Net
+
diff --git a/ice_validator/tests/fixtures/test_neutron_port_addresses/fail/fail0.yaml b/ice_validator/tests/fixtures/test_neutron_port_addresses/fail/fail0.yaml
new file mode 100644
index 0000000..3237293
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_neutron_port_addresses/fail/fail0.yaml
@@ -0,0 +1,86 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+resources:
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ allowed_address_pairs:
+ - ip_address: { get_param: my_ip }
+ v6_ip_address: { get_param: my_v6_ip }
+ mac_and_cheese: 0
+ - ip_address: { get_param: my_ip }
+ v6_ip_address: { get_param: my_v6_ip }
+ mac_and_cheese: 1
+
+ vm_typeX_1_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ allowed_address_pairs:
+ - ip_address: { get_param: my_ip }
+ v6_ip_address: { get_param: my_v6_ip }
+ mac_and_cheese: 0
+ - ip_address: { get_param: my_ip_1 }
+ v6_ip_address: { get_param: my_v6_ip_1 }
+ mac_and_cheese: 1
+
+ vm_typeX_2_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ allowed_address_pairs:
+ - ip_address: { get_parm: my_ip }
+ v6_ip_address: { get_parm: my_v6_ip }
+
+ vm_typeX_3_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ allowed_address_pairs:
+ - ip_address
+
+ vm_typeX_4_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ allowed_address_pairs:
+ ip_address: { get_param: my_ip }
+ v6_ip_address: { get_param: my_v6_ip }
+
diff --git a/ice_validator/tests/fixtures/test_neutron_port_addresses/fail/fail1.yaml b/ice_validator/tests/fixtures/test_neutron_port_addresses/fail/fail1.yaml
new file mode 100644
index 0000000..de3c46f
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_neutron_port_addresses/fail/fail1.yaml
@@ -0,0 +1,86 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+resources:
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ allowed_address_pairs:
+ - ip_address: { get_param: my_ip }
+ v6_ip_address: { get_param: my_v6_ip }
+ mac_and_cheese: 0
+ - ip_address: { get_param: my_ip }
+ v6_ip_address: { get_param: my_v6_ip }
+ mac_and_cheese: 1
+
+ vm_typeX_1_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ xallowed_address_pairs:
+ - ip_address: { get_param: my_ip }
+ v6_ip_address: { get_param: my_v6_ip }
+ mac_and_cheese: 0
+ - ip_address: { get_param: my_ip_1 }
+ v6_ip_address: { get_param: my_v6_ip_1 }
+ mac_and_cheese: 1
+
+ vm_typeX_2_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ allowed_address_pairs:
+ - ip_address: { get_parm: my_ip }
+ v6_ip_address: { get_parm: my_v6_ip }
+
+ vm_typeX_3_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ allowed_address_pairs:
+ - ip_address
+
+ vm_typeX_4_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ allowed_address_pairs:
+ ip_address: { get_param: my_ip }
+ v6_ip_address: { get_param: my_v6_ip }
+
diff --git a/ice_validator/tests/fixtures/test_neutron_port_addresses/fail/fail2.yaml b/ice_validator/tests/fixtures/test_neutron_port_addresses/fail/fail2.yaml
new file mode 100644
index 0000000..6d3cc82
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_neutron_port_addresses/fail/fail2.yaml
@@ -0,0 +1,86 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+resources:
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ allowed_address_pairs:
+ - ip_address: { get_param: my_ip }
+ v6_ip_address: { get_param: my_v6_ip }
+ mac_and_cheese: 0
+ - ip_address: { get_param: my_ip }
+ v6_ip_address: { get_param: my_v6_ip }
+ mac_and_cheese: 1
+
+ vm_typeX_1_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ xallowed_address_pairs:
+ - ip_address: { get_param: my_ip }
+ v6_ip_address: { get_param: my_v6_ip }
+ mac_and_cheese: 0
+ - ip_address: { get_param: my_ip_1 }
+ v6_ip_address: { get_param: my_v6_ip_1 }
+ mac_and_cheese: 1
+
+ vm_typeX_2_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ allowed_address_pairs:
+ - ip_address: { get_parm: my_ip }
+ v6_ip_address: { get_parm: my_v6_ip }
+
+ vm_typeX_3_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ xallowed_address_pairs:
+ - ip_address
+
+ vm_typeX_4_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ allowed_address_pairs:
+ ip_address: { get_param: my_ip }
+ v6_ip_address: { get_param: my_v6_ip }
+
diff --git a/ice_validator/tests/fixtures/test_neutron_port_addresses/fail/fail3.yaml b/ice_validator/tests/fixtures/test_neutron_port_addresses/fail/fail3.yaml
new file mode 100644
index 0000000..521136a
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_neutron_port_addresses/fail/fail3.yaml
@@ -0,0 +1,86 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+resources:
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ allowed_address_pairs:
+ - ip_address: { get_param: my_ip }
+ v6_ip_address: { get_param: my_v6_ip }
+ mac_and_cheese: 0
+ - ip_address: { get_param: my_ip }
+ v6_ip_address: { get_param: my_v6_ip }
+ mac_and_cheese: 1
+
+ vm_typeX_1_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ xallowed_address_pairs:
+ - ip_address: { get_param: my_ip }
+ v6_ip_address: { get_param: my_v6_ip }
+ mac_and_cheese: 0
+ - ip_address: { get_param: my_ip_1 }
+ v6_ip_address: { get_param: my_v6_ip_1 }
+ mac_and_cheese: 1
+
+ vm_typeX_2_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ xallowed_address_pairs:
+ - ip_address: { get_parm: my_ip }
+ v6_ip_address: { get_parm: my_v6_ip }
+
+ vm_typeX_3_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ xallowed_address_pairs:
+ - ip_address
+
+ vm_typeX_4_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ allowed_address_pairs:
+ ip_address: { get_param: my_ip }
+ v6_ip_address: { get_param: my_v6_ip }
+
diff --git a/ice_validator/tests/fixtures/test_neutron_port_addresses/fail/other0.yaml b/ice_validator/tests/fixtures/test_neutron_port_addresses/fail/other0.yaml
new file mode 100644
index 0000000..e690ea3
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_neutron_port_addresses/fail/other0.yaml
@@ -0,0 +1,53 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+resources:
+
+ other_typeX_0_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ allowed_address_pairs:
+ - ip_address: { get_param: my_ip }
+ - ip_address: { get_param: my_v6_ip }
+ - ip_address: { get_param: my2_ip }
+ - ip_address: { get_param: my2_v6_ip }
+
diff --git a/ice_validator/tests/fixtures/test_neutron_port_addresses/pass/other0.yaml b/ice_validator/tests/fixtures/test_neutron_port_addresses/pass/other0.yaml
new file mode 100644
index 0000000..cc9d315
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_neutron_port_addresses/pass/other0.yaml
@@ -0,0 +1,55 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+resources:
+
+ other_typeX_0_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ allowed_address_pairs:
+ - ip_address: { get_param: my_ip_1 }
+ v6_ip_address: { get_param: my_v6_ip_1 }
+ mac_and_cheese: 0
+ - ip_address: { get_param: my_ip_1 }
+ v6_ip_address: { get_param: my_v6_ip_1 }
+ mac_and_cheese: 1
+
diff --git a/ice_validator/tests/fixtures/test_neutron_port_addresses/pass/pass0.yaml b/ice_validator/tests/fixtures/test_neutron_port_addresses/pass/pass0.yaml
new file mode 100644
index 0000000..07711cd
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_neutron_port_addresses/pass/pass0.yaml
@@ -0,0 +1,86 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+resources:
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ allowed_address_pairs:
+ - ip_address: { get_param: my_ip }
+ v6_ip_address: { get_param: my_v6_ip }
+ mac_and_cheese: 0
+ - ip_address: { get_param: my_ip }
+ v6_ip_address: { get_param: my_v6_ip }
+ mac_and_cheese: 1
+
+ vm_typeX_1_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ allowed_address_pairs:
+ - ip_address: { get_param: my_ip }
+ v6_ip_address: { get_param: my_v6_ip }
+ mac_and_cheese: 0
+ - ip_address: { get_param: my_ip }
+ v6_ip_address: { get_param: my_v6_ip }
+ mac_and_cheese: 1
+
+ vm_typeX_2_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ xallowed_address_pairs:
+ - ip_address: { get_parm: my_ip }
+ v6_ip_address: { get_parm: my_v6_ip }
+
+ vm_typeX_3_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ xallowed_address_pairs:
+ - ip_address
+
+ vm_typeX_4_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ xallowed_address_pairs:
+ ip_address: { get_param: my_ip }
+ v6_ip_address: { get_param: my_v6_ip }
+
diff --git a/ice_validator/tests/fixtures/test_neutron_port_fixed_ips/fail/fail0.yaml b/ice_validator/tests/fixtures/test_neutron_port_fixed_ips/fail/fail0.yaml
new file mode 100644
index 0000000..d5756f3
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_neutron_port_fixed_ips/fail/fail0.yaml
@@ -0,0 +1,97 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+parameters:
+
+ vm_typeX_bialy_vlan_filter:
+ type: comma_delimited_list
+ vm_typeX_bialy_public_vlans:
+ type: comma_delimited_list
+ vm_typeX_bialy_private_vlans:
+ type: comma_delimited_list
+ vm_typeX_bialy_guest_vlans:
+ type: comma_delimited_list
+ subnet_param:
+ type: string
+ subnet_id_param:
+ type: comma_delimited_list
+
+resources:
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: int_intranet_net_name }
+ fixed_ips:
+ - ip_address: { get_param: lb_1_int_intranet_floating_ip }
+ subnet: { get_param: subnet_param }
+ subnet_id: { get_param: subnet_id_param }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Trunk
+
+ vm_typeX_3_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: extnet_net_id }
+ fixed_ips:
+ - ip_address: { get_param: lb_2_extnet_floating_v6_ip }
+ subnet: { get_param: subnet_param }
+ subnet_id: { get_param: subnet_id_param }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Mirrored_Trunk
+
diff --git a/ice_validator/tests/fixtures/test_neutron_port_fixed_ips/fail/fail1.yaml b/ice_validator/tests/fixtures/test_neutron_port_fixed_ips/fail/fail1.yaml
new file mode 100644
index 0000000..29b20fe
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_neutron_port_fixed_ips/fail/fail1.yaml
@@ -0,0 +1,97 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+parameters:
+
+ vm_typeX_bialy_vlan_filter:
+ type: comma_delimited_list
+ vm_typeX_bialy_public_vlans:
+ type: comma_delimited_list
+ vm_typeX_bialy_private_vlans:
+ type: comma_delimited_list
+ vm_typeX_bialy_guest_vlans:
+ type: comma_delimited_list
+ bialy_subnet:
+ type: string
+ bialy_subnet_id:
+ type: string
+
+resources:
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: int_intranet_net_name }
+ fixed_ips:
+ - ip_address: { get_param: lb_1_int_intranet_floating_ip }
+ subnet: { get_param: bialy_subnet }
+ subnet_id: { get_param: bialy_subnet_id }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Trunk
+
+ vm_typeX_3_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: extnet_net_id }
+ fixed_ips:
+ - ip_address: { get_param: lb_2_extnet_floating_v6_ip }
+ subnet: { get_param: bialy_subnet }
+ subnet_id: { get_param: bialy_subnet_id }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Mirrored_Trunk
+
diff --git a/ice_validator/tests/fixtures/test_neutron_port_fixed_ips/pass/pass0.yaml b/ice_validator/tests/fixtures/test_neutron_port_fixed_ips/pass/pass0.yaml
new file mode 100644
index 0000000..c26c0a8
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_neutron_port_fixed_ips/pass/pass0.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.
+#
+# VERSION: '1.0.0'
+
+---
+parameters:
+
+ vm_typeX_bialy_vlan_filter:
+ type: comma_delimited_list
+ vm_typeX_bialy_public_vlans:
+ type: comma_delimited_list
+ vm_typeX_bialy_private_vlans:
+ type: comma_delimited_list
+ vm_typeX_bialy_guest_vlans:
+ type: comma_delimited_list
+ bialy_subnet:
+ type: string
+ bialy_subnet_id:
+ type: string
+
+resources:
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ 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 }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Trunk
+
+ vm_typeX_3_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ 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 }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Mirrored_Trunk
+
diff --git a/ice_validator/tests/fixtures/test_neutron_port_fixed_ips/pass/pass0_base.yaml b/ice_validator/tests/fixtures/test_neutron_port_fixed_ips/pass/pass0_base.yaml
new file mode 100644
index 0000000..a73de94
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_neutron_port_fixed_ips/pass/pass0_base.yaml
@@ -0,0 +1,49 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+parameters:
+
+resources:
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::Neutron::Net
+
diff --git a/ice_validator/tests/fixtures/test_neutron_port_internal_network/fail/fail0.yaml b/ice_validator/tests/fixtures/test_neutron_port_internal_network/fail/fail0.yaml
new file mode 100644
index 0000000..85d0524
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_neutron_port_internal_network/fail/fail0.yaml
@@ -0,0 +1,100 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+parameters:
+
+ vm_typeX_bialy_vlan_filter:
+ type: comma_delimited_list
+ vm_typeX_bialy_public_vlans:
+ type: comma_delimited_list
+ vm_typeX_bialy_private_vlans:
+ type: comma_delimited_list
+ vm_typeX_bialy_guest_vlans:
+ type: comma_delimited_list
+ subnet_param:
+ type: string
+ subnet_id_param:
+ type: string
+ int_extnet_net_id:
+ type: string
+ int_intranet_net_name:
+ type: string
+resources:
+
+ vm_typeX_0_intranet_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: int_intranet_net_name }
+ fixed_ips:
+ - ip_address: { get_param: lb_1_int_intranet_floating_ip }
+ subnet: { get_param: subnet_param }
+ subnet_id: { get_param: subnet_id_param }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Trunk
+
+ vm_typeX_3_extnet_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: int_extnet_net_id }
+ fixed_ips:
+ - ip_address: { get_param: lb_2_extnet_floating_v6_ip }
+ subnet: { get_param: subnet_param }
+ subnet_id: { get_param: subnet_id_param }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Mirrored_Trunk
+
diff --git a/ice_validator/tests/fixtures/test_neutron_port_internal_network/fail/fail0_base.yaml b/ice_validator/tests/fixtures/test_neutron_port_internal_network/fail/fail0_base.yaml
new file mode 100644
index 0000000..4fa9c0b
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_neutron_port_internal_network/fail/fail0_base.yaml
@@ -0,0 +1,63 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+outputs:
+
+ #int_extnet_net_id:
+ # value: { get_resource: int_extnet_net_id }
+ #int_intranet_net_name:
+ # value: { get_param: int_intranet_net_name }
+
+
+resources:
+
+ int_intranet_net_name:
+ type: OS::Neutron::Net
+ properties:
+ name: { get_param: int_intranet_net_name }
+
+ int_extnet_net_id:
+ type: OS::Neutron::Net
+
+parameters:
+ int_intranet_net_name:
+ type: string
diff --git a/ice_validator/tests/fixtures/test_neutron_port_internal_network/pass/pass0.yaml b/ice_validator/tests/fixtures/test_neutron_port_internal_network/pass/pass0.yaml
new file mode 100644
index 0000000..85d0524
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_neutron_port_internal_network/pass/pass0.yaml
@@ -0,0 +1,100 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+parameters:
+
+ vm_typeX_bialy_vlan_filter:
+ type: comma_delimited_list
+ vm_typeX_bialy_public_vlans:
+ type: comma_delimited_list
+ vm_typeX_bialy_private_vlans:
+ type: comma_delimited_list
+ vm_typeX_bialy_guest_vlans:
+ type: comma_delimited_list
+ subnet_param:
+ type: string
+ subnet_id_param:
+ type: string
+ int_extnet_net_id:
+ type: string
+ int_intranet_net_name:
+ type: string
+resources:
+
+ vm_typeX_0_intranet_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: int_intranet_net_name }
+ fixed_ips:
+ - ip_address: { get_param: lb_1_int_intranet_floating_ip }
+ subnet: { get_param: subnet_param }
+ subnet_id: { get_param: subnet_id_param }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Trunk
+
+ vm_typeX_3_extnet_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: int_extnet_net_id }
+ fixed_ips:
+ - ip_address: { get_param: lb_2_extnet_floating_v6_ip }
+ subnet: { get_param: subnet_param }
+ subnet_id: { get_param: subnet_id_param }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Mirrored_Trunk
+
diff --git a/ice_validator/tests/fixtures/test_neutron_port_internal_network/pass/pass0_base.yaml b/ice_validator/tests/fixtures/test_neutron_port_internal_network/pass/pass0_base.yaml
new file mode 100644
index 0000000..464ea71
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_neutron_port_internal_network/pass/pass0_base.yaml
@@ -0,0 +1,63 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+outputs:
+
+ int_extnet_net_id:
+ value: { get_resource: int_extnet_net_id }
+ int_intranet_net_name:
+ value: { get_param: int_intranet_net_name }
+
+
+resources:
+
+ int_intranet_network:
+ type: OS::Neutron::Net
+ properties:
+ name: { get_param: int_intranet_net_name }
+
+ int_extnet_network:
+ type: OS::Neutron::Net
+
+parameters:
+ int_intranet_net_name:
+ type: string
diff --git a/ice_validator/tests/fixtures/test_neutron_port_network_parameter/fail/fail.yaml b/ice_validator/tests/fixtures/test_neutron_port_network_parameter/fail/fail.yaml
new file mode 100644
index 0000000..8beb00a
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_neutron_port_network_parameter/fail/fail.yaml
@@ -0,0 +1,16 @@
+heat_template_version: 2015-04-30
+
+description: fdsafsfsa
+
+parameters:
+
+ # network cloud
+ testnetwork:
+ type: snafjsa
+
+resources:
+
+ testport:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: testnetwork }
diff --git a/ice_validator/tests/fixtures/test_neutron_port_network_parameter/pass/pass.yaml b/ice_validator/tests/fixtures/test_neutron_port_network_parameter/pass/pass.yaml
new file mode 100644
index 0000000..86da04e
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_neutron_port_network_parameter/pass/pass.yaml
@@ -0,0 +1,16 @@
+heat_template_version: 2015-04-30
+
+description: fdsafsfsa
+
+parameters:
+
+ # network cloud
+ testnetwork:
+ type: string
+
+resources:
+
+ testport:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: testnetwork }
diff --git a/ice_validator/tests/fixtures/test_no_http_resources/fail/fail.yaml b/ice_validator/tests/fixtures/test_no_http_resources/fail/fail.yaml
new file mode 100644
index 0000000..7bf50af
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_no_http_resources/fail/fail.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:
+
+ admin_server_0:
+ type: OS::Nova::Server
+ properties:
+ availability_zone: { get_param: availability_zone_0 }
+ name: { get_param: [admin_names, 0] }
+ flavor: { get_param: admin_flavor_name}
+ networks:
+ - port: { get_resource: admin_0_exnet_0_port }
+ - port: { get_resource: admin_0_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 }
+ user_data:
+ get_file: http://server.example.com/files/user_data.sh
+
+ admin_server_1:
+ type: OS::Nova::Server
+ properties:
+ availability_zone: { get_param: availability_zone_0 }
+ name: { get_param: [admin_names, 1] }
+ flavor: { get_param: admin_flavor_name}
+ networks:
+ - port: { get_resource: admin_1_extnet_0_port }
+ - port: { get_resource: admin_1_extnet_1_port }
+ metadata:
+ vnf_name: { get_param: vnf_name }
+ vnf_id: { get_param: vnf_id }
+ vf_module_id: { get_param: vf_module_id }
+ personality: {"/opt/new.txt": { get_file: "new.txt" } }
+
+ 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}
+ 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: http://www.google.com.yaml
+ properties:
+ availability_zone: { get_param: availability_zone_0 }
+ name: { get_param: [lb_names, 0] }
+ flavor: { get_param: lb_flavor_name}
+ metadata:
+ vnf_name: { get_param: vnf_name }
+ vnf_id: { get_param: vnf_id }
+ vf_module_id: { get_param: vf_module_id } \ 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_no_http_resources/pass/valid_template.yaml
index 2efaa5d..0f5dcb6 100644
--- a/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_format/pass/valid_base_heat_template.yaml
+++ b/ice_validator/tests/fixtures/test_no_http_resources/pass/valid_template.yaml
@@ -40,30 +40,55 @@
---
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 }
+ admin_server_0:
+ type: OS::Nova::Server
+ properties:
+ availability_zone: { get_param: availability_zone_0 }
+ name: { get_param: [admin_names, 0] }
+ flavor: { get_param: admin_flavor_name}
+ networks:
+ - port: { get_resource: admin_0_exnet_0_port }
+ - port: { get_resource: admin_0_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 }
+ user_data:
+ get_file: user_data.sh
- 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 }
+ admin_server_1:
+ type: OS::Nova::Server
+ properties:
+ availability_zone: { get_param: availability_zone_0 }
+ name: { get_param: [admin_names, 1] }
+ flavor: { get_param: admin_flavor_name}
+ networks:
+ - port: { get_resource: admin_1_extnet_0_port }
+ - port: { get_resource: admin_1_extnet_1_port }
+ metadata:
+ vnf_name: { get_param: vnf_name }
+ vnf_id: { get_param: vnf_id }
+ vf_module_id: { get_param: vf_module_id }
+ personality: {"/opt/new.txt": { get_file: "new.txt"} }
- 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 }
+ 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}
+ metadata:
+ vnf_name: { get_param: vnf_name }
+ vnf_id: { get_param: vnf_id }
+ vf_module_id: { get_param: vf_module_id }
- 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
+ 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}
+ metadata:
+ vnf_name: { get_param: vnf_name }
+ vnf_id: { get_param: vnf_id }
+ vf_module_id: { get_param: vf_module_id } \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_no_image_files/fail/image.ami b/ice_validator/tests/fixtures/test_no_image_files/fail/image.ami
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_no_image_files/fail/image.ami
diff --git a/ice_validator/tests/fixtures/test_no_image_files/fail/image2.ISO b/ice_validator/tests/fixtures/test_no_image_files/fail/image2.ISO
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_no_image_files/fail/image2.ISO
diff --git a/ice_validator/tests/fixtures/test_no_image_files/fail/pass.sh b/ice_validator/tests/fixtures/test_no_image_files/fail/pass.sh
new file mode 100644
index 0000000..739dc11
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_no_image_files/fail/pass.sh
@@ -0,0 +1 @@
+echo "test" \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_no_image_files/fail/pass.yaml b/ice_validator/tests/fixtures/test_no_image_files/fail/pass.yaml
new file mode 100644
index 0000000..86da04e
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_no_image_files/fail/pass.yaml
@@ -0,0 +1,16 @@
+heat_template_version: 2015-04-30
+
+description: fdsafsfsa
+
+parameters:
+
+ # network cloud
+ testnetwork:
+ type: string
+
+resources:
+
+ testport:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: testnetwork }
diff --git a/ice_validator/tests/fixtures/test_no_image_files/fail/settings b/ice_validator/tests/fixtures/test_no_image_files/fail/settings
new file mode 100644
index 0000000..ad78c6f
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_no_image_files/fail/settings
@@ -0,0 +1 @@
+test=one \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_no_image_files/pass/pass.sh b/ice_validator/tests/fixtures/test_no_image_files/pass/pass.sh
new file mode 100644
index 0000000..739dc11
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_no_image_files/pass/pass.sh
@@ -0,0 +1 @@
+echo "test" \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_no_image_files/pass/pass.yaml b/ice_validator/tests/fixtures/test_no_image_files/pass/pass.yaml
new file mode 100644
index 0000000..86da04e
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_no_image_files/pass/pass.yaml
@@ -0,0 +1,16 @@
+heat_template_version: 2015-04-30
+
+description: fdsafsfsa
+
+parameters:
+
+ # network cloud
+ testnetwork:
+ type: string
+
+resources:
+
+ testport:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: testnetwork }
diff --git a/ice_validator/tests/fixtures/test_no_image_files/pass/settings b/ice_validator/tests/fixtures/test_no_image_files/pass/settings
new file mode 100644
index 0000000..ad78c6f
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_no_image_files/pass/settings
@@ -0,0 +1 @@
+test=one \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_non_server_name/fail/fail0.yaml b/ice_validator/tests/fixtures/test_non_server_name/fail/fail0.yaml
new file mode 100644
index 0000000..50acd30
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_non_server_name/fail/fail0.yaml
@@ -0,0 +1,126 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+parameters:
+
+ vm_typeX_bialy_vlan_filter:
+ type: comma_delimited_list
+ vm_typeX_bialy_public_vlans:
+ type: comma_delimited_list
+ vm_typeX_bialy_private_vlans:
+ type: comma_delimited_list
+ vm_typeX_bialy_guest_vlans:
+ type: comma_delimited_list
+
+resources:
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ name: mynameistrouble
+ network: { get_param: int_intranet_net_name }
+ fixed_ips:
+ - ip_address: { get_param: lb_1_int_intranet_floating_ip }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Trunk
+
+ vm_typeX_1_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ name:
+ str_replace: mynameisstilltrouble
+ network: { get_param: int_intranet_net_id }
+ fixed_ips:
+ - ip_address: { get_param: lb_2_int_intranet_floating_v6_ip }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Non_Trunk
+
+ vm_typeX_2_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: extnet_net_name }
+ fixed_ips:
+ - ip_address: { get_param: lb_1_extnet_floating_ip }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: OVS
+
+ vm_typeX_3_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: extnet_net_id }
+ fixed_ips:
+ - ip_address: { get_param: lb_2_extnet_floating_v6_ip }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Mirrored_Trunk
+
diff --git a/ice_validator/tests/fixtures/test_non_server_name/fail/fail1.yaml b/ice_validator/tests/fixtures/test_non_server_name/fail/fail1.yaml
new file mode 100644
index 0000000..daa2045
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_non_server_name/fail/fail1.yaml
@@ -0,0 +1,129 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+parameters:
+
+ vm_typeX_bialy_vlan_filter:
+ type: comma_delimited_list
+ vm_typeX_bialy_public_vlans:
+ type: comma_delimited_list
+ vm_typeX_bialy_private_vlans:
+ type: comma_delimited_list
+ vm_typeX_bialy_guest_vlans:
+ type: comma_delimited_list
+
+resources:
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ name:
+ str_replace:
+ template:
+ params: mynameisstilltrouble
+ network: { get_param: int_intranet_net_name }
+ fixed_ips:
+ - ip_address: { get_param: lb_1_int_intranet_floating_ip }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Trunk
+
+ vm_typeX_1_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ name:
+ str_replace: {}
+ network: { get_param: int_intranet_net_id }
+ fixed_ips:
+ - ip_address: { get_param: lb_2_int_intranet_floating_v6_ip }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Non_Trunk
+
+ vm_typeX_2_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: extnet_net_name }
+ fixed_ips:
+ - ip_address: { get_param: lb_1_extnet_floating_ip }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: OVS
+
+ vm_typeX_3_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: extnet_net_id }
+ fixed_ips:
+ - ip_address: { get_param: lb_2_extnet_floating_v6_ip }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Mirrored_Trunk
+
diff --git a/ice_validator/tests/fixtures/test_non_server_name/fail/fail2.yaml b/ice_validator/tests/fixtures/test_non_server_name/fail/fail2.yaml
new file mode 100644
index 0000000..64a519b
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_non_server_name/fail/fail2.yaml
@@ -0,0 +1,133 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+parameters:
+
+ vm_typeX_bialy_vlan_filter:
+ type: comma_delimited_list
+ vm_typeX_bialy_public_vlans:
+ type: comma_delimited_list
+ vm_typeX_bialy_private_vlans:
+ type: comma_delimited_list
+ vm_typeX_bialy_guest_vlans:
+ type: comma_delimited_list
+
+resources:
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ name:
+ str_replace:
+ template:
+ params:
+ mynameisstillbad: foozle
+ network: { get_param: int_intranet_net_name }
+ fixed_ips:
+ - ip_address: { get_param: lb_1_int_intranet_floating_ip }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Trunk
+
+ vm_typeX_1_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ name:
+ str_replace:
+ template:
+ params:
+ mynameisstilltrouble:
+ network: { get_param: int_intranet_net_id }
+ fixed_ips:
+ - ip_address: { get_param: lb_2_int_intranet_floating_v6_ip }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Non_Trunk
+
+ vm_typeX_2_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: extnet_net_name }
+ fixed_ips:
+ - ip_address: { get_param: lb_1_extnet_floating_ip }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: OVS
+
+ vm_typeX_3_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: extnet_net_id }
+ fixed_ips:
+ - ip_address: { get_param: lb_2_extnet_floating_v6_ip }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Mirrored_Trunk
+
diff --git a/ice_validator/tests/fixtures/test_non_server_name/fail/fail3.yaml b/ice_validator/tests/fixtures/test_non_server_name/fail/fail3.yaml
new file mode 100644
index 0000000..2def749
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_non_server_name/fail/fail3.yaml
@@ -0,0 +1,135 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+parameters:
+
+ vm_typeX_bialy_vlan_filter:
+ type: comma_delimited_list
+ vm_typeX_bialy_public_vlans:
+ type: comma_delimited_list
+ vm_typeX_bialy_private_vlans:
+ type: comma_delimited_list
+ vm_typeX_bialy_guest_vlans:
+ type: comma_delimited_list
+
+resources:
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ name:
+ str_replace:
+ template:
+ params:
+ mynameisstillbad:
+ get_param: foozle
+ network: { get_param: int_intranet_net_name }
+ fixed_ips:
+ - ip_address: { get_param: lb_1_int_intranet_floating_ip }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Trunk
+
+ vm_typeX_1_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ name:
+ str_replace:
+ template:
+ params:
+ mynameisstilltrouble:
+ get_param:
+ network: { get_param: int_intranet_net_id }
+ fixed_ips:
+ - ip_address: { get_param: lb_2_int_intranet_floating_v6_ip }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Non_Trunk
+
+ vm_typeX_2_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: extnet_net_name }
+ fixed_ips:
+ - ip_address: { get_param: lb_1_extnet_floating_ip }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: OVS
+
+ vm_typeX_3_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: extnet_net_id }
+ fixed_ips:
+ - ip_address: { get_param: lb_2_extnet_floating_v6_ip }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Mirrored_Trunk
+
diff --git a/ice_validator/tests/fixtures/test_non_server_name/pass/pass0.yaml b/ice_validator/tests/fixtures/test_non_server_name/pass/pass0.yaml
new file mode 100644
index 0000000..ff96331
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_non_server_name/pass/pass0.yaml
@@ -0,0 +1,135 @@
+# -*- 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.
+#
+# VERSION: '1.0.0'
+
+---
+parameters:
+
+ vm_typeX_bialy_vlan_filter:
+ type: comma_delimited_list
+ vm_typeX_bialy_public_vlans:
+ type: comma_delimited_list
+ vm_typeX_bialy_private_vlans:
+ type: comma_delimited_list
+ vm_typeX_bialy_guest_vlans:
+ type: comma_delimited_list
+
+resources:
+
+ vm_typeX_0_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ name:
+ str_replace:
+ template: mynameisok_port2
+ params:
+ mynameisok:
+ get_param: vnf_name
+ network: { get_param: int_intranet_net_name }
+ fixed_ips:
+ - ip_address: { get_param: lb_1_int_intranet_floating_ip }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Trunk
+
+ vm_typeX_1_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ name:
+ str_replace:
+ template: mynameisok_port2
+ params:
+ mynameisok:
+ get_param: vnf_name
+ network: { get_param: int_intranet_net_id }
+ fixed_ips:
+ - ip_address: { get_param: lb_2_int_intranet_floating_v6_ip }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Non_Trunk
+
+ vm_typeX_2_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: extnet_net_name }
+ fixed_ips:
+ - ip_address: { get_param: lb_1_extnet_floating_ip }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: OVS
+
+ vm_typeX_3_bialy_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: extnet_net_id }
+ fixed_ips:
+ - ip_address: { get_param: lb_2_extnet_floating_v6_ip }
+ binding:vnic_type: direct
+ value_specs:
+ vlan_filter: {get_param: vm_typeX_bialy_vlan_filter}
+ public_vlans: {get_param: vm_typeX_bialy_public_vlans}
+ private_vlans: {get_param: vm_typeX_bialy_private_vlans}
+ guest_vlans: {get_param: vm_typeX_bialy_guest_vlans}
+ vlan_mirror:
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true
+ metadata:
+ port_type: SR-IOV_Mirrored_Trunk
+
diff --git a/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/fail/fail.yaml b/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/fail/fail.yaml
new file mode 100644
index 0000000..e0a7b60
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/fail/fail.yaml
@@ -0,0 +1,56 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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: Simple template to deploy a single compute instance
+
+parameters:
+ vm1_name_1:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
+
+ vm2_name_0:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
+
+ vm2_name_2:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/fail/fail2.yaml b/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/fail/fail2.yaml
new file mode 100644
index 0000000..77b388e
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/fail/fail2.yaml
@@ -0,0 +1,55 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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: Simple template to deploy a single compute instance
+
+parameters:
+ vm3_name_0:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
+
+ vm3_name_2:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
+
+resources:
+ vm1_server_0:
+ type: nested.yaml
diff --git a/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/fail/nested.yaml b/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/fail/nested.yaml
new file mode 100644
index 0000000..207d8f6
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/fail/nested.yaml
@@ -0,0 +1,46 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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: Simple template to deploy a single compute instance
+
+parameters:
+ vm2_name_16:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
diff --git a/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/pass/nested.yaml b/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/pass/nested.yaml
new file mode 100644
index 0000000..71d5419
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/pass/nested.yaml
@@ -0,0 +1,46 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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: Simple template to deploy a single compute instance
+
+parameters:
+ vm1_name_16:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
diff --git a/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/pass/pass.yaml b/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/pass/pass.yaml
new file mode 100644
index 0000000..4a3a81f
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/pass/pass.yaml
@@ -0,0 +1,51 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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: Simple template to deploy a single compute instance
+
+parameters:
+ vm1_name_0:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
+
+ vm1_name_1:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
diff --git a/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/pass/pass2.yaml b/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/pass/pass2.yaml
new file mode 100644
index 0000000..6f16fb2
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_server_name_parameters_start_at_0/pass/pass2.yaml
@@ -0,0 +1,54 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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: Simple template to deploy a single compute instance
+
+parameters:
+ vm2_name_0:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
+ vm2_name_1:
+ type: string
+ label: Key Name
+ description: Name of key-pair to be used for compute instance
+
+resources:
+ vm1_server_0:
+ type: nested.yaml
diff --git a/ice_validator/tests/fixtures/test_nova_server_resource_id/fail/fail.yaml b/ice_validator/tests/fixtures/test_nova_server_resource_id/fail/fail.yaml
new file mode 100644
index 0000000..a587025
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_server_resource_id/fail/fail.yaml
@@ -0,0 +1,56 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+
+resources:
+ dont_mind_me:
+ type: not-a-nova-server
+ server_0:
+ type: OS::Nova::Server
+ _server_1:
+ type: OS::Nova::Server
+ _server_:
+ type: OS::Nova::Server
+ foo_server_:
+ type: OS::Nova::Server
+
diff --git a/ice_validator/tests/fixtures/test_nova_server_resource_id/pass/pass.yaml b/ice_validator/tests/fixtures/test_nova_server_resource_id/pass/pass.yaml
new file mode 100644
index 0000000..7f19679
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_server_resource_id/pass/pass.yaml
@@ -0,0 +1,56 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+
+resources:
+ dont_mind_me:
+ type: not-a-nova-server
+ ok_server_0:
+ type: OS::Nova::Server
+ ok_server_1:
+ type: OS::Nova::Server
+ ok_server_2:
+ type: OS::Nova::Server
+ foo_server_0:
+ type: OS::Nova::Server
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet/fail/fail0.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet/fail/fail0.yaml
new file mode 100644
index 0000000..2a31b23
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet/fail/fail0.yaml
@@ -0,0 +1,55 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.1'
+
+# resource of type "OS::Nova::Server" has metadata "valet_groups"
+# FAIL: invalid format
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: [vm_type_a_names, 0] }
+ flavor: { get_param: vm_type_a_flavor_name}
+ image: { get_param: vm_type_a_image_name}
+ metadata:
+ valet_groups: 'Valet_Rule, has embedded-space'
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_index/fail/fail0.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet/pass/pass.yaml
index b75f58c..bba5ffd 100644
--- a/ice_validator/tests/fixtures/test_nova_servers_index/fail/fail0.yaml
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet/pass/pass.yaml
@@ -38,7 +38,10 @@
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-# VERSION = '1.0.0'
+# VERSION = '1.0.1'
+
+# resource of type "OS::Nova::Server" has metadata
+# which references parameter "workload_context" of type "string".
---
resources:
@@ -48,25 +51,24 @@ resources:
name: { get_param: [vm_type_a_names, 0] }
flavor: { get_param: vm_type_a_flavor_name}
image: { get_param: vm_type_a_image_name}
+ metadata:
+ valet_groups: 'rule1'
- vm_type_a_server_2:
+ vm_type_a_server_1:
type: OS::Nova::Server
properties:
name: { get_param: [vm_type_a_names, 1] }
flavor: { get_param: vm_type_a_flavor_name}
image: { get_param: vm_type_a_image_name}
+ metadata:
+ valet_groups: 'rule1, rule2, rule3'
- vm_type_b_server_0:
- type: OS::Nova::Server
- properties:
- name: { get_param: vm_type_b_name_0 }
- flavor: { get_param: vm_type_b_flavor_name}
- image: { get_param: vm_type_b_image_name}
-
- vm_type_b_server_1:
+ vm_type_a_server_2:
type: OS::Nova::Server
properties:
- name: { get_param: vm_type_b_name_1 }
- flavor: { get_param: vm_type_b_flavor_name}
- image: { get_param: vm_type_b_image_name}
+ name: { get_param: [vm_type_a_names, 2] }
+ flavor: { get_param: vm_type_a_flavor_name}
+ image: { get_param: vm_type_a_image_name}
+ metadata:
+ valet_groups: 'rule1 , rule2, rule3 '
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail0.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail0.yaml
new file mode 100644
index 0000000..755a397
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail0.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.
+#
+
+# VERSION = '1.0.0'
+
+# If resource of type "OS::Nova::Server" has metadata.valet_groups
+# then every "OS::Nova::Server" must have a valid
+# properties.availability_zone.
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ xavailability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: {'get_param': xxxx}
+ $VALET_HOST_ASSIGNMENT: {'get_param': xxxx}
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: {'get_param': xxxx}
+ $VALET_HOST_ASSIGNMENT: {'get_param': xxxx}
+ metadata:
+ valet_groups: 'rule1'
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail1.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail1.yaml
new file mode 100644
index 0000000..29b5706
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail1.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.
+#
+
+# VERSION = '1.0.0'
+
+# If resource of type "OS::Nova::Server" has metadata.valet_groups
+# then every "OS::Nova::Server" must have a valid
+# properties.availability_zone.
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ availability_zone:
+ xstr_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: {'get_param': xxxx}
+ $VALET_HOST_ASSIGNMENT: {'get_param': xxxx}
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: {'get_param': xxxx}
+ $VALET_HOST_ASSIGNMENT: {'get_param': xxxx}
+ metadata:
+ valet_groups: 'rule1'
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail2.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail2.yaml
new file mode 100644
index 0000000..1ae0e30
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail2.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.
+#
+
+# VERSION = '1.0.0'
+
+# If resource of type "OS::Nova::Server" has metadata.valet_groups
+# then every "OS::Nova::Server" must have a valid
+# properties.availability_zone.
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ availability_zone:
+ str_replace:
+ xtemplate: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: {'get_param': xxxx}
+ $VALET_HOST_ASSIGNMENT: {'get_param': xxxx}
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: {'get_param': xxxx}
+ $VALET_HOST_ASSIGNMENT: {'get_param': xxxx}
+ metadata:
+ valet_groups: 'rule1'
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail3.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail3.yaml
new file mode 100644
index 0000000..4d3ab2b
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail3.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.
+#
+
+# VERSION = '1.0.0'
+
+# If resource of type "OS::Nova::Server" has metadata.valet_groups
+# then every "OS::Nova::Server" must have a valid
+# properties.availability_zone.
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ xparams:
+ $AZ: {'get_param': xxxx}
+ $VALET_HOST_ASSIGNMENT: {'get_param': xxxx}
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: {'get_param': xxxx}
+ $VALET_HOST_ASSIGNMENT: {'get_param': xxxx}
+ metadata:
+ valet_groups: 'rule1'
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail4.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail4.yaml
new file mode 100644
index 0000000..5be8642
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail4.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.
+#
+
+# VERSION = '1.0.0'
+
+# If resource of type "OS::Nova::Server" has metadata.valet_groups
+# then every "OS::Nova::Server" must have a valid
+# properties.availability_zone.
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ x$AZ: {'get_param': xxxx}
+ $VALET_HOST_ASSIGNMENT: {'get_param': xxxx}
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: {'get_param': xxxx}
+ $VALET_HOST_ASSIGNMENT: {'get_param': xxxx}
+ metadata:
+ valet_groups: 'rule1'
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail5.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail5.yaml
new file mode 100644
index 0000000..a95304d
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail5.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.
+#
+
+# VERSION = '1.0.0'
+
+# If resource of type "OS::Nova::Server" has metadata.valet_groups
+# then every "OS::Nova::Server" must have a valid
+# properties.availability_zone.
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: {'xget_param': xxxx}
+ $VALET_HOST_ASSIGNMENT: {'get_param': xxxx}
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: {'get_param': xxxx}
+ $VALET_HOST_ASSIGNMENT: {'get_param': xxxx}
+ metadata:
+ valet_groups: 'rule1'
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail6.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail6.yaml
new file mode 100644
index 0000000..410fc36
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/fail/fail6.yaml
@@ -0,0 +1,64 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+# If resource of type "OS::Nova::Server" has metadata.valet_groups
+# then every "OS::Nova::Server" must have a valid
+# properties.availability_zone.
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: {'get_param': xxxx}
+ $VALET_HOST_ASSIGNMENT: {'get_param': xxxx}
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ availability_zone: "bogus value here"
+ metadata:
+ valet_groups: 'rule1'
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/pass/pass0.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/pass/pass0.yaml
new file mode 100644
index 0000000..96e733d
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/pass/pass0.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.
+#
+
+# VERSION = '1.0.0'
+
+# If resource of type "OS::Nova::Server" has metadata.valet_groups
+# then every "OS::Nova::Server" must have a valid
+# properties.availability_zone.
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: {'get_param': xxxx}
+ $VALET_HOST_ASSIGNMENT: {'get_param': xxxx}
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: {'get_param': xxxx}
+ $VALET_HOST_ASSIGNMENT: {'get_param': xxxx}
+ metadata:
+ valet_groups: 'rule1'
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/pass/pass1.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/pass/pass1.yaml
new file mode 100644
index 0000000..00e4a92
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_availability_zone/pass/pass1.yaml
@@ -0,0 +1,66 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+# If resource of type "OS::Nova::Server" has metadata.valet_groups
+# then every "OS::Nova::Server" must have a valid
+# properties.availability_zone.
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ availability_zone:
+ str_replace:
+ params:
+ $AZ: {'get_param': xxxx}
+ $VALET_HOST_ASSIGNMENT: {'get_param': xxxx}
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: {'get_param': xxxx}
+ $VALET_HOST_ASSIGNMENT: {'get_param': xxxx}
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail0.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail0.yaml
new file mode 100644
index 0000000..6759d45
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail0.yaml
@@ -0,0 +1,93 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+
+parameters:
+ vm_type_a_name_0:
+ type: string
+ description: VM Name for vm_type_a VM 0
+ availability_zone_0:
+ type: string
+ description: availability zone 0 name
+ vm_type_a_valet_host_0:
+ type: string
+ description: Compute Name that vm_type_a VM 0 will be deployed on
+ vm_type_a_name_1:
+ type: string
+ description: VM Name for vm_type_a VM 1
+ availability_zone_1:
+ type: string
+ description: availability zone 1 name
+ vm_type_a_valet_host_1:
+ type: string
+ description: Compute Name that vm_type_a VM 1 will be deployed on
+
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: vm_type_a_name_0}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_0 }
+ $VALET_HOST_ASSIGNMENT: { get_param: vm_type_a_valet_host_0 }
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: vm_type_a_name_1}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_1 }
+ $VALET_HOST_ASSIGNMENT: { get_param: vm_type_X_valet_host_1 }
+ metadata:
+ valet_groups: "Valet_Rule_Name_01, Valet_Rule_Name_02"
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail0c.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail0c.yaml
new file mode 100644
index 0000000..07d438d
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail0c.yaml
@@ -0,0 +1,91 @@
+# -*- 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.
+#
+
+# VERSION = '1.1.0'
+
+---
+
+parameters:
+ vm_type_a_names:
+ type: string
+ description: VM Names for vm_type_a
+ vm_type_a_valet_hosts:
+ type: comma_delimited_list
+ description: Compute Names that vm_type_a will be deployed on
+ availability_zone_0:
+ type: string
+ description: availability zone 0 name
+ availability_zone_1:
+ type: string
+ description: availability zone 1 name
+
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: [vm_type_a_names, 0]}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_0 }
+ $VALET_HOST_ASSIGNMENT: { get_param: [
+ vm_type_a_valet_hosts,
+ get_param: index]}
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: [vm_type_a_names, 1]}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_1 }
+ $VALET_HOST_ASSIGNMENT: { get_param: [
+ vm_type_a_valet_hosts,
+ get_param: index]}
+ metadata:
+ valet_groups: "Valet_Rule_Name_01, Valet_Rule_Name_02"
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail1.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail1.yaml
new file mode 100644
index 0000000..4dab3eb
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail1.yaml
@@ -0,0 +1,93 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+
+parameters:
+ vm_type_a_name_0:
+ type: string
+ description: VM Name for vm_type_a VM 0
+ availability_zone_0:
+ type: string
+ description: availability zone 0 name
+ vm_type_a_valet_host_0:
+ type: string
+ description: Compute Name that vm_type_a VM 0 will be deployed on
+ vm_type_a_name_1:
+ type: string
+ description: VM Name for vm_type_a VM 1
+ availability_zone_1:
+ type: string
+ description: availability zone 1 name
+ vm_type_a_valet_host_1:
+ type: string
+ description: Compute Name that vm_type_a VM 1 will be deployed on
+
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: vm_type_a_name_0}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_0 }
+ $VALET_HOST_ASSIGNMENT: { get_param: vm_type_a_valet_host_0 }
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: vm_type_a_name_1}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VaLET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_1 }
+ $VALET_HOST_ASSIGNMENT: { get_param: vm_type_a_valet_host_1 }
+ metadata:
+ valet_groups: "Valet_Rule_Name_01, Valet_Rule_Name_02"
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail1c.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail1c.yaml
new file mode 100644
index 0000000..997a06d
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail1c.yaml
@@ -0,0 +1,91 @@
+# -*- 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.
+#
+
+# VERSION = '1.1.0'
+
+---
+
+parameters:
+ vm_type_a_names:
+ type: comma_delimited_list
+ description: VM Names for vm_type_a
+ vm_type_a_valet_hosts:
+ type: comma_delimited_list
+ description: Compute Names that vm_type_a will be deployed on
+ availability_zone_0:
+ type: string
+ description: availability zone 0 name
+ availability_zone_2:
+ type: string
+ description: availability zone 2 name
+
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: [vm_type_a_names, 0]}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_0 }
+ $VALET_HOST_ASSIGNMENT: { get_param: [
+ vm_type_a_valet_hosts,
+ get_param: index]}
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: [vm_type_a_names, 1]}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_1 }
+ $VALET_HOST_ASSIGNMENT: { get_param: [
+ vm_type_a_valet_hosts,
+ get_param: index]}
+ metadata:
+ valet_groups: "Valet_Rule_Name_01, Valet_Rule_Name_02"
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail2.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail2.yaml
new file mode 100644
index 0000000..0643d99
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail2.yaml
@@ -0,0 +1,93 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+
+parameters:
+ vm_type_a_name_0:
+ type: string
+ description: VM Name for vm_type_a VM 0
+ availability_zone_0:
+ type: string
+ description: availability zone 0 name
+ vm_type_a_valet_host_0:
+ type: string
+ description: Compute Name that vm_type_a VM 0 will be deployed on
+ vm_type_a_name_1:
+ type: string
+ description: VM Name for vm_type_a VM 1
+ availability_zone_1:
+ type: string
+ description: availability zone 1 name
+ vm_type_a_valet_host_1:
+ type: string
+ description: Compute Name that vm_type_a VM 1 will be deployed on
+
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: vm_type_a_name_0}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_0 }
+ $VALET_HOST_ASSIGNMENT: { get_param: vm_type_a_valet_host_0 }
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: vm_type_a_name_1}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ Xtemplate: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_1 }
+ $VALET_HOST_ASSIGNMENT: { get_param: vm_type_a_valet_host_1 }
+ metadata:
+ valet_groups: "Valet_Rule_Name_01, Valet_Rule_Name_02"
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail2c.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail2c.yaml
new file mode 100644
index 0000000..7eefac6
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail2c.yaml
@@ -0,0 +1,91 @@
+# -*- 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.
+#
+
+# VERSION = '1.1.0'
+
+---
+
+parameters:
+ vm_type_a_names:
+ type: comma_delimited_list
+ description: VM Names for vm_type_a
+ vm_type_a_valet_hosts:
+ type: comma_delimited_list
+ description: Compute Names that vm_type_a will be deployed on
+ availability_zone_0:
+ type: string
+ description: availability zone 0 name
+ availability_zone_1:
+ type: string
+ description: availability zone 1 name
+
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: [vm_type_a_names, 0]}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_0 }
+ $VALET_HOST_ASSIGNMENT: { get_param: [
+ vm_type_a_valet_hosts,
+ get_param: index]}
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: [vm_type_a_names, 1]}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_1 }
+ $VALET_HOST_ASSIGNMENT: { get_param: [
+ vm_type_a_valet_hosts,
+ get_param: index]}
+ metadata:
+ valet_groups: "Valet_Rule_Name_01, Valet_Rule_Name_02"
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail3.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail3.yaml
new file mode 100644
index 0000000..9d6827b
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail3.yaml
@@ -0,0 +1,93 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+
+parameters:
+ vm_type_a_name_0:
+ type: string
+ description: VM Name for vm_type_a VM 0
+ availability_zone_0:
+ type: string
+ description: availability zone 0 name
+ vm_type_a_valet_host_0:
+ type: string
+ description: Compute Name that vm_type_a VM 0 will be deployed on
+ vm_type_a_name_1:
+ type: string
+ description: VM Name for vm_type_a VM 1
+ availability_zone_1:
+ type: string
+ description: availability zone 1 name
+ vm_type_a_valet_host_1:
+ type: string
+ description: Compute Name that vm_type_a VM 1 will be deployed on
+
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: vm_type_a_name_0}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_0 }
+ $VALET_HOST_ASSIGNMENT: { get_param: vm_type_a_valet_host_0 }
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: vm_type_a_name_1}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ Xparams:
+ $AZ: { get_param: availability_zone_1 }
+ $VALET_HOST_ASSIGNMENT: { get_param: vm_type_a_valet_host_1 }
+ metadata:
+ valet_groups: "Valet_Rule_Name_01, Valet_Rule_Name_02"
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail4.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail4.yaml
new file mode 100644
index 0000000..b9174eb
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail4.yaml
@@ -0,0 +1,93 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+
+parameters:
+ vm_type_a_name_0:
+ type: string
+ description: VM Name for vm_type_a VM 0
+ availability_zone_0:
+ type: string
+ description: availability zone 0 name
+ vm_type_a_valet_host_0:
+ type: string
+ description: Compute Name that vm_type_a VM 0 will be deployed on
+ vm_type_a_name_1:
+ type: string
+ description: VM Name for vm_type_a VM 1
+ availability_zone_1:
+ type: string
+ description: availability zone 1 name
+ vm_type_a_valet_host_1:
+ type: string
+ description: Compute Name that vm_type_a VM 1 will be deployed on
+
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: vm_type_a_name_0}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_0 }
+ $VALET_HOST_ASSIGNMENT: { get_param: vm_type_a_valet_host_0 }
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: vm_type_a_name_1}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ X$AZ: { get_param: availability_zone_1 }
+ $VALET_HOST_ASSIGNMENT: { get_param: vm_type_a_valet_host_1 }
+ metadata:
+ valet_groups: "Valet_Rule_Name_01, Valet_Rule_Name_02"
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail5.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail5.yaml
new file mode 100644
index 0000000..dff47d6
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail5.yaml
@@ -0,0 +1,93 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+
+parameters:
+ vm_type_a_name_0:
+ type: string
+ description: VM Name for vm_type_a VM 0
+ availability_zone_0:
+ type: string
+ description: availability zone 0 name
+ vm_type_a_valet_host_0:
+ type: string
+ description: Compute Name that vm_type_a VM 0 will be deployed on
+ vm_type_a_name_1:
+ type: string
+ description: VM Name for vm_type_a VM 1
+ availability_zone_1:
+ type: string
+ description: availability zone 1 name
+ vm_type_a_valet_host_1:
+ type: string
+ description: Compute Name that vm_type_a VM 1 will be deployed on
+
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: vm_type_a_name_0}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_0 }
+ $VALET_HOST_ASSIGNMENT: { get_param: vm_type_a_valet_host_0 }
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: vm_type_a_name_1}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { Xget_param: availability_zone_1 }
+ $VALET_HOST_ASSIGNMENT: { get_param: vm_type_a_valet_host_1 }
+ metadata:
+ valet_groups: "Valet_Rule_Name_01, Valet_Rule_Name_02"
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail6.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail6.yaml
new file mode 100644
index 0000000..46bc241
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail6.yaml
@@ -0,0 +1,93 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+
+parameters:
+ vm_type_a_name_0:
+ type: string
+ description: VM Name for vm_type_a VM 0
+ availability_zone_0:
+ type: string
+ description: availability zone 0 name
+ vm_type_a_valet_host_0:
+ type: string
+ description: Compute Name that vm_type_a VM 0 will be deployed on
+ vm_type_a_name_1:
+ type: string
+ description: VM Name for vm_type_a VM 1
+ availability_zone_1:
+ type: string
+ description: availability zone 1 name
+ vm_type_a_valet_host_1:
+ type: string
+ description: Compute Name that vm_type_a VM 1 will be deployed on
+
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: vm_type_a_name_0}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_0 }
+ $VALET_HOST_ASSIGNMENT: { get_param: vm_type_a_valet_host_0 }
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: vm_type_a_name_1}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: Xavailability_zone_1 }
+ $VALET_HOST_ASSIGNMENT: { get_param: vm_type_a_valet_host_1 }
+ metadata:
+ valet_groups: "Valet_Rule_Name_01, Valet_Rule_Name_02"
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail8.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail8.yaml
new file mode 100644
index 0000000..98df513
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail8.yaml
@@ -0,0 +1,93 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+
+parameters:
+ vm_type_a_name_0:
+ type: string
+ description: VM Name for vm_type_a VM 0
+ availability_zone_0:
+ type: string
+ description: availability zone 0 name
+ vm_type_a_valet_host_0:
+ type: string
+ description: Compute Name that vm_type_a VM 0 will be deployed on
+ vm_type_a_name_1:
+ type: string
+ description: VM Name for vm_type_a VM 1
+ Xavailability_zone_1:
+ type: string
+ description: availability zone 1 name
+ vm_type_a_valet_host_1:
+ type: string
+ description: Compute Name that vm_type_a VM 1 will be deployed on
+
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: vm_type_a_name_0}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_0 }
+ $VALET_HOST_ASSIGNMENT: { get_param: vm_type_a_valet_host_0 }
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: vm_type_a_name_1}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_1 }
+ $VALET_HOST_ASSIGNMENT: { get_param: vm_type_a_valet_host_1 }
+ metadata:
+ valet_groups: "Valet_Rule_Name_01, Valet_Rule_Name_02"
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail9.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail9.yaml
new file mode 100644
index 0000000..c30b387
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_host/fail/fail9.yaml
@@ -0,0 +1,93 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+
+parameters:
+ vm_type_a_name_0:
+ type: string
+ description: VM Name for vm_type_a VM 0
+ availability_zone_0:
+ type: string
+ description: availability zone 0 name
+ vm_type_a_valet_host_0:
+ type: string
+ description: Compute Name that vm_type_a VM 0 will be deployed on
+ vm_type_a_name_1:
+ type: string
+ description: VM Name for vm_type_a VM 1
+ availability_zone_1:
+ type: string
+ description: availability zone 1 name
+ vm_type_a_valet_host_1:
+ type: string
+ description: Compute Name that vm_type_a VM 1 will be deployed on
+
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: vm_type_a_name_0}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_0 }
+ $VALET_HOST_ASSIGNMENT: { get_param: vm_type_a_valet_host_0 }
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: Xvm_type_a_name_1}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_1 }
+ $VALET_HOST_ASSIGNMENT: { get_param: vm_type_a_valet_host_1 }
+ metadata:
+ valet_groups: "Valet_Rule_Name_01, Valet_Rule_Name_02"
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_host/pass/pass0.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_host/pass/pass0.yaml
new file mode 100644
index 0000000..beca864
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_host/pass/pass0.yaml
@@ -0,0 +1,93 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+
+parameters:
+ vm_type_a_name_0:
+ type: string
+ description: VM Name for vm_type_a VM 0
+ availability_zone_0:
+ type: string
+ description: availability zone 0 name
+ vm_type_a_valet_host_0:
+ type: string
+ description: Compute Name that vm_type_a VM 0 will be deployed on
+ vm_type_a_name_1:
+ type: string
+ description: VM Name for vm_type_a VM 1
+ availability_zone_1:
+ type: string
+ description: availability zone 1 name
+ vm_type_a_valet_host_1:
+ type: string
+ description: Compute Name that vm_type_a VM 1 will be deployed on
+
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: vm_type_a_name_0}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_0 }
+ $VALET_HOST_ASSIGNMENT: { get_param: vm_type_a_valet_host_0 }
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: vm_type_a_name_1}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_1 }
+ $VALET_HOST_ASSIGNMENT: { get_param: vm_type_a_valet_host_1 }
+ metadata:
+ valet_groups: "Valet_Rule_Name_01, Valet_Rule_Name_02"
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_valet_host/pass/pass1.yaml b/ice_validator/tests/fixtures/test_nova_servers_valet_host/pass/pass1.yaml
new file mode 100644
index 0000000..a00446b
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_nova_servers_valet_host/pass/pass1.yaml
@@ -0,0 +1,91 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+
+parameters:
+ vm_type_a_names:
+ type: comma_delimited_list
+ description: VM Names for vm_type_a
+ vm_type_a_valet_hosts:
+ type: comma_delimited_list
+ description: Compute Names that vm_type_a will be deployed on
+ availability_zone_0:
+ type: string
+ description: availability zone 0 name
+ availability_zone_1:
+ type: string
+ description: availability zone 1 name
+
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: [vm_type_a_names, 0]}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_0 }
+ $VALET_HOST_ASSIGNMENT: { get_param: [
+ vm_type_a_valet_hosts,
+ 0]}
+
+ vm_type_a_server_1:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: [vm_type_a_names, 1]}
+ flavor: ...
+ image: ...
+ availability_zone:
+ str_replace:
+ template: '$AZ$VALET_HOST_ASSIGNMENT'
+ params:
+ $AZ: { get_param: availability_zone_1 }
+ $VALET_HOST_ASSIGNMENT: { get_param: [
+ vm_type_a_valet_hosts,
+ 1]}
+ metadata:
+ valet_groups: "Valet_Rule_Name_01, Valet_Rule_Name_02"
+
diff --git a/ice_validator/tests/fixtures/test_port_connected_to_multiple_servers/fail/base_mod.yaml b/ice_validator/tests/fixtures/test_port_connected_to_multiple_servers/fail/base_mod.yaml
new file mode 100644
index 0000000..0dc304e
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_port_connected_to_multiple_servers/fail/base_mod.yaml
@@ -0,0 +1,21 @@
+heat_template_version: 2014-10-16
+
+resources:
+
+ vmtype_0_nr_port_0:
+ type: OS::Neutron::Port
+
+ vmtype_0_nr_port_1:
+ type: OS::Neutron::Port
+
+ vmtype_server_0:
+ type: OS::Nova::Server
+ properties:
+ networks:
+ - port: { get_resource: vmtype_0_nr_port_0}
+
+ vmtype_server_1:
+ type: OS::Nova::Server
+ properties:
+ networks:
+ - port: { get_resource: vmtype_0_nr_port_0}
diff --git a/ice_validator/tests/fixtures/test_port_connected_to_multiple_servers/pass/base_mod.yaml b/ice_validator/tests/fixtures/test_port_connected_to_multiple_servers/pass/base_mod.yaml
new file mode 100644
index 0000000..36d3f6e
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_port_connected_to_multiple_servers/pass/base_mod.yaml
@@ -0,0 +1,21 @@
+heat_template_version: 2014-10-16
+
+resources:
+
+ vmtype_0_nr_port_0:
+ type: OS::Neutron::Port
+
+ vmtype_0_nr_port_1:
+ type: OS::Neutron::Port
+
+ vmtype_server_0:
+ type: OS::Nova::Server
+ properties:
+ networks:
+ - port: { get_resource: vmtype_0_nr_port_0}
+
+ vmtype_server_1:
+ type: OS::Nova::Server
+ properties:
+ networks:
+ - port: { get_resource: vmtype_0_nr_port_1}
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 504fbdc..6471a84 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
@@ -136,7 +136,7 @@ resources:
name: { get_param: [admin_names, 2] }
flavor: { get_param: admin_flavor_name}
networks:
- - port: { get_resource: admin_2_int_vpnnet_port_0 }
+ - port: { get_resource: admin_2_int_oam_port_0 }
metadata:
vnf_name: { get_param: vnf_name }
vnf_id: { get_param: vnf_id }
@@ -172,15 +172,14 @@ resources:
properties:
network: { get_param: extnet_net_id }
- int_oam_net:
+ int_oam_network:
type: OS::Neutron::Net
properties:
name: { get_param: int_oam_net_name }
- admin_2_int_vpnnet_port_0:
+ admin_2_int_oam_port_0:
type: OS::Neutron::Port
properties:
- network: { get_resource: int_oam_net }
+ network: { get_resource: int_oam_network }
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_required_parameters_no_constraints/fail/heat_template_required_parameters_with_constraints.yaml b/ice_validator/tests/fixtures/test_required_parameters_no_constraints/fail/heat_template_required_parameters_with_constraints.yaml
index 1a49f68..f3507cd 100644
--- a/ice_validator/tests/fixtures/test_required_parameters_no_constraints/fail/heat_template_required_parameters_with_constraints.yaml
+++ b/ice_validator/tests/fixtures/test_required_parameters_no_constraints/fail/heat_template_required_parameters_with_constraints.yaml
@@ -78,4 +78,44 @@ parameters:
- allowed_values:
- 0
- 5
+ - 10
+ environment_context:
+ type: string
+ description: Unique ID for this VNF Module instance
+ constraints:
+ - range: { min: 0, max: 10 }
+ description: allowed range of values
+ - allowed_values:
+ - 0
+ - 5
+ - 10
+ workload_context:
+ type: string
+ description: Unique ID for this VNF Module instance
+ constraints:
+ - range: { min: 0, max: 10 }
+ description: allowed range of values
+ - allowed_values:
+ - 0
+ - 5
+ - 10
+ vf_module_index:
+ type: string
+ description: Unique ID for this VNF Module instance
+ constraints:
+ - range: { min: 0, max: 10 }
+ description: allowed range of values
+ - allowed_values:
+ - 0
+ - 5
+ - 10
+ vm_role:
+ type: string
+ description: Unique ID for this VNF Module instance
+ constraints:
+ - range: { min: 0, max: 10 }
+ description: allowed range of values
+ - allowed_values:
+ - 0
+ - 5
- 10 \ 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
deleted file mode 100644
index 1fd21a2..0000000
--- a/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_has_base_outputs/fail/invalid_base_heat_template_1.yaml
+++ /dev/null
@@ -1,90 +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.
-#
----
-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
deleted file mode 100644
index d4e38e6..0000000
--- a/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_has_base_outputs/fail/invalid_base_heat_template_2.yaml
+++ /dev/null
@@ -1,95 +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.
-#
----
-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
deleted file mode 100644
index 9d52e98..0000000
--- a/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_has_base_outputs/pass/valid_base_heat_template_1.yaml
+++ /dev/null
@@ -1,94 +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.
-#
----
-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
deleted file mode 100644
index ebec57b..0000000
--- a/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_has_base_outputs/pass/valid_base_heat_template_2.yaml
+++ /dev/null
@@ -1,76 +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.
-#
----
-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_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
deleted file mode 100644
index 2efaa5d..0000000
--- a/ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/pass/valid_base_heat_template_1.yaml
+++ /dev/null
@@ -1,69 +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.
-#
----
-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
deleted file mode 100644
index 90d46c3..0000000
--- a/ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/pass/valid_base_heat_template_2.yaml
+++ /dev/null
@@ -1,69 +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.
-#
----
-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
deleted file mode 100644
index 6cb3fb4..0000000
--- a/ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/pass/valid_base_heat_template_3.yaml
+++ /dev/null
@@ -1,69 +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.
-#
----
-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
deleted file mode 100644
index 90d46c3..0000000
--- a/ice_validator/tests/fixtures/test_reserve_port_only_in_base_template/pass/valid_module_heat_template.yaml
+++ /dev/null
@@ -1,69 +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.
-#
----
-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_resource_indices/fail/fail0.yaml b/ice_validator/tests/fixtures/test_resource_indices/fail/fail0.yaml
new file mode 100644
index 0000000..18c78b5
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_resource_indices/fail/fail0.yaml
@@ -0,0 +1,84 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+resources:
+
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: [vm_type_a_names, 0] }
+ flavor: { get_param: vm_type_a_flavor_name}
+ image: { get_param: vm_type_a_image_name}
+
+ vm_type_a_server_2:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: [vm_type_a_names, 1] }
+ flavor: { get_param: vm_type_a_flavor_name}
+ image: { get_param: vm_type_a_image_name}
+
+ vm_type_b_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: vm_type_b_name_0 }
+ flavor: { get_param: vm_type_b_flavor_name}
+ image: { get_param: vm_type_b_image_name}
+
+ vm_type_b_server_1:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: vm_type_b_name_1 }
+ flavor: { get_param: vm_type_b_flavor_name}
+ image: { get_param: vm_type_b_image_name}
+
+ vm_type_b_0_port_0:
+ type: OS::Neutron::Port
+
+ vm_type_b_0_port_1:
+ type: OS::Neutron::Port
+
+ vm_type_b_1_port_2:
+ type: OS::Neutron::Port
+
+ vm_type_b_1_port_3:
+ type: nested.yaml
diff --git a/ice_validator/tests/fixtures/test_resource_indices/fail/nested.yaml b/ice_validator/tests/fixtures/test_resource_indices/fail/nested.yaml
new file mode 100644
index 0000000..a30cef9
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_resource_indices/fail/nested.yaml
@@ -0,0 +1,55 @@
+# -*- 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============================================
+#
+
+resources:
+ vm_type_c_server_1:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: [vm_type_a_names, 0] }
+ flavor: { get_param: vm_type_a_flavor_name}
+ image: { get_param: vm_type_a_image_name}
+
+ vm_type_b_server_3:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: vm_type_b_name_0 }
+ flavor: { get_param: vm_type_b_flavor_name}
+ image: { get_param: vm_type_b_image_name}
+
+
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_index/fail/fail1.yaml b/ice_validator/tests/fixtures/test_resource_indices/pass/nested.yaml
index 4ee1d8b..034d1ad 100644
--- a/ice_validator/tests/fixtures/test_nova_servers_index/fail/fail1.yaml
+++ b/ice_validator/tests/fixtures/test_resource_indices/pass/nested.yaml
@@ -35,38 +35,28 @@
#
# ============LICENSE_END============================================
#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
-
-# VERSION = '1.0.0'
----
resources:
- vm_type_a_server_2:
+ vm_type_c_server_0:
type: OS::Nova::Server
properties:
name: { get_param: [vm_type_a_names, 0] }
flavor: { get_param: vm_type_a_flavor_name}
image: { get_param: vm_type_a_image_name}
- vm_type_a_server_1:
+ vm_type_c_server_1:
type: OS::Nova::Server
properties:
name: { get_param: [vm_type_a_names, 1] }
flavor: { get_param: vm_type_a_flavor_name}
image: { get_param: vm_type_a_image_name}
- vm_type_b_server_0:
+ vm_type_b_server_2:
type: OS::Nova::Server
properties:
name: { get_param: vm_type_b_name_0 }
flavor: { get_param: vm_type_b_flavor_name}
image: { get_param: vm_type_b_image_name}
- vm_type_b_server_1:
- type: OS::Nova::Server
- properties:
- name: { get_param: vm_type_b_name_1 }
- flavor: { get_param: vm_type_b_flavor_name}
- image: { get_param: vm_type_b_image_name}
+
diff --git a/ice_validator/tests/fixtures/test_nova_servers_index/pass/pass0.yaml b/ice_validator/tests/fixtures/test_resource_indices/pass/pass0.yaml
index 5f4a931..76ab92f 100644
--- a/ice_validator/tests/fixtures/test_nova_servers_index/pass/pass0.yaml
+++ b/ice_validator/tests/fixtures/test_resource_indices/pass/pass0.yaml
@@ -70,3 +70,16 @@ resources:
flavor: { get_param: vm_type_b_flavor_name}
image: { get_param: vm_type_b_image_name}
+ vm_type_b_0_port_0:
+ type: OS::Neutron::Port
+
+ vm_type_b_0_port_1:
+ type: OS::Neutron::Port
+
+ vm_type_b_1_port_0:
+ type: OS::Neutron::Port
+
+ nested_yaml:
+ type: nested.yaml
+
+
diff --git a/ice_validator/tests/fixtures/test_server_parameters/fail/fail.yaml b/ice_validator/tests/fixtures/test_server_parameters/fail/fail.yaml
new file mode 100644
index 0000000..d103a86
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_server_parameters/fail/fail.yaml
@@ -0,0 +1,72 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+description: base
+
+parameters:
+ vm_role:
+ type: number
+ vnf_id:
+ type: number
+ vf_module_id:
+ type: number
+ vnf_name:
+ type: number
+ vf_module_name:
+ type: number
+ vf_module_index:
+ type: string
+ availability_zone_0:
+ type: number
+
+resources:
+ server_0:
+ type: OS::Nova::Server
+ properties:
+ metadata:
+ vm_role: { get_param: vm_role }
+ vnf_id: { get_param: vnf_id }
+ vf_module_id: { get_param: vf_module_id }
+ vnf_name: { get_param: vnf_name }
+ vf_module_name: { get_param: vf_module_name }
+ vf_module_index: { get_param: vf_module_index }
diff --git a/ice_validator/tests/fixtures/test_server_parameters/pass/pass.yaml b/ice_validator/tests/fixtures/test_server_parameters/pass/pass.yaml
new file mode 100644
index 0000000..0998152
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_server_parameters/pass/pass.yaml
@@ -0,0 +1,72 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+description: base
+
+parameters:
+ vm_role:
+ type: string
+ vnf_id:
+ type: string
+ vf_module_id:
+ type: string
+ vnf_name:
+ type: string
+ vf_module_name:
+ type: string
+ vf_module_index:
+ type: number
+ availability_zone_0:
+ type: string
+
+resources:
+ server_0:
+ type: OS::Nova::Server
+ properties:
+ metadata:
+ vm_role: { get_param: vm_role }
+ vnf_id: { get_param: vnf_id }
+ vf_module_id: { get_param: vf_module_id }
+ vnf_name: { get_param: vnf_name }
+ vf_module_name: { get_param: vf_module_name }
+ vf_module_index: { get_param: vf_module_index }
diff --git a/ice_validator/tests/fixtures/test_servers_metadata_use_get_param/fail/not_using_get_param.yaml b/ice_validator/tests/fixtures/test_servers_metadata_use_get_param/fail/not_using_get_param.yaml
index cad3301..4e38fb5 100644
--- a/ice_validator/tests/fixtures/test_servers_metadata_use_get_param/fail/not_using_get_param.yaml
+++ b/ice_validator/tests/fixtures/test_servers_metadata_use_get_param/fail/not_using_get_param.yaml
@@ -44,9 +44,13 @@ resources:
properties:
name: {get_param: server_name_0}
metadata:
- vf_module_id:
- - vf_module_id
- vnf_id:
- - vnf_id
- vnf_name:
- - vnf_name
+ #vf_module_id: { get_param: vf_module_id }
+ #vnf_id: { get_param: vnf_id }
+ #vnf_name: { get_param: vnf_name }
+ #vf_module_name: { get_param: vf_module_name }
+ #vf_module_index: { get_param: vf_module_index }
+ vf_module_id: fadsfdsa
+ vnf_id: dasfasd
+ vnf_name: dsafasdf
+ vf_module_name: dfadsf
+ vf_module_index: dsafsadf
diff --git a/ice_validator/tests/fixtures/test_software_config_resource_id/fail/fail.yaml b/ice_validator/tests/fixtures/test_software_config_resource_id/fail/fail.yaml
new file mode 100644
index 0000000..9fa9f18
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_software_config_resource_id/fail/fail.yaml
@@ -0,0 +1,56 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+
+ vm_type_b_0_romeo_port_0:
+ type: OS::Neutron::Port
+
+ vm_type_c_0_int_romeo_port_0:
+ type: OS::Heat::SoftwareConfig
+
+ say_what_vm_type_c_0_port_0:
+ type: OS::Heat::SoftwareConfig
+
diff --git a/ice_validator/tests/fixtures/test_software_config_resource_id/pass/pass.yaml b/ice_validator/tests/fixtures/test_software_config_resource_id/pass/pass.yaml
new file mode 100644
index 0000000..fd14e55
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_software_config_resource_id/pass/pass.yaml
@@ -0,0 +1,56 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+
+ vm_type_b_0_romeo_port_0:
+ type: OS::Neutron::Port
+
+ vm_type_a_0_int_romeo_port_0:
+ type: OS::Heat::SoftwareConfig
+
+ say_what_vm_type_a_0_port_0:
+ type: OS::Heat::SoftwareConfig
+
diff --git a/ice_validator/tests/fixtures/test_subnet_format_use_get_param_or_get_resource/fail/get_param_not_used_for_subnet.yaml b/ice_validator/tests/fixtures/test_subnet_format_use_get_param_or_get_resource/fail/get_param_not_used_for_subnet.yaml
deleted file mode 100644
index 81908c2..0000000
--- a/ice_validator/tests/fixtures/test_subnet_format_use_get_param_or_get_resource/fail/get_param_not_used_for_subnet.yaml
+++ /dev/null
@@ -1,86 +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.
-#
----
-resources:
- vm_type_1_int_intranet_0_port:
- type: OS::Neutron::Port
- properties:
- network: { get_param: int_intranet_net_name }
- fixed_ips:
- - subnet_id: { get_param: int_intranet_subnet_id }
- - subnet_id: { get_param: int_intranet_v6_subnet_id }
-
- vm_type_1_int_vpnnet_1_port:
- type: OS::Neutron::Port
- properties:
- network: { get_param: int_vpnnet_net_id }
- fixed_ips:
- - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] }
- - subnet_id: { get_param1: int_vpnnet_subnet_id }
-
- vm_type_1_int_vpnnet_2_port:
- type: OS::Neutron::Port
- properties:
- network: { get_param: int_vpnnet_net_id }
- fixed_ips:
- - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] }
- - subnet_id: { int_vpnnet_subnet_id }
-
- vm_type_1_extnet_net_3_port:
- type: OS::Neutron::Port
- properties:
- network: { get_param: extnet_net_name }
- fixed_ips:
- - ip_address: { get_param: lb_1_extnet_ip_0 }
- - subnet_id: { get_param: extnet_subnet_id }
-
- vm_type_1_extnet_4_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 }
-
- vm_type_1_extnet_5_port:
- type: OS::Neutron::Port
- properties:
- network: { get_param: extnet_net_id }
-
diff --git a/ice_validator/tests/fixtures/test_subnet_format_use_get_param_or_get_resource/fail/get_resource_used_for_external_network.yaml b/ice_validator/tests/fixtures/test_subnet_format_use_get_param_or_get_resource/fail/get_resource_used_for_external_network.yaml
deleted file mode 100644
index e2ad5f4..0000000
--- a/ice_validator/tests/fixtures/test_subnet_format_use_get_param_or_get_resource/fail/get_resource_used_for_external_network.yaml
+++ /dev/null
@@ -1,86 +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.
-#
----
-resources:
- vm_type_1_int_intranet_0_port:
- type: OS::Neutron::Port
- properties:
- network: { get_param: int_intranet_net_name }
- fixed_ips:
- - subnet_id: { get_param: int_intranet_subnet_id }
- - subnet_id: { get_param: int_intranet_v6_subnet_id }
-
- vm_type_1_int_vpnnet_1_port:
- type: OS::Neutron::Port
- properties:
- network: { get_param: int_vpnnet_net_id }
- fixed_ips:
- - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] }
- - subnet_id: { get_param: int_vpnnet_subnet_id }
-
- vm_type_1_int_vpnnet_2_port:
- type: OS::Neutron::Port
- properties:
- network: { get_param: int_vpnnet_net_id }
- fixed_ips:
- - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] }
- - subnet_id: { get_resource: int_vpnnet_subnet_id }
-
- vm_type_1_extnet_net_3_port:
- type: OS::Neutron::Port
- properties:
- network: { get_param: extnet_net_name }
- fixed_ips:
- - ip_address: { get_param: lb_1_extnet_ip_0 }
- - subnet_id: { get_param: extnet_subnet_id }
-
- vm_type_1_extnet_4_port:
- type: OS::Neutron::Port
- properties:
- network: { get_param: extnet_net_id }
- fixed_ips:
- - subnet_id: { get_param: extnet_subnet_id }
- - subnet_id: { get_resource: extnet_v6_subnet_id }
-
- vm_type_1_extnet_5_port:
- type: OS::Neutron::Port
- properties:
- network: { get_param: extnet_net_id }
-
diff --git a/ice_validator/tests/fixtures/test_subnet_format_use_get_param_or_get_resource/pass/valid_heat_template.yaml b/ice_validator/tests/fixtures/test_subnet_format_use_get_param_or_get_resource/pass/valid_heat_template.yaml
deleted file mode 100644
index d6bf4bf..0000000
--- a/ice_validator/tests/fixtures/test_subnet_format_use_get_param_or_get_resource/pass/valid_heat_template.yaml
+++ /dev/null
@@ -1,86 +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.
-#
----
-resources:
- vm_type_1_int_intranet_0_port:
- type: OS::Neutron::Port
- properties:
- network: { get_param: int_intranet_net_name }
- fixed_ips:
- - subnet_id: { get_param: int_intranet_subnet_id }
- - subnet_id: { get_param: int_intranet_v6_subnet_id }
-
- vm_type_1_int_vpnnet_1_port:
- type: OS::Neutron::Port
- properties:
- network: { get_param: int_vpnnet_net_id }
- fixed_ips:
- - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] }
- - subnet_id: { get_param: int_vpnnet_subnet_id }
-
- vm_type_1_int_vpnnet_2_port:
- type: OS::Neutron::Port
- properties:
- network: { get_param: int_vpnnet_net_id }
- fixed_ips:
- - ip_address: { get_param: [db_1_int_vpnnet_ips, 0] }
- - subnet_id: { get_resource: int_vpnnet_subnet_id }
-
- vm_type_1_extnet_net_3_port:
- type: OS::Neutron::Port
- properties:
- network: { get_param: extnet_net_name }
- fixed_ips:
- - ip_address: { get_param: lb_1_extnet_ip_0 }
- - subnet_id: { get_param: extnet_subnet_id }
-
- vm_type_1_extnet_4_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 }
-
- vm_type_1_extnet_5_port:
- type: OS::Neutron::Port
- properties:
- network: { get_param: extnet_net_id }
-
diff --git a/ice_validator/tests/fixtures/test_unique_name_resources/fail/heat_template_1.yaml b/ice_validator/tests/fixtures/test_unique_name_resources/fail/heat_template_1.yaml
deleted file mode 100644
index 22c73de..0000000
--- a/ice_validator/tests/fixtures/test_unique_name_resources/fail/heat_template_1.yaml
+++ /dev/null
@@ -1,108 +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.
-#
----
-resources:
- lb_server_0:
- type: OS::Nova::Server
- properties:
- availability_zone: { get_param: availability_zone_0 }
- name: { get_param: [vm_type_a_names, 0] }
- flavor: { get_param: vm_type_a_flavor_name}
- image: { get_param: vm_type_a_image_name}
- block_device_mapping: [{ device_name: "vda", volume_id : { get_param : vm_type_a_cinder_volume_id_0 }, delete_on_termination : "false" }]
- metadata:
- vnf_name: { get_param: vnf_name }
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
-
- lb_server_3:
- type: OS::Nova::Server
- properties:
- availability_zone: { get_param: availability_zone_0 }
- name: { get_param: [vm_type_a_names, { get_param: lb_server_index }] }
- flavor: { get_param: vm_type_a_flavor_name}
- image: { get_param: vm_type_a_image_name}
- block_device_mapping: [{ device_name: "vda", volume_id : { get_param : vm_type_a_cinder_volume_id_0 }, delete_on_termination : "false" }]
- metadata:
- vnf_name: { get_param: vnf_name }
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
-
- lb_volume_0:
- type: OS::Cinder::Volume
- properties:
- name:
- str_replace:
- template: VNF_NAME_STACK_NAME_oam_volume
- params:
- VNF_NAME: { get_param: vnf_name }
- STACK_NAME: { get_param: 'OS::stack_name' }
-
- lb_volume_0:
- type: OS::Cinder::Volume
- properties:
- name:
- str_replace:
- template: MODULE_ID_STACK_NAME_oam_volume
- params:
- STACK_NAME: { get_param: 'OS::stack_name' }
- MODULE_ID: { get_param: vnf_module_id }
-
- lb_volume_1:
- type: OS::Cinder::Volume
- properties:
- name:
- str_replace:
- template: VNF_NAME_STACK_NAME_MODULE_ID_oam_volume
- params:
- VNF_NAME: { get_param: vnf_name }
- STACK_NAME: { get_param: 'OS::stack_name' }
- MODULE_ID: { get_param: vnf_module_id }
-
- my_keypair:
- type: OS::Nova::Keypair
- properties:
- name:
- str_replace:
- template: VNF_NAME_key_pair
- params:
- VNF_NAME: { get_param: vnf_name }
- public_key: {get_param: ssh_public_key}
- save_private_key: false
diff --git a/ice_validator/tests/fixtures/test_unique_name_resources/fail/heat_template_2_identical_to_heat_template_2.yaml b/ice_validator/tests/fixtures/test_unique_name_resources/fail/heat_template_2_identical_to_heat_template_2.yaml
deleted file mode 100644
index 22c73de..0000000
--- a/ice_validator/tests/fixtures/test_unique_name_resources/fail/heat_template_2_identical_to_heat_template_2.yaml
+++ /dev/null
@@ -1,108 +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.
-#
----
-resources:
- lb_server_0:
- type: OS::Nova::Server
- properties:
- availability_zone: { get_param: availability_zone_0 }
- name: { get_param: [vm_type_a_names, 0] }
- flavor: { get_param: vm_type_a_flavor_name}
- image: { get_param: vm_type_a_image_name}
- block_device_mapping: [{ device_name: "vda", volume_id : { get_param : vm_type_a_cinder_volume_id_0 }, delete_on_termination : "false" }]
- metadata:
- vnf_name: { get_param: vnf_name }
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
-
- lb_server_3:
- type: OS::Nova::Server
- properties:
- availability_zone: { get_param: availability_zone_0 }
- name: { get_param: [vm_type_a_names, { get_param: lb_server_index }] }
- flavor: { get_param: vm_type_a_flavor_name}
- image: { get_param: vm_type_a_image_name}
- block_device_mapping: [{ device_name: "vda", volume_id : { get_param : vm_type_a_cinder_volume_id_0 }, delete_on_termination : "false" }]
- metadata:
- vnf_name: { get_param: vnf_name }
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
-
- lb_volume_0:
- type: OS::Cinder::Volume
- properties:
- name:
- str_replace:
- template: VNF_NAME_STACK_NAME_oam_volume
- params:
- VNF_NAME: { get_param: vnf_name }
- STACK_NAME: { get_param: 'OS::stack_name' }
-
- lb_volume_0:
- type: OS::Cinder::Volume
- properties:
- name:
- str_replace:
- template: MODULE_ID_STACK_NAME_oam_volume
- params:
- STACK_NAME: { get_param: 'OS::stack_name' }
- MODULE_ID: { get_param: vnf_module_id }
-
- lb_volume_1:
- type: OS::Cinder::Volume
- properties:
- name:
- str_replace:
- template: VNF_NAME_STACK_NAME_MODULE_ID_oam_volume
- params:
- VNF_NAME: { get_param: vnf_name }
- STACK_NAME: { get_param: 'OS::stack_name' }
- MODULE_ID: { get_param: vnf_module_id }
-
- my_keypair:
- type: OS::Nova::Keypair
- properties:
- name:
- str_replace:
- template: VNF_NAME_key_pair
- params:
- VNF_NAME: { get_param: vnf_name }
- public_key: {get_param: ssh_public_key}
- save_private_key: false
diff --git a/ice_validator/tests/fixtures/test_unique_name_resources/pass/unique_resource_template_1.yml b/ice_validator/tests/fixtures/test_unique_name_resources/pass/unique_resource_template_1.yml
deleted file mode 100644
index 22c73de..0000000
--- a/ice_validator/tests/fixtures/test_unique_name_resources/pass/unique_resource_template_1.yml
+++ /dev/null
@@ -1,108 +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.
-#
----
-resources:
- lb_server_0:
- type: OS::Nova::Server
- properties:
- availability_zone: { get_param: availability_zone_0 }
- name: { get_param: [vm_type_a_names, 0] }
- flavor: { get_param: vm_type_a_flavor_name}
- image: { get_param: vm_type_a_image_name}
- block_device_mapping: [{ device_name: "vda", volume_id : { get_param : vm_type_a_cinder_volume_id_0 }, delete_on_termination : "false" }]
- metadata:
- vnf_name: { get_param: vnf_name }
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
-
- lb_server_3:
- type: OS::Nova::Server
- properties:
- availability_zone: { get_param: availability_zone_0 }
- name: { get_param: [vm_type_a_names, { get_param: lb_server_index }] }
- flavor: { get_param: vm_type_a_flavor_name}
- image: { get_param: vm_type_a_image_name}
- block_device_mapping: [{ device_name: "vda", volume_id : { get_param : vm_type_a_cinder_volume_id_0 }, delete_on_termination : "false" }]
- metadata:
- vnf_name: { get_param: vnf_name }
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
-
- lb_volume_0:
- type: OS::Cinder::Volume
- properties:
- name:
- str_replace:
- template: VNF_NAME_STACK_NAME_oam_volume
- params:
- VNF_NAME: { get_param: vnf_name }
- STACK_NAME: { get_param: 'OS::stack_name' }
-
- lb_volume_0:
- type: OS::Cinder::Volume
- properties:
- name:
- str_replace:
- template: MODULE_ID_STACK_NAME_oam_volume
- params:
- STACK_NAME: { get_param: 'OS::stack_name' }
- MODULE_ID: { get_param: vnf_module_id }
-
- lb_volume_1:
- type: OS::Cinder::Volume
- properties:
- name:
- str_replace:
- template: VNF_NAME_STACK_NAME_MODULE_ID_oam_volume
- params:
- VNF_NAME: { get_param: vnf_name }
- STACK_NAME: { get_param: 'OS::stack_name' }
- MODULE_ID: { get_param: vnf_module_id }
-
- my_keypair:
- type: OS::Nova::Keypair
- properties:
- name:
- str_replace:
- template: VNF_NAME_key_pair
- params:
- VNF_NAME: { get_param: vnf_name }
- public_key: {get_param: ssh_public_key}
- save_private_key: false
diff --git a/ice_validator/tests/fixtures/test_unique_name_resources/pass/unique_resource_template_2.yml b/ice_validator/tests/fixtures/test_unique_name_resources/pass/unique_resource_template_2.yml
deleted file mode 100644
index ec01c0b..0000000
--- a/ice_validator/tests/fixtures/test_unique_name_resources/pass/unique_resource_template_2.yml
+++ /dev/null
@@ -1,108 +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.
-#
----
-resources:
- lb_server_1:
- type: OS::Nova::Server
- properties:
- availability_zone: { get_param: availability_zone_0 }
- name: { get_param: [vm_type_a_names, 1] }
- flavor: { get_param: vm_type_a_flavor_name}
- image: { get_param: vm_type_a_image_name}
- block_device_mapping: [{ device_name: "vda", volume_id : { get_param : vm_type_a_cinder_volume_id_0 }, delete_on_termination : "false" }]
- metadata:
- vnf_name: { get_param: vnf_name }
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
-
- lb_server_4:
- type: OS::Nova::Server
- properties:
- availability_zone: { get_param: availability_zone_0 }
- name: { get_param: [vm_type_a_names, { get_param: lb_server_index }] }
- flavor: { get_param: vm_type_a_flavor_name}
- image: { get_param: vm_type_a_image_name}
- block_device_mapping: [{ device_name: "vda", volume_id : { get_param : vm_type_a_cinder_volume_id_0 }, delete_on_termination : "false" }]
- metadata:
- vnf_name: { get_param: vnf_name }
- vnf_id: { get_param: vnf_id }
- vf_module_id: { get_param: vf_module_id }
-
- lb_volume_2:
- type: OS::Cinder::Volume
- properties:
- name:
- str_replace:
- template: VNF_NAME_STACK_NAME_oam_volume
- params:
- VNF_NAME: { get_param: vnf_name }
- STACK_NAME: { get_param: 'OS::stack_name' }
-
- lb_volume_3:
- type: OS::Cinder::Volume
- properties:
- name:
- str_replace:
- template: MODULE_ID_STACK_NAME_oam_volume
- params:
- STACK_NAME: { get_param: 'OS::stack_name' }
- MODULE_ID: { get_param: vnf_module_id }
-
- lb_volume_2:
- type: OS::Cinder::Volume
- properties:
- name:
- str_replace:
- template: VNF_NAME_STACK_NAME_MODULE_ID_oam_volume
- params:
- VNF_NAME: { get_param: vnf_name }
- STACK_NAME: { get_param: 'OS::stack_name' }
- MODULE_ID: { get_param: vnf_module_id }
-
- my_keypair:
- type: OS::Nova::Keypair
- properties:
- name:
- str_replace:
- template: VNF_NAME_key_pair
- params:
- VNF_NAME: { get_param: vnf_name }
- public_key: {get_param: ssh_public_key}
- save_private_key: false
diff --git a/ice_validator/tests/fixtures/test_vm_type_case/fail/fail.yaml b/ice_validator/tests/fixtures/test_vm_type_case/fail/fail.yaml
new file mode 100644
index 0000000..16b740a
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_vm_type_case/fail/fail.yaml
@@ -0,0 +1,70 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+# resource of type "OS::Nova::Server" has metadata
+# which references parameter "environment_context" of type "string".
+
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: [vm_type_a_names, 0] }
+ flavor: { get_param: vm_type_a_flavor_name}
+ image: { get_param: vm_Type_a_image_name}
+ metadata:
+ my_attribute: {get_param: environment_context}
+
+ vm_type_a_0_romeo_port_0:
+ type: OS::Neutron::Port
+ properties:
+ name: { get_param: [vm_type_a_names, 0] }
+ flavor: { get_param: vm_Type_a_flavor_name}
+ image: { get_param: vm_Type_a_image_name}
+
+ vm_type_a_0_int_romeo_port_0:
+ type: OS::Neutron::Port
+ properties:
+ name: { get_param: [vm_Type_a_names, 0] }
+ flavor: { get_param: vm_Type_a_flavor_name}
+ image: { get_param: vm_Type_a_image_name}
+
diff --git a/ice_validator/tests/fixtures/test_vm_type_case/pass/pass.yaml b/ice_validator/tests/fixtures/test_vm_type_case/pass/pass.yaml
new file mode 100644
index 0000000..e3caa72
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_vm_type_case/pass/pass.yaml
@@ -0,0 +1,70 @@
+# -*- 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.
+#
+
+# VERSION = '1.0.0'
+
+# resource of type "OS::Nova::Server" has metadata
+# which references parameter "environment_context" of type "string".
+
+---
+resources:
+ vm_type_a_server_0:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: [vm_type_a_names, 0] }
+ flavor: { get_param: vm_type_a_flavor_name}
+ image: { get_param: vm_type_a_image_name}
+ metadata:
+ my_attribute: {get_param: environment_context}
+
+ vm_type_a_0_romeo_port_0:
+ type: OS::Neutron::Port
+ properties:
+ name: { get_param: [vm_type_a_names, 0] }
+ flavor: { get_param: vm_type_a_flavor_name}
+ image: { get_param: vm_type_a_image_name}
+
+ vm_type_a_0_int_romeo_port_0:
+ type: OS::Neutron::Port
+ properties:
+ name: { get_param: [vm_type_a_names, 0] }
+ flavor: { get_param: vm_type_a_flavor_name}
+ image: { get_param: vm_type_a_image_name}
+
diff --git a/ice_validator/tests/fixtures/test_volume_module_naming/fail/module_volumes.yaml b/ice_validator/tests/fixtures/test_volume_module_naming/fail/module_volumes.yaml
new file mode 100644
index 0000000..ea21f22
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_volume_module_naming/fail/module_volumes.yaml
@@ -0,0 +1,52 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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============================================
+resources:
+
+ vm_type_volume_0:
+ type: OS::Cinder::Volume
+
+ vm_type_volume_1:
+ type: OS::Cinder::Volume
+
+ vm_type_volume_0_RSG:
+ type: OS::Heat::ResourceGroup
+ properties:
+ resource_def:
+ type: nested_volume1.yaml
+
+ vm_type_volume_0_nested:
+ type: nested_volume2.yaml \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_volume_module_naming/fail/nested_volume1.yaml b/ice_validator/tests/fixtures/test_volume_module_naming/fail/nested_volume1.yaml
new file mode 100644
index 0000000..888aa75
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_volume_module_naming/fail/nested_volume1.yaml
@@ -0,0 +1,40 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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============================================
+resources:
+
+ vm_type_volume_2:
+ type: OS::Cinder::Volume \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_volume_module_naming/fail/nested_volume2.yaml b/ice_validator/tests/fixtures/test_volume_module_naming/fail/nested_volume2.yaml
new file mode 100644
index 0000000..6bce356
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_volume_module_naming/fail/nested_volume2.yaml
@@ -0,0 +1,40 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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============================================
+resources:
+
+ vm_type_volume_3:
+ type: OS::Cinder::Volume \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_volume_module_naming/pass/module2_base.yaml b/ice_validator/tests/fixtures/test_volume_module_naming/pass/module2_base.yaml
new file mode 100644
index 0000000..1c80888
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_volume_module_naming/pass/module2_base.yaml
@@ -0,0 +1,55 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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============================================
+resources:
+
+ vm_type_volume_0:
+ type: OS::Cinder::Volume
+
+ vm_type_volume_1:
+ type: OS::Cinder::Volume
+
+ vm_type_volume_0_RSG:
+ type: OS::Heat::ResourceGroup
+ properties:
+ resource_def:
+ type: nested_volume1.yaml
+
+ vm_type_volume_0_nested:
+ type: nested_volume2.yaml
+
+ vmtype_server_0:
+ type: OS::Nova::Server \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_volume_module_naming/pass/module_volume.yaml b/ice_validator/tests/fixtures/test_volume_module_naming/pass/module_volume.yaml
new file mode 100644
index 0000000..ea21f22
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_volume_module_naming/pass/module_volume.yaml
@@ -0,0 +1,52 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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============================================
+resources:
+
+ vm_type_volume_0:
+ type: OS::Cinder::Volume
+
+ vm_type_volume_1:
+ type: OS::Cinder::Volume
+
+ vm_type_volume_0_RSG:
+ type: OS::Heat::ResourceGroup
+ properties:
+ resource_def:
+ type: nested_volume1.yaml
+
+ vm_type_volume_0_nested:
+ type: nested_volume2.yaml \ No newline at end of file
diff --git a/ice_validator/tests/fixtures/test_volume_module_naming/pass/nested_volume1.yaml b/ice_validator/tests/fixtures/test_volume_module_naming/pass/nested_volume1.yaml
new file mode 100644
index 0000000..e96fd82
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_volume_module_naming/pass/nested_volume1.yaml
@@ -0,0 +1,40 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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============================================
+resources:
+
+ vm_type_volume_2:
+ type: OS::Cinder::Volume
diff --git a/ice_validator/tests/fixtures/test_volume_module_naming/pass/nested_volume2.yaml b/ice_validator/tests/fixtures/test_volume_module_naming/pass/nested_volume2.yaml
new file mode 100644
index 0000000..6bce356
--- /dev/null
+++ b/ice_validator/tests/fixtures/test_volume_module_naming/pass/nested_volume2.yaml
@@ -0,0 +1,40 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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============================================
+resources:
+
+ vm_type_volume_3:
+ type: OS::Cinder::Volume \ No newline at end of file
diff --git a/ice_validator/tests/helpers.py b/ice_validator/tests/helpers.py
index 502d3aa..fa106c3 100644
--- a/ice_validator/tests/helpers.py
+++ b/ice_validator/tests/helpers.py
@@ -42,29 +42,31 @@
"""
import os
+from collections import defaultdict
+
from boltons import funcutils
from tests import cached_yaml as yaml
-VERSION = '1.1.0'
+VERSION = "1.1.0"
def check_basename_ending(template_type, basename):
- '''
+ """
return True/False if the template type is matching
the filename
- '''
+ """
if not template_type:
return True
- elif template_type == 'volume':
- return basename.endswith('_volume')
+ elif template_type == "volume":
+ return basename.endswith("_volume")
else:
- return not basename.endswith('_volume')
+ return not basename.endswith("_volume")
def get_parsed_yml_for_yaml_files(yaml_files, sections=None):
- '''
+ """
get the parsed yaml for a list of yaml files
- '''
+ """
sections = [] if sections is None else sections
parsed_yml_list = []
for yaml_file in yaml_files:
@@ -73,7 +75,7 @@ def get_parsed_yml_for_yaml_files(yaml_files, sections=None):
yml = yaml.load(fh)
except yaml.YAMLError as e:
# pylint: disable=superfluous-parens
- print('Error in %s: %s' % (yaml_file, e))
+ print("Error in %s: %s" % (yaml_file, e))
continue
if yml:
if sections:
@@ -103,8 +105,10 @@ def validates(*requirement_ids):
@funcutils.wraps(func)
def wrapper(*args, **kw):
return func(*args, **kw)
+
wrapper.requirement_ids = requirement_ids
return wrapper
+
decorator.requirement_ids = requirement_ids
return decorator
@@ -124,3 +128,81 @@ def get_environment_pair(heat_template):
return environment_pair
return None
+
+
+def load_yaml(yaml_file):
+ """
+ Load the YAML file at the given path. If the file has previously been
+ loaded, then a cached version will be returned.
+
+ :param yaml_file: path to the YAML file
+ :return: data structure loaded from the YAML file
+ """
+ with open(yaml_file) as fh:
+ return yaml.load(fh)
+
+
+def traverse(data, search_key, func, path=None):
+ """
+ Traverse the data structure provided via ``data`` looking for occurences
+ of ``search_key``. When ``search_key`` is found, the value associated
+ with that key is passed to ``func``
+
+ :param data: arbitrary data structure of dicts and lists
+ :param search_key: key field to search for
+ :param func: Callable object that takes two parameters:
+ * A list representing the path of keys to search_key
+ * The value associated with the search_key
+ """
+ path = [] if path is None else path
+ if isinstance(data, dict):
+ for key, value in data.items():
+ curr_path = path + [key]
+ if key == search_key:
+ func(curr_path, value)
+ traverse(value, search_key, func, curr_path)
+ elif isinstance(data, list):
+ for value in data:
+ curr_path = path + [value]
+ if isinstance(value, dict):
+ traverse(value, search_key, func, curr_path)
+ elif value == search_key:
+ func(curr_path, value)
+
+
+def check_indices(pattern, values, value_type):
+ """
+ Checks that indices associated with the matched prefix start at 0 and
+ increment by 1. It returns a list of messages for any prefixes that
+ violate the rules.
+
+ :param pattern: Compiled regex that whose first group matches the prefix and
+ second group matches the index
+ :param values: sequence of string names that may or may not match the pattern
+ :param name: Type of value being checked (ex: IP Parameters). This will
+ be included in the error messages.
+ :return: List of error messages, empty list if no violations found
+ """
+ if not hasattr(pattern, "match"):
+ raise RuntimeError("Pattern must be a compiled regex")
+
+ prefix_indices = defaultdict(set)
+ for value in values:
+ m = pattern.match(value)
+ if m:
+ prefix_indices[m.group(1)].add(int(m.group(2)))
+
+ invalid_params = []
+ for prefix, indices in prefix_indices.items():
+ indices = sorted(indices)
+ if indices[0] != 0:
+ invalid_params.append(
+ "{} with prefix {} do not start at 0".format(value_type, prefix)
+ )
+ elif len(indices) - 1 != indices[-1]:
+ invalid_params.append(
+ (
+ "Index values of {} with prefix {} do not " + "increment by 1: {}"
+ ).format(value_type, prefix, indices)
+ )
+ return invalid_params
diff --git a/ice_validator/tests/parametrizers.py b/ice_validator/tests/parametrizers.py
index 641d53a..e44c6a6 100644
--- a/ice_validator/tests/parametrizers.py
+++ b/ice_validator/tests/parametrizers.py
@@ -48,365 +48,362 @@ import pytest
from .helpers import get_parsed_yml_for_yaml_files, check_basename_ending
from .utils.nested_files import get_list_of_nested_files
-VERSION = '1.0.0'
+VERSION = "1.0.0"
# pylint: disable=invalid-name
def get_template_dir(metafunc):
- '''
+ """
returns template_dir, either as its passed in on CLI
or, during --self-test, the directory whos name matches
the current tests module name
- '''
- if metafunc.config.getoption('template_dir') is None:
+ """
+ if metafunc.config.getoption("template_dir") is None:
return path.join(
- path.dirname(path.realpath(__file__)),
- 'fixtures',
- metafunc.function.__module__.split('.')[-1])
+ path.dirname(metafunc.module.__file__),
+ "fixtures",
+ metafunc.function.__module__.split(".")[-1],
+ )
else:
- return metafunc.config.getoption('template_dir')[0]
+ return metafunc.config.getoption("template_dir")[0]
+
+
+def file_is_a_nested_template(file):
+ directory = path.dirname(file)
+ nested_files = []
+ for filename in listdir(directory):
+ if filename.endswith(".yaml") or filename.endswith(".yml"):
+ filename = "{}/{}".format(directory, filename)
+ try:
+ with open(filename) as fh:
+ yml = yaml.load(fh)
+ if "resources" not in yml:
+ continue
+ nested_files.extend(
+ get_list_of_nested_files(yml["resources"], path.dirname(filename))
+ )
+ except yaml.YAMLError as e:
+ print(e) # pylint: disable=superfluous-parens
+ continue
+ return file in nested_files
def get_nested_files(filenames):
- '''
+ """
returns all the nested files for a set of filenames
- '''
+ """
nested_files = []
for filename in filenames:
- try:
- with open(filename) as fh:
- yml = yaml.load(fh)
- if "resources" not in yml:
- continue
- nested_files.extend(get_list_of_nested_files(
- yml["resources"],
- path.dirname(filename)))
- except yaml.YAMLError as e:
- print(e) # pylint: disable=superfluous-parens
- continue
+ if file_is_a_nested_template(filename):
+ nested_files.append(filename)
return nested_files
-def list_filenames_in_template_dir(metafunc,
- extensions,
- template_type='',
- sub_dirs=None):
- '''
+def list_filenames_in_template_dir(
+ metafunc, extensions, template_type="", sub_dirs=None
+):
+ """
returns the filenames in a template_dir, either as its passed in
on CLI or, during --self-test, the directory whos name matches
the current tests module name
- '''
+ """
sub_dirs = [] if sub_dirs is None else sub_dirs
template_dir = get_template_dir(metafunc)
filenames = []
- if metafunc.config.getoption('self_test'):
- filenames = [path.join(template_dir, s, f)
- for s in sub_dirs
- for f in listdir(path.join(template_dir, s))
- if path.isfile(path.join(template_dir, s, f))
- and path.splitext(f)[-1] in extensions
- and check_basename_ending(template_type,
- path.splitext(f)[0])]
+ if metafunc.config.getoption("self_test"):
+ filenames = [
+ path.join(template_dir, s, f)
+ for s in sub_dirs
+ for f in listdir(path.join(template_dir, s))
+ if path.isfile(path.join(template_dir, s, f))
+ and path.splitext(f)[-1] in extensions
+ and check_basename_ending(template_type, path.splitext(f)[0])
+ ]
else:
- filenames = [path.join(template_dir, f)
- for f in listdir(template_dir)
- if path.isfile(path.join(template_dir, f))
- and path.splitext(f)[-1] in extensions
- and check_basename_ending(template_type,
- path.splitext(f)[0])]
+ filenames = [
+ path.join(template_dir, f)
+ for f in listdir(template_dir)
+ if path.isfile(path.join(template_dir, f))
+ and path.splitext(f)[-1] in extensions
+ and check_basename_ending(template_type, path.splitext(f)[0])
+ ]
return filenames
-def list_template_dir(metafunc,
- extensions,
- exclude_nested=True,
- template_type='',
- sub_dirs=None):
- '''
+def list_template_dir(
+ metafunc, extensions, exclude_nested=True, template_type="", sub_dirs=None
+):
+ """
returns the filenames excluding the nested files for a template_dir,
either as its passed in on CLI or, during --self-test, the
directory whos name matches the current tests module name
- '''
+ """
sub_dirs = [] if sub_dirs is None else sub_dirs
filenames = []
nested_files = []
- filenames = list_filenames_in_template_dir(metafunc,
- extensions,
- template_type,
- sub_dirs)
+ filenames = list_filenames_in_template_dir(
+ metafunc, extensions, template_type, sub_dirs
+ )
if exclude_nested:
nested_files = get_nested_files(filenames)
return list(set(filenames) - set(nested_files))
-def get_filenames_list(metafunc,
- extensions=None,
- exclude_nested=False,
- template_type=''):
- '''
+def get_filenames_list(
+ metafunc, extensions=None, exclude_nested=False, template_type=""
+):
+ """
returns the filename fixtures for the template dir, either as by how its
passed in on CLI or, during --self-test, the directory whos name
matches the current tests module name
- '''
- extensions = [".yaml",
- ".yml",
- ".env"] if extensions is None else extensions
- if metafunc.config.getoption('self_test'):
- filenames_list = list_template_dir(metafunc,
- extensions,
- exclude_nested,
- template_type,
- ['pass'])
- filenames_list += [pytest.mark.xfail(f, strict=True)
- for f in list_template_dir(metafunc,
- extensions,
- exclude_nested,
- template_type,
- ['fail'])]
+ """
+ extensions = [".yaml", ".yml", ".env"] if extensions is None else extensions
+ if metafunc.config.getoption("self_test"):
+ filenames_list = list_template_dir(
+ metafunc, extensions, exclude_nested, template_type, ["pass"]
+ )
+ filenames_list += [
+ pytest.mark.xfail(f, strict=True)
+ for f in list_template_dir(
+ metafunc, extensions, exclude_nested, template_type, ["fail"]
+ )
+ ]
else:
- filenames_list = list_template_dir(metafunc,
- extensions,
- exclude_nested,
- template_type)
+ filenames_list = list_template_dir(
+ metafunc, extensions, exclude_nested, template_type
+ )
return filenames_list
-def get_filenames_lists(metafunc,
- extensions=None,
- exclude_nested=False,
- template_type=''):
- '''
+def get_filenames_lists(
+ metafunc, extensions=None, exclude_nested=False, template_type=""
+):
+ """
returns the list of files in the template dir, either as by how its
passed in on CLI or, during --self-test, the directory whos name
matches the current tests module name
- '''
- extensions = [".yaml",
- ".yml",
- ".env"] if extensions is None else extensions
+ """
+ extensions = [".yaml", ".yml", ".env"] if extensions is None else extensions
filenames_lists = []
- if metafunc.config.getoption('self_test'):
- filenames_lists.append(list_template_dir(metafunc,
- extensions,
- exclude_nested,
- template_type,
- ['pass']))
- filenames_lists.append(pytest.mark.xfail(
- list_template_dir(metafunc,
- extensions,
- exclude_nested,
- template_type,
- ['fail']), strict=True))
+ if metafunc.config.getoption("self_test"):
+ filenames_lists.append(
+ list_template_dir(
+ metafunc, extensions, exclude_nested, template_type, ["pass"]
+ )
+ )
+ filenames_lists.append(
+ pytest.mark.xfail(
+ list_template_dir(
+ metafunc, extensions, exclude_nested, template_type, ["fail"]
+ ),
+ strict=True,
+ )
+ )
else:
- filenames_lists.append(list_template_dir(metafunc,
- extensions,
- exclude_nested,
- template_type))
+ filenames_lists.append(
+ list_template_dir(metafunc, extensions, exclude_nested, template_type)
+ )
return filenames_lists
-def get_parsed_yaml_files(metafunc,
- extensions,
- exclude_nested=True,
- template_type='',
- sections=None):
- '''
+def get_parsed_yaml_files(
+ metafunc, extensions, exclude_nested=True, template_type="", sections=None
+):
+ """
returns the list of parsed yaml files in the specified template dir,
either as by how its passed in on CLI or, during --self-test, the
directory whos name matches the current tests module name
- '''
+ """
sections = [] if sections is None else sections
extensions = [".yaml", ".yml"]
- if metafunc.config.getoption('self_test'):
- yaml_files = list_template_dir(metafunc, extensions, exclude_nested,
- template_type, ['pass'])
- parsed_yml_list = get_parsed_yml_for_yaml_files(yaml_files,
- sections)
-
- yaml_files = list_template_dir(metafunc, extensions, exclude_nested,
- template_type, ['fail'])
- parsed_yml_list = get_parsed_yml_for_yaml_files(yaml_files,
- sections)
- parsed_yml_list += [pytest.mark.xfail(parsed_yml, strict=True)
- for parsed_yml in parsed_yml_list]
+ if metafunc.config.getoption("self_test"):
+ yaml_files = list_template_dir(
+ metafunc, extensions, exclude_nested, template_type, ["pass"]
+ )
+ parsed_yml_list = get_parsed_yml_for_yaml_files(yaml_files, sections)
+
+ yaml_files = list_template_dir(
+ metafunc, extensions, exclude_nested, template_type, ["fail"]
+ )
+ parsed_yml_list = get_parsed_yml_for_yaml_files(yaml_files, sections)
+ parsed_yml_list += [
+ pytest.mark.xfail(parsed_yml, strict=True) for parsed_yml in parsed_yml_list
+ ]
else:
yaml_files = list_template_dir(metafunc, extensions)
- parsed_yml_list = get_parsed_yml_for_yaml_files(yaml_files,
- sections)
+ parsed_yml_list = get_parsed_yml_for_yaml_files(yaml_files, sections)
return parsed_yml_list
def parametrize_filenames(metafunc):
- '''
+ """
This param runs tests all files in the template dir
- '''
+ """
filenames = get_filenames_lists(metafunc)
- metafunc.parametrize('filenames', filenames)
+ metafunc.parametrize("filenames", filenames)
def parametrize_filename(metafunc):
- '''
+ """
This param runs tests once for every file in the template dir
- '''
+ """
filenames = get_filenames_list(metafunc)
- metafunc.parametrize('filename', filenames)
+ metafunc.parametrize("filename", filenames)
def parametrize_yaml_files(metafunc):
- '''
+ """
This param runs tests for the yaml files in the template dir
- '''
- yaml_files = get_filenames_lists(metafunc, ['.yaml', '.yml'], False)
+ """
+ yaml_files = get_filenames_lists(metafunc, [".yaml", ".yml"], False)
metafunc.parametrize("yaml_files", yaml_files)
def parametrize_yaml_file(metafunc):
- '''
+ """
This param runs tests for every yaml file in the template dir
- '''
- yaml_files = get_filenames_list(metafunc, ['.yaml', '.yml'], False)
- metafunc.parametrize('yaml_file', yaml_files)
+ """
+ yaml_files = get_filenames_list(metafunc, [".yaml", ".yml"], False)
+ metafunc.parametrize("yaml_file", yaml_files)
def parametrize_templates(metafunc):
- '''
+ """
This param runs tests for the template in the template dir
- '''
- templates = get_filenames_lists(metafunc, ['.yaml', '.yml'], True)
+ """
+ templates = get_filenames_lists(metafunc, [".yaml", ".yml"], True)
metafunc.parametrize("templates", templates)
def parametrize_template(metafunc):
- '''
+ """
This param runs tests for every template in the template dir
- '''
- templates = get_filenames_list(metafunc, ['.yaml', '.yml'], True)
- metafunc.parametrize('template', templates)
+ """
+ templates = get_filenames_list(metafunc, [".yaml", ".yml"], True)
+ metafunc.parametrize("template", templates)
def parametrize_parsed_yaml_file(metafunc):
- '''
+ """
This param runs tests for a parsed version of each yaml file
in the template dir
- '''
- parsed_yaml_files = get_parsed_yaml_files(metafunc, ['.yaml', '.yml'],
- False)
- metafunc.parametrize('parsed_yaml_file', parsed_yaml_files)
+ """
+ parsed_yaml_files = get_parsed_yaml_files(metafunc, [".yaml", ".yml"], False)
+ metafunc.parametrize("parsed_yaml_file", parsed_yaml_files)
def parametrize_heat_templates(metafunc):
- '''
+ """
This param runs tests for all heat templates in the template dir
- '''
- heat_templates = get_filenames_lists(metafunc, ['.yaml', '.yml'],
- True, 'heat')
- metafunc.parametrize('heat_templates', heat_templates)
+ """
+ heat_templates = get_filenames_lists(metafunc, [".yaml", ".yml"], True, "heat")
+ metafunc.parametrize("heat_templates", heat_templates)
def parametrize_heat_template(metafunc):
- '''
+ """
This param runs tests for every heat template in the template dir
- '''
- heat_templates = get_filenames_list(metafunc, ['.yaml', '.yml'],
- True, 'heat')
- metafunc.parametrize('heat_template', heat_templates)
+ """
+ heat_templates = get_filenames_list(metafunc, [".yaml", ".yml"], True, "heat")
+ metafunc.parametrize("heat_template", heat_templates)
def parametrize_volume_templates(metafunc):
- '''
+ """
This param runs tests for all volume templates in the template dir
- '''
- volume_templates = get_filenames_lists(metafunc, ['.yaml', '.yml'],
- True, 'volume')
- metafunc.parametrize('volume_templates', volume_templates)
+ """
+ volume_templates = get_filenames_lists(metafunc, [".yaml", ".yml"], True, "volume")
+ metafunc.parametrize("volume_templates", volume_templates)
def parametrize_volume_template(metafunc):
- '''
+ """
This param runs tests for every volume template in the template dir
- '''
- volume_templates = get_filenames_list(metafunc, ['.yaml', '.yml'],
- True, 'volume')
- metafunc.parametrize('volume_template', volume_templates)
+ """
+ volume_templates = get_filenames_list(metafunc, [".yaml", ".yml"], True, "volume")
+ metafunc.parametrize("volume_template", volume_templates)
def parametrize_environment_files(metafunc):
- '''
+ """
This param runs tests for all environment files in the template dir
- '''
- env_files = get_filenames_lists(metafunc, ['.env'])
- metafunc.parametrize('env_files', env_files)
+ """
+ env_files = get_filenames_lists(metafunc, [".env"])
+ metafunc.parametrize("env_files", env_files)
def parametrize_environment_file(metafunc):
- '''
+ """
This param runs tests for every environment file in the template dir
- '''
- env_files = get_filenames_list(metafunc, ['.env'])
- metafunc.parametrize('env_file', env_files)
+ """
+ env_files = get_filenames_list(metafunc, [".env"])
+ metafunc.parametrize("env_file", env_files)
def parametrize_parsed_environment_file(metafunc):
- '''
+ """
This param runs tests for every parsed environment file
in the template dir
- '''
- parsed_env_files = get_parsed_yaml_files(metafunc, ['.env'])
- metafunc.parametrize('parsed_env_file', parsed_env_files)
+ """
+ parsed_env_files = get_parsed_yaml_files(metafunc, [".env"])
+ metafunc.parametrize("parsed_env_file", parsed_env_files)
def parametrize_template_dir(metafunc):
- '''
+ """
This param passes a the template_dir as passed in on CLI
or, during --self-test, passes in the sub directories of
template_dir/pass/ and template_dir/fail
template_dir = get_template_dir(metafunc)
- '''
+ """
template_dir = get_template_dir(metafunc)
- if metafunc.config.getoption('self_test'):
- dirs = [path.join(template_dir, s, t)
- for s in ['pass']
- for t in listdir(path.join(template_dir, s))
- if path.isdir(path.join(template_dir, s, t))]
-
- dirs += [pytest.mark.xfail(path.join(template_dir, s, t))
- for s in ['fail']
- for t in listdir(path.join(template_dir, s))
- if path.isdir(path.join(template_dir, s, t))]
+ if metafunc.config.getoption("self_test"):
+ dirs = [
+ path.join(template_dir, s, t)
+ for s in ["pass"]
+ for t in listdir(path.join(template_dir, s))
+ if path.isdir(path.join(template_dir, s, t))
+ ]
+
+ dirs += [
+ pytest.mark.xfail(path.join(template_dir, s, t))
+ for s in ["fail"]
+ for t in listdir(path.join(template_dir, s))
+ if path.isdir(path.join(template_dir, s, t))
+ ]
else:
dirs = [template_dir]
- metafunc.parametrize('template_dir', dirs)
+ metafunc.parametrize("template_dir", dirs)
-def parametrize_environment_pair(metafunc, template_type=''):
- '''
+def parametrize_environment_pair(metafunc, template_type=""):
+ """
Define a list of pairs of parsed yaml from the heat templates and
environment files
- '''
+ """
pairs = []
- if metafunc.config.getoption('self_test'):
- sub_dirs = ['pass', 'fail']
- env_files = list_template_dir(metafunc, ['.env'], True,
- template_type, sub_dirs)
- yaml_files = list_template_dir(metafunc, ['.yaml', '.yml'], True,
- template_type, sub_dirs)
+ if metafunc.config.getoption("self_test"):
+ sub_dirs = ["pass", "fail"]
+ env_files = list_template_dir(metafunc, [".env"], True, template_type, sub_dirs)
+ yaml_files = list_template_dir(
+ metafunc, [".yaml", ".yml"], True, template_type, sub_dirs
+ )
else:
- env_files = list_template_dir(metafunc, ['.env'], True,
- template_type)
- yaml_files = list_template_dir(metafunc, ['.yaml', '.yml'],
- True, template_type)
+ env_files = list_template_dir(metafunc, [".env"], True, template_type)
+ yaml_files = list_template_dir(metafunc, [".yaml", ".yml"], True, template_type)
for filename in env_files:
basename = path.splitext(filename)[0]
- if basename + '.yml' in yaml_files:
- yfilename = basename + '.yml'
+ if basename + ".yml" in yaml_files:
+ yfilename = basename + ".yml"
else:
- yfilename = basename + '.yaml'
+ yfilename = basename + ".yaml"
try:
with open(filename) as fh:
@@ -414,44 +411,44 @@ def parametrize_environment_pair(metafunc, template_type=''):
with open(yfilename) as fh:
yyml = yaml.load(fh)
- if 'fail' in filename:
- pairs.append(pytest.mark.xfail({"name": basename,
- "yyml": yyml,
- "eyml": eyml},
- strict=True))
+ if "fail" in filename:
+ pairs.append(
+ pytest.mark.xfail(
+ {"name": basename, "yyml": yyml, "eyml": eyml}, strict=True
+ )
+ )
else:
pairs.append({"name": basename, "yyml": yyml, "eyml": eyml})
except yaml.YAMLError as e:
print(e) # pylint: disable=superfluous-parens
- metafunc.parametrize('environment_pair', pairs)
+ metafunc.parametrize("environment_pair", pairs)
def parametrize_heat_volume_pair(metafunc):
- '''
+ """
Define a list of pairs of parsed yaml from the a heat and volume
template
- '''
+ """
pairs = []
- if metafunc.config.getoption('self_test'):
- sub_dirs = ['pass', 'fail']
- volume_files = list_template_dir(metafunc, ['.yaml', '.yml'],
- True, 'volume', sub_dirs)
- yaml_files = list_template_dir(metafunc, ['.yaml', '.yml'],
- True, '', sub_dirs)
+ if metafunc.config.getoption("self_test"):
+ sub_dirs = ["pass", "fail"]
+ volume_files = list_template_dir(
+ metafunc, [".yaml", ".yml"], True, "volume", sub_dirs
+ )
+ yaml_files = list_template_dir(metafunc, [".yaml", ".yml"], True, "", sub_dirs)
else:
- volume_files = list_template_dir(metafunc, ['.yaml', '.yml'],
- True, 'volume')
- yaml_files = list_template_dir(metafunc, ['.yaml', '.yml'], True)
+ volume_files = list_template_dir(metafunc, [".yaml", ".yml"], True, "volume")
+ yaml_files = list_template_dir(metafunc, [".yaml", ".yml"], True)
- pattern = re.compile(r'\_volume$')
+ pattern = re.compile(r"\_volume$")
for vfilename in volume_files:
- basename = pattern.sub('', path.splitext(vfilename)[0])
- if basename + '.yml' in yaml_files:
- yfilename = basename + '.yml'
+ basename = pattern.sub("", path.splitext(vfilename)[0])
+ if basename + ".yml" in yaml_files:
+ yfilename = basename + ".yml"
else:
- yfilename = basename + '.yaml'
+ yfilename = basename + ".yaml"
try:
with open(vfilename) as fh:
@@ -459,15 +456,16 @@ def parametrize_heat_volume_pair(metafunc):
with open(yfilename) as fh:
yyml = yaml.load(fh)
- if 'fail' in vfilename:
- pairs.append(pytest.mark.xfail({"name": basename,
- "yyml": yyml,
- "vyml": vyml},
- strict=True))
+ if "fail" in vfilename:
+ pairs.append(
+ pytest.mark.xfail(
+ {"name": basename, "yyml": yyml, "vyml": vyml}, strict=True
+ )
+ )
else:
pairs.append({"name": basename, "yyml": yyml, "vyml": vyml})
except yaml.YAMLError as e:
print(e) # pylint: disable=superfluous-parens
- metafunc.parametrize('heat_volume_pair', pairs)
+ metafunc.parametrize("heat_volume_pair", pairs)
diff --git a/ice_validator/tests/report.html.jinja2 b/ice_validator/tests/report.html.jinja2
index 5bc59e5..5856c5d 100644
--- a/ice_validator/tests/report.html.jinja2
+++ b/ice_validator/tests/report.html.jinja2
@@ -97,6 +97,7 @@
<h1>Validation Report</h1>
<ul>
<li><b>Profile:</b> {{ profile_name }}</li>
+ <li><b>Tool Version:</b> {{ version }}</li>
<li><b>Directory Validated:</b> {{ template_dir }}</li>
<li><b>Checksum:</b> {{ checksum }}</li>
<li><b>Generated:</b> {{ timestamp }}</li>
@@ -197,7 +198,6 @@
dom: 'Bfrtip',
buttons: [
'csv',
- 'excel',
{
extend: 'pdfHtml5',
orientation: 'landscape',
diff --git a/ice_validator/tests/structures.py b/ice_validator/tests/structures.py
index 8d66220..3f48422 100644
--- a/ice_validator/tests/structures.py
+++ b/ice_validator/tests/structures.py
@@ -35,19 +35,429 @@
#
# ============LICENSE_END============================================
#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
-'''structures
-'''
+"""structures
+"""
+import sys
+
+import collections
+import inspect
import os
+import re
from tests import cached_yaml as yaml
+from tests.helpers import load_yaml
from .utils import nested_dict
-VERSION = '1.4.0'
+VERSION = "3.5.0"
+
+# key = pattern, value = regex compiled from pattern
+_REGEX_CACHE = {}
+
+
+def _get_regex(pattern):
+ """Return a compiled version of pattern.
+ Keep result in _REGEX_CACHE to avoid re-compiling.
+ """
+ regex = _REGEX_CACHE.get(pattern, None)
+ if regex is None:
+ regex = re.compile(pattern)
+ _REGEX_CACHE[pattern] = regex
+ return regex
+
+
+class HeatObject(object):
+ """base class for xxxx::xxxx::xxxx objects
+ """
+
+ resource_type = None
+
+ def __init__(self):
+ self.re_rids = self.get_re_rids()
+
+ @staticmethod
+ def get_re_rids():
+ """Return OrderedDict of name: regex
+ Each regex parses the proper format for a given rid
+ (resource id).
+ """
+ return collections.OrderedDict()
+
+ def get_rid_match_tuple(self, rid):
+ """find the first regex matching `rid` and return the tuple
+ (name, match object) or ('', None) if no match.
+ """
+ for name, regex in self.re_rids.items():
+ match = regex.match(rid)
+ if match:
+ return name, match
+ return "", None
+
+ def get_rid_patterns(self):
+ """Return OrderedDict of name: friendly regex.pattern
+ "friendly" means the group notation is replaced with
+ braces, and the trailing "$" is removed.
+
+ NOTE
+ nested parentheses in any rid_pattern will break this parser.
+ The final character is ASSUMED to be a dollar sign.
+ """
+ friendly_pattern = _get_regex(r"\(\?P<(.*?)>.*?\)")
+ rid_patterns = collections.OrderedDict()
+ for name, regex in self.re_rids.items():
+ rid_patterns[name] = friendly_pattern.sub(
+ r"{\1}", regex.pattern # replace groups with braces
+ )[
+ :-1
+ ] # remove trailing $
+ return rid_patterns
+
+
+class ContrailV2NetworkHeatObject(HeatObject):
+ """ContrailV2 objects which have network_flavor
+ """
+
+ network_flavor_external = "external"
+ network_flavor_internal = "internal"
+ network_flavor_subint = "subint"
+
+ def get_network_flavor(self, resource):
+ """Return the network flavor of resource, one of
+ "internal" - get_resource, or get_param contains _int_
+ "subint" - get_param contains _subint_
+ "external" - otherwise
+ None - no parameters found to decide the flavor.
+
+ resource.properties.virtual_network_refs should be a list.
+ All the parameters in the list should have the same "flavor"
+ so the flavor is determined from the first item.
+ """
+ network_flavor = None
+ network_refs = nested_dict.get(resource, "properties", "virtual_network_refs")
+ if network_refs and isinstance(network_refs, list):
+ param = network_refs[0]
+ if isinstance(param, dict):
+ if "get_resource" in param:
+ network_flavor = self.network_flavor_internal
+ else:
+ p = param.get("get_param")
+ if isinstance(p, str):
+ if "_int_" in p or p.startswith("int_"):
+ network_flavor = self.network_flavor_internal
+ elif "_subint_" in p:
+ network_flavor = self.network_flavor_subint
+ else:
+ network_flavor = self.network_flavor_external
+ return network_flavor
+
+
+class ContrailV2InstanceIp(ContrailV2NetworkHeatObject):
+ """ ContrailV2 InstanceIp
+ """
+
+ resource_type = "OS::ContrailV2::InstanceIp"
+
+ def get_re_rids(self):
+ """Return OrderedDict of name: regex
+ """
+ return collections.OrderedDict(
+ [
+ (
+ "int_ip",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_int"
+ r"_(?P<network_role>.+)"
+ r"_vmi"
+ r"_(?P<vmi_index>\d+)"
+ r"_IP"
+ r"_(?P<index>\d+)"
+ r"$"
+ ),
+ ),
+ (
+ "int_v6_ip",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_int"
+ r"_(?P<network_role>.+)"
+ r"_vmi"
+ r"_(?P<vmi_index>\d+)"
+ r"_v6_IP"
+ r"_(?P<index>\d+)"
+ r"$"
+ ),
+ ),
+ (
+ "subint_ip",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_subint"
+ r"_(?P<network_role>.+)"
+ r"_vmi"
+ r"_(?P<vmi_index>\d+)"
+ r"_IP"
+ r"_(?P<index>\d+)"
+ r"$"
+ ),
+ ),
+ (
+ "subint_v6_ip",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_subint"
+ r"_(?P<network_role>.+)"
+ r"_vmi"
+ r"_(?P<vmi_index>\d+)"
+ r"_v6_IP"
+ r"_(?P<index>\d+)"
+ r"$"
+ ),
+ ),
+ (
+ "ip",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_(?P<network_role>.+)"
+ r"_vmi"
+ r"_(?P<vmi_index>\d+)"
+ r"_IP"
+ r"_(?P<index>\d+)"
+ r"$"
+ ),
+ ),
+ (
+ "v6_ip",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_(?P<network_role>.+)"
+ r"_vmi"
+ r"_(?P<vmi_index>\d+)"
+ r"_v6_IP"
+ r"_(?P<index>\d+)"
+ r"$"
+ ),
+ ),
+ ]
+ )
+
+
+class ContrailV2InterfaceRouteTable(HeatObject):
+ """ ContrailV2 InterfaceRouteTable
+ """
+
+ resource_type = "OS::ContrailV2::InterfaceRouteTable"
+
+
+class ContrailV2NetworkIpam(HeatObject):
+ """ ContrailV2 NetworkIpam
+ """
+
+ resource_type = "OS::ContrailV2::NetworkIpam"
+
+
+class ContrailV2PortTuple(HeatObject):
+ """ ContrailV2 PortTuple
+ """
+
+ resource_type = "OS::ContrailV2::PortTuple"
+
+
+class ContrailV2ServiceHealthCheck(HeatObject):
+ """ ContrailV2 ServiceHealthCheck
+ """
+
+ resource_type = "OS::ContrailV2::ServiceHealthCheck"
+
+
+class ContrailV2ServiceInstance(HeatObject):
+ """ ContrailV2 ServiceInstance
+ """
+
+ resource_type = "OS::ContrailV2::ServiceInstance"
+
+
+class ContrailV2ServiceInstanceIp(HeatObject):
+ """ ContrailV2 ServiceInstanceIp
+ """
+
+ resource_type = "OS::ContrailV2::ServiceInstanceIp"
+
+
+class ContrailV2ServiceTemplate(HeatObject):
+ """ ContrailV2 ServiceTemplate
+ """
+
+ resource_type = "OS::ContrailV2::ServiceTemplate"
+
+
+class ContrailV2VirtualMachineInterface(ContrailV2NetworkHeatObject):
+ """ ContrailV2 Virtual Machine Interface resource
+ """
+
+ resource_type = "OS::ContrailV2::VirtualMachineInterface"
+
+ def get_re_rids(self):
+ """Return OrderedDict of name: regex
+ """
+ return collections.OrderedDict(
+ [
+ (
+ "vmi_internal",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_int"
+ r"_(?P<network_role>.+)"
+ r"_vmi"
+ r"_(?P<vmi_index>\d+)"
+ r"$"
+ ),
+ ),
+ (
+ "vmi_subint",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_subint"
+ r"_(?P<network_role>.+)"
+ r"_vmi"
+ r"_(?P<vmi_index>\d+)"
+ r"$"
+ ),
+ ),
+ (
+ "vmi_external",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_(?P<network_role>.+)"
+ r"_vmi"
+ r"_(?P<vmi_index>\d+)"
+ r"$"
+ ),
+ ),
+ ]
+ )
+
+
+class ContrailV2VirtualNetwork(HeatObject):
+ """ ContrailV2 VirtualNetwork
+ """
+
+ resource_type = "OS::ContrailV2::VirtualNetwork"
+
+ def get_re_rids(self):
+ """Return OrderedDict of name: regex
+ """
+ return collections.OrderedDict(
+ [
+ (
+ "network",
+ _get_regex(r"int" r"_(?P<network_role>.+)" r"_network" r"$"),
+ ),
+ ("rvn", _get_regex(r"int" r"_(?P<network_role>.+)" r"_RVN" r"$")),
+ ]
+ )
+
+
+class NeutronNet(HeatObject):
+ """ Neutron Net resource
+ """
+
+ resource_type = "OS::Neutron::Net"
+
+ def get_re_rids(self):
+ """Return OrderedDict of name: regex
+ """
+ return collections.OrderedDict(
+ [("network", _get_regex(r"int" r"_(?P<network_role>.+)" r"_network" r"$"))]
+ )
+
+
+class NeutronPort(HeatObject):
+ """ Neutron Port resource
+ """
+
+ resource_type = "OS::Neutron::Port"
+
+ def get_re_rids(self):
+ """Return OrderedDict of name: regex
+ """
+ return collections.OrderedDict(
+ [
+ (
+ "internal_port",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_int"
+ r"_(?P<network_role>.+)"
+ r"_port_(?P<port_index>\d+)"
+ r"$"
+ ),
+ ),
+ (
+ "port",
+ _get_regex(
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_(?P<network_role>.+)"
+ r"_port_(?P<port_index>\d+)"
+ r"$"
+ ),
+ ),
+ (
+ "floating_ip",
+ _get_regex(
+ r"reserve_port"
+ r"_(?P<vm_type>.+)"
+ r"_(?P<network_role>.+)"
+ r"_floating_ip_(?P<index>\d+)"
+ r"$"
+ ),
+ ),
+ (
+ "floating_v6_ip",
+ _get_regex(
+ r"reserve_port"
+ r"_(?P<vm_type>.+)"
+ r"_(?P<network_role>.+)"
+ r"_floating_v6_ip_(?P<index>\d+)"
+ r"$"
+ ),
+ ),
+ ]
+ )
+
+
+class NovaServer(HeatObject):
+ """ Nova Server resource
+ """
+
+ resource_type = "OS::Nova::Server"
+
+ def get_re_rids(self):
+ """Return OrderedDict of name: regex
+ """
+ return collections.OrderedDict(
+ [
+ (
+ "server",
+ _get_regex(
+ r"(?P<vm_type>.+)" r"_server_(?P<vm_type_index>\d+)" r"$"
+ ),
+ )
+ ]
+ )
class Heat(object):
@@ -55,6 +465,11 @@ class Heat(object):
filepath - absolute path to template file.
envpath - absolute path to environmnt file.
"""
+
+ type_cdl = "comma_delimited_list"
+ type_num = "number"
+ type_str = "string"
+
def __init__(self, filepath=None, envpath=None):
self.filepath = None
self.basename = None
@@ -72,6 +487,49 @@ class Heat(object):
self.env = None
if envpath:
self.load_env(envpath)
+ self.heat_objects = self.get_heat_objects()
+
+ @property
+ def contrail_resources(self):
+ """This attribute is a dict of Contrail resources.
+ """
+ return self.get_resource_by_type(
+ resource_type=ContrailV2VirtualMachineInterface.resource_type
+ )
+
+ @staticmethod
+ def get_heat_objects():
+ """Return a dict, key is resource_type, value is the
+ HeatObject subclass whose resource_type is the key.
+ """
+ return _HEAT_OBJECTS
+
+ def get_resource_by_type(self, resource_type):
+ """Return dict of resources whose type is `resource_type`.
+ key is resource_id, value is resource.
+ """
+ return {
+ rid: resource
+ for rid, resource in self.resources.items()
+ if self.nested_get(resource, "type") == resource_type
+ }
+
+ def get_rid_match_tuple(self, rid, resource_type):
+ """return get_rid_match_tuple(rid) called on the class
+ corresponding to the given resource_type.
+ """
+ hoc = self.heat_objects.get(resource_type, HeatObject)
+ return hoc().get_rid_match_tuple(rid)
+
+ def get_vm_type(self, rid, resource=None):
+ """return the vm_type
+ """
+ if resource is None:
+ resource = self
+ resource_type = self.nested_get(resource, "type")
+ match = self.get_rid_match_tuple(rid, resource_type)[1]
+ vm_type = match.groupdict().get("vm_type") if match else None
+ return vm_type
def load(self, filepath):
"""Load the Heat template given a filepath.
@@ -81,45 +539,161 @@ class Heat(object):
self.dirname = os.path.dirname(self.filepath)
with open(self.filepath) as fi:
self.yml = yaml.load(fi)
- self.heat_template_version = self.yml.get('heat_template_version', None)
- self.description = self.yml.get('description', '')
- self.parameter_groups = self.yml.get('parameter_groups', {})
- self.parameters = self.yml.get('parameters', {})
- self.resources = self.yml.get('resources', {})
- self.outputs = self.yml.get('outputs', {})
- self.conditions = self.yml.get('conditions', {})
+ self.heat_template_version = self.yml.get("heat_template_version", None)
+ self.description = self.yml.get("description", "")
+ self.parameter_groups = self.yml.get("parameter_groups", {})
+ self.parameters = self.yml.get("parameters") or {}
+ self.resources = self.yml.get("resources", {})
+ self.outputs = self.yml.get("outputs", {})
+ self.conditions = self.yml.get("conditions", {})
+
+ def get_all_resources(self, base_dir):
+ """
+ Like ``resources``, but this returns all the resources definitions
+ defined in the template, resource groups, and nested YAML files.
+ """
+ resources = {}
+ for r_id, r_data in self.resources.items():
+ resources[r_id] = r_data
+ resource = Resource(r_id, r_data)
+ if resource.is_nested():
+ nested = Heat(os.path.join(base_dir, resource.get_nested_filename()))
+ resources.update(nested.get_all_resources(base_dir))
+ return resources
def load_env(self, envpath):
- """Load the Environment template given a envpath.
+ """
+ Load the Environment template given a envpath.
"""
self.env = Env(filepath=envpath)
@staticmethod
- def nested_get(dic, *keys):
+ def nested_get(dic, *keys, **kwargs):
"""make utils.nested_dict.get available as a class method.
"""
- return nested_dict.get(dic, *keys)
+ return nested_dict.get(dic, *keys, **kwargs)
+
+ @property
+ def neutron_port_resources(self):
+ """This attribute is a dict of Neutron Ports
+ """
+ return self.get_resource_by_type(resource_type=NeutronPort.resource_type)
+
+ @property
+ def nova_server_resources(self):
+ """This attribute is a dict of Nova Servers
+ """
+ return self.get_resource_by_type(resource_type=NovaServer.resource_type)
+
+ @staticmethod
+ def part_is_in_name(part, name):
+ """
+ Return True if any of
+ - name starts with part + '_'
+ - name contains '_' + part + '_'
+ - name ends with '_' + part
+ False otherwise
+ """
+ return bool(
+ re.search("(^(%(x)s)_)|(_(%(x)s)_)|(_(%(x)s)$)" % dict(x=part), name)
+ )
class Env(Heat):
"""An Environment file
"""
+
pass
class Resource(object):
"""A Resource
"""
+
def __init__(self, resource_id=None, resource=None):
- self.resource_id = resource_id or ''
+ self.resource_id = resource_id or ""
self.resource = resource or {}
+ self.properties = self.resource.get("properties", {})
+ self.resource_type = resource.get("type", "")
@staticmethod
def get_index_var(resource):
"""Return the index_var for this resource.
"""
- index_var = nested_dict.get(resource,
- 'properties',
- 'index_var') or 'index'
+ index_var = nested_dict.get(resource, "properties", "index_var") or "index"
return index_var
+ def get_nested_filename(self):
+ """Returns the filename of the nested YAML file if the
+ resource is a nested YAML or ResourceDef, returns '' otherwise."""
+ typ = self.resource.get("type", "")
+ if typ == "OS::Heat::ResourceGroup":
+ rd = nested_dict.get(self.resource, "properties", "resource_def")
+ typ = rd.get("type", "") if rd else ""
+ ext = os.path.splitext(typ)[1]
+ ext = ext.lower()
+ if ext == ".yml" or ext == ".yaml":
+ return typ
+ else:
+ return ""
+
+ def get_nested_properties(self):
+ """
+ Returns {} if not nested
+ Returns resource: properties if nested
+ Returns resource: properties: resource_def: properties if RG
+ """
+ if not bool(self.get_nested_filename()):
+ return {}
+ elif self.resource_type == "OS::Heat::ResourceGroup":
+ return nested_dict.get(
+ self.properties, "resource_def", "properties", default={}
+ )
+ else:
+ return self.properties
+
+ @property
+ def depends_on(self):
+ """
+ Returns the list of resources this resource depends on. Always
+ returns a list.
+
+ :return: list of all resource IDs this resource depends on. If none,
+ then returns an empty list
+ """
+ parents = self.resource.get("depends_on", [])
+ return parents if isinstance(parents, list) else [parents]
+
+ def is_nested(self):
+ """Returns True if the resource represents a Nested YAML resource
+ using either type: {filename} or ResourceGroup -> resource_def"""
+ return bool(self.get_nested_filename())
+
+ def get_nested_yaml(self, base_dir):
+ """If the resource represents a Nested YAML resource, then it
+ returns the loaded YAML. If the resource is not nested or the
+ file cannot be found, then an empty dict is returned"""
+ filename = self.get_nested_filename()
+ if filename:
+ file_path = os.path.join(base_dir, filename)
+ return load_yaml(file_path) if os.path.exists(file_path) else {}
+ else:
+ return {}
+
+
+def _get_heat_objects():
+ """
+ Introspect this module and return a dict of all HeatObject sub-classes with
+ a (True) resource_type. Key is the resource_type, value is the
+ corresponding class.
+ """
+ mod_classes = inspect.getmembers(sys.modules[__name__], inspect.isclass)
+ heat_objects = {
+ c.resource_type: c
+ for _, c in mod_classes
+ if issubclass(c, HeatObject) and c.resource_type
+ }
+ return heat_objects
+
+
+_HEAT_OBJECTS = _get_heat_objects()
diff --git a/ice_validator/tests/test_heat_numeric_parameters.py b/ice_validator/tests/test_all_parameters_used_in_template.py
index 7cf5212..41356d4 100644
--- a/ice_validator/tests/test_heat_numeric_parameters.py
+++ b/ice_validator/tests/test_all_parameters_used_in_template.py
@@ -1,8 +1,8 @@
# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
+# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -42,37 +42,39 @@ import pytest
from tests import cached_yaml as yaml
from .helpers import validates
+from .utils.nested_iterables import find_all_get_param_in_yml
+VERSION = "1.0.0"
-@validates('R-88863')
-def test_numeric_parameter(heat_template):
- '''
- Make sure all numeric parameters has either `range` or `allowed_values`
- specified
- '''
- key_values = ["range", "allowed_values"]
- missing_constraints = []
+# pylint: disable=invalid-name
- with open(heat_template) as fh:
- yml = yaml.load(fh)
- # skip if parameters are not defined
- if "parameters" not in yml:
- pytest.skip("No parameters specified in the heat template")
+@validates("R-90279")
+def test_all_parameters_used_in_template(yaml_file):
- for k1, v1 in yml["parameters"].items():
- if not isinstance(v1, dict):
- continue
- if 'number' not in v1.values():
- continue
+ invalid_params = []
+ get_params = []
+ skip_params = ["availability_zone"]
- for k2, v2 in v1.items():
- if k2 == "type" and v2 == "number":
- if "constraints" not in v1:
- missing_constraints.append(k1)
- continue
- for v3 in v1["constraints"]:
- if not set(v3) & set(key_values):
- missing_constraints.append(k1)
+ with open(yaml_file, "r") as f:
+ yml = yaml.load(f)
- assert not set(missing_constraints)
+ template_parameters = yml.get("parameters")
+ if not template_parameters:
+ pytest.skip("no parameters found in template")
+
+ get_params = find_all_get_param_in_yml(yml)
+ if not get_params:
+ pytest.skip("no get_params found in template")
+
+ template_parameters = list(template_parameters.keys())
+ for param in template_parameters:
+ for sparam in skip_params:
+ if param.find(sparam) != -1:
+ template_parameters.remove(param)
+
+ invalid_params = set(template_parameters) - set(get_params)
+
+ assert not invalid_params, "Unused parameters detected in template {}".format(
+ invalid_params
+ )
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 0d4bbdf..fe002e3 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
@@ -38,9 +38,9 @@
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-'''
+"""
test_allowed_address_pairs_include_vm_type_network_role
-'''
+"""
import pytest
from tests import cached_yaml as yaml
@@ -48,20 +48,18 @@ from tests import cached_yaml as yaml
from .helpers import validates
from .utils.ports import get_invalid_ip_addresses
-VERSION = '1.0.0'
+VERSION = "1.0.0"
# pylint: disable=invalid-name
-@validates('R-41492',
- 'R-35735',
- 'R-98748')
+@validates("R-41492", "R-35735", "R-98748")
def test_allowed_address_pairs_include_vm_type_network_role(heat_template):
- '''
+ """
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(heat_template) as fh:
yml = yaml.load(fh)
@@ -72,11 +70,10 @@ def test_allowed_address_pairs_include_vm_type_network_role(heat_template):
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"])
-
- assert not set(invalid_ip_addresses), (
- 'invalid ip addresses allowed address pairs %s' % list(
- set(invalid_ip_addresses)))
+ invalid_ip_addresses = get_invalid_ip_addresses(
+ yml["resources"], "allowed_address_pairs", yml["parameters"]
+ )
+ assert not set(
+ invalid_ip_addresses
+ ), "invalid ip addresses allowed address pairs %s" % list(set(invalid_ip_addresses))
diff --git a/ice_validator/tests/test_availability_zone.py b/ice_validator/tests/test_availability_zone.py
index 33d07e1..bbd8d99 100644
--- a/ice_validator/tests/test_availability_zone.py
+++ b/ice_validator/tests/test_availability_zone.py
@@ -47,14 +47,14 @@ from tests import cached_yaml as yaml
from .helpers import validates
-VERSION = '1.1.0'
+VERSION = "1.1.0"
-@validates('R-98450')
+@validates("R-98450")
def test_availability_zone_naming(heat_template):
- '''
+ """
Make sure all availability zones are properly formatted
- '''
+ """
with open(heat_template) as fh:
yml = yaml.load(fh)
@@ -75,16 +75,15 @@ def test_availability_zone_naming(heat_template):
if v1["type"] == "OS::Nova::Server":
for k2, v2 in v1["properties"].items():
- if k2 != 'availability_zone':
+ if k2 != "availability_zone":
continue
- if 'str_replace' in v2:
+ if "str_replace" in v2:
continue
if "get_param" not in v2:
invalid_availability_zones.add(k1)
- elif not re.match(r'availability_zone_\d+', v2["get_param"]):
+ elif not re.match(r"availability_zone_\d+", v2["get_param"]):
invalid_availability_zones.add(v2["get_param"])
- assert not invalid_availability_zones, (
- 'invalid availability zones %s' % list(
- invalid_availability_zones))
-
+ assert not invalid_availability_zones, "invalid availability zones %s" % list(
+ invalid_availability_zones
+ )
diff --git a/ice_validator/tests/test_availability_zone_params_start_at_0.py b/ice_validator/tests/test_availability_zone_params_start_at_0.py
new file mode 100644
index 0000000..32a7484
--- /dev/null
+++ b/ice_validator/tests/test_availability_zone_params_start_at_0.py
@@ -0,0 +1,50 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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============================================
+import re
+
+from tests.helpers import validates, check_indices
+from tests.structures import Heat
+
+
+AZ_PATTERN = re.compile(r"^(availability_zone_)(\d+)$")
+
+
+@validates("R-98450")
+def test_availability_zones_start_at_0(heat_template):
+ params = Heat(heat_template).parameters
+ invalid_params = check_indices(AZ_PATTERN, params, "Availability Zone Parameters")
+ assert not invalid_params, ". ".join(invalid_params)
diff --git a/ice_validator/tests/test_base_template_names.py b/ice_validator/tests/test_base_template_names.py
index dbc8815..5dce061 100644
--- a/ice_validator/tests/test_base_template_names.py
+++ b/ice_validator/tests/test_base_template_names.py
@@ -48,32 +48,34 @@ import re
from .helpers import check_basename_ending
from .helpers import validates
-VERSION = '1.2.0'
+VERSION = "1.2.0"
# is 'base', starts with 'base_', contains '_base_', ends with '_base'
-RE_BASE = re.compile(r'(^base$)|(^base_)|(_base_)|(_base$)')
+RE_BASE = re.compile(r"(^base$)|(^base_)|(_base_)|(_base$)")
-@validates('R-37028', 'R-87485', 'R-81339', 'R-87247', 'R-76057')
+@validates("R-37028", "R-87485", "R-81339", "R-87247", "R-76057")
def test_base_template_names(template_dir):
- '''
+ """
Check all base templates have a filename that includes "_base_".
- '''
+ """
base_template_count = 0
- filenames = [f for f in listdir(template_dir)
- if path.isfile(path.join(template_dir, f)) and
- path.splitext(f)[-1] in ['.yaml', '.yml']]
+ filenames = [
+ f
+ for f in listdir(template_dir)
+ if path.isfile(path.join(template_dir, f))
+ and path.splitext(f)[-1] in [".yaml", ".yml"]
+ ]
for filename in filenames:
filename = path.splitext(filename)[0]
# volume templates are tied to their parent naming wise
- if check_basename_ending('volume', filename):
+ if check_basename_ending("volume", filename):
continue
if RE_BASE.search(filename.lower()):
base_template_count += 1
- assert base_template_count == 1, (
- 'must be 1 "*_base_*" in %s not %d' % (
- filenames,
- base_template_count))
-
+ assert base_template_count == 1, 'must be 1 "*_base_*" in %s not %d' % (
+ filenames,
+ base_template_count,
+ )
diff --git a/ice_validator/tests/test_cloud_config_resource_id.py b/ice_validator/tests/test_cloud_config_resource_id.py
index 2adf860..de82fe4 100644
--- a/ice_validator/tests/test_cloud_config_resource_id.py
+++ b/ice_validator/tests/test_cloud_config_resource_id.py
@@ -38,10 +38,10 @@
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-'''
+"""
A VNF's Heat Orchestration Template's Resource ``OS::Heat::CloudConfig``
Resource ID **MUST** contain the ``{vm-type}``.
-'''
+"""
import pytest
@@ -49,24 +49,24 @@ from .structures import Heat
from .helpers import validates
from .utils import vm_types
-VERSION = '1.0.0'
+VERSION = "1.0.0"
-@validates('R-04747')
+@validates("R-04747")
def test_cloud_config(heat_template):
- '''validate resource ids
- '''
+ """validate resource ids
+ """
h = Heat(filepath=heat_template)
if not h.resources:
- pytest.skip('No resources in this template')
+ pytest.skip("No resources in this template")
cloud_configs = get_cloud_configs(h)
if not cloud_configs:
- pytest.skip('No CloudConfig resources in this template')
+ pytest.skip("No CloudConfig resources in this template")
resource_vm_types = vm_types.get_vm_types(h.resources)
if not resource_vm_types:
- pytest.skip('No resources with {vm-type} in this template')
+ pytest.skip("No resources with {vm-type} in this template")
bad = set()
for rid in cloud_configs:
@@ -75,14 +75,17 @@ def test_cloud_config(heat_template):
break
else:
bad.add(rid)
- assert not bad, 'CloudConfigs %s have {vm-type} not in %s' % (
+ assert not bad, "CloudConfigs %s have {vm-type} not in %s" % (
list(bad),
- list(resource_vm_types))
+ list(resource_vm_types),
+ )
def get_cloud_configs(heat):
"""Return list of resource_id whose type is OS::Heat::CloudConfig.
"""
- return [rid for rid, resource in heat.resources.items()
- if heat.nested_get(resource, 'type') == 'OS::Heat::CloudConfig']
-
+ return [
+ rid
+ for rid, resource in heat.resources.items()
+ if heat.nested_get(resource, "type") == "OS::Heat::CloudConfig"
+ ]
diff --git a/ice_validator/tests/test_contrail_fqdn.py b/ice_validator/tests/test_contrail_fqdn.py
new file mode 100644
index 0000000..ec5f58a
--- /dev/null
+++ b/ice_validator/tests/test_contrail_fqdn.py
@@ -0,0 +1,138 @@
+# -*- 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.
+#
+
+"""
+contrail fqdn
+"""
+
+import re
+
+import pytest
+
+from .structures import Heat
+from .helpers import validates
+
+VERSION = "1.1.0"
+
+RE_NETWORK_ROLE = re.compile(
+ r".+_" r"\d+_" r"(int_)?" r"(subint_)?" r"(?P<network_role>.+)" r"_vmi_" r"\d$"
+)
+
+
+def get_network_role(rid):
+ """return the network_role parsed from the rid.
+ """
+ match = RE_NETWORK_ROLE.match(rid)
+ return match.groupdict()["network_role"] if match else None
+
+
+def run_test(heat_template, validate):
+ """call validate for each fixed_ips
+ """
+ heat = Heat(filepath=heat_template)
+ if not heat.resources:
+ pytest.skip("No resources found")
+
+ contrail_resources = heat.contrail_resources
+ if not contrail_resources:
+ pytest.skip("No Contrail resources found")
+
+ skip = True
+ bad = {}
+ for rid, resource in contrail_resources.items():
+ network_role = get_network_role(rid)
+ if network_role is None:
+ continue
+ virtual_network_refs = heat.nested_get(
+ resource, "properties", "virtual_network_refs"
+ )
+ if virtual_network_refs is None:
+ continue
+ if not isinstance(virtual_network_refs, list):
+ bad[rid] = "properties.virtual_network_refs must be a list."
+ continue
+ error = validate(heat, virtual_network_refs, network_role)
+ if error:
+ bad[rid] = error
+ continue
+ skip = False
+ if bad:
+ raise AssertionError(
+ "Bad OS::ContrailV2::VirtualMachineInterface: %s"
+ % (", ".join("%s: %s" % (rid, error) for rid, error in bad.items()))
+ )
+ if skip:
+ pytest.skip("No Contrail virtual_network_refs found")
+
+
+def validate_virtual_network_refs(heat, virtual_network_refs, network_role):
+ """ensure there is a matching virtual_network_ref in the list.
+ Returns error message string or None.
+ """
+ expect = "%s_net_fqdn" % network_role
+ for vn_ref in virtual_network_refs:
+ param = heat.nested_get(vn_ref, "get_param")
+ if param == expect:
+ param_type = heat.nested_get(heat.parameters, param, "type")
+ if param_type != "string":
+ return (
+ 'virtual_network_ref parameter "%s" '
+ 'type "%s" must be "string"' % (param, param_type)
+ )
+ else:
+ return None
+ return "virtual_network_refs must include {get_param: %s}" % expect
+
+
+# pylint: disable=invalid-name
+
+
+@validates("R-02164")
+def test_contrail_fqdn(heat_template):
+ """
+ When a VNF's Heat Orchestration Template's Contrail resource
+ has a property that
+ references an external network that requires the network's
+ Fully Qualified Domain Name (FQDN), the property parameter
+
+ * **MUST** follow the format ``{network-role}_net_fqdn``
+ * **MUST** be declared as type ``string``
+ """
+ run_test(heat_template, validate_virtual_network_refs)
diff --git a/ice_validator/tests/test_contrail_instance_ip_resource_id.py b/ice_validator/tests/test_contrail_instance_ip_resource_id.py
new file mode 100644
index 0000000..c7c8c57
--- /dev/null
+++ b/ice_validator/tests/test_contrail_instance_ip_resource_id.py
@@ -0,0 +1,141 @@
+# -*- 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:
+{vm-type}_server_{vm-type_index}
+"""
+import pytest
+
+from .structures import Heat
+from .structures import ContrailV2InstanceIp
+from .helpers import validates
+
+VERSION = "1.1.0"
+
+
+def run_test(heat_template, regex_names, network_flavor):
+ """run test
+ """
+ heat = Heat(filepath=heat_template)
+ heat_object_class = ContrailV2InstanceIp
+ resource_type = heat_object_class.resource_type
+ resources = heat.get_resource_by_type(resource_type=resource_type)
+ if not resources:
+ pytest.skip("No %s resources found" % resource_type)
+ bad = []
+ heat_object = heat_object_class()
+ rid_patterns = heat_object.get_rid_patterns()
+ for rid, resource in resources.items():
+ flavor = heat_object.get_network_flavor(resource)
+ if flavor != network_flavor:
+ continue
+ regex_name = heat_object.get_rid_match_tuple(rid)[0]
+ if regex_name in regex_names:
+ continue
+ bad.append(rid)
+ assert not bad, "%s resource ids %s must match one of %s" % (
+ network_flavor,
+ bad,
+ [v for k, v in rid_patterns.items() if k in regex_names],
+ )
+
+
+# pylint: disable=invalid-name
+
+
+@validates("R-53310", "R-46128")
+def test_contrail_instance_ip_resource_id_external(heat_template):
+ """
+ A VNF's Heat Orchestration Template's Resource OS::ContrailV2::InstanceIp
+ that is configuring an IPv4 Address on a port attached to an external
+ network
+ Resource ID **MUST** use the naming convention
+
+ {vm-type}_{vm-type_index}_{network-role}_vmi_{vmi_index}
+ _IP_{index}
+
+ A VNF's Heat Orchestration Template's Resource OS::ContrailV2::InstanceIp
+ that is configuring an IPv6 Address on a port attached to an external
+ network
+ Resource ID **MUST** use the naming convention
+
+ {vm-type}_{vm-type_index}_{network-role}_vmi_{vmi_index}
+ _v6_IP_{index}
+
+ """
+
+ run_test(
+ heat_template,
+ regex_names=("ip", "v6_ip"),
+ network_flavor=ContrailV2InstanceIp.network_flavor_external,
+ )
+
+
+@validates("R-62187", "R-87563")
+def test_contrail_instance_ip_resource_id_internal(heat_template):
+ """
+ internal
+ {vm-type}_{vm-type_index}_int_{network-role}_vmi_{vmi_index}
+ _IP_{index}
+ {vm-type}_{vm-type_index}_int_{network-role}_vmi_{vmi_index}
+ _v6_IP_{index}
+ """
+ run_test(
+ heat_template,
+ regex_names=("int_ip", "int_v6_ip"),
+ network_flavor=ContrailV2InstanceIp.network_flavor_internal,
+ )
+
+
+@validates("R-20947", "R-88540")
+def test_contrail_instance_ip_resource_id_subint(heat_template):
+ """
+ subint
+ {vm-type}_{vm-type_index}_subint_{network-role}_vmi_{vmi_index}
+ _IP_{index}
+ {vm-type}_{vm-type_index}_subint_{network-role}_vmi_{vmi_index}
+ _v6_IP_{index}
+ """
+ run_test(
+ heat_template,
+ regex_names=("subint_ip", "subint_v6_ip"),
+ network_flavor=ContrailV2InstanceIp.network_flavor_subint,
+ )
diff --git a/ice_validator/tests/test_contrail_irt_routes.py b/ice_validator/tests/test_contrail_irt_routes.py
new file mode 100644
index 0000000..3d614bf
--- /dev/null
+++ b/ice_validator/tests/test_contrail_irt_routes.py
@@ -0,0 +1,167 @@
+# -*- 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.
+#
+
+"""
+contrail interface route table routes
+
+resources:
+<resource name>:
+ type: OS::ContrailV2::InterfaceRouteTable
+ depends_on: [resource name of OS::ContrailV2::ServiceInstance]
+ properties:
+ name:
+ str_replace:
+ template: VNF_NAME_interface_route_table
+ params:
+ VNF_NAME: { get_param: vnf_name }
+ interface_route_table_routes:
+ interface_route_table_routes_route: { get_param: fw_oam_route_prefixes }
+ service_instance_refs:
+ - get_resource: <resource name of OS::ContrailV2::ServiceInstance>
+ service_instance_refs_data:
+ - service_instance_refs_data_interface_type:
+ { get_param: oam_interface_type }
+"""
+
+import re
+
+import pytest
+
+from .structures import Heat
+from .helpers import validates
+
+VERSION = "1.1.0"
+
+RE_ROUTE_ROUTE_PARAM = re.compile(
+ r"(?P<vm_type>.+)" r"_(?P<network_role>.+)" r"_route_prefixes" r"$"
+)
+
+
+def run_test(heat_template, validate):
+ """call validate for each routes route
+ """
+ heat = Heat(filepath=heat_template)
+ if not heat.resources:
+ pytest.skip("No resources found")
+
+ irts = heat.get_resource_by_type(
+ resource_type="OS::ContrailV2::InterfaceRouteTable"
+ )
+ if not irts:
+ pytest.skip("No Contrail InterfaceRouteTable found")
+
+ skip = True
+ bad = {}
+ for rid, resource in irts.items():
+ routes_route = heat.nested_get(
+ resource,
+ "properties",
+ "interface_route_table_routes",
+ "interface_route_table_routes_route",
+ )
+ if routes_route is None:
+ continue
+ error = validate(heat, routes_route)
+ if error:
+ bad[rid] = error
+ continue
+ skip = False
+ if bad:
+ raise AssertionError(
+ "Bad OS::ContrailV2::InterfaceRouteTable: %s"
+ % (", ".join("%s: %s" % (rid, error) for rid, error in bad.items()))
+ )
+ if skip:
+ pytest.skip("No Contrail routes_route found")
+
+
+def validate_irt_route_param_format(heat, routes_route):
+ """ensure routes_route has proper format.
+ Returns error message string or None.
+ """
+ param = heat.nested_get(routes_route, "get_param")
+ if param is None:
+ return "missing routes_route get_param"
+ match = RE_ROUTE_ROUTE_PARAM.match(param)
+ if match is None:
+ return 'routes_route get_param "%s" must match "%s"' % (
+ param,
+ RE_ROUTE_ROUTE_PARAM.pattern,
+ )
+ return None
+
+
+def validate_irt_route_param_type(heat, routes_route):
+ """ensure routes_route has proper type.
+ Returns error message string or None.
+ """
+ param = heat.nested_get(routes_route, "get_param")
+ if param is None:
+ return None
+ if heat.nested_get(heat.parameters, param, "type") != "json":
+ return (
+ 'routes_route get_param "%s" '
+ 'must have a parameter of type "json"' % param
+ )
+ return None
+
+
+# pylint: disable=invalid-name
+
+
+@validates("R-28222")
+def test_contrail_irt_route_param_format(heat_template):
+ """
+ If a VNF's Heat Orchestration Template
+ ``OS::ContrailV2::InterfaceRouteTable`` resource
+ ``interface_route_table_routes`` property
+ ``interface_route_table_routes_route`` map property parameter name
+ **MUST** follow the format
+ """
+ run_test(heat_template, validate_irt_route_param_format)
+
+
+@validates("R-19756")
+def test_contrail_irt_route_param_type(heat_template):
+ """
+ * ``{vm-type}_{network-role}_route_prefixes``
+ **MUST** be defined as type ``json``.
+ """
+ run_test(heat_template, validate_irt_route_param_type)
diff --git a/ice_validator/tests/test_contrail_resource_id.py b/ice_validator/tests/test_contrail_resource_id.py
new file mode 100644
index 0000000..7667600
--- /dev/null
+++ b/ice_validator/tests/test_contrail_resource_id.py
@@ -0,0 +1,150 @@
+# -*- 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.
+#
+
+"""
+contrail
+"""
+
+import pytest
+from .structures import ContrailV2InterfaceRouteTable
+from .structures import ContrailV2NetworkIpam
+from .structures import ContrailV2PortTuple
+from .structures import ContrailV2ServiceHealthCheck
+from .structures import ContrailV2ServiceTemplate
+from .utils.network_roles import get_network_roles
+from .utils.vm_types import get_vm_types
+from .structures import Heat
+from .helpers import validates
+
+VERSION = "1.0.1"
+
+
+def run_test(heat_template, contrail_class, get_parts, part_name):
+ """
+ run test
+ """
+ heat = Heat(filepath=heat_template)
+ if not heat.resources:
+ pytest.skip("No resources found")
+ parts = get_parts(heat.resources)
+ if not parts:
+ pytest.skip("No %s found" % part_name)
+
+ contrail_resources = heat.get_resource_by_type(
+ resource_type=contrail_class.resource_type
+ )
+ if not contrail_resources:
+ pytest.skip("No %s resources found" % contrail_class.resource_type)
+
+ bad = []
+ for rid in contrail_resources:
+ if not any(heat.part_is_in_name(part, rid) for part in parts):
+ bad.append(rid)
+ if bad:
+ raise AssertionError(
+ "%s: %s"
+ " must have %s in %s"
+ % (contrail_class.resource_type, bad, part_name, list(parts))
+ )
+
+
+# pylint: disable=invalid-name
+
+
+@validates("R-81214")
+def test_contrail_interfaceroutetable_resource_id(heat_template):
+ """
+ A VNF's Heat Orchestration Template's Resource
+ ``OS::ContrailV2::InterfaceRouteTable``
+ Resource ID
+ **MUST**
+ contain the ``{network-role}``.
+ """
+ run_test(
+ heat_template, ContrailV2InterfaceRouteTable, get_network_roles, "network_role"
+ )
+
+
+@validates("R-30753")
+def test_contrail_networkipam_resource_id(heat_template):
+ """
+ A VNF's Heat Orchestration Template's Resource
+ ``OS::ContrailV2::NetworkIpam``
+ Resource ID
+ **MUST**
+ contain the ``{network-role}``.
+ """
+ run_test(heat_template, ContrailV2NetworkIpam, get_network_roles, "network_role")
+
+
+@validates("R-20065")
+def test_contrail_porttuple_resource_id(heat_template):
+ """
+ A VNF's Heat Orchestration Template's Resource
+ ``OS::ContrailV2::PortTuple``
+ Resource ID
+ **MUST**
+ contain the ``{vm-type}``.
+ """
+ run_test(heat_template, ContrailV2PortTuple, get_vm_types, "vm_type")
+
+
+@validates("R-76014")
+def test_contrail_servicehealthcheck_resource_id(heat_template):
+ """
+ A VNF's Heat Orchestration Template's Resource
+ ``OS::ContrailV2::ServiceHealthCheck``
+ Resource ID
+ **MUST**
+ contain the ``{vm-type}``.
+ """
+ run_test(heat_template, ContrailV2ServiceHealthCheck, get_vm_types, "vm_type")
+
+
+@validates("R-16437")
+def test_contrail_servicetemplate_resource_id(heat_template):
+ """
+ A VNF's Heat Orchestration Template's Resource
+ ``OS::ContrailV2::ServiceTemplate``
+ Resource ID
+ **MUST**
+ contain the ``{vm-type}``.
+ """
+ run_test(heat_template, ContrailV2ServiceTemplate, get_vm_types, "vm_type")
diff --git a/ice_validator/tests/test_contrail_vmi_resource_id.py b/ice_validator/tests/test_contrail_vmi_resource_id.py
new file mode 100644
index 0000000..35f16e6
--- /dev/null
+++ b/ice_validator/tests/test_contrail_vmi_resource_id.py
@@ -0,0 +1,132 @@
+# -*- 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 .structures import Heat
+from .structures import ContrailV2VirtualMachineInterface
+from .helpers import validates
+
+"""
+resources:
+{vm-type}_server_{vm-type_index}
+"""
+
+VERSION = "1.0.0"
+
+
+def run_test(heat_template, regex_name, network_flavor):
+ """run test
+ """
+ heat = Heat(filepath=heat_template)
+ heat_object_class = ContrailV2VirtualMachineInterface
+ resource_type = heat_object_class.resource_type
+ resources = heat.get_resource_by_type(resource_type=resource_type)
+ if not resources:
+ pytest.skip("No %s resources found" % resource_type)
+ bad = []
+ heat_object = heat_object_class()
+ rid_pattern = heat_object.get_rid_patterns()[regex_name]
+ for rid, resource in resources.items():
+ flavor = heat_object.get_network_flavor(resource)
+ if flavor != network_flavor:
+ continue
+ name = heat_object.get_rid_match_tuple(rid)[0]
+ if name == regex_name:
+ continue
+ bad.append(rid)
+ assert not bad, "%s resource ids %s must match %s" % (
+ network_flavor,
+ bad,
+ [rid_pattern],
+ )
+
+
+# pylint: disable=invalid-name
+
+
+@validates("R-96253")
+def test_contrail_instance_ip_resource_id_external(heat_template):
+ """
+ A VNF's Heat Orchestration Template's Resource
+ OS::ContrailV2::VirtualMachineInterface that is attaching to an
+ external network
+ Resource ID **MUST** use the naming convention
+
+ {vm-type}_{vm-type_index}_{network-role}_vmi_{vmi_index}
+ """
+ run_test(
+ heat_template,
+ regex_name="vmi_external",
+ network_flavor=ContrailV2VirtualMachineInterface.network_flavor_external,
+ )
+
+
+@validates("R-50468")
+def test_contrail_instance_ip_resource_id_internal(heat_template):
+ """
+ A VNF's Heat Orchestration Template's Resource
+ OS::ContrailV2::VirtualMachineInterface that is attaching to an
+ internal network
+ Resource ID **MUST** use the naming convention
+
+ {vm-type}_{vm-type_index}_int_{network-role}_vmi_{vmi_index}
+ """
+ run_test(
+ heat_template,
+ regex_name="vmi_internal",
+ network_flavor=ContrailV2VirtualMachineInterface.network_flavor_internal,
+ )
+
+
+@validates("R-54458")
+def test_contrail_instance_ip_resource_id_subint(heat_template):
+ """
+ A VNF's Heat Orchestration Template's Resource
+ OS::ContrailV2::VirtualMachineInterface that is attaching to an
+ sub-interface network
+ Resource ID **MUST** use the naming convention
+
+ {vm-type}_{vm-type_index}_subint_{network-role}_vmi_{vmi_index}
+ """
+ run_test(
+ heat_template,
+ regex_name="vmi_subint",
+ network_flavor=ContrailV2VirtualMachineInterface.network_flavor_subint,
+ )
diff --git a/ice_validator/tests/test_contrail_vn_resource_id.py b/ice_validator/tests/test_contrail_vn_resource_id.py
new file mode 100644
index 0000000..4045eee
--- /dev/null
+++ b/ice_validator/tests/test_contrail_vn_resource_id.py
@@ -0,0 +1,82 @@
+# -*- 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.
+#
+
+"""
+neutron net resource id
+"""
+
+import pytest
+
+from .helpers import validates
+from .structures import Heat
+from .structures import ContrailV2VirtualNetwork
+
+VERSION = "1.0.0"
+
+# pylint: disable=invalid-name
+
+
+@validates("R-99110")
+def test_neutron_net_resource_id(heat_template):
+ """
+ A VNF's Heat Orchestration Template's Resource
+ OS::ContrailV2::VirtualNetwork Resource ID
+ **MUST** use the naming convention
+
+ 1) int_{network-role}_network
+ or
+ 2) int_{network-role}_RVN`` where RVN represents Resource Virtual
+ """
+ heat = Heat(filepath=heat_template)
+ heat_object_class = ContrailV2VirtualNetwork
+ resource_type = heat_object_class.resource_type
+ resources = heat.get_resource_by_type(resource_type)
+ if not resources:
+ pytest.skip("No %s resources found" % resource_type)
+ heat_object = heat_object_class()
+ bad = []
+ for rid in resources:
+ if not heat_object.get_rid_match_tuple(rid)[0]:
+ bad.append(rid)
+ assert not bad, "%s resource ids %s do not match %s" % (
+ resource_type,
+ bad,
+ heat_object.get_rid_patterns().values(),
+ )
diff --git a/ice_validator/tests/test_env_and_yaml_same_name.py b/ice_validator/tests/test_env_and_yaml_same_name.py
index 46a0917..cbfb1fb 100644
--- a/ice_validator/tests/test_env_and_yaml_same_name.py
+++ b/ice_validator/tests/test_env_and_yaml_same_name.py
@@ -39,32 +39,27 @@
#
from .helpers import validates
-'''test_env_and_yaml_same_name
-'''
+"""test_env_and_yaml_same_name
+"""
from os import listdir
from os import path
-VERSION = '1.0.0'
+VERSION = "1.0.0"
-@validates('R-38474', 'R-81725', 'R-53433')
+@validates("R-38474", "R-81725", "R-53433")
def test_env_and_yaml_same_name(template_dir):
- '''
+ """
Check that all environment template filenames are identical to an
associated Heat template filenames. Log the result of the check and add the
filename of any environment file that is badly named.
- '''
+ """
files = listdir(template_dir)
- env_files = [f for f in files
- if path.splitext(f)[-1] == ".env"]
- yaml_files = [f for f in files
- if path.splitext(f)[-1] in ['.yml', '.yaml']]
+ env_files = [f for f in files if path.splitext(f)[-1] == ".env"]
+ yaml_files = [f for f in files if path.splitext(f)[-1] in [".yml", ".yaml"]]
unmatched = []
for filename in env_files:
basename = path.splitext(filename)[0]
- if (basename + '.yaml' not in yaml_files
- and basename + '.yml' not in yaml_files):
+ if basename + ".yaml" not in yaml_files and basename + ".yml" not in yaml_files:
unmatched.append(filename)
- assert not unmatched, (
- 'files with no corresponding .y[a]ml %s' % unmatched)
-
+ assert not unmatched, "files with no corresponding .y[a]ml %s" % unmatched
diff --git a/ice_validator/tests/test_env_no_resource_registry.py b/ice_validator/tests/test_env_no_resource_registry.py
index 227f0bf..4b00103 100644
--- a/ice_validator/tests/test_env_no_resource_registry.py
+++ b/ice_validator/tests/test_env_no_resource_registry.py
@@ -2,7 +2,7 @@
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -38,25 +38,25 @@
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-'''test env file has no resource_registry
-'''
+"""test env file has no resource_registry
+"""
from tests import cached_yaml as yaml
from .helpers import validates
-VERSION = '1.0.0'
+VERSION = "1.0.0"
-@validates('R-67231')
+@validates("R-67231")
def test_env_no_resource_registry(env_files):
- '''
+ """
A VNF's Heat Orchestration template's Environment File's
**MUST NOT** contain the "resource_registry:" section.
- '''
+ """
for filename in env_files:
with open(filename) as fi:
yml = yaml.load(fi)
- assert 'resource_registry' not in yml, (
- '%s contains "resource_registry"' % filename)
-
+ assert "resource_registry" not in yml, (
+ '%s contains "resource_registry"' % filename
+ )
diff --git a/ice_validator/tests/test_volume_templates_outputs_resources.py b/ice_validator/tests/test_env_parameters_defined_in_template.py
index d3cec1e..9bdd56e 100644
--- a/ice_validator/tests/test_volume_templates_outputs_resources.py
+++ b/ice_validator/tests/test_env_parameters_defined_in_template.py
@@ -37,44 +37,43 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-
-from tests import cached_yaml as yaml
import pytest
-from .utils.nested_iterables import find_all_get_resource_in_yml
+from .helpers import validates, get_environment_pair
+
+
+@validates("R-599443")
+def test_env_params_are_defined_in_template(heat_template):
+ """Test that each paraemter defined in an environment file
+ is also defined in the paired heat template"""
-def test_volume_templates_outputs_match_resources(volume_template):
- '''
- Check that all referenced resources in the outputs of a volume
- template actually exists
- '''
- with open(volume_template) as fh:
- yml = yaml.load(fh)
+ bad = []
+ template_pair = get_environment_pair(heat_template)
- # skip if resources are not defined
- if "resources" not in yml:
- pytest.skip("No resources specified in the volume template")
+ if not template_pair:
+ pytest.skip("No yaml/env pair could be determined")
- # skip if outputs are not defined
- if "outputs" not in yml:
- pytest.skip("No outputs specified in the volume template")
+ template = template_pair.get("yyml").get("parameters", {})
+ environment = template_pair.get("eyml").get("parameters", {})
- referenced_resources = find_all_get_resource_in_yml(yml['outputs'])
+ if not isinstance(template, dict) or not isinstance(environment, dict):
+ pytest.skip("No parameters defined in environment or template")
- invalid_get_attr = []
- for k, v in yml['outputs'].items():
- if 'value' not in v:
- continue
- if 'get_attr' not in v['value']:
- continue
- if not isinstance(v['value']['get_attr'], list):
- continue
+ template = template.keys()
+ environment = environment.keys()
- for v1 in v['value']['get_attr']:
- if v1 in yml['resources']:
- break
- else:
- invalid_get_attr.append(k)
+ for parameter in environment:
+ if parameter not in template:
+ bad.append(
+ (
+ "{} is defined in the environment file but not in "
+ + "the template file "
+ ).format(parameter)
+ )
+ msg = (
+ "All parameters defined in an environment file must "
+ + "be defined in the template file. "
+ + ". ".join(bad)
+ )
- assert (set(referenced_resources) <= set(yml["resources"]) and
- not invalid_get_attr)
+ assert not bad, msg
diff --git a/ice_validator/tests/test_environment_file_parameters.py b/ice_validator/tests/test_environment_file_parameters.py
index 547ab5b..031f898 100644
--- a/ice_validator/tests/test_environment_file_parameters.py
+++ b/ice_validator/tests/test_environment_file_parameters.py
@@ -46,7 +46,7 @@ import pytest
from .helpers import validates, get_environment_pair
-VERSION = '1.0.0'
+VERSION = "1.0.0"
# pylint: disable=invalid-name
@@ -62,21 +62,25 @@ def check_parameter_exists(pattern, parameters):
return False
-def check_param_in_env_file(environment_pair, param, DESIRED):
+def check_param_in_env_file(environment_pair, param, DESIRED, exclude_parameter=None):
+
+ # workaround for internal/external parameters
+ if exclude_parameter and re.match(exclude_parameter, param):
+ return False
if not environment_pair:
pytest.skip("No heat/env pair could be identified")
env_file = environment_pair.get("eyml")
- pattern = re.compile(r'^{}$'.format(param))
+ pattern = re.compile(r"^{}$".format(param))
if "parameters" not in env_file:
pytest.skip("No parameters specified in the environment file")
- return check_parameter_exists(pattern,
- env_file.get("parameters", {})
- ) is not DESIRED
+ return (
+ check_parameter_exists(pattern, env_file.get("parameters", {})) is not DESIRED
+ )
"""
@@ -95,13 +99,16 @@ resource_id:
"""
-def check_resource_parameter(environment_pair,
- prop,
- DESIRED,
- resource_type,
- resource_type_inverse=False,
- nested_prop='',
- exclude_resource=''):
+def check_resource_parameter(
+ environment_pair,
+ prop,
+ DESIRED,
+ resource_type,
+ resource_type_inverse=False,
+ nested_prop="",
+ exclude_resource="",
+ exclude_parameter="",
+):
if not environment_pair:
pytest.skip("No heat/env pair could be identified")
@@ -117,12 +124,13 @@ def check_resource_parameter(environment_pair,
if template_file:
for resource, resource_prop in template_file.get("resources", {}).items():
+ # workaround for subinterface resource groups
if exclude_resource and re.match(exclude_resource, resource):
continue
- if resource_prop.get("type") == resource_type or \
- (resource_prop.get("type") != resource_type
- and resource_type_inverse):
+ if (
+ resource_prop.get("type") == resource_type and not resource_type_inverse
+ ) or (resource_prop.get("type") != resource_type and resource_type_inverse):
pattern = False
@@ -141,7 +149,10 @@ def check_resource_parameter(environment_pair,
if not nested_param:
continue
- pattern = nested_param.get("get_param")
+ if isinstance(nested_param, dict):
+ pattern = nested_param.get("get_param")
+ else:
+ pattern = ""
if not pattern:
continue
@@ -149,26 +160,37 @@ def check_resource_parameter(environment_pair,
if isinstance(pattern, list):
pattern = pattern[0]
+ if check_param_in_env_file(
+ environment_pair,
+ pattern,
+ DESIRED,
+ exclude_parameter=exclude_parameter,
+ ):
+ invalid_parameters.append(pattern)
+
elif isinstance(resource_parameter, dict):
if nested_prop and nested_prop in resource_parameter:
resource_parameter = resource_parameter.get(nested_prop)
pattern = resource_parameter.get("get_param")
-
+ if not pattern:
+ continue
+
+ if check_param_in_env_file(
+ environment_pair,
+ pattern,
+ DESIRED,
+ exclude_parameter=exclude_parameter,
+ ):
+ invalid_parameters.append(pattern)
else:
continue
- if not pattern:
- continue
-
- if check_param_in_env_file(environment_pair, pattern, DESIRED):
- invalid_parameters.append(pattern)
-
return set(invalid_parameters)
-@validates('R-91125')
+@validates("R-91125")
def test_nova_server_image_parameter_exists_in_environment_file(heat_template):
if pytest.config.getoption("validation_profile") == "heat_only":
@@ -180,19 +202,19 @@ def test_nova_server_image_parameter_exists_in_environment_file(heat_template):
DESIRED = True
resource_type = "OS::Nova::Server"
- invalid_parameters = check_resource_parameter(environment_pair,
- prop,
- DESIRED,
- resource_type)
+ invalid_parameters = check_resource_parameter(
+ environment_pair, prop, DESIRED, resource_type
+ )
- assert not invalid_parameters, ("OS::Nova::Server {} parameters not"
- " found in {} environment file {}"
- .format(prop,
- environment_pair.get("name"),
- invalid_parameters))
+ assert not invalid_parameters, (
+ "OS::Nova::Server {} parameters not"
+ " found in {} environment file {}".format(
+ prop, environment_pair.get("name"), invalid_parameters
+ )
+ )
-@validates('R-69431')
+@validates("R-69431")
def test_nova_server_flavor_parameter_exists_in_environment_file(heat_template):
if pytest.config.getoption("validation_profile") == "heat_only":
@@ -204,19 +226,19 @@ def test_nova_server_flavor_parameter_exists_in_environment_file(heat_template):
DESIRED = True
resource_type = "OS::Nova::Server"
- invalid_parameters = check_resource_parameter(environment_pair,
- prop,
- DESIRED,
- resource_type)
+ invalid_parameters = check_resource_parameter(
+ environment_pair, prop, DESIRED, resource_type
+ )
- assert not invalid_parameters, ("OS::Nova::Server {} parameters not"
- " found in {} environment file {}"
- .format(prop,
- environment_pair.get("name"),
- invalid_parameters))
+ assert not invalid_parameters, (
+ "OS::Nova::Server {} parameters not"
+ " found in {} environment file {}".format(
+ prop, environment_pair.get("name"), invalid_parameters
+ )
+ )
-@validates('R-22838')
+@validates("R-22838")
def test_nova_server_name_parameter_doesnt_exist_in_environment_file(heat_template):
if pytest.config.getoption("validation_profile") == "heat_only":
@@ -228,19 +250,19 @@ def test_nova_server_name_parameter_doesnt_exist_in_environment_file(heat_templa
DESIRED = False
resource_type = "OS::Nova::Server"
- invalid_parameters = check_resource_parameter(environment_pair,
- prop,
- DESIRED,
- resource_type)
+ invalid_parameters = check_resource_parameter(
+ environment_pair, prop, DESIRED, resource_type
+ )
- assert not invalid_parameters, ("OS::Nova::Server {} parameters"
- " found in {} environment file {}"
- .format(prop,
- environment_pair.get("name"),
- invalid_parameters))
+ assert not invalid_parameters, (
+ "OS::Nova::Server {} parameters"
+ " found in {} environment file {}".format(
+ prop, environment_pair.get("name"), invalid_parameters
+ )
+ )
-@validates('R-59568')
+@validates("R-59568")
def test_nova_server_az_parameter_doesnt_exist_in_environment_file(heat_template):
if pytest.config.getoption("validation_profile") == "heat_only":
@@ -252,19 +274,19 @@ def test_nova_server_az_parameter_doesnt_exist_in_environment_file(heat_template
DESIRED = False
resource_type = "OS::Nova::Server"
- invalid_parameters = check_resource_parameter(environment_pair,
- prop,
- DESIRED,
- resource_type)
+ invalid_parameters = check_resource_parameter(
+ environment_pair, prop, DESIRED, resource_type
+ )
- assert not invalid_parameters, ("OS::Nova::Server {} parameters"
- " found in {} environment file {}"
- .format(prop,
- environment_pair.get("name"),
- invalid_parameters))
+ assert not invalid_parameters, (
+ "OS::Nova::Server {} parameters"
+ " found in {} environment file {}".format(
+ prop, environment_pair.get("name"), invalid_parameters
+ )
+ )
-@validates('R-20856')
+@validates("R-20856")
def test_nova_server_vnf_id_parameter_doesnt_exist_in_environment_file(heat_template):
if pytest.config.getoption("validation_profile") == "heat_only":
@@ -275,19 +297,20 @@ def test_nova_server_vnf_id_parameter_doesnt_exist_in_environment_file(heat_temp
prop = "vnf_id"
DESIRED = False
- invalid_parameters = check_param_in_env_file(environment_pair,
- prop,
- DESIRED)
+ invalid_parameters = check_param_in_env_file(environment_pair, prop, DESIRED)
- assert not invalid_parameters, ("{} parameters"
- " found in {} environment file {}"
- .format(prop,
- environment_pair.get("name"),
- invalid_parameters))
+ assert not invalid_parameters, (
+ "{} parameters"
+ " found in {} environment file {}".format(
+ prop, environment_pair.get("name"), invalid_parameters
+ )
+ )
-@validates('R-72871')
-def test_nova_server_vf_module_id_parameter_doesnt_exist_in_environment_file(heat_template):
+@validates("R-72871")
+def test_nova_server_vf_module_id_parameter_doesnt_exist_in_environment_file(
+ heat_template
+):
if pytest.config.getoption("validation_profile") == "heat_only":
pytest.skip("skipping test because validation profile is heat only")
@@ -297,18 +320,40 @@ def test_nova_server_vf_module_id_parameter_doesnt_exist_in_environment_file(hea
prop = "vf_module_id"
DESIRED = False
- invalid_parameters = check_param_in_env_file(environment_pair,
- prop,
- DESIRED)
+ invalid_parameters = check_param_in_env_file(environment_pair, prop, DESIRED)
+
+ assert not invalid_parameters, (
+ "{} parameters"
+ " found in {} environment file {}".format(
+ prop, environment_pair.get("name"), invalid_parameters
+ )
+ )
- assert not invalid_parameters, ("{} parameters"
- " found in {} environment file {}"
- .format(prop,
- environment_pair.get("name"),
- invalid_parameters))
+@validates("R-37039")
+def test_nova_server_vf_module_index_parameter_doesnt_exist_in_environment_file(
+ heat_template
+):
+
+ if pytest.config.getoption("validation_profile") == "heat_only":
+ pytest.skip("skipping test because validation profile is heat only")
+
+ environment_pair = get_environment_pair(heat_template)
+
+ prop = "vf_module_index"
+ DESIRED = False
-@validates('R-36542')
+ invalid_parameters = check_param_in_env_file(environment_pair, prop, DESIRED)
+
+ assert not invalid_parameters, (
+ "{} parameters"
+ " found in {} environment file {}".format(
+ prop, environment_pair.get("name"), invalid_parameters
+ )
+ )
+
+
+@validates("R-36542")
def test_nova_server_vnf_name_parameter_doesnt_exist_in_environment_file(heat_template):
if pytest.config.getoption("validation_profile") == "heat_only":
@@ -319,19 +364,20 @@ def test_nova_server_vnf_name_parameter_doesnt_exist_in_environment_file(heat_te
prop = "vnf_name"
DESIRED = False
- invalid_parameters = check_param_in_env_file(environment_pair,
- prop,
- DESIRED)
+ invalid_parameters = check_param_in_env_file(environment_pair, prop, DESIRED)
- assert not invalid_parameters, ("{} parameters"
- " found in {} environment file {}"
- .format(prop,
- environment_pair.get("name"),
- invalid_parameters))
+ assert not invalid_parameters, (
+ "{} parameters"
+ " found in {} environment file {}".format(
+ prop, environment_pair.get("name"), invalid_parameters
+ )
+ )
-@validates('R-80374')
-def test_nova_server_vf_module_name_parameter_doesnt_exist_in_environment_file(heat_template):
+@validates("R-80374")
+def test_nova_server_vf_module_name_parameter_doesnt_exist_in_environment_file(
+ heat_template
+):
if pytest.config.getoption("validation_profile") == "heat_only":
pytest.skip("skipping test because validation profile is heat only")
@@ -341,19 +387,20 @@ def test_nova_server_vf_module_name_parameter_doesnt_exist_in_environment_file(h
prop = "vf_module_name"
DESIRED = False
- invalid_parameters = check_param_in_env_file(environment_pair,
- prop,
- DESIRED)
+ invalid_parameters = check_param_in_env_file(environment_pair, prop, DESIRED)
- assert not invalid_parameters, ("{} parameters"
- " found in {} environment file {}"
- .format(prop,
- environment_pair.get("name"),
- invalid_parameters))
+ assert not invalid_parameters, (
+ "{} parameters"
+ " found in {} environment file {}".format(
+ prop, environment_pair.get("name"), invalid_parameters
+ )
+ )
-@validates('R-02691')
-def test_nova_server_workload_context_parameter_doesnt_exist_in_environment_file(heat_template):
+@validates("R-02691")
+def test_nova_server_workload_context_parameter_doesnt_exist_in_environment_file(
+ heat_template
+):
if pytest.config.getoption("validation_profile") == "heat_only":
pytest.skip("skipping test because validation profile is heat only")
@@ -363,19 +410,20 @@ def test_nova_server_workload_context_parameter_doesnt_exist_in_environment_file
prop = "workload_context"
DESIRED = False
- invalid_parameters = check_param_in_env_file(environment_pair,
- prop,
- DESIRED)
+ invalid_parameters = check_param_in_env_file(environment_pair, prop, DESIRED)
- assert not invalid_parameters, ("{} parameters"
- " found in {} environment file {}"
- .format(prop,
- environment_pair.get("name"),
- invalid_parameters))
+ assert not invalid_parameters, (
+ "{} parameters"
+ " found in {} environment file {}".format(
+ prop, environment_pair.get("name"), invalid_parameters
+ )
+ )
-@validates('R-13194')
-def test_nova_server_environment_context_parameter_doesnt_exist_in_environment_file(heat_template):
+@validates("R-13194")
+def test_nova_server_environment_context_parameter_doesnt_exist_in_environment_file(
+ heat_template
+):
if pytest.config.getoption("validation_profile") == "heat_only":
pytest.skip("skipping test because validation profile is heat only")
@@ -385,18 +433,17 @@ def test_nova_server_environment_context_parameter_doesnt_exist_in_environment_f
prop = "environment_context"
DESIRED = False
- invalid_parameters = check_param_in_env_file(environment_pair,
- prop,
- DESIRED)
+ invalid_parameters = check_param_in_env_file(environment_pair, prop, DESIRED)
- assert not invalid_parameters, ("{} parameters"
- " found in {} environment file {}"
- .format(prop,
- environment_pair.get("name"),
- invalid_parameters))
+ assert not invalid_parameters, (
+ "{} parameters"
+ " found in {} environment file {}".format(
+ prop, environment_pair.get("name"), invalid_parameters
+ )
+ )
-@validates('R-29872')
+@validates("R-29872")
def test_nova_server_network_parameter_doesnt_exist_in_environment_file(heat_template):
if pytest.config.getoption("validation_profile") == "heat_only":
@@ -409,33 +456,22 @@ def test_nova_server_network_parameter_doesnt_exist_in_environment_file(heat_tem
DESIRED = False
resource_type = "OS::Nova::Server"
- invalid_parameters = check_resource_parameter(environment_pair,
- prop,
- DESIRED,
- resource_type,
- nested_prop=nested_prop)
-
- assert not invalid_parameters, ("{} {} parameters"
- " found in {} environment file {}"
- .format(resource_type,
- nested_prop,
- environment_pair.get("name"),
- invalid_parameters))
-
-
-@validates('R-39841',
- 'R-87123',
- 'R-28795',
- 'R-97201',
- 'R-62590',
- 'R-93496',
- 'R-98905',
- 'R-93030',
- 'R-90206',
- 'R-98569',
- 'R-62590',
- 'R-93496')
-def test_neutron_port_fixedips_ipaddress_parameter_doesnt_exist_in_environment_file(heat_template):
+ invalid_parameters = check_resource_parameter(
+ environment_pair, prop, DESIRED, resource_type, nested_prop=nested_prop
+ )
+
+ assert not invalid_parameters, (
+ "{} {} parameters"
+ " found in {} environment file {}".format(
+ resource_type, nested_prop, environment_pair.get("name"), invalid_parameters
+ )
+ )
+
+
+@validates("R-39841", "R-87123", "R-62590", "R-98905", "R-93030", "R-62590")
+def test_neutron_port_external_fixedips_ipaddress_parameter_doesnt_exist_in_environment_file(
+ heat_template
+):
if pytest.config.getoption("validation_profile") == "heat_only":
pytest.skip("skipping test because validation profile is heat only")
@@ -446,26 +482,62 @@ def test_neutron_port_fixedips_ipaddress_parameter_doesnt_exist_in_environment_f
nested_prop = "ip_address"
DESIRED = False
resource_type = "OS::Neutron::Port"
+ exclude_parameter = re.compile(r"^(.+?)_int_(.+?)$")
+
+ invalid_parameters = check_resource_parameter(
+ environment_pair,
+ prop,
+ DESIRED,
+ resource_type,
+ nested_prop=nested_prop,
+ exclude_parameter=exclude_parameter,
+ )
+
+ assert not invalid_parameters, (
+ "{} {} external parameters"
+ " found in {} environment file {}".format(
+ resource_type, nested_prop, environment_pair.get("name"), invalid_parameters
+ )
+ )
+
+
+@validates("R-28795", "R-97201", "R-93496", "R-90206", "R-98569", "R-93496")
+def test_neutron_port_internal_fixedips_ipaddress_parameter_exists_in_environment_file(
+ heat_template
+):
- invalid_parameters = check_resource_parameter(environment_pair,
- prop,
- DESIRED,
- resource_type,
- nested_prop=nested_prop)
-
- assert not invalid_parameters, ("{} {} parameters"
- " found in {} environment file {}"
- .format(resource_type,
- nested_prop,
- environment_pair.get("name"),
- invalid_parameters))
+ if pytest.config.getoption("validation_profile") == "heat_only":
+ pytest.skip("skipping test because validation profile is heat only")
+ environment_pair = get_environment_pair(heat_template)
-@validates('R-83677',
- 'R-80829',
- 'R-69634',
- 'R-22288')
-def test_neutron_port_fixedips_subnet_parameter_doesnt_exist_in_environment_file(heat_template):
+ prop = "fixed_ips"
+ nested_prop = "ip_address"
+ DESIRED = True
+ resource_type = "OS::Neutron::Port"
+ exclude_parameter = re.compile(r"^((?!_int_).)*$")
+
+ invalid_parameters = check_resource_parameter(
+ environment_pair,
+ prop,
+ DESIRED,
+ resource_type,
+ nested_prop=nested_prop,
+ exclude_parameter=exclude_parameter,
+ )
+
+ assert not invalid_parameters, (
+ "{} {} internal parameters"
+ " not found in {} environment file {}".format(
+ resource_type, nested_prop, environment_pair.get("name"), invalid_parameters
+ )
+ )
+
+
+@validates("R-83677", "R-80829", "R-69634", "R-22288")
+def test_neutron_port_fixedips_subnet_parameter_doesnt_exist_in_environment_file(
+ heat_template
+):
if pytest.config.getoption("validation_profile") == "heat_only":
pytest.skip("skipping test because validation profile is heat only")
@@ -473,26 +545,23 @@ def test_neutron_port_fixedips_subnet_parameter_doesnt_exist_in_environment_file
environment_pair = get_environment_pair(heat_template)
prop = "fixed_ips"
- nested_prop = "subnet_id"
+ nested_prop = "subnet"
DESIRED = False
resource_type = "OS::Neutron::Port"
- invalid_parameters = check_resource_parameter(environment_pair,
- prop,
- DESIRED,
- resource_type,
- nested_prop=nested_prop)
+ invalid_parameters = check_resource_parameter(
+ environment_pair, prop, DESIRED, resource_type, nested_prop=nested_prop
+ )
- assert not invalid_parameters, ("{} {} parameters"
- " found in {} environment file {}"
- .format(resource_type,
- nested_prop,
- environment_pair.get("name"),
- invalid_parameters))
+ assert not invalid_parameters, (
+ "{} {} parameters"
+ " found in {} environment file {}".format(
+ resource_type, nested_prop, environment_pair.get("name"), invalid_parameters
+ )
+ )
-@validates('R-83412',
- 'R-83418')
+@validates("R-83412", "R-83418")
def test_neutron_port_aap_ip_parameter_doesnt_exist_in_environment_file(heat_template):
if pytest.config.getoption("validation_profile") == "heat_only":
@@ -505,21 +574,19 @@ def test_neutron_port_aap_ip_parameter_doesnt_exist_in_environment_file(heat_tem
DESIRED = False
resource_type = "OS::Neutron::Port"
- invalid_parameters = check_resource_parameter(environment_pair,
- prop,
- DESIRED,
- resource_type,
- nested_prop=nested_prop)
+ invalid_parameters = check_resource_parameter(
+ environment_pair, prop, DESIRED, resource_type, nested_prop=nested_prop
+ )
- assert not invalid_parameters, ("{} {} parameters"
- " found in {} environment file {}"
- .format(resource_type,
- nested_prop,
- environment_pair.get("name"),
- invalid_parameters))
+ assert not invalid_parameters, (
+ "{} {} parameters"
+ " found in {} environment file {}".format(
+ resource_type, nested_prop, environment_pair.get("name"), invalid_parameters
+ )
+ )
-@validates('R-99812')
+@validates("R-99812")
def test_non_nova_server_name_parameter_doesnt_exist_in_environment_file(heat_template):
if pytest.config.getoption("validation_profile") == "heat_only":
@@ -531,21 +598,19 @@ def test_non_nova_server_name_parameter_doesnt_exist_in_environment_file(heat_te
DESIRED = False
resource_type = "OS::Nova::Server"
- invalid_parameters = check_resource_parameter(environment_pair,
- prop,
- DESIRED,
- resource_type,
- resource_type_inverse=True)
+ invalid_parameters = check_resource_parameter(
+ environment_pair, prop, DESIRED, resource_type, resource_type_inverse=True
+ )
- assert not invalid_parameters, ("non-{} {} parameters"
- " found in {} environment file {}"
- .format(resource_type,
- prop,
- environment_pair.get("name"),
- invalid_parameters))
+ assert not invalid_parameters, (
+ "non-{} {} parameters"
+ " found in {} environment file {}".format(
+ resource_type, prop, environment_pair.get("name"), invalid_parameters
+ )
+ )
-@validates('R-92193')
+@validates("R-92193")
def test_network_fqdn_parameter_doesnt_exist_in_environment_file(heat_template):
if pytest.config.getoption("validation_profile") == "heat_only":
@@ -553,22 +618,23 @@ def test_network_fqdn_parameter_doesnt_exist_in_environment_file(heat_template):
environment_pair = get_environment_pair(heat_template)
- prop = r'^(.+?)_net_fqdn$'
+ prop = r"^(.+?)_net_fqdn$"
DESIRED = False
- invalid_parameters = check_param_in_env_file(environment_pair,
- prop,
- DESIRED)
+ invalid_parameters = check_param_in_env_file(environment_pair, prop, DESIRED)
- assert not invalid_parameters, ("{} parameters"
- " found in {} environment file {}"
- .format(prop,
- environment_pair.get("name"),
- invalid_parameters))
+ assert not invalid_parameters, (
+ "{} parameters"
+ " found in {} environment file {}".format(
+ prop, environment_pair.get("name"), invalid_parameters
+ )
+ )
-@validates('R-76682')
-def test_contrail_route_prefixes_parameter_doesnt_exist_in_environment_file(heat_template):
+@validates("R-76682")
+def test_contrail_route_prefixes_parameter_doesnt_exist_in_environment_file(
+ heat_template
+):
if pytest.config.getoption("validation_profile") == "heat_only":
pytest.skip("skipping test because validation profile is heat only")
@@ -580,21 +646,19 @@ def test_contrail_route_prefixes_parameter_doesnt_exist_in_environment_file(heat
DESIRED = False
resource_type = "OS::ContrailV2::InterfaceRouteTable"
- invalid_parameters = check_resource_parameter(environment_pair,
- prop,
- DESIRED,
- resource_type,
- nested_prop=nested_prop)
+ invalid_parameters = check_resource_parameter(
+ environment_pair, prop, DESIRED, resource_type, nested_prop=nested_prop
+ )
- assert not invalid_parameters, ("{} {} parameters"
- " found in {} environment file {}"
- .format(resource_type,
- nested_prop,
- environment_pair.get("name"),
- invalid_parameters))
+ assert not invalid_parameters, (
+ "{} {} parameters"
+ " found in {} environment file {}".format(
+ resource_type, nested_prop, environment_pair.get("name"), invalid_parameters
+ )
+ )
-@validates('R-50011')
+@validates("R-50011")
def test_heat_rg_count_parameter_exists_in_environment_file(heat_template):
if pytest.config.getoption("validation_profile") == "heat_only":
@@ -605,17 +669,19 @@ def test_heat_rg_count_parameter_exists_in_environment_file(heat_template):
prop = "count"
DESIRED = True
resource_type = "OS::Heat::ResourceGroup"
- exclude_resource = re.compile(r'^(.+?)_subint_(.+?)_port_(.+?)_subinterfaces$')
-
- invalid_parameters = check_resource_parameter(environment_pair,
- prop,
- DESIRED,
- resource_type,
- exclude_resource=exclude_resource)
-
- assert not invalid_parameters, ("{} {} parameters not"
- " found in {} environment file {}"
- .format(resource_type,
- prop,
- environment_pair.get("name"),
- invalid_parameters))
+ exclude_resource = re.compile(r"^(.+?)_subint_(.+?)_port_(.+?)_subinterfaces$")
+
+ invalid_parameters = check_resource_parameter(
+ environment_pair,
+ prop,
+ DESIRED,
+ resource_type,
+ exclude_resource=exclude_resource,
+ )
+
+ assert not invalid_parameters, (
+ "{} {} parameters not"
+ " found in {} environment file {}".format(
+ resource_type, prop, environment_pair.get("name"), invalid_parameters
+ )
+ )
diff --git a/ice_validator/tests/test_environment_file_structure.py b/ice_validator/tests/test_environment_file_structure.py
index 42786e9..a4fd0f8 100644
--- a/ice_validator/tests/test_environment_file_structure.py
+++ b/ice_validator/tests/test_environment_file_structure.py
@@ -45,19 +45,19 @@ from tests import cached_yaml as yaml
from .helpers import validates
-VERSION = '1.0.0'
+VERSION = "1.0.0"
# pylint: disable=invalid-name
-@validates('R-03324')
+@validates("R-03324")
def test_environment_file_contains_required_sections(env_file):
- '''
+ """
Check that all environments files only have the allowed sections
- '''
+ """
required_keys = ["parameters"]
with open(env_file) as fh:
yml = yaml.load(fh)
missing_keys = [v for v in required_keys if v not in yml]
- assert not missing_keys, '%s missing %s' % (env_file, missing_keys)
+ assert not missing_keys, "%s missing %s" % (env_file, missing_keys)
diff --git a/ice_validator/tests/test_filename_is_vmtype_dot_yaml.py b/ice_validator/tests/test_filename_is_vmtype_dot_yaml.py
new file mode 100644
index 0000000..f31f370
--- /dev/null
+++ b/ice_validator/tests/test_filename_is_vmtype_dot_yaml.py
@@ -0,0 +1,75 @@
+# -*- 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 os
+from tests import cached_yaml as yaml
+
+from .helpers import validates
+from .utils.vm_types import get_vm_types
+
+VERSION = "1.0.0"
+
+# pylint: disable=invalid-name
+
+
+@validates("R-70276")
+def test_filename_is_vmtype_dot_yaml(yaml_files):
+
+ vm_types = []
+ invalid_files = []
+
+ for yaml_file in yaml_files:
+ with open(yaml_file, "r") as f:
+ yml = yaml.load(f)
+
+ if "resources" not in yml:
+ continue
+
+ vm_types.extend(get_vm_types(yml["resources"]))
+
+ for yaml_file in yaml_files:
+ basename, filename = os.path.split(yaml_file)
+ file, ext = os.path.splitext(os.path.basename(filename))
+ for vt in vm_types:
+ if vt == file:
+ invalid_files.append({"vm_type": vt, "file": yaml_file})
+
+ assert not invalid_files, "filenames must not be in format vm_type.yaml: {}".format(
+ invalid_files
+ )
diff --git a/ice_validator/tests/test_files_in_flat_dir.py b/ice_validator/tests/test_files_in_flat_dir.py
new file mode 100644
index 0000000..ac0ff7c
--- /dev/null
+++ b/ice_validator/tests/test_files_in_flat_dir.py
@@ -0,0 +1,50 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START====================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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============================================
+import os
+
+from tests.helpers import validates
+
+
+@validates("R-511776", "R-99646")
+def test_files_in_flat_dir(template_dir):
+ paths = (os.path.join(template_dir, p) for p in os.listdir(template_dir))
+ nested_dirs = (p for p in paths if os.path.isdir(p))
+ nested_dirs = [os.path.relpath(p, template_dir) for p in nested_dirs]
+ msg = "Nested directories detected in template directory: {}".format(
+ ", ".join(nested_dirs)
+ )
+ assert not nested_dirs, msg
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 428b72e..f94d22b 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
@@ -45,21 +45,23 @@ from .helpers import validates
from .utils.ports import get_invalid_ip_addresses
-@validates('R-40971',
- 'R-27818',
- 'R-29765',
- 'R-85235',
- 'R-78380',
- 'R-23503',
- 'R-71577',
- 'R-04697',
- 'R-34037')
+@validates(
+ "R-40971",
+ "R-27818",
+ "R-29765",
+ "R-85235",
+ "R-78380",
+ "R-23503",
+ "R-71577",
+ "R-04697",
+ "R-34037",
+)
def test_fixed_ips_include_vm_type_network_role(heat_template):
- '''
+ """
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(heat_template) as fh:
yml = yaml.load(fh)
@@ -70,8 +72,11 @@ def test_fixed_ips_include_vm_type_network_role(heat_template):
if "parameters" not in yml:
pytest.skip("No parameters specified in the heat template")
- invalid_ip_addresses = get_invalid_ip_addresses(yml['resources'],
- "fixed_ips",
- yml["parameters"])
+ invalid_ip_addresses = get_invalid_ip_addresses(
+ yml["resources"], "fixed_ips", yml["parameters"]
+ )
- assert not set(invalid_ip_addresses)
+ msg = "The following fixed_ips are declared incorrectly: {}".format(
+ ", ".join(invalid_ip_addresses)
+ )
+ assert not set(invalid_ip_addresses), msg
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/test_forbidden_resources.py
index d686e65..7ff6bb6 100644
--- a/ice_validator/tests/fixtures/test_reserve_port_fixed_ips_format/fail/invalid_base_naming_for_fixed_ips.yaml
+++ b/ice_validator/tests/test_forbidden_resources.py
@@ -1,5 +1,5 @@
# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
+# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -37,33 +37,45 @@
#
# 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 }
+"""
+forbidden resources
+"""
- 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 }
+from .structures import Heat
+from .helpers import validates
- 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
+VERSION = "1.1.1"
+
+
+def run_test(heat_template, forbidden):
+ """run
+ """
+ heat = Heat(filepath=heat_template)
+ bad = set()
+ for rid, resource in heat.resources.items():
+ if heat.nested_get(resource, "type") == forbidden:
+ bad.add(rid)
+ assert not bad, 'resource(s) with forbidden type "%s" %s' % (forbidden, list(bad))
+
+
+# pylint: disable=invalid-name
+
+
+@validates("R-05257")
+def test_neutron_floating_ip_resource_type(heat_template):
+ """
+ A VNF's Heat Orchestration Template's **MUST NOT**
+ contain the Resource ``OS::Neutron::FloatingIP``.
+ """
+ run_test(heat_template, "OS::Neutron::FloatingIP")
+
+
+@validates("R-76449")
+def test_neutron_floating_ip_association_resource_type(heat_template):
+ """
+ A VNF's Heat Orchestration Template's **MUST NOT**
+ contain the Resource ``OS::Neutron::FloatingIPAssociation``.
+ """
+ run_test(heat_template, "OS::Neutron::FloatingIPAssociation")
diff --git a/ice_validator/tests/test_get_attr_usage.py b/ice_validator/tests/test_get_attr_usage.py
new file mode 100644
index 0000000..5180add
--- /dev/null
+++ b/ice_validator/tests/test_get_attr_usage.py
@@ -0,0 +1,86 @@
+import os
+
+import pytest
+
+from tests.helpers import validates, traverse, load_yaml
+from tests.structures import Resource
+from tests.utils import nested_dict
+
+
+class GetAttrValidator:
+ def __init__(self, yaml, base_dir):
+ self.yaml = yaml
+ self.base_dir = base_dir
+ self.errors = []
+
+ @property
+ def resources(self):
+ return self.yaml.get("resources", {})
+
+ def __call__(self, path, get_attr_arg):
+ if not isinstance(get_attr_arg, list):
+ self.add_error(path, get_attr_arg, "get_attr argument is not a list")
+ elif len(get_attr_arg) < 1:
+ self.add_error(
+ path, get_attr_arg, "get_attr argument must have a parameter"
+ )
+ elif get_attr_arg[0] not in self.resources:
+ self.add_error(
+ path,
+ get_attr_arg,
+ "Resource ID could not be found. Please ensure "
+ "the resource is spelled correctly and defined "
+ "under the resources section of the YAML file.",
+ )
+ else:
+ r_id = get_attr_arg[0]
+ r = Resource(r_id, self.yaml["resources"][r_id])
+ if not r.is_nested():
+ return
+ if len(get_attr_arg) < 2:
+ self.add_error(
+ path,
+ get_attr_arg,
+ "get_attr used on nested "
+ "resource, but no attribute "
+ "value specified",
+ )
+ return
+ expected_param = get_attr_arg[1]
+ nested_yaml = r.get_nested_yaml(self.base_dir)
+ param = nested_dict.get(nested_yaml, "outputs", expected_param)
+ if not param:
+ self.add_error(
+ path,
+ get_attr_arg,
+ "Attribute key "
+ + expected_param
+ + " not found in outputs "
+ + r.get_nested_filename(),
+ )
+
+ def add_error(self, path, arg, message):
+ path_str = ".".join(path)
+ self.errors.append("{} {}: {}".format(path_str, arg, message))
+
+ @property
+ def error_message(self):
+ errs = ", ".join(self.errors)
+ return "Invalid get_attr usage detected: {}".format(errs)
+
+
+@pytest.mark.base
+@validates("R-95303")
+def test_08_validate_get_attr_usage(yaml_file):
+ """Ensures that every get_attr refers to a valid resource name,
+ and if that resource is a nested YAML that the attribute exists as
+ an output of the nested YAML file. It does not validate the
+ attribute keys are always valid because of the attributes could
+ refer to intrinsic attributes of the resource that are not present
+ in the YAML file."""
+
+ yml = load_yaml(yaml_file)
+ base_dir, _ = os.path.split(yaml_file)
+ validator = GetAttrValidator(yml, base_dir)
+ traverse(yml, "get_attr", validator)
+ assert not validator.errors, validator.error_message
diff --git a/ice_validator/tests/test_get_file_only_reference_local_files.py b/ice_validator/tests/test_get_file_only_reference_local_files.py
index a419585..58a1384 100644
--- a/ice_validator/tests/test_get_file_only_reference_local_files.py
+++ b/ice_validator/tests/test_get_file_only_reference_local_files.py
@@ -1,5 +1,5 @@
# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
+# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -37,8 +37,11 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-
+"""test get_file
+"""
import re
+from os import listdir
+from os import path
from os import sep
import pytest
@@ -47,14 +50,19 @@ from tests import cached_yaml as yaml
from .helpers import validates
from .utils.nested_iterables import find_all_get_file_in_yml
+VERSION = "1.0.0"
-@validates('R-99646')
-def test_get_file_only_reference_local_files(yaml_file):
- '''
+# pylint: disable=invalid-name
+
+
+@validates("R-41888")
+@pytest.mark.base
+def test_get_file_no_url_retrieval(yaml_file):
+ """
Make sure that all references to get_file only try to access local files
and only assume a flat directory structure
- '''
- is_url = re.compile(r'(?:http|https|file|ftp|ftps)://.+')
+ """
+ is_url = re.compile(r"(?:http|https|file|ftp|ftps)://.+")
with open(yaml_file) as fh:
yml = yaml.load(fh)
@@ -74,4 +82,39 @@ def test_get_file_only_reference_local_files(yaml_file):
invalid_files.append(get_file)
continue
- assert not set(invalid_files)
+ assert not set(invalid_files), "External get_file references detected {}".format(
+ invalid_files
+ )
+
+
+@validates("R-76718")
+@pytest.mark.base
+def test_get_file_only_reference_local_files(yaml_file):
+ """
+ Make sure that all references to get_file only try to access local files
+ and only assume a flat directory structure
+ """
+ is_url = re.compile(r"(?:http|https|file|ftp|ftps)://.+")
+ base_dir, filename = path.split(yaml_file)
+
+ with open(yaml_file) as fh:
+ yml = yaml.load(fh)
+
+ # skip if parameters are not defined
+ if "resources" not in yml:
+ pytest.skip("No resources specified in the heat template")
+
+ get_files = find_all_get_file_in_yml(yml["resources"])
+
+ invalid_files = []
+ for get_file in get_files:
+ if is_url.match(get_file):
+ pytest.skip("external get_file detected")
+ continue
+ if get_file not in listdir(base_dir):
+ invalid_files.append(get_file)
+ continue
+
+ assert not set(invalid_files), "Non-local files detected in get_file {}".format(
+ invalid_files
+ )
diff --git a/ice_validator/tests/test_heat_pairs_provided.py b/ice_validator/tests/test_heat_pairs_provided.py
index 76aa276..fd6c95b 100644
--- a/ice_validator/tests/test_heat_pairs_provided.py
+++ b/ice_validator/tests/test_heat_pairs_provided.py
@@ -43,24 +43,54 @@ from os import path
from .helpers import validates
-@validates('R-86285', 'R-38474', 'R-81725', 'R-53433', 'R-56438',
- 'R-74304', 'R-91342', 'R-94509', 'R-31141')
+@validates(
+ "R-86285",
+ "R-38474",
+ "R-81725",
+ "R-53433",
+ "R-56438",
+ "R-74304",
+ "R-91342",
+ "R-94509",
+ "R-31141",
+)
def test_heat_pairs_provided(heat_templates, env_files, volume_templates):
- '''
+ """
Check that every yaml file is submitted with
an associated env file, and every env has an
associated yaml file.
- '''
+ """
+ env_files_missing_template = []
for filename in env_files:
basename = path.splitext(filename)[0]
- assert basename + '.yaml' in heat_templates or \
- basename + '.yml' in heat_templates or \
- basename + '.yml' in volume_templates or \
- basename + '.yaml' in volume_templates
+ if not (
+ basename + ".yaml" in heat_templates
+ or basename + ".yml" in heat_templates
+ or basename + ".yml" in volume_templates
+ or basename + ".yaml" in volume_templates
+ ):
+ env_files_missing_template.append(filename)
+
+ heat_template_missing_env = []
for filename in heat_templates:
basename = path.splitext(filename)[0]
- assert basename + '.env' in env_files
+ if not basename + ".env" in env_files:
+ heat_template_missing_env.append(filename)
+
for filename in volume_templates:
basename = path.splitext(filename)[0]
- assert basename + '.env' in env_files
+ if not basename + ".env" in env_files:
+ heat_template_missing_env.append(filename)
+
+ msg = (
+ "Mismatched template and environment file pairs detected. "
+ + "Environment files with no matching template: {} ".format(
+ env_files_missing_template
+ )
+ + "Heat templates with no matching environment file: {}".format(
+ heat_template_missing_env
+ )
+ )
+
+ assert not (env_files_missing_template or heat_template_missing_env), msg
diff --git a/ice_validator/tests/test_heat_parameter_section.py b/ice_validator/tests/test_heat_parameter_section.py
index a226416..ce97023 100644
--- a/ice_validator/tests/test_heat_parameter_section.py
+++ b/ice_validator/tests/test_heat_parameter_section.py
@@ -2,7 +2,7 @@
# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -48,17 +48,17 @@ from tests import cached_yaml as yaml
from .helpers import validates
-VERSION = '1.0.0'
+VERSION = "1.0.0"
# one or more (alphanumeric or underscore)
-RE_VALID_PARAMETER_NAME = re.compile(r'[\w_]+$')
+RE_VALID_PARAMETER_NAME = re.compile(r"[\w_]+$")
-@validates('R-90526')
+@validates("R-90526")
def test_default_values(yaml_file):
- '''
+ """
Make sure no default values are set for any parameter.
- '''
+ """
with open(yaml_file) as fh:
yml = yaml.load(fh)
@@ -66,23 +66,26 @@ def test_default_values(yaml_file):
if "parameters" not in yml:
pytest.skip("No parameters specified in the heat template")
- invalid_params = []
- for v1 in yml["parameters"].values():
+ invalid_params = set()
+ for param, v1 in yml["parameters"].items():
if not isinstance(v1, dict):
continue
- if any(k == 'default' for k in v1):
- invalid_params.append(str(v1))
+ if any(k == "default" for k in v1):
+ invalid_params.add(param)
- assert not set(invalid_params)
+ msg = "The following parameters specify a default: {}".format(
+ ", ".join(invalid_params)
+ )
+ assert not invalid_params, msg
-@validates('R-25877')
+@validates("R-25877")
def test_parameter_names(yaml_file):
- '''
+ """
A VNF's Heat Orchestration Template's parameter name
(i.e., <param name>) **MUST** contain only alphanumeric
characters and underscores ('_').
- '''
+ """
with open(yaml_file) as fh:
yml = yaml.load(fh)
@@ -90,9 +93,7 @@ def test_parameter_names(yaml_file):
if "parameters" not in yml:
pytest.skip("No parameters specified in the heat template")
- for key in yml['parameters']:
- assert RE_VALID_PARAMETER_NAME.match(key), (
- '%s parameter "%s" not alphanumeric or underscore' % (
- yaml_file,
- key))
-
+ for key in yml["parameters"]:
+ assert RE_VALID_PARAMETER_NAME.match(
+ key
+ ), '%s parameter "%s" not alphanumeric or underscore' % (yaml_file, key)
diff --git a/ice_validator/tests/test_heat_template_parameters_contain_required_fields.py b/ice_validator/tests/test_heat_template_parameters_contain_required_fields.py
index 9f0a5a8..c1a9777 100644
--- a/ice_validator/tests/test_heat_template_parameters_contain_required_fields.py
+++ b/ice_validator/tests/test_heat_template_parameters_contain_required_fields.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -37,6 +37,7 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
+from collections import defaultdict
import pytest
from tests import cached_yaml as yaml
@@ -44,13 +45,13 @@ from tests import cached_yaml as yaml
from .helpers import validates
-@validates('R-36772', 'R-44001')
+@validates("R-36772", "R-44001")
def test_heat_template_parameters_contain_required_fields(yaml_file):
- '''
+ """
Check that all parameters in the environment
file have the required fields
- '''
- required_keys = ["type", "description"]
+ """
+ required_keys = {"type", "description"}
with open(yaml_file) as fh:
yml = yaml.load(fh)
@@ -59,11 +60,17 @@ def test_heat_template_parameters_contain_required_fields(yaml_file):
if "parameters" not in yml:
pytest.skip("No parameters specified in the heat template")
- invalid_parameters = []
- for k1, v1 in yml["parameters"].items():
- if not isinstance(v1, dict):
+ invalid_params = defaultdict(list)
+ for param, param_attrs in yml["parameters"].items():
+ if not isinstance(param_attrs, dict):
continue
- if not all(map(lambda v: v in v1, required_keys)):
- invalid_parameters.append(k1)
+ for key in required_keys:
+ if key not in param_attrs:
+ invalid_params[param].append(key)
- assert not set(invalid_parameters)
+ msg = [
+ "Parameter {} is missing required attribute(s): {}".format(k, ", ".join(v))
+ for k, v in invalid_params.items()
+ ]
+ msg = ". ".join(msg)
+ assert not invalid_params, msg
diff --git a/ice_validator/tests/test_heat_template_structure.py b/ice_validator/tests/test_heat_template_structure.py
index 32b448e..fabe9bd 100644
--- a/ice_validator/tests/test_heat_template_structure.py
+++ b/ice_validator/tests/test_heat_template_structure.py
@@ -44,89 +44,90 @@
from tests import cached_yaml as yaml
from .helpers import validates
-VERSION = '1.2.0'
+VERSION = "1.2.0"
# pylint: disable=invalid-name
-@validates('R-27078')
+@validates("R-27078")
def test_heat_template_structure_contains_heat_template_version(yaml_file):
- '''
+ """
Check that all heat templates have the required sections
- '''
+ """
required_key_values = ["heat_template_version"]
with open(yaml_file) as fh:
yml = yaml.load(fh)
- assert all([k in yml for k in required_key_values]), (
- "{} doesn't contain the {} section, but it is required"
- .format(yaml_file, required_key_values[0]))
+ assert all(
+ [k in yml for k in required_key_values]
+ ), "{} doesn't contain the {} section, but it is required".format(
+ yaml_file, required_key_values[0]
+ )
-@validates('R-39402')
+@validates("R-39402")
def test_heat_template_structure_contains_description(yaml_file):
- '''
+ """
Check that all heat templates have the required sections
- '''
+ """
required_key_values = ["description"]
with open(yaml_file) as fh:
yml = yaml.load(fh)
- assert all([k in yml for k in required_key_values]), (
- "{} doesn't contain the {} section, but it is required"
- .format(yaml_file, required_key_values[0]))
+ assert all(
+ [k in yml for k in required_key_values]
+ ), "{} doesn't contain the {} section, but it is required".format(
+ yaml_file, required_key_values[0]
+ )
-@validates('R-35414')
+@validates("R-35414")
def test_heat_template_structure_contains_parameters(yaml_file):
- '''
+ """
Check that all heat templates have the required sections
- '''
+ """
required_key_values = ["parameters"]
with open(yaml_file) as fh:
yml = yaml.load(fh)
- assert all([k in yml for k in required_key_values]), (
- "{} doesn't contain the {} section, but it is required"
- .format(yaml_file, required_key_values[0]))
+ assert all(
+ [k in yml for k in required_key_values]
+ ), "{} doesn't contain the {} section, but it is required".format(
+ yaml_file, required_key_values[0]
+ )
-@validates('R-23664')
+@validates("R-23664")
def test_heat_template_structure_contains_resources(heat_template):
- '''
+ """
Check that all heat templates have the required sections
- '''
+ """
required_key_values = ["resources"]
with open(heat_template) as fh:
yml = yaml.load(fh)
- assert all([k in yml for k in required_key_values]), (
- "{} doesn't contain the {} section, but it is required"
- .format(heat_template, required_key_values[0]))
+ assert all(
+ [k in yml for k in required_key_values]
+ ), "{} doesn't contain the {} section, but it is required".format(
+ heat_template, required_key_values[0]
+ )
-@validates('R-11441')
+@validates("R-11441")
def test_parameter_type(yaml_file):
- '''A VNF's Heat Orchestration Template's parameter type **MUST**
+ """A VNF's Heat Orchestration Template's parameter type **MUST**
be one of the following values:
- '''
- types = ['string',
- 'number',
- 'json',
- 'comma_delimited_list',
- 'boolean']
+ """
+ types = ["string", "number", "json", "comma_delimited_list", "boolean"]
with open(yaml_file) as fh:
yml = yaml.load(fh)
- for key, param in yml.get('parameters', {}).items():
- assert isinstance(param, dict), '%s parameter %s is not dict' % (
- yaml_file,
- key)
- assert 'type' in param, '%s parameter %s has no "type"' % (
- yaml_file,
- key)
- typ = param['type']
+ for key, param in yml.get("parameters", {}).items():
+ assert isinstance(param, dict), "%s parameter %s is not dict" % (yaml_file, key)
+ if "type" not in param:
+ continue
+ typ = param["type"]
assert typ in types, '%s parameter %s has invalid type "%s"' % (
yaml_file,
key,
- typ)
-
+ typ,
+ )
diff --git a/ice_validator/tests/test_initial_configuration.py b/ice_validator/tests/test_initial_configuration.py
index 7944970..6a91567 100644
--- a/ice_validator/tests/test_initial_configuration.py
+++ b/ice_validator/tests/test_initial_configuration.py
@@ -37,16 +37,21 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-
+import os
+from os import listdir
from os import path
import pytest
+from yaml.constructor import ConstructorError
+
from tests import cached_yaml as yaml
+from tests.utils import yaml_custom_utils
from .helpers import validates
from yamllint.config import YamlLintConfig
from yamllint import linter
from .utils.nested_files import check_for_invalid_nesting
+from .utils.nested_files import get_list_of_nested_files
from .utils.nested_iterables import find_all_get_resource_in_yml
from .utils.nested_iterables import find_all_get_param_in_yml
@@ -56,31 +61,55 @@ Order tests by number so they execute in order for base tests
@pytest.mark.base
-@validates('R-95303')
+@validates("R-95303")
def test_00_valid_yaml(filename):
- '''
+ """
Read in each .yaml or .env file. If it is successfully parsed as yaml, save
contents, else add filename to list of bad yaml files. Log the result of
parse attempt.
- '''
- conf = YamlLintConfig('rules: {}')
+ """
+ conf = YamlLintConfig("rules: {}")
if path.splitext(filename)[-1] in [".yml", ".yaml", ".env"]:
gen = linter.run(open(filename), conf)
errors = list(gen)
- assert not errors, "Error parsing file {} with error {}".format(filename, errors)
+ assert not errors, "Error parsing file {} with error {}".format(
+ filename, errors
+ )
else:
- pytest.skip("The file does not have any of the extensions .yml,\
- .yaml, or .env")
+ pytest.skip(
+ "The file does not have any of the extensions .yml,\
+ .yaml, or .env"
+ )
+
+
+@pytest.mark.base
+@validates("R-92635")
+def test_02_no_duplicate_keys_in_file(yaml_file):
+ """
+ Checks that no duplicate keys exist in a given YAML file.
+ """
+ import yaml as normal_yaml # we can't use the caching version in this test
+
+ normal_yaml.add_constructor(
+ yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG,
+ yaml_custom_utils.raise_duplicates_keys,
+ )
+
+ try:
+ with open(yaml_file) as fh:
+ normal_yaml.load(fh)
+ except ConstructorError as e:
+ pytest.fail("{} {}".format(e.problem, e.problem_mark))
@pytest.mark.base
-def test_02_all_referenced_resources_exists(yaml_file):
- '''
+def test_03_all_referenced_resources_exists(yaml_file):
+ """
Check that all resources referenced by get_resource
actually exists in all yaml files
- '''
+ """
with open(yaml_file) as fh:
yml = yaml.load(fh)
@@ -88,55 +117,63 @@ def test_02_all_referenced_resources_exists(yaml_file):
if "resources" not in yml:
pytest.skip("No resources specified in the yaml file")
- resource_ids = yml['resources'].keys()
- referenced_resource_ids = find_all_get_resource_in_yml(yml)
+ resources = yml.get("resources")
+ if resources:
+ resource_ids = resources.keys()
+ referenced_resource_ids = find_all_get_resource_in_yml(yml)
- missing_referenced_resources = set()
- for referenced_resource_id in referenced_resource_ids:
- if referenced_resource_id not in resource_ids:
- missing_referenced_resources.add(referenced_resource_id)
+ missing_referenced_resources = set()
+ for referenced_resource_id in referenced_resource_ids:
+ if referenced_resource_id not in resource_ids:
+ missing_referenced_resources.add(referenced_resource_id)
- assert not missing_referenced_resources, (
- 'missing referenced resources %s' % list(
- missing_referenced_resources))
+ assert not missing_referenced_resources, (
+ "Unable to resolve get_resource for the following "
+ "resource IDS: {}. Please ensure the resource ID is defined and "
+ "nested under the resources section of the template".format(
+ ", ".join(missing_referenced_resources)
+ )
+ )
@pytest.mark.base
-def test_01_valid_nesting(yaml_file):
- '''
+def test_04_valid_nesting(yaml_file):
+ """
Check that the nesting is following the proper format and
that all nested files exists and are parsable
- '''
+ """
invalid_nesting = []
with open(yaml_file) as fh:
yml = yaml.load(fh)
if "resources" in yml:
try:
- invalid_nesting.extend(check_for_invalid_nesting(
- yml["resources"],
- yaml_file,
- path.dirname(yaml_file)))
+ invalid_nesting.extend(
+ check_for_invalid_nesting(
+ yml["resources"], yaml_file, path.dirname(yaml_file)
+ )
+ )
except Exception:
invalid_nesting.append(yaml_file)
- assert not invalid_nesting, \
- "invalid nested file detected in file {}\n\n".format(invalid_nesting)
+ assert not invalid_nesting, "invalid nested file detected in file {}\n\n".format(
+ invalid_nesting
+ )
@pytest.mark.base
-def test_03_all_get_param_have_defined_parameter(yaml_file):
- '''
+def test_05_all_get_param_have_defined_parameter(yaml_file):
+ """
Check that all referenced parameters are actually defined
as parameters
- '''
+ """
invalid_get_params = []
with open(yaml_file) as fh:
yml = yaml.load(fh)
resource_params = find_all_get_param_in_yml(yml)
- parameters = set(yml.get('parameters', {}).keys())
+ parameters = set(yml.get("parameters", {}).keys())
if not parameters:
pytest.skip("no parameters detected")
@@ -144,6 +181,55 @@ def test_03_all_get_param_have_defined_parameter(yaml_file):
if rp not in parameters:
invalid_get_params.append(rp)
- assert not invalid_get_params, (
- "get_param reference detected without corresponding parameter defined {}"
- .format(invalid_get_params))
+ assert (
+ not invalid_get_params
+ ), "get_param reference detected without corresponding parameter defined {}".format(
+ invalid_get_params
+ )
+
+
+@validates("R-90152")
+@pytest.mark.base
+def test_06_heat_template_resource_section_has_resources(heat_template):
+
+ found_resource = False
+
+ with open(heat_template) as fh:
+ yml = yaml.load(fh)
+
+ resources = yml.get("resources")
+ if resources:
+ for k1, v1 in yml["resources"].items():
+ if not isinstance(v1, dict):
+ continue
+
+ found_resource = True
+ break
+
+ assert found_resource, "Heat templates must contain at least one resource"
+
+
+@validates("R-52530")
+@pytest.mark.base
+def test_07_nested_template_in_same_directory(yaml_file):
+
+ missing_files = []
+
+ 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")
+
+ dirname = os.path.dirname(yaml_file)
+ list_of_files = get_list_of_nested_files(yml, dirname)
+ dir_files = listdir(dirname)
+ for file in list_of_files:
+ base_name = path.basename(file)
+ if base_name not in dir_files:
+ missing_files.append(base_name)
+
+ assert (
+ not missing_files
+ ), "Missing nested files in heat template directory {}".format(missing_files)
diff --git a/ice_validator/tests/test_ip_parameters_start_at_0.py b/ice_validator/tests/test_ip_parameters_start_at_0.py
new file mode 100644
index 0000000..e16c161
--- /dev/null
+++ b/ice_validator/tests/test_ip_parameters_start_at_0.py
@@ -0,0 +1,50 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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============================================
+import re
+
+from tests.helpers import validates, check_indices
+from tests.structures import Heat
+
+
+IP_PARAM_PATTERN = re.compile(r"^(.*_ip_)(\d+)$")
+
+
+@validates("R-71577", "R-40971")
+def test_ips_start_at_0(heat_template):
+ params = Heat(heat_template).parameters
+ invalid_params = check_indices(IP_PARAM_PATTERN, params, "IP Parameters")
+ assert not invalid_params, ". ".join(invalid_params)
diff --git a/ice_validator/tests/test_multipart_mime_resource_id.py b/ice_validator/tests/test_multipart_mime_resource_id.py
index 1660399..fe6fe47 100644
--- a/ice_validator/tests/test_multipart_mime_resource_id.py
+++ b/ice_validator/tests/test_multipart_mime_resource_id.py
@@ -38,10 +38,10 @@
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-'''
+"""
A VNF's Heat Orchestration Template's Resource ``OS::Heat::MultipartMime``
Resource ID **MUST** contain the ``{vm-type}``.
-'''
+"""
import pytest
@@ -49,24 +49,24 @@ from .structures import Heat
from .helpers import validates
from .utils import vm_types
-VERSION = '1.0.1'
+VERSION = "1.0.1"
-@validates('R-30804')
+@validates("R-30804")
def test_multipart_mime(heat_template):
- '''validate resource ids
- '''
+ """validate resource ids
+ """
h = Heat(filepath=heat_template)
if not h.resources:
- pytest.skip('No resources in this template')
+ pytest.skip("No resources in this template")
multipart_mimes = get_multipart_mimes(h)
if not multipart_mimes:
- pytest.skip('No MultipartMime resources in this template')
+ pytest.skip("No MultipartMime resources in this template")
resource_vm_types = vm_types.get_vm_types(h.resources)
if not resource_vm_types:
- pytest.skip('No resources with {vm-type} in this template')
+ pytest.skip("No resources with {vm-type} in this template")
bad = set()
for rid in multipart_mimes:
@@ -75,14 +75,17 @@ def test_multipart_mime(heat_template):
break
else:
bad.add(rid)
- assert not bad, 'MultipartMime %s have {vm-type} not in %s' % (
+ assert not bad, "MultipartMime %s have {vm-type} not in %s" % (
list(bad),
- list(resource_vm_types))
+ list(resource_vm_types),
+ )
def get_multipart_mimes(heat):
"""Return list of resource_id whose type is OS::Heat::MultipartMime.
"""
- return [rid for rid, resource in heat.resources.items()
- if heat.nested_get(resource, 'type') == 'OS::Heat::MultipartMime']
-
+ return [
+ rid
+ for rid, resource in heat.resources.items()
+ if heat.nested_get(resource, "type") == "OS::Heat::MultipartMime"
+ ]
diff --git a/ice_validator/tests/test_nested_parameter_args.py b/ice_validator/tests/test_nested_parameter_args.py
new file mode 100644
index 0000000..cba76f6
--- /dev/null
+++ b/ice_validator/tests/test_nested_parameter_args.py
@@ -0,0 +1,112 @@
+# -*- 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 parameters
+"""
+
+import collections
+
+import pytest
+
+from .structures import Heat
+from .helpers import validates
+
+VERSION = "1.0.0"
+
+
+@validates("R-10834")
+def test_nested_parameter_args(heat_template):
+ """
+ If a VNF’s Heat Orchestration Template resource attribute
+ property metadata uses a nested get_param, then the "outer"
+ get_param must take 2 arguments. The first argument must be
+ a parameter of type "comma_delimited_list", and the second
+ argument must be the "inner" get_param whose value must be a
+ parameter of type "number".
+
+ parameters:
+ cdl:
+ type: comma_delimited_list
+ num:
+ type: number
+ resources:
+ 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: [ cdl, { get_param: num }]
+ """
+ heat = Heat(filepath=heat_template)
+ if not heat.resources:
+ pytest.skip("No resources found")
+ has_nested_parameters = False
+ bad = collections.defaultdict(list)
+ for rid, r in heat.resources.items():
+ metadata = heat.nested_get(r, "properties", "metadata", default={})
+ for key, value in metadata.items():
+ param = heat.nested_get(value, "get_param")
+ if isinstance(param, list) and len(param) == 2:
+ nested_param = heat.nested_get(param[1], "get_param")
+ if nested_param:
+ has_nested_parameters = True
+ if (
+ heat.nested_get(heat.parameters, param[0], "type")
+ != Heat.type_cdl
+ ):
+ bad[rid].append(
+ "%s %s parameter type not %s"
+ % (key, param[0], Heat.type_cdl)
+ )
+ if (
+ heat.nested_get(heat.parameters, nested_param, "type")
+ != Heat.type_num
+ ):
+ bad[rid].append(
+ "%s %s nested parameter type not %s"
+ % (key, nested_param, Heat.type_num)
+ )
+ assert not bad, "resource ids with invalid nested parameter arguments\n %s" % (
+ "\n ".join("%s %s" % (k, ", ".join(v)) for k, v in bad.items())
+ )
+ if has_nested_parameters is False:
+ pytest.skip("No nested parameters found")
diff --git a/ice_validator/tests/test_nested_parameters.py b/ice_validator/tests/test_nested_parameters.py
index a1af4bd..3e3bb06 100644
--- a/ice_validator/tests/test_nested_parameters.py
+++ b/ice_validator/tests/test_nested_parameters.py
@@ -41,40 +41,101 @@
"""heat parameters
"""
-import os
-
import pytest
from tests import cached_yaml as yaml
+from tests.structures import Resource
from .helpers import validates
-from .utils.nested_files import get_list_of_nested_files
-VERSION = '1.0.0'
+VERSION = "1.0.0"
-@validates('R-00011')
-def test_nested_parameter(yaml_file):
- '''
- A VNF's Heat Orchestration Template's Nested YAML file's
- parameter's **MUST NOT** have a parameter constraint defined.
+def check_nested_parameter_doesnt_change(yaml_file, parameter):
- '''
with open(yaml_file) as fh:
yml = yaml.load(fh)
- dirname = os.path.dirname(yaml_file)
- nested_files = get_list_of_nested_files(yml, dirname)
- if nested_files:
- for filename in nested_files:
- with open(filename) as fh:
- template = yaml.load(fh)
- parameters = template.get('parameters')
- if parameters and isinstance(parameters, dict):
- for param, value in parameters.items():
- if isinstance(value, dict):
- assert 'constraints' not in value, (
- '%s parameter "%s" has "constraints"' % (
- filename,
- param))
- else:
- pytest.skip('No nested files')
+ # skip if resources are not defined
+ if "resources" not in yml:
+ pytest.skip("No resources specified in the heat template")
+
+ invalid_parameters = []
+
+ """
+ checking if property: { get_param: <parameter> }, then property == <parameter>
+
+ resource_id:
+ type: nested.yaml
+ properties:
+ property: { get_param: <parameter> }
+
+ resource_id:
+ type: OS::Heat::ResourceGroup
+ properties:
+ resource_def:
+ properties:
+ property: { get_param: <parameter> }
+ """
+ for resource_id, resource in yml.get("resources", {}).items():
+ r = Resource(resource_id=resource_id, resource=resource)
+ properties = r.get_nested_properties()
+ for k1, v1 in properties.items():
+ if (
+ isinstance(v1, dict)
+ and "get_param" in v1
+ and parameter == v1.get("get_param")
+ ):
+ if k1 != parameter:
+ invalid_parameters.append(
+ {
+ "resource": r.resource_id,
+ "nested parameter": k1,
+ "parameter": parameter,
+ }
+ )
+
+ assert (
+ not invalid_parameters
+ ), "Invalid parameter name change detected in nested template {}".format(
+ invalid_parameters
+ )
+
+
+@validates("R-70757")
+def test_vm_role_doesnt_change_in_nested_template(yaml_file):
+ check_nested_parameter_doesnt_change(yaml_file, "vm_role")
+
+
+@validates("R-44491")
+def test_vnf_id_doesnt_change_in_nested_template(yaml_file):
+ check_nested_parameter_doesnt_change(yaml_file, "vnf_id")
+
+
+@validates("R-86237")
+def test_vf_module_id_doesnt_change_in_nested_template(yaml_file):
+ check_nested_parameter_doesnt_change(yaml_file, "vf_module_id")
+
+
+@validates("R-16576")
+def test_vnf_name_doesnt_change_in_nested_template(yaml_file):
+ check_nested_parameter_doesnt_change(yaml_file, "vnf_name")
+
+
+@validates("R-49177")
+def test_vf_module_name_doesnt_change_in_nested_template(yaml_file):
+ check_nested_parameter_doesnt_change(yaml_file, "vf_module_name")
+
+
+@validates("R-22441")
+def test_vf_module_index_name_doesnt_change_in_nested_template(yaml_file):
+ check_nested_parameter_doesnt_change(yaml_file, "vf_module_index")
+
+
+@validates("R-62954")
+def test_environment_context_name_doesnt_change_in_nested_template(yaml_file):
+ check_nested_parameter_doesnt_change(yaml_file, "environment_context")
+
+
+@validates("R-75202")
+def test_workload_context_name_doesnt_change_in_nested_template(yaml_file):
+ check_nested_parameter_doesnt_change(yaml_file, "workload_context")
diff --git a/ice_validator/tests/test_nested_template_parameters.py b/ice_validator/tests/test_nested_template_parameters.py
new file mode 100644
index 0000000..26a0fb3
--- /dev/null
+++ b/ice_validator/tests/test_nested_template_parameters.py
@@ -0,0 +1,120 @@
+# -*- 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.
+#
+
+"""nested template parameters
+"""
+import os.path
+
+import pytest
+
+from .structures import Heat
+from .helpers import validates
+from .utils import nested_files
+
+VERSION = "1.2.0"
+
+
+def validate_parms(dirname, basename, nested, nested_props, prop_type):
+ """ensure all parms are props
+ return list of errors.
+ """
+ bad = []
+ for rid, nested_filename in nested.items():
+ nested_filepath = os.path.join(dirname, nested_filename)
+ nested_heat = Heat(filepath=nested_filepath)
+ parms = set(nested_heat.parameters.keys())
+ props = nested_props.get(rid, set())
+ missing = parms - props
+ if missing:
+ bad.append(
+ "%s parameters %s missing as %s"
+ " of %s resource %s"
+ % (nested_filename, list(missing), prop_type, basename, rid)
+ )
+ return bad
+
+
+@validates("R-11041")
+def test_nested_template_parameters(heat_template):
+ """
+ All parameters defined in a VNFs Nested YAML file
+ **MUST** be passed in as properties of the resource calling
+ the nested yaml file.
+ """
+ dirname, basename = os.path.split(heat_template)
+ heat = Heat(filepath=heat_template)
+ if not heat.resources:
+ pytest.skip("No resources found")
+ nested_type = nested_files.get_type_nested_files(heat.yml, dirname)
+ nested_resourcegroup = nested_files.get_resourcegroup_nested_files(
+ heat.yml, dirname
+ )
+ if not nested_type and not nested_resourcegroup:
+ pytest.skip("No nested files")
+ bad = []
+ nested_type_props = {
+ rid: set(heat.resources[rid].get("properties", {}).keys())
+ for rid in nested_type
+ }
+ nested_resourcegroup_props = {
+ rid: set(
+ heat.nested_get(
+ heat.resources[rid],
+ "properties",
+ "resource_def",
+ "properties",
+ default={},
+ ).keys()
+ )
+ for rid in nested_resourcegroup
+ }
+ bad.extend(
+ validate_parms(dirname, basename, nested_type, nested_type_props, "properties")
+ )
+ bad.extend(
+ validate_parms(
+ dirname,
+ basename,
+ nested_resourcegroup,
+ nested_resourcegroup_props,
+ "resource_def.properties",
+ )
+ )
+ assert not bad, "; ".join(bad)
diff --git a/ice_validator/tests/test_nesting_level.py b/ice_validator/tests/test_nesting_level.py
new file mode 100644
index 0000000..e1e4e68
--- /dev/null
+++ b/ice_validator/tests/test_nesting_level.py
@@ -0,0 +1,64 @@
+# -*- 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.
+#
+
+"""
+test nesting level
+0 -> 1 -> 2 -> too many levels.
+"""
+
+from .utils import nested_files
+from .helpers import validates
+
+VERSION = "1.1.0"
+
+# pylint: disable=invalid-name
+
+
+@validates("R-60011")
+def test_nesting_level(yaml_files):
+ """
+ A VNF's Heat Orchestration Template **MUST** have no more than two
+ levels of nesting.
+ """
+ bad, __, __, __ = nested_files.get_nesting(yaml_files)
+ assert not bad, "nesting depth of %d exceeded: %s" % (
+ nested_files.MAX_DEPTH,
+ ", ".join(bad),
+ )
diff --git a/ice_validator/tests/test_nesting_nova_server.py b/ice_validator/tests/test_nesting_nova_server.py
new file mode 100644
index 0000000..ed23059
--- /dev/null
+++ b/ice_validator/tests/test_nesting_nova_server.py
@@ -0,0 +1,99 @@
+# -*- 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.
+#
+
+"""
+test nesting level
+0 -> 1 -> 2 -> too many levels.
+"""
+
+import pytest
+
+from .utils import nested_files
+from .helpers import validates
+
+VERSION = "1.0.0"
+
+
+def get_nova_server_count(heat):
+ """return the number of OS::Nova::Server
+ resources in heat
+ """
+ return len(heat.get_resource_by_type("OS::Nova::Server"))
+
+
+# pylint: disable=invalid-name
+
+
+@validates("R-17528")
+def test_nesting_nova_server(yaml_files):
+ """
+ A VNF's Heat Orchestration Template's first level Nested YAML file
+ **MUST NOT** contain more than one ``OS::Nova::Server`` resource.
+ A VNF's Heat Orchestration Template's second level Nested YAML file
+ **MUST NOT** contain an ``OS::Nova::Server`` resource.
+
+ level: 0 1 2 3
+ template -> nested -> nested -> too many levels
+ """
+ bad, __, heat, depths = nested_files.get_nesting(yaml_files)
+ if bad:
+ pytest.skip("nesting depth exceeded")
+ for parent, depth in depths.items():
+ for depth_tuple in depth:
+ depth, context = depth_tuple
+ if depth > 1:
+ fname = context[0]
+ nservers = get_nova_server_count(heat[fname])
+ if nservers > 1:
+ bad.append(
+ "nested template %s must have only have 1 "
+ "OS::Nova::Server defined, but %s were found"
+ % (fname, nservers)
+ )
+ if depth > 2:
+ fname = context[1]
+ nservers = get_nova_server_count(heat[fname])
+ if nservers > 0:
+ bad.append(
+ "nested template %s must not have an "
+ "OS::Nova::Server defined, but %s were found"
+ % (fname, nservers)
+ )
+ assert not bad, "; ".join(bad)
diff --git a/ice_validator/tests/test_network_format.py b/ice_validator/tests/test_network_format.py
index 7fb343a..bfa9813 100644
--- a/ice_validator/tests/test_network_format.py
+++ b/ice_validator/tests/test_network_format.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -39,19 +39,25 @@
#
import pytest
+import re
+
from tests import cached_yaml as yaml
from .helpers import validates
-from .utils.network_roles import get_network_role_from_port, \
- property_uses_get_resource
+from .utils.network_roles import get_network_role_from_port, property_uses_get_resource
+
+RE_INTERNAL_NETWORK_RID = re.compile( # match pattern
+ r"int_(?P<network_role>.+)_network$"
+)
+NETWORK_RESOURCE_TYPES = ["OS::Neutron::Net", "OS::ContrailV2::VirtualNetwork"]
-@validates('R-62983', 'R-86182')
+@validates("R-62983", "R-86182")
def test_network_format(heat_template):
- '''
+ """
Make sure all network properties use the allowed naming
conventions
- '''
+ """
with open(heat_template) as fh:
yml = yaml.load(fh)
@@ -72,4 +78,96 @@ def test_network_format(heat_template):
if not get_network_role_from_port(v):
invalid_ports.append(k)
- assert not set(invalid_ports)
+ assert not set(invalid_ports), (
+ "Missing 'network' property or improperly "
+ "formatted network parameter name on the "
+ "following OS::Neutron::Ports: "
+ "{}".format(", ".join(invalid_ports))
+ )
+
+
+@validates("R-16968", "R-35666")
+def test_network_resource_id_format(yaml_file):
+ """
+ Make sure all network resource ids use the allowed naming
+ convention
+ """
+ RE_INTERNAL_NETWORK_RID = re.compile( # match pattern
+ r"int_(?P<network_role>.+)_network$"
+ )
+
+ 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")
+
+ invalid_networks = []
+ for k, v in yml["resources"].items():
+ if not isinstance(v, dict):
+ continue
+ if "properties" not in v:
+ continue
+ if property_uses_get_resource(v, "network"):
+ continue
+ if v.get("type") not in NETWORK_RESOURCE_TYPES:
+ continue
+ match = RE_INTERNAL_NETWORK_RID.match(k)
+ if not match:
+ invalid_networks.append(k)
+
+ assert not set(invalid_networks), (
+ "Heat templates must only create internal networks "
+ "and follow format int_{network-role}_network"
+ "{}".format(", ".join(invalid_networks))
+ )
+
+
+@validates("R-16241")
+def test_network_has_subnet(yaml_file):
+ """
+ if creating internal network, make sure there is a
+ corresponding subnet that references it
+ """
+
+ 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")
+
+ networks = []
+
+ for k, v in yml["resources"].items():
+ if not isinstance(v, dict):
+ continue
+ if "properties" not in v:
+ continue
+ # need to check if contrail networks also require subnet
+ # and it is defined the same as neutron networks
+ # if v.get("type") not in NETWORK_RESOURCE_TYPES:
+ if v.get("type") not in ["OS::Neutron::Net"]:
+ continue
+ networks.append(k)
+
+ for k, v in yml["resources"].items():
+ if not isinstance(v, dict):
+ continue
+ if "properties" not in v:
+ continue
+ if v.get("type") != "OS::Neutron::Subnet":
+ continue
+ network_prop = v.get("properties", {}).get("network", {}).get("get_resource")
+
+ if not network_prop:
+ continue
+ x = 0
+ for network in networks:
+ if network == network_prop:
+ networks.pop(x)
+ break
+ x += 1
+
+ assert not networks, "Networks detected without subnet {}".format(networks)
diff --git a/ice_validator/tests/test_network_format_use_get_param_or_get_resource.py b/ice_validator/tests/test_network_format_use_get_param_or_get_resource.py
index 98d4401..dada3e5 100644
--- a/ice_validator/tests/test_network_format_use_get_param_or_get_resource.py
+++ b/ice_validator/tests/test_network_format_use_get_param_or_get_resource.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -44,12 +44,12 @@ from tests import cached_yaml as yaml
from .helpers import validates
-@validates('R-93177')
+@validates("R-93177")
def test_network_format_use_get_param_or_get_resource(heat_template):
- '''
+ """
Make sure all network properties only use get_param
or get_resource of an internal network
- '''
+ """
with open(heat_template) as fh:
yml = yaml.load(fh)
@@ -58,7 +58,8 @@ def test_network_format_use_get_param_or_get_resource(heat_template):
if "resources" not in yml:
pytest.skip("No resources specified in the heat template")
- invalid_ports = []
+ invalid_get_resource = []
+ invalid_get_param = []
for k1, v1 in yml["resources"].items():
if not isinstance(v1, dict):
continue
@@ -67,17 +68,35 @@ def test_network_format_use_get_param_or_get_resource(heat_template):
if v1.get("type") != "OS::Neutron::Port":
continue
- valid_network = True
for k2, v2 in v1["properties"].items():
if k2 != "network":
continue
- if "get_resource" in v2:
- if not v2["get_resource"].startswith('int_'):
- valid_network = False
+ if not isinstance(v2, dict):
+ invalid_get_param.append(k1)
+ elif "get_resource" in v2:
+ if not v2["get_resource"].startswith("int_"):
+ invalid_get_resource.append(k1)
elif "get_param" not in v2:
- valid_network = False
+ invalid_get_param.append(k1)
+ # TODO: I don't think this test needs to check get_param as that is
+ # already covered by another test.
- if not valid_network:
- invalid_ports.append(k1)
+ msg = (
+ "A OS::Neutron::Port must connect to an internal network using "
+ "get_resource (network created in same template) or get_param "
+ "(network created in a different template)."
+ )
+ if invalid_get_resource:
+ msg = (
+ msg
+ + " These resources use get_resource to connect to a "
+ + "non-internal network: {}"
+ ).format(", ".join(invalid_get_resource))
+ if invalid_get_param:
+ msg = (
+ msg
+ + " These resources do not use get_resource or get_param "
+ + "to connect to a network: {}"
+ ).format(", ".join(invalid_get_param))
- assert not set(invalid_ports)
+ assert not (invalid_get_param or invalid_get_resource), msg
diff --git a/ice_validator/tests/test_neutron_net_resource_id.py b/ice_validator/tests/test_neutron_net_resource_id.py
new file mode 100644
index 0000000..36e77fa
--- /dev/null
+++ b/ice_validator/tests/test_neutron_net_resource_id.py
@@ -0,0 +1,73 @@
+# -*- 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.
+#
+
+"""
+neutron net resource id
+"""
+
+import pytest
+
+from .helpers import validates
+from .structures import Heat
+from .structures import NeutronNet
+
+VERSION = "1.1.0"
+
+# pylint: disable=invalid-name
+
+
+@validates("R-25720")
+def test_neutron_net_resource_id(heat_template):
+ """
+ A VNF's Heat Orchestration Template's Resource OS::Neutron::Net
+ Resource ID **MUST** use the naming convention
+
+ * int_{network-role}_network
+ """
+ heat = Heat(filepath=heat_template)
+ neutron_nets = heat.get_resource_by_type(NeutronNet.resource_type)
+ if not neutron_nets:
+ pytest.skip("No neutron nets found")
+ neutron_net = NeutronNet()
+ bad = []
+ for rid in neutron_nets:
+ if not neutron_net.get_rid_match_tuple(rid)[0]:
+ bad.append("Neutron Net %s does not match any known format" % rid)
+ assert not bad, "; ".join(bad)
diff --git a/ice_validator/tests/test_neutron_port_addresses.py b/ice_validator/tests/test_neutron_port_addresses.py
new file mode 100644
index 0000000..0cd6b3b
--- /dev/null
+++ b/ice_validator/tests/test_neutron_port_addresses.py
@@ -0,0 +1,242 @@
+# -*- 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.
+#
+
+"""
+OS::Neutron::Port connecting to external network
+must have at most one ip_address and at most one v6_ip_address.
+"""
+
+import collections
+import os.path
+
+import pytest
+
+from .structures import Heat
+from .helpers import validates
+
+VERSION = "1.1.0"
+
+
+def is_v6_ip(ip_address):
+ if ip_address.find("v6") != -1:
+ return True
+ return False
+
+
+def get_neutron_ports(heat):
+ """Return dict of resource_id: resource, whose type is
+ OS::Neutron::Port.
+ """
+ return {
+ rid: resource
+ for rid, resource in heat.resources.items()
+ if heat.nested_get(resource, "type") == "OS::Neutron::Port"
+ }
+
+
+def get_port_addresses(filepath):
+ """Return dict:
+ key is field name, value is dict:
+ key is parameter name, value is dict:
+ key is filepath, value is set of rid
+ """
+ port_addresses = collections.defaultdict(
+ lambda: collections.defaultdict(lambda: collections.defaultdict(set))
+ )
+ heat = Heat(filepath=filepath)
+ basename = os.path.basename(filepath)
+ for rid, port in get_neutron_ports(heat).items():
+ allowed_address_pairs = heat.nested_get(
+ port, "properties", "allowed_address_pairs"
+ )
+ if not isinstance(allowed_address_pairs, list):
+ continue
+ field = "ip_address"
+ for aa_pair in allowed_address_pairs:
+ param = heat.nested_get(aa_pair, field, "get_param")
+ if param is None:
+ continue
+ port_addresses[field][param][basename].add(rid)
+ return port_addresses
+
+
+def nested_update(out_dict, in_dict):
+ """Recursively update out_dict from in_dict.
+ """
+ for key, value in in_dict.items():
+ if key not in out_dict:
+ out_dict[key] = value
+ elif isinstance(value, dict) and isinstance(out_dict[key], dict):
+ out_dict[key] = nested_update(out_dict[key], value)
+ elif isinstance(value, set) and isinstance(out_dict[key], set):
+ out_dict[key].update(value)
+ else:
+ out_dict[key] = value
+ return out_dict
+
+
+def run_test(heat_template, validate):
+ """call validate with allowed_address_pairs
+ """
+ heat = Heat(filepath=heat_template)
+ if not heat.resources:
+ pytest.skip("No resources found")
+
+ neutron_ports = get_neutron_ports(heat)
+ if not neutron_ports:
+ pytest.skip("No OS::Neutron::Port resources found")
+
+ bad = {}
+ for rid, resource in neutron_ports.items():
+ if rid.startswith("int_"):
+ continue
+ allowed_address_pairs = heat.nested_get(
+ resource, "properties", "allowed_address_pairs"
+ )
+ if allowed_address_pairs is None:
+ continue
+ if not isinstance(allowed_address_pairs, list):
+ bad[rid] = "properties.allowed_address_pairs must be a list."
+ continue
+ error = validate(heat, allowed_address_pairs)
+ if error:
+ bad[rid] = error
+ break
+ if bad:
+ # raise RuntimeError(
+ raise AssertionError(
+ "Bad OS::Neutron::Port: %s"
+ % (", ".join("%s: %s" % (rid, error) for rid, error in bad.items()))
+ )
+
+
+def validate_field(heat, allowed_address_pairs, field, v6=False):
+ """ensure at most one `field` is found in `allowed_address_pairs'
+ validate allowed_addrfess_pairs as well.
+ Returns error message string or None.
+ """
+ error = None
+ ports = set()
+ port_type = "ipv6" if v6 else "ipv4"
+ for allowed_address_pair in allowed_address_pairs:
+ if not isinstance(allowed_address_pair, dict):
+ error = 'allowed_address_pair "%s" is not a dict' % (allowed_address_pair)
+ break
+ if field in allowed_address_pair:
+ param = heat.nested_get(allowed_address_pair, field, "get_param")
+ if param is None:
+ error = 'allowed_address_pair %s requires "get_param"' % field
+ break
+ else:
+ # if v6 and testing v6, or inverse
+ if v6 == is_v6_ip(param):
+ ports.add(param)
+ if error is None and len(ports) > 1:
+ error = 'More than one %s "%s" found in allowed_address_pairs: %s' % (
+ port_type,
+ field,
+ list(ports),
+ )
+ return error
+
+
+def validate_external_ipaddress(heat, allowed_address_pairs):
+ """ensure allowed_address_pairs has at most one ip_address
+ Returns error message string or None.
+ """
+ return validate_field(heat, allowed_address_pairs, "ip_address")
+
+
+def validate_external_ipaddress_v6(heat, allowed_address_pairs):
+ """ensure allowed_address_pairs has at most one v6_ip_address
+ Returns error message string or None.
+ """
+ return validate_field(heat, allowed_address_pairs, "ip_address", v6=True)
+
+
+# pylint: disable=invalid-name
+
+
+@validates("R-91810")
+def test_neutron_port_external_ipaddress(heat_template):
+ """
+ If a VNF requires ECOMP to assign a Virtual IP (VIP) Address to
+ ports connected an external network, the port
+ **MUST NOT** have more than one IPv4 VIP address.
+ """
+ run_test(heat_template, validate_external_ipaddress)
+
+
+@validates("R-41956")
+def test_neutron_port_external_ipaddress_v6(heat_template):
+ """
+ If a VNF requires ECOMP to assign a Virtual IP (VIP) Address to
+ ports connected an external network, the port
+ **MUST NOT** have more than one IPv6 VIP address.
+ """
+ run_test(heat_template, validate_external_ipaddress_v6)
+
+
+@validates("R-10754")
+def test_neutron_port_floating(yaml_files):
+ """
+ If a VNF has two or more ports that
+ attach to an external network that require a Virtual IP Address (VIP),
+ and the VNF requires ECOMP automation to assign the IP address,
+ all the Virtual Machines using the VIP address **MUST**
+ be instantiated in the same Base Module Heat Orchestration Template
+ or in the same Incremental Module Heat Orchestration Template.
+ """
+ fields = {}
+ for filepath in yaml_files:
+ fields = nested_update(fields, get_port_addresses(filepath))
+ bad = []
+ for field, params in fields.items():
+ for param, files in params.items():
+ if len(files) > 1:
+ bad.append(
+ '"%s" "%s" in multiple templates: %s'
+ % (
+ field,
+ param,
+ ", ".join("%s: %s" % (k, list(v)) for k, v in files.items()),
+ )
+ )
+ assert not bad, "; ".join(bad)
diff --git a/ice_validator/tests/test_neutron_port_fixed_ips.py b/ice_validator/tests/test_neutron_port_fixed_ips.py
new file mode 100644
index 0000000..f8cb7db
--- /dev/null
+++ b/ice_validator/tests/test_neutron_port_fixed_ips.py
@@ -0,0 +1,325 @@
+# -*- 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:
+{vm-type}_{vm-type_index}_{network-role}_port_{port-index}:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: ...}
+ fixed_ips: [ { "ipaddress": { get_param: ... } } ]
+ binding:vnic_type: direct #only SR-IOV ports, not OVS ports
+ value_specs: {
+ vlan_filter: { get_param: ... }, #all NC ports
+ public_vlans: { get_param: ... }, #all NC ports
+ private_vlans: { get_param: ... },#all NC ports
+ guest_vlans: { get_param: ... }, #SR-IOV Trunk Port only
+ vlan_mirror: { get_param: ... }, #SRIOV Trunk Port
+ # Receiving Mirrored Traffic only
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true #all NC ports
+ }
+ metadata:
+ port_type: SR-IOV_Trunk #SR-IOV Trunk Port
+ port_type: SR-IOV_Non_Trunk #SR-IOV Non Trunk Port
+ port_type: OVS #OVS Port
+ port_type: SR-IOV_Mirrored_Trunk #SR-IOV Trunk Port
+ # Receiving Mirrored Traffic
+"""
+
+import os
+import os.path
+import re
+
+import pytest
+
+from .structures import Heat
+from .helpers import validates
+
+VERSION = "1.3.0"
+
+RE_BASE = re.compile(r"(^base$)|(^base_)|(_base_)|(_base$)") # search pattern
+
+RE_EXTERNAL_PARAM_SUBNET_ID = re.compile( # match pattern
+ r"(?P<network_role>.+)(_v6)?_subnet_id$"
+)
+RE_EXTERNAL_PARAM_SUBNET = RE_EXTERNAL_PARAM_SUBNET_ID
+# RE_EXTERNAL_PARAM_SUBNET = re.compile( # match pattern
+# r'(?P<network_role>.+)(_v6)?_subnet$')
+
+RE_INTERNAL_PARAM_SUBNET_ID = re.compile( # match pattern
+ r"int_(?P<network_role>.+)(_v6)?_subnet_id$"
+)
+RE_INTERNAL_PARAM_SUBNET = RE_INTERNAL_PARAM_SUBNET_ID
+# RE_INTERNAL_PARAM_SUBNET = re.compile( # match pattern
+# r'int_(?P<network_role>.+)(_v6)?_subnet$')
+
+
+def get_network(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)
+ for r in base_template.resources.values():
+ if (
+ base_template.nested_get(r, "type") == "OS::Neutron::Net"
+ or base_template.nested_get(r, "type") == "OS::ContrailV2::VirtualNetwork"
+ ):
+ return base_template
+ return None
+
+
+def run_test(heat_template, validate):
+ """call validate for each fixed_ips
+ """
+ heat = Heat(filepath=heat_template)
+ base_template = get_base_template(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
+ if not heat.parameters:
+ bad[rid] = "fixed_ips requires parameters"
+ continue
+ for fixed_ip in fixed_ips:
+ error = validate(heat, fixed_ip, base_template)
+ if error:
+ bad[rid] = error
+ break
+ if bad:
+ # raise RuntimeError(
+ raise AssertionError(
+ "Bad OS::Neutron::Port: %s"
+ % (", ".join("%s: %s" % (rid, error) for rid, error in bad.items()))
+ )
+
+
+def validate_external_fixed_ip(heat, fixed_ip, base_template):
+ """ensure fixed_ip subnet and subnet_id for external network
+ match the pattern.
+ Returns error message string or None.
+ """
+ subnet = heat.nested_get(fixed_ip, "subnet", "get_param")
+ subnet_id = heat.nested_get(fixed_ip, "subnet_id", "get_param")
+ if subnet and subnet_id:
+ error = 'fixed_ip %s has both "subnet" and "subnet_id"' % (fixed_ip)
+ elif subnet:
+ error = validate_external_subnet(subnet)
+ elif subnet_id:
+ error = validate_external_subnet_id(subnet_id)
+ else:
+ error = None
+ return error
+
+
+def validate_external_subnet(subnet):
+ """ensure subnet matches template.
+ Returns error message string or None.
+ """
+ if (
+ subnet
+ and not subnet.startswith("int_")
+ and RE_EXTERNAL_PARAM_SUBNET.match(subnet) is None
+ ):
+ return 'fixed_ip subnet parameter "%s" does not match "%s"' % (
+ subnet,
+ RE_EXTERNAL_PARAM_SUBNET.pattern,
+ )
+ return None
+
+
+def validate_external_subnet_id(subnet_id):
+ """ensure subnet_id matches template.
+ Returns error message string or None.
+ """
+ if (
+ subnet_id
+ and not subnet_id.startswith("int_")
+ and RE_EXTERNAL_PARAM_SUBNET_ID.match(subnet_id) is None
+ ):
+ return 'fixed_ip subnet_id parameter "%s" does not match "%s"' % (
+ subnet_id,
+ RE_EXTERNAL_PARAM_SUBNET_ID.pattern,
+ )
+ return None
+
+
+def validate_internal_fixed_ip(heat, fixed_ip, base_template):
+ """ensure fixed_ip subnet and subnet_id for internal network
+ match the pattern.
+ Returns error message string or None.
+ """
+ base_module = get_network(base_template)
+ subnet = heat.nested_get(fixed_ip, "subnet", "get_param")
+ subnet_id = heat.nested_get(fixed_ip, "subnet_id", "get_param")
+ if subnet and subnet_id:
+ error = 'fixed_ip %s has both "subnet" and "subnet_id"' % (fixed_ip)
+ elif subnet:
+ error = validate_internal_subnet(heat, base_module, subnet)
+ elif subnet_id:
+ error = validate_internal_subnet_id(heat, base_module, subnet_id)
+ else:
+ error = None
+ return error
+
+
+def validate_internal_subnet(heat, base_module, subnet):
+ """ensure if subnet matches template then its parameter exists.
+ Returns error message string or None.
+ """
+ if (
+ subnet
+ and subnet.startswith("int_")
+ and RE_INTERNAL_PARAM_SUBNET.match(subnet)
+ and heat.nested_get(base_module.outputs, subnet) is None
+ ):
+ return 'fixed_ip subnet parameter "%s" not in base outputs"' % (subnet)
+ return None
+
+
+def validate_internal_subnet_id(heat, base_module, subnet_id):
+ """ensure if subnet_id matches template then its parameter exists.
+ Returns error message string or None.
+ """
+ if (
+ subnet_id
+ and subnet_id.startswith("int_")
+ and RE_INTERNAL_PARAM_SUBNET_ID.match(subnet_id)
+ and heat.nested_get(base_module.outputs, subnet_id) is None
+ ):
+ return 'fixed_ip subnet_id parameter "%s" not in base outputs"' % (subnet_id)
+ return None
+
+
+def validate_fixed_ip(heat, fixed_ip, base_template):
+ """ensure fixed_ip has proper parameters
+ Returns error message string or None.
+ """
+ subnet = heat.nested_get(fixed_ip, "subnet", "get_param")
+ subnet_id = heat.nested_get(fixed_ip, "subnet_id", "get_param")
+ if subnet and subnet_id:
+ error = 'fixed_ip %s has both "subnet" and "subnet_id"' % (fixed_ip)
+ elif subnet and heat.nested_get(heat.parameters, subnet, "type") != "string":
+ error = 'subnet parameter "%s" must be type "string"' % subnet
+ elif subnet_id and heat.nested_get(heat.parameters, subnet_id, "type") != "string":
+ error = 'subnet_id parameter "%s" must be type "string"' % subnet_id
+ else:
+ error = None
+ return error
+
+
+def get_base_template(heat_template):
+ (dirname, filename) = os.path.split(heat_template)
+ files = os.listdir(dirname)
+ for file in files:
+ basename, __ = os.path.splitext(os.path.basename(file))
+ if (
+ __ == ".yaml"
+ and basename.find("base") != -1
+ and basename.find("volume") == -1
+ ):
+ return os.path.join(dirname, "{}{}".format(basename, __))
+ return None
+
+
+@validates("R-38236")
+def test_neutron_port_fixed_ips(heat_template):
+ """
+ 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(heat_template, validate_fixed_ip)
+
+
+@validates("R-62802", "R-15287")
+def test_neutron_port_external_fixed_ips(heat_template):
+ """
+ When the VNF's Heat Orchestration Template's
+ resource ``OS::Neutron::Port`` is attaching
+ to an external network (per the ECOMP definition, see
+ Requirement R-57424),
+ 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(heat_template, validate_external_fixed_ip)
+
+
+@validates("R-84123", "R-76160")
+def test_neutron_port_internal_fixed_ips(heat_template):
+ """
+ When
+
+ * the VNF's Heat Orchestration Template's
+ resource ``OS::Neutron::Port`` in an Incremental Module is attaching
+ to an internal network (per the ECOMP definition, see
+ Requirements R-52425 and R-46461)
+ 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(heat_template, validate_internal_fixed_ip)
diff --git a/ice_validator/tests/test_neutron_port_internal_network.py b/ice_validator/tests/test_neutron_port_internal_network.py
new file mode 100644
index 0000000..b625be6
--- /dev/null
+++ b/ice_validator/tests/test_neutron_port_internal_network.py
@@ -0,0 +1,241 @@
+# -*- 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:
+{vm-type}_{vm-type_index}_{network-role}_port_{port-index}:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: ...}
+ fixed_ips: [ { "ipaddress": { get_param: ... } } ]
+ binding:vnic_type: direct #only SR-IOV ports, not OVS ports
+ value_specs: {
+ vlan_filter: { get_param: ... }, #all NC ports
+ public_vlans: { get_param: ... }, #all NC ports
+ private_vlans: { get_param: ... },#all NC ports
+ guest_vlans: { get_param: ... }, #SR-IOV Trunk Port only
+ vlan_mirror: { get_param: ... }, #SRIOV Trunk Port
+ # Receiving Mirrored Traffic only
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true #all NC ports
+ }
+ metadata:
+ port_type: SR-IOV_Trunk #SR-IOV Trunk Port
+ port_type: SR-IOV_Non_Trunk #SR-IOV Non Trunk Port
+ port_type: OVS #OVS Port
+ port_type: SR-IOV_Mirrored_Trunk #SR-IOV Trunk Port
+ # Receiving Mirrored Traffic
+"""
+
+import os.path
+import re
+
+import pytest
+
+from .structures import Heat
+from .helpers import validates
+
+VERSION = "1.1.0"
+
+RE_BASE = re.compile(r"(^base$)|(^base_)|(_base_)|(_base$)") # search pattern
+RE_NEUTRON_PORT_RID = re.compile( # match pattern
+ r"(?P<vm_type>.+)"
+ r"_(?P<vm_type_index>\d+)"
+ r"_(?P<network_role>.+)"
+ r"_port_"
+ r"(?P<port_index>\d+)"
+ r"$"
+)
+RE_INTERNAL_NETWORK_PARAM = re.compile( # match pattern
+ r"int_(?P<network_role>.+)_net_(?P<value_type>id|name)$"
+)
+RE_INTERNAL_NETWORK_RID = re.compile( # match pattern
+ r"int_(?P<network_role>.+)_network$"
+)
+
+
+def get_base_template_filepath(yaml_files):
+ """Return first filepath to match RE_BASE
+ """
+ for filepath in yaml_files:
+ basename, __ = os.path.splitext(os.path.basename(filepath))
+ if RE_BASE.search(basename) and basename.find("volume") == -1:
+ return filepath
+ return None
+
+
+def get_internal_network(yaml_files):
+ """Return the base template's Heat istance.
+ """
+ base_template_filepath = get_base_template_filepath(yaml_files)
+ if base_template_filepath is None:
+ pytest.skip("No base template found")
+ base_template = Heat(filepath=base_template_filepath)
+ for r in base_template.resources.values():
+ # if base_template.nested_get(r, 'type') == 'OS::Neutron::Net':
+ return base_template
+
+ return None
+
+
+def get_neutron_ports(heat):
+ """Return dict of resource_id: resource, whose type is
+ OS::Neutron::Port.
+ """
+ return {
+ rid: resource
+ for rid, resource in heat.resources.items()
+ if heat.nested_get(resource, "type") == "OS::Neutron::Port"
+ }
+
+
+# pylint: disable=invalid-name
+
+
+@validates("R-86182", "R-22688")
+def test_neutron_port_internal_network(yaml_files):
+ """
+ When the VNF's Heat Orchestration Template's Resource
+ ``OS::Neutron::Port`` is attaching to an internal network (per the
+ ECOMP definition, see Requirements R-52425 and R-46461),
+ and the internal network is created in a
+ different Heat Orchestration Template than the ``OS::Neutron::Port``,
+ the ``network`` parameter name **MUST**
+
+ * follow the naming convention ``int_{network-role}_net_id``
+ if the Neutron
+ network UUID value is used to reference the network
+ * follow the naming convention ``int_{network-role}_net_name`` if the
+ OpenStack network name in is used to reference the network.
+
+ where ``{network-role}`` is the network-role of the internal network and
+ a ``get_param`` **MUST** be used as the intrinsic function.
+
+ In Requirement R-86182, the internal network is created in the VNF's
+ Base Module (Heat Orchestration Template) and the parameter name is
+ declared in the Base Module's ``outputs`` section.
+ When the parameter's value uses a "get_param" function, its name
+ must end in "_name", and when it uses a "get_resource" function,
+ its name must end in "_id".
+
+ The output parameter name will be declared as a parameter in the
+ ``parameters`` section of the incremental module.
+ """
+ internal_network = get_internal_network(yaml_files)
+ if not internal_network:
+ pytest.skip("internal_network template not found")
+
+ if not internal_network.outputs:
+ pytest.skip('internal_network template has no "outputs"')
+
+ for filepath in yaml_files:
+ if filepath != internal_network.filepath:
+ validate_neutron_port(filepath, internal_network)
+
+
+def validate_neutron_port(filepath, internal_network):
+ """validate the neutron port
+ """
+ heat = Heat(filepath=filepath)
+ if not heat.resources:
+ return
+ neutron_ports = get_neutron_ports(heat)
+ if not neutron_ports:
+ return
+ bad = {}
+ for rid, resource in neutron_ports.items():
+ if not heat.parameters:
+ bad[rid] = 'missing "parameters"'
+ continue
+ network = heat.nested_get(resource, "properties", "network", "get_param")
+ if network is None:
+ bad[rid] = 'missing "network.get_param"'
+ continue
+ if not network.startswith("int_"):
+ continue # not an internal network port
+ error = validate_param(heat, network, internal_network)
+ if error:
+ bad[rid] = error
+ if bad:
+ raise RuntimeError(
+ "Bad OS::Neutron::Port: %s"
+ % (", ".join("%s: %s" % (rid, error) for rid, error in bad.items()))
+ )
+
+
+def validate_param(heat, network, internal_network):
+ """Ensure network (the parameter name) is defined in the base
+ template, and has the correct value function. Ensure its
+ network-role is found in the base template in some
+ OS::Neutron::Net resource.
+ Return error message string, or None if no no errors.
+ """
+ match = RE_INTERNAL_NETWORK_PARAM.match(network)
+ if not match:
+ return 'network.get_param "%s" does not match "%s"' % (
+ network,
+ RE_INTERNAL_NETWORK_PARAM.pattern,
+ )
+ if heat.nested_get(heat.parameters, network) is None:
+ return "missing parameters.%s" % network
+ output = heat.nested_get(internal_network.outputs, network)
+ if not output:
+ return 'network.get_param "%s"' " not found in base template outputs" % network
+ param_dict = match.groupdict()
+ expect = {"name": "get_param", "id": "get_resource"}[param_dict["value_type"]]
+ value = heat.nested_get(output, "value")
+ if heat.nested_get(value, expect) is None:
+ return (
+ 'network.get_param "%s" implies its base template'
+ ' output value function should be "%s" dict not "%s"'
+ % (network, expect, value)
+ )
+ network_role = param_dict["network_role"]
+ for rid, resource in internal_network.resources.items():
+ if (
+ heat.nested_get(resource, "type") == "OS::Neutron::Net"
+ or heat.nested_get(resource, "type") == "OS::ContrailV2::VirtualNetwork"
+ ):
+ match = RE_INTERNAL_NETWORK_RID.match(rid)
+ if match and match.groupdict()["network_role"] == network_role:
+ return None
+ return (
+ "OS::Neutron::Net with network-role"
+ ' "%s" not found in base template."' % network_role
+ )
diff --git a/ice_validator/tests/test_unique_name_str_replace_use_params_in_tmpl.py b/ice_validator/tests/test_neutron_port_network_parameter.py
index f7a202d..14fe386 100644
--- a/ice_validator/tests/test_unique_name_str_replace_use_params_in_tmpl.py
+++ b/ice_validator/tests/test_neutron_port_network_parameter.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -38,42 +38,57 @@
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-from tests import cached_yaml as yaml
import pytest
+from tests import cached_yaml as yaml
+
+from .helpers import validates
+from .utils.network_roles import property_uses_get_resource
-def test_unique_name_str_replace_use_req_params_in_tmpl(yaml_file):
- '''
- Check that all occurences of str_replace uses either vnf_name or
- vnf_module_id to construct the name
- '''
- with open(yaml_file) as fh:
+@validates("R-18008")
+def test_neutron_port_network_param_is_string(heat_template):
+ """
+ Make sure all network properties use the allowed naming
+ conventions
+ """
+ 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")
- in_template = []
- for v1 in yml["resources"].values():
- if not isinstance(v1, dict):
+ # skip if parameters are not defined
+ if "parameters" not in yml:
+ pytest.skip("No parameters specified in the heat template")
+
+ invalid_ports = []
+ for k, v in yml["resources"].items():
+ if not isinstance(v, dict):
+ continue
+ if "properties" not in v:
continue
- if "properties" not in v1:
+ if property_uses_get_resource(v, "network"):
continue
- if v1["type"] in ["OS::Nova::Server", "OS::Neutron::Port",
- "OS::Heat::ResourceGroup"]:
+ if v.get("type") != "OS::Neutron::Port":
+ continue
+
+ prop = v.get("properties", {}).get("network", {})
+ network_param = prop.get("get_param", "") if isinstance(prop, dict) else ""
+ if not network_param:
+ continue
+
+ param = yml.get("parameters").get(network_param)
+ if not param:
continue
- try:
- v2 = v1["properties"]["name"]
- str_replace = v2["str_replace"]
- params = str_replace["params"]
- template = str_replace["template"]
- in_template.append(all(k3 in template for k3 in params))
- except (TypeError, KeyError):
+ param_type = param.get("type")
+ if not param_type:
continue
- if not in_template:
- pytest.skip("No str_replace instances were detected")
+ if param_type != "string":
+ invalid_ports.append({"port": k, "param": network_param})
- assert all(c for c in in_template)
+ assert not invalid_ports, "network parameter must be defined as string {} ".format(
+ invalid_ports
+ )
diff --git a/ice_validator/tests/test_required_parameters_specified_in_heat_templates.py b/ice_validator/tests/test_no_http_resources.py
index 9b38722..6c01971 100644
--- a/ice_validator/tests/test_required_parameters_specified_in_heat_templates.py
+++ b/ice_validator/tests/test_no_http_resources.py
@@ -1,5 +1,5 @@
# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
+# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -37,41 +37,38 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
+import re
import pytest
from tests import cached_yaml as yaml
+from .helpers import validates
-def test_required_parameters_provided_in_heat_template(heat_template):
- '''
- Make sure all required parameters are specified properly
- in the heat template if a server resource is defined
- '''
- required_parameters = ["vnf_id", "vf_module_id", "vnf_name"]
- provided_parameters = []
+VERSION = "1.0.0"
- with open(heat_template) as fh:
+# pylint: disable=invalid-name
+
+
+@validates("R-71699", "R-53952")
+def test_no_http_resources(yaml_file):
+ """Resources are prohibited from retrieving external
+ yaml files"""
+ is_url = re.compile(r"(?:http|https|file|ftp|ftps)://.+")
+
+ with open(yaml_file) as fh:
yml = yaml.load(fh)
+ # skip if parameters are not defined
if "resources" not in yml:
pytest.skip("No resources specified in the heat template")
- server_count = 0
- for v in yml["resources"].values():
- if "type" not in v:
+ invalid_resources = []
+ for rid, rprop in yml["resources"].items():
+ rtype = rprop.get("type", "")
+ if is_url.match(rtype):
+ invalid_resources.append({"resource": rid, "url": rtype})
continue
- if v["type"] == "OS::Nova::Server":
- server_count += 1
-
- if server_count == 0:
- pytest.skip("No Nova Server resources specified in " +
- "the heat template")
-
- if "parameters" not in yml:
- pytest.fail("No parameters specified in the heat template")
-
- for k in yml["parameters"]:
- if k in required_parameters:
- provided_parameters.append(k)
- assert set(required_parameters) == set(provided_parameters)
+ assert not invalid_resources, "External resource types detected {}".format(
+ invalid_resources
+ )
diff --git a/ice_validator/tests/test_no_image_files.py b/ice_validator/tests/test_no_image_files.py
new file mode 100644
index 0000000..fc09bfe
--- /dev/null
+++ b/ice_validator/tests/test_no_image_files.py
@@ -0,0 +1,69 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START====================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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============================================
+import os
+
+from tests.helpers import validates
+
+
+INVALID_EXTS = {
+ ".aki",
+ ".ami",
+ ".ari",
+ ".iso",
+ ".qcow2",
+ ".raw",
+ ".vdi",
+ ".vhd",
+ ".vhdx",
+ ".vmdk",
+ ".bare",
+ ".ova",
+ ".ovf",
+ ".docker",
+}
+
+
+@validates("R-348813")
+def test_no_image_files_included(template_dir):
+ filenames = (f.lower() for f in os.listdir(template_dir))
+ exts = {os.path.splitext(f)[1] for f in filenames}
+ bad_exts = exts.intersection(INVALID_EXTS)
+ msg = (
+ "Image files are not allowed in the template package. Files with "
+ + "the following extensions were found: {}".format(", ".join(bad_exts))
+ )
+ assert not bad_exts, msg
diff --git a/ice_validator/tests/test_no_unused_parameters_between_env_and_templates.py b/ice_validator/tests/test_no_unused_parameters_between_env_and_templates.py
index 81cfc9a..333e01e 100644
--- a/ice_validator/tests/test_no_unused_parameters_between_env_and_templates.py
+++ b/ice_validator/tests/test_no_unused_parameters_between_env_and_templates.py
@@ -35,41 +35,59 @@
#
# ============LICENSE_END============================================
#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
import os
import pytest
from .helpers import validates, get_environment_pair
+def get_keys(template, key):
+ """
+ Gets the set of keys from an expected dict from the ``template`` mapped to
+ the ``key``. If the key is not found, or is not a dict, then an empty
+ set is returned
+ """
+ value = template.get(key)
+ if not value or not hasattr(value, "keys"):
+ return set()
+ else:
+ return set(value.keys())
+
+
@pytest.mark.heat_only
-@validates('R-90279', 'R-01896', 'R-26124')
+@validates("R-01896", "R-26124")
def test_no_unused_parameters_between_env_and_templates(heat_template):
"""
- Check all defined parameters are used in the appropiate Heat template.
+ Check all defined parameters are used in the appropriate Heat template.
"""
environment_pair = get_environment_pair(heat_template)
if not environment_pair:
pytest.skip("No heat/env pair could be identified")
- env_parameters = set(environment_pair["eyml"]["parameters"].keys())
- template_parameters = set(environment_pair["yyml"]["parameters"].keys())
+ env_parameters = get_keys(environment_pair["eyml"], "parameters")
+ template_parameters = get_keys(environment_pair["yyml"], "parameters")
extra_in_template = template_parameters.difference(env_parameters)
extra_in_env = env_parameters.difference(template_parameters)
- msg = "Mismatched parameters detected for the template and environment pair " \
- "with basename ({basename}). "
+ msg = (
+ "Mismatched parameters detected for the template and environment pair "
+ "({basename}). Ensure the parameters exist in both "
+ "templates indented under their respective parameters sections. "
+ )
if extra_in_env:
- msg += "The following parameters exist in the env file, but not the " \
- "template: {extra_in_env}. "
+ msg += (
+ "The following parameters exist in the env file, but not the "
+ "template: {extra_in_env}. "
+ )
if extra_in_template:
- msg += "The following parameters exist in the template file, but not the " \
- "environment file: {extra_in_template}"
+ msg += (
+ "The following parameters exist in the template file, but not the "
+ "environment file: {extra_in_template}"
+ )
assert not (extra_in_template or extra_in_env), msg.format(
basename=os.path.split(environment_pair["name"])[-1],
extra_in_env=", ".join(extra_in_env),
- extra_in_template=", ".join(extra_in_template)
+ extra_in_template=", ".join(extra_in_template),
)
diff --git a/ice_validator/tests/test_non_server_name.py b/ice_validator/tests/test_non_server_name.py
new file mode 100644
index 0000000..7d88155
--- /dev/null
+++ b/ice_validator/tests/test_non_server_name.py
@@ -0,0 +1,143 @@
+# -*- 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.
+#
+
+"""
+resource property name
+"""
+
+import pytest
+
+from .structures import Heat
+from .helpers import validates
+
+VERSION = "1.1.0"
+
+
+def get_non_servers(heat):
+ """
+ Return a dict of non servers. key is rid, value is resource
+ """
+ non_servers = {
+ rid: resource
+ for rid, resource in heat.resources.items()
+ if heat.nested_get(resource, "type") != "OS::Nova::Server"
+ }
+ return non_servers
+
+
+@validates("R-85734")
+def test_non_server_name(heat_template):
+ """
+ If a VNF's Heat Orchestration Template contains the property ``name``
+ for a non ``OS::Nova::Server`` resource, the intrinsic function
+ ``str_replace`` **MUST** be used in conjunction with the ECOMP
+ supplied metadata parameter ``vnf_name`` to generate a unique value.
+
+ """
+ h = Heat(filepath=heat_template)
+ if not h.resources:
+ pytest.skip("No resources in this template")
+
+ non_servers = get_non_servers(h)
+ if not non_servers:
+ pytest.skip("No non-server resources in this template")
+
+ bad = []
+ for rid, resource in non_servers.items():
+ name = h.nested_get(resource, "properties", "name")
+ if not name:
+ continue
+
+ # Make sure it uses str_replace
+ str_replace = name.get("str_replace") if hasattr(name, "get") else None
+ if not str_replace:
+ bad.append("{}'s name property does not use str_replace".format(rid))
+ continue
+
+ # Make sure str_replace is properly formatted
+ if not all(key in str_replace for key in ("template", "params")):
+ bad.append(
+ (
+ "{}'s name property use of str_replace is "
+ + "missing template, params, or both"
+ ).format(rid)
+ )
+ continue
+ params = str_replace["params"]
+ if not isinstance(params, dict):
+ bad.append(
+ (
+ "{}'s name property's use of str_replace.params is "
+ + "missing or invalid"
+ ).format(rid)
+ )
+ continue
+
+ # Find the param that uses vnf_name
+ vnf_name_param = None
+ for key, value in params.items():
+ if not isinstance(value, dict):
+ continue
+ if value.get("get_param", "") == "vnf_name":
+ vnf_name_param = key
+ break
+ if not vnf_name_param:
+ bad.append(
+ (
+ "{}'s name property's use str_replace does not "
+ + "use have a params that maps to the parameter "
+ "via {{get_param: vnf_name}}"
+ ).format(rid)
+ )
+ continue
+
+ # make sure the VNF name is used in the template string
+ template = str_replace.get("template") or ""
+ if vnf_name_param not in template:
+ bad.append(
+ (
+ "{}'s name property's str_replace template does "
+ + "not incorporate vnf_name; expected {} in "
+ + "template ({})"
+ ).format(rid, vnf_name_param, template)
+ )
+ msg = "Improper name property for non-OS::Nova::Server resources. " + ". ".join(bad)
+
+ assert not bad, msg
diff --git a/ice_validator/tests/test_nova_server_name_parameters_start_at_0.py b/ice_validator/tests/test_nova_server_name_parameters_start_at_0.py
new file mode 100644
index 0000000..91258e1
--- /dev/null
+++ b/ice_validator/tests/test_nova_server_name_parameters_start_at_0.py
@@ -0,0 +1,52 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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============================================
+import re
+
+from tests.helpers import check_indices, validates
+from tests.structures import Heat
+
+
+SERVER_NAME_PARAM = re.compile(r"(.*_name_)(\d+)")
+
+
+@validates("R-54171")
+def test_nova_server_name_parameter_starts_at(heat_template):
+ params = Heat(heat_template).parameters
+ invalid_params = check_indices(
+ SERVER_NAME_PARAM, params, "OS::Nova::Server Name Parameters"
+ )
+ assert not invalid_params, ". ".join(invalid_params)
diff --git a/ice_validator/tests/test_nova_server_resource_id.py b/ice_validator/tests/test_nova_server_resource_id.py
new file mode 100644
index 0000000..64462a5
--- /dev/null
+++ b/ice_validator/tests/test_nova_server_resource_id.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.
+#
+
+"""
+resources:
+{vm-type}_server_{vm-type_index}
+"""
+import pytest
+
+from .structures import Heat
+from .structures import NovaServer
+from .helpers import validates
+
+VERSION = "1.0.0"
+
+# pylint: disable=invalid-name
+
+
+@validates("R-29751")
+def test_nova_server_resource_id(heat_template):
+ """
+ A VNF's Heat Orchestration Template's Resource
+ OS::Nova::Server Resource ID
+ **MUST** use the naming convention
+
+ * ``{vm-type}_server_{index}``
+
+ """
+ heat = Heat(filepath=heat_template)
+ resources = heat.nova_server_resources
+ if not resources:
+ pytest.skip("No Nova Server resources found")
+ nova_server = NovaServer()
+ bad = []
+ for rid in resources:
+ if not nova_server.get_rid_match_tuple(rid)[0]:
+ bad.append(rid)
+ assert not bad, "Resource ids %s must match %s" % (
+ bad,
+ nova_server.get_rid_patterns(),
+ )
diff --git a/ice_validator/tests/test_nova_servergroup_policies.py b/ice_validator/tests/test_nova_servergroup_policies.py
index 6a49822..4e67f58 100644
--- a/ice_validator/tests/test_nova_servergroup_policies.py
+++ b/ice_validator/tests/test_nova_servergroup_policies.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -43,11 +43,11 @@ import pytest
def test_nova_servergroup_policies(yaml_file):
- '''
+ """
Check that nova servergroup resources using either anti-affinity or
affinity rules in policies
- '''
- req_rules = ['affinity', 'anti-affinity']
+ """
+ req_rules = ["affinity", "anti-affinity"]
with open(yaml_file) as fh:
yml = yaml.load(fh)
@@ -56,8 +56,8 @@ def test_nova_servergroup_policies(yaml_file):
if "resources" not in yml:
pytest.skip("No resources specified in the heat template")
- has_req_rules = []
- for v1 in yml["resources"].values():
+ invalid_policies = []
+ for r_id, v1 in yml["resources"].items():
if not isinstance(v1, dict):
continue
if "properties" not in v1:
@@ -70,11 +70,19 @@ def test_nova_servergroup_policies(yaml_file):
try:
all_rules = v1["properties"]["policies"]
detected_rules = set(all_rules) & set(req_rules)
- has_req_rules.append(len(detected_rules) > 0)
- except (ValueError):
+ if len(detected_rules) == 0:
+ invalid_policies.append(
+ "{} policies must include one of {}".format(
+ r_id, ", ".join(req_rules)
+ )
+ )
+ elif len(detected_rules) > 1:
+ invalid_policies.append(
+ "{} policies must include only one of {}".format(
+ r_id, ", ".join(req_rules)
+ )
+ )
+ except ValueError:
continue
- if not has_req_rules:
- pytest.skip("No policies Nova::ServerGroup instances were detected")
-
- assert all(has_req_rules)
+ assert not invalid_policies, ". ".join(invalid_policies)
diff --git a/ice_validator/tests/test_nova_servers_environment_context.py b/ice_validator/tests/test_nova_servers_environment_context.py
index 9e01ce0..7c71ef1 100644
--- a/ice_validator/tests/test_nova_servers_environment_context.py
+++ b/ice_validator/tests/test_nova_servers_environment_context.py
@@ -38,24 +38,28 @@
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-'''environment context
-'''
+"""environment context
+"""
import pytest
from tests import cached_yaml as yaml
from .helpers import validates
-VERSION = '1.0.0'
+VERSION = "1.0.0"
-@validates('R-20308')
+@validates("R-20308")
def test_environment_context(heat_template):
- '''
+ """
+ A VNF's Heat Orchestration Template's OS::Nova::Server Resource
+ **MUST**
+ contain the metadata map value parameter 'environment_context'.
+
A VNF's Heat Orchestration Template's OS::Nova::Server Resource
metadata map value parameter 'environment_context' **MUST**
be declared as type: 'string'.
- '''
+ """
with open(heat_template) as fh:
yml = yaml.load(fh)
@@ -65,38 +69,38 @@ def test_environment_context(heat_template):
pytest.skip("No resources specified in the heat template")
for resource, v in yml["resources"].items():
- if (not isinstance(v, dict)
- or v.get('type') != 'OS::Nova::Server'
- or 'properties' not in v):
+ if (
+ not isinstance(v, dict)
+ or v.get("type") != "OS::Nova::Server"
+ or "properties" not in v
+ ):
continue
- metadata = v['properties'].get('metadata')
+ metadata = v["properties"].get("metadata")
if not isinstance(metadata, dict):
continue
- error = validate_metadata(metadata, yml['parameters'])
+ error = validate_metadata(metadata, yml["parameters"])
if error:
- assert False, '%s resource "%s" %s' % (
- heat_template,
- resource,
- error)
+ assert False, '%s resource "%s" %s' % (heat_template, resource, error)
def validate_metadata(metadata, parameters):
- '''validate metatdata.
- Ensure metadata references parameter environment_context
- is a string.
+ """validate metatdata.
+ Ensure metadata references parameter environment_context,
+ and that it is a string.
Return error message string or None if no errors.
- '''
+ """
for value in metadata.values():
if isinstance(value, dict):
- if 'get_param' in value:
- if value['get_param'] == 'environment_context':
- wc = parameters.get('environment_context', {})
- if wc.get('type') == 'string':
+ if "get_param" in value:
+ if value["get_param"] == "environment_context":
+ wc = parameters.get("environment_context", {})
+ if wc.get("type") == "string":
break
else:
- return ('must have parameter "environment_context"'
- ' of type "string"')
+ return (
+ 'must have parameter "environment_context"'
+ ' of type "string"'
+ )
break
else:
return None
-
diff --git a/ice_validator/tests/test_nova_servers_index.py b/ice_validator/tests/test_nova_servers_index.py
deleted file mode 100644
index 9ce843a..0000000
--- a/ice_validator/tests/test_nova_servers_index.py
+++ /dev/null
@@ -1,120 +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.
-#
-
-'''
-Ensure that if a resource_id has an {index}, then all resources of
-the same vm-type have an index, the indices are consecutive and start
-with 0.
-'''
-
-import collections
-import re
-
-import pytest
-
-from .structures import Heat
-from .helpers import validates
-from .utils import vm_types
-
-VERSION = '1.1.0'
-
-RE_INDEXED_RESOURCE_ID = re.compile(r'\w+_(?P<index>\d+)$')
-
-
-@validates('R-11690')
-def test_indices(heat_templates):
- '''validate indices
- '''
- indexed_resource_ids = {}
- resources = {}
- for heat_template in heat_templates:
- h = Heat(filepath=heat_template)
- if h.resources:
- indexed_resource_ids.update(get_indexed_resource_ids(h.resources))
- resources.update(h.resources)
- if not resources:
- pytest.skip('No resources found')
-
- if not indexed_resource_ids:
- pytest.skip('No resources with {index} found')
-
- types = get_types(resources, indexed_resource_ids)
- if not types:
- pytest.skip('No resources with {vm-type} found')
-
- indices = collections.defaultdict(list)
- for resource_id, vm_type in types.items():
- indices[vm_type].append(indexed_resource_ids[resource_id])
- bad = {}
- for vm_type, index_list in indices.items():
- for i in range(len(index_list)):
- if i not in index_list:
- bad[vm_type] = index_list
- break
- assert not bad, (
- 'vm-type indices must be consecutive, unique,'
- ' and start at 0.\n %s' % (
- '\n '.join(['Resource ID %s: VM Type: %s' % (x, y)
- for x, y in types.items() if y in bad])))
-
-
-def get_indexed_resource_ids(resources):
- """Return dict. keys are resource_ids which end in an index.
- values are the integer index parsed from the resource_id.
- """
- indexed_resource_ids = {}
- for resource in resources:
- match = RE_INDEXED_RESOURCE_ID.match(resource)
- if match:
- indexed_resource_ids[resource] = int(match.groupdict()['index'])
- return indexed_resource_ids
-
-
-def get_types(resources, indexed_resource_ids):
- """Return dict. keys are resource_ids from indexed_resource_ids.
- values are the vm-type extracted from the resource.
- """
- all_vm_types = {}
- for rid in indexed_resource_ids:
- x = vm_types.get_vm_types_for_resource(resources[rid])
- if x and len(x) == 1:
- all_vm_types[rid] = list(x)[0] # x is a set.
- return all_vm_types
-
diff --git a/ice_validator/tests/test_nova_servers_resource_ids.py b/ice_validator/tests/test_nova_servers_resource_ids.py
index dd3e156..9747e29 100644
--- a/ice_validator/tests/test_nova_servers_resource_ids.py
+++ b/ice_validator/tests/test_nova_servers_resource_ids.py
@@ -45,12 +45,11 @@ from .helpers import validates
from .utils.vm_types import get_vm_type_for_nova_server
-@validates('R-40499',
- 'R-57282')
+@validates("R-40499", "R-57282")
def test_nova_servers_valid_resource_ids(yaml_file):
- '''
+ """
Make sure all nova servers have valid resource ids
- '''
+ """
with open(yaml_file) as fh:
yml = yaml.load(fh)
@@ -85,14 +84,27 @@ def test_nova_servers_valid_resource_ids(yaml_file):
int(k1_suffix)
except ValueError:
# vm_type_index is not an integer
- invalid_nova_servers.append({"resource": k1, "vm_type": vm_type, "vm_type_index": k1_suffix})
+ invalid_nova_servers.append(
+ {
+ "resource": k1,
+ "vm_type": vm_type,
+ "vm_type_index": k1_suffix,
+ }
+ )
else:
# vm_type_index not found
- invalid_nova_servers.append({"resource": k1, "vm_type": vm_type, "vm_type_index": "none found"})
+ invalid_nova_servers.append(
+ {
+ "resource": k1,
+ "vm_type": vm_type,
+ "vm_type_index": "none found",
+ }
+ )
- assert not invalid_nova_servers, \
- "Invalid OS::Nova::Server resource ids detected {}\n" \
- "OS::Nova::Server resource ids must be in the form " \
- "<vm_type>_server_<vm_type_index> \n" \
- "<vm_type> is derived from flavor, image and name properties " \
+ assert not invalid_nova_servers, (
+ "Invalid OS::Nova::Server resource ids detected {}\n"
+ "OS::Nova::Server resource ids must be in the form "
+ "<vm_type>_server_<vm_type_index> \n"
+ "<vm_type> is derived from flavor, image and name properties "
"".format(invalid_nova_servers)
+ )
diff --git a/ice_validator/tests/test_nova_servers_vm_types.py b/ice_validator/tests/test_nova_servers_vm_types.py
index 233304c..786973e 100644
--- a/ice_validator/tests/test_nova_servers_vm_types.py
+++ b/ice_validator/tests/test_nova_servers_vm_types.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -45,18 +45,17 @@ from tests import cached_yaml as yaml
from .helpers import validates
-from .utils.vm_types import get_vm_types_for_resource
-from .utils.vm_types import get_vm_types
+from .utils.vm_types import get_vm_types_for_resource, get_vm_types
from .utils.network_roles import get_network_roles
-@validates('R-57282')
+@validates("R-57282")
def test_vm_type_consistent_on_nova_servers(heat_template):
- '''
+ """
Make sure all nova servers have properly formatted properties
for their name, image and flavor
- '''
+ """
with open(heat_template) as fh:
yml = yaml.load(fh)
@@ -68,22 +67,23 @@ def test_vm_type_consistent_on_nova_servers(heat_template):
for k, v in yml["resources"].items():
if not isinstance(v, dict):
continue
- if v.get('type') != 'OS::Nova::Server':
+ if v.get("type") != "OS::Nova::Server":
continue
- if 'properties' not in v:
+ if "properties" not in v:
continue
vm_types = get_vm_types_for_resource(v)
if len(vm_types) != 1:
invalid_nova_servers.append(k)
- assert not set(invalid_nova_servers), \
- "vm_types not consistant on the following resources {}" \
- .format(invalid_nova_servers)
+ assert not set(
+ invalid_nova_servers
+ ), "vm_types not consistant on the following resources: {}".format(
+ ",".join(invalid_nova_servers)
+ )
-@validates('R-48067',
- 'R-00977')
+@validates("R-48067", "R-00977")
def test_vm_type_network_role_collision(yaml_file):
with open(yaml_file) as fh:
yml = yaml.load(fh)
@@ -100,34 +100,37 @@ def test_vm_type_network_role_collision(yaml_file):
collisions = []
for nr in network_roles:
for vt in vm_types:
- if vt in nr or nr in vt:
- collisions.append({"vm_type": vt, "network_role": nr})
-
- assert not collisions, \
- "vm_type and network_role should not be substrings {}" .format(collisions)
-
-
-@validates('R-50436',
- 'R-45188',
- 'R-40499')
+ if vt in nr:
+ collisions.append(
+ (
+ "vm_type ({}) cannot be a substring " "of network_role ({})"
+ ).format(vt, nr)
+ )
+ elif nr in vt:
+ collisions.append(
+ (
+ "network_role ({}) cannot be a substring " "of vm_type ({})"
+ ).format(nr, vt)
+ )
+
+ assert not collisions, ", ".join(collisions)
+
+
+@validates("R-50436", "R-45188", "R-40499")
def test_nova_server_flavor_parameter(yaml_file):
prop = "flavor"
check_nova_parameter_format(prop, yaml_file)
-@validates('R-51430',
- 'R-54171',
- 'R-87817')
+@validates("R-51430", "R-54171", "R-87817")
def test_nova_server_name_parameter(yaml_file):
prop = "name"
check_nova_parameter_format(prop, yaml_file)
-@validates('R-71152',
- 'R-45188',
- 'R-57282')
+@validates("R-71152", "R-57282", "R-58670")
def test_nova_server_image_parameter(yaml_file):
prop = "image"
@@ -138,13 +141,11 @@ def check_nova_parameter_format(prop, yaml_file):
formats = {
"string": {
- "name": re.compile(r'(.+?)_name_\d+$'),
- "flavor": re.compile(r'(.+?)_flavor_name$'),
- "image": re.compile(r'(.+?)_image_name$')
+ "name": re.compile(r"(.+?)_name_\d+$"),
+ "flavor": re.compile(r"(.+?)_flavor_name$"),
+ "image": re.compile(r"(.+?)_image_name$"),
},
- "comma_delimited_list": {
- "name": re.compile(r'(.+?)_names$')
- }
+ "comma_delimited_list": {"name": re.compile(r"(.+?)_names$")},
}
with open(yaml_file) as fh:
@@ -163,31 +164,28 @@ def check_nova_parameter_format(prop, yaml_file):
for k, v in yml["resources"].items():
if not isinstance(v, dict):
continue
- if v.get('type') != 'OS::Nova::Server':
+ if v.get("type") != "OS::Nova::Server":
continue
- prop_param = v.get("properties", {}) \
- .get(prop, {}) \
- .get("get_param")
+ prop_val = v.get("properties", {}).get(prop, {})
+ prop_param = prop_val.get("get_param", "") if isinstance(prop_val, dict) else ""
if not prop_param:
pytest.skip("{} doesn't have property {}".format(k, prop))
elif isinstance(prop_param, list):
prop_param = prop_param[0]
- template_param_type = yml.get("parameters", {}) \
- .get(prop_param, {}) \
- .get("type")
+ template_param_type = yml.get("parameters", {}).get(prop_param, {}).get("type")
if not template_param_type:
pytest.skip("could not determine param type for {}".format(prop_param))
- format_match = formats.get(template_param_type, {}) \
- .get(prop)
+ format_match = formats.get(template_param_type, {}).get(prop)
if not format_match or not format_match.match(prop_param):
- invalid_parameters.append(prop_param)
+ msg = (
+ "Invalid parameter format ({}) on Resource ID ({}) property" " ({})"
+ ).format(prop_param, k, prop)
+ invalid_parameters.append(msg)
- assert not set(invalid_parameters), \
- "invalid {} parameters detected {}" \
- .format(prop, invalid_parameters)
+ assert not set(invalid_parameters), ", ".join(invalid_parameters)
diff --git a/ice_validator/tests/test_nova_servers_vm_types_use_get_param.py b/ice_validator/tests/test_nova_servers_vm_types_use_get_param.py
index 6b1a668..2f69b52 100644
--- a/ice_validator/tests/test_nova_servers_vm_types_use_get_param.py
+++ b/ice_validator/tests/test_nova_servers_vm_types_use_get_param.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -41,11 +41,14 @@
import pytest
from tests import cached_yaml as yaml
+from .helpers import validates
+
+@validates("R-901331", "R-481670", "R-663631")
def test_vm_type_assignments_on_nova_servers_only_use_get_param(heat_template):
- '''
+ """
Make sure all nova servers only use get_param for their properties
- '''
+ """
with open(heat_template) as fh:
yml = yaml.load(fh)
@@ -54,7 +57,7 @@ def test_vm_type_assignments_on_nova_servers_only_use_get_param(heat_template):
pytest.skip("No resources specified in the heat template")
key_values = ["name", "flavor", "image"]
- invalid_nova_servers = []
+ invalid_nova_servers = set()
for k, v in yml["resources"].items():
if not isinstance(v, dict):
@@ -69,8 +72,11 @@ def test_vm_type_assignments_on_nova_servers_only_use_get_param(heat_template):
for k2, v2 in v["properties"].items():
if k2 in key_values:
if not isinstance(v2, dict):
- invalid_nova_servers.append(k)
+ invalid_nova_servers.add(k)
elif "get_param" not in v2:
- invalid_nova_servers.append(k)
-
- assert not set(invalid_nova_servers)
+ invalid_nova_servers.add(k)
+ msg = (
+ "These OS::Nova::Server resources do not derive one or more of "
+ + "their {} properties via get_param: {}"
+ ).format(", ".join(key_values), ", ".join(invalid_nova_servers))
+ assert not invalid_nova_servers, msg
diff --git a/ice_validator/tests/test_nova_servers_workload_context.py b/ice_validator/tests/test_nova_servers_workload_context.py
index 650a6e1..5703f75 100644
--- a/ice_validator/tests/test_nova_servers_workload_context.py
+++ b/ice_validator/tests/test_nova_servers_workload_context.py
@@ -38,24 +38,28 @@
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-'''workload context
-'''
+"""workload context
+"""
import pytest
from tests import cached_yaml as yaml
from .helpers import validates
-VERSION = '1.0.0'
+VERSION = "1.0.0"
-@validates('R-74978')
+@validates("R-74978")
def test_workload_context(heat_template):
- '''
+ """
+ A VNF's Heat Orchestration Template's OS::Nova::Server Resource
+ **MUST**
+ contain the metadata map value parameter 'workload_context'.
+
A VNF's Heat Orchestration Template's OS::Nova::Server Resource
metadata map value parameter 'workload_context' **MUST**
be declared as type: 'string'.
- '''
+ """
with open(heat_template) as fh:
yml = yaml.load(fh)
@@ -65,38 +69,37 @@ def test_workload_context(heat_template):
pytest.skip("No resources specified in the heat template")
for resource, v in yml["resources"].items():
- if (not isinstance(v, dict)
- or v.get('type') != 'OS::Nova::Server'
- or 'properties' not in v):
+ if (
+ not isinstance(v, dict)
+ or v.get("type") != "OS::Nova::Server"
+ or "properties" not in v
+ ):
continue
- metadata = v['properties'].get('metadata')
+ metadata = v["properties"].get("metadata")
if not isinstance(metadata, dict):
continue
- error = validate_metadata(metadata, yml['parameters'])
+ error = validate_metadata(metadata, yml["parameters"])
if error:
- assert False, '%s resource "%s" %s' % (
- heat_template,
- resource,
- error)
+ assert False, '%s resource "%s" %s' % (heat_template, resource, error)
def validate_metadata(metadata, parameters):
- '''validate metatdata.
- Ensure metadata references parameter workload_context
- is a string.
+ """validate metatdata.
+ Ensure metadata references parameter workload_context,
+ and that it is a string.
Return error message string or None if no errors.
- '''
+ """
for value in metadata.values():
if isinstance(value, dict):
- if 'get_param' in value:
- if value['get_param'] == 'workload_context':
- wc = parameters.get('workload_context', {})
- if wc.get('type') == 'string':
+ if "get_param" in value:
+ if value["get_param"] == "workload_context":
+ wc = parameters.get("workload_context", {})
+ if wc.get("type") == "string":
break
else:
- return ('must have parameter "workload_context"'
- ' of type "string"')
+ return (
+ 'must have parameter "workload_context"' ' of type "string"'
+ )
break
else:
return None
-
diff --git a/ice_validator/tests/test_port_connected_to_multiple_servers.py b/ice_validator/tests/test_port_connected_to_multiple_servers.py
new file mode 100644
index 0000000..e8b778d
--- /dev/null
+++ b/ice_validator/tests/test_port_connected_to_multiple_servers.py
@@ -0,0 +1,71 @@
+# -*- 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============================================
+from collections import defaultdict
+
+import pytest
+
+from tests.helpers import validates
+from tests.structures import Heat, Resource
+
+
+@validates("R-92635")
+def test_port_connected_to_multiple_servers(yaml_file):
+ """
+ SDC will throw an error if a single port is connected to more than
+ one server. This test detects that condition and logs a test failure.
+ """
+ heat = Heat(yaml_file)
+ if not heat.resources:
+ pytest.skip("No resources")
+
+ port_to_server = defaultdict(list)
+ for server_id, server_data in heat.get_resource_by_type("OS::Nova::Server").items():
+ server = Resource(server_id, server_data)
+ ports = server.properties.get("networks", [])
+ for port in ports:
+ port_val = port.get("port")
+ if isinstance(port_val, dict) and "get_resource" in port_val:
+ port_id = port_val["get_resource"]
+ port_to_server[port_id].append(server_id)
+ errors = []
+ for port, servers in port_to_server.items():
+ if len(servers) > 1:
+ errors.append("Port {} is connected to {}".format(port, ", ".join(servers)))
+ msg = "A port cannot be connected to more than 1 server: {}".format(
+ ". ".join(errors)
+ )
+ assert not errors, msg
diff --git a/ice_validator/tests/test_port_resource_ids.py b/ice_validator/tests/test_port_resource_ids.py
index 076c479..f53370d 100644
--- a/ice_validator/tests/test_port_resource_ids.py
+++ b/ice_validator/tests/test_port_resource_ids.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -44,29 +44,22 @@ import pytest
from tests import cached_yaml as yaml
from .helpers import validates
-from .utils.network_roles import get_network_role_from_port, \
- get_network_type_from_port, \
- property_uses_get_resource
+from .utils.network_roles import (
+ get_network_role_from_port,
+ get_network_type_from_port,
+ property_uses_get_resource,
+)
from .utils.vm_types import get_vm_type_for_nova_server
-@validates('R-69014',
- 'R-05201',
- 'R-68936',
- 'R-32025',
- 'R-11168',
- 'R-84322',
- 'R-96983',
- 'R-26506',
- 'R-20453',
- 'R-26351')
+@validates("R-20453", "R-26351", "R-26506" "R-681859")
def test_port_resource_ids(heat_template):
- '''
+ """
Check that all resource ids for ports follow the right
naming convention to 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(heat_template) as fh:
yml = yaml.load(fh)
@@ -74,45 +67,39 @@ def test_port_resource_ids(heat_template):
if "resources" not in yml:
pytest.skip("No resources specified in the heat template")
- port_patterns = {'internal': re.compile(r'(.+?)_\d+_int_(.+?)_port_\d+'),
- 'external': re.compile(r'(.+?)_\d+_(.+?)_port_\d+')}
- resources = yml['resources']
+ resources = yml["resources"]
invalid_ports = []
for k, v in resources.items():
if not isinstance(v, dict):
continue
- if 'type' not in v:
+ if "type" not in v:
continue
- if v['type'] not in 'OS::Nova::Server':
+ if v["type"] not in "OS::Nova::Server":
continue
- if 'properties' not in v:
+ if "properties" not in v:
continue
- if 'networks' not in v['properties']:
+ if "networks" not in v["properties"]:
continue
- has_vm_type = False
- has_network_role = True
- port_resource = None
-
vm_type = get_vm_type_for_nova_server(v)
if not vm_type:
continue
vm_type = vm_type.lower()
# get all ports associated with the nova server
- properties = v['properties']
- for v2 in properties['networks']:
+ properties = v["properties"]
+ for v2 in properties["networks"]:
for k3, v3 in v2.items():
- if k3 != 'port':
+ if k3 != "port":
continue
if not isinstance(v3, dict):
continue
- if 'get_param' in v3:
+ if "get_param" in v3:
continue
- elif 'get_resource' in v3:
- port_id = v3['get_resource']
+ elif "get_resource" in v3:
+ port_id = v3["get_resource"]
if not resources[port_id]:
continue
port_resource = resources[port_id]
@@ -120,34 +107,30 @@ def test_port_resource_ids(heat_template):
else:
continue
- has_vm_type = vm_type + "_" in port_id
- has_network_role = False
-
- 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
- network_role = network_role.lower()
-
- network_type = get_network_type_from_port(port_resource)
- if not network_type:
- continue
-
- if port_patterns[network_type].match(port_id):
- has_network_role = True
- else:
- # match the assumed naming convention for ports
- # if the specified port is provided via get_param
- network_type = 'external'
- if "int_" in port_id:
- network_type = 'internal'
- if port_patterns[network_type].match(port_id):
- has_network_role = True
-
- if has_vm_type and has_network_role:
+ if property_uses_get_resource(v, "network"):
continue
- invalid_ports.append(port_id)
+ network_role = get_network_role_from_port(port_resource)
+ if not network_role:
+ continue
+ network_role = network_role.lower()
- assert not set(invalid_ports)
+ network_type = get_network_type_from_port(port_resource)
+ if not network_type:
+ continue
+ if network_type == "external":
+ expected_r_id = r"{}_\d+_{}_port_\d+".format(vm_type, network_role)
+ else:
+ expected_r_id = r"{}_\d+_int_{}_port_\d+".format(
+ vm_type, network_role
+ )
+ if not re.match(expected_r_id, port_id):
+ invalid_ports.append(
+ (port_id, "Did not match {}".format(expected_r_id))
+ )
+
+ port_errors = "; ".join(
+ "{} -> {}".format(port, error) for port, error in invalid_ports
+ )
+ msg = "The following ports have invalid resource IDs: {}".format(port_errors)
+ msg = msg.replace(r"\d+", "{index}")
+ assert not invalid_ports, msg
diff --git a/ice_validator/tests/test_required_parameters_no_constraints.py b/ice_validator/tests/test_required_parameters_no_constraints.py
index 4036162..d397a23 100644
--- a/ice_validator/tests/test_required_parameters_no_constraints.py
+++ b/ice_validator/tests/test_required_parameters_no_constraints.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -44,24 +44,55 @@ from tests import cached_yaml as yaml
from .helpers import validates
-@validates('R-55218', 'R-98374', 'R-44318')
-def test_required_parameters_no_constraints(yaml_file):
- '''
- Make sure all required parameters are specified without any
- constraints in the heat template.
- '''
- required_parameters = ["vnf_id", "vf_module_id", "vnf_name"]
+def check_parameters_no_constraints(yaml_file, parameter):
with open(yaml_file) as fh:
yml = yaml.load(fh)
- # skip if parameters are not defined
- if "parameters" not in yml:
- pytest.skip("No parameters specified in the heat template")
+ param = yml.get("parameters", {}).get(parameter)
+ if not param:
+ pytest.skip("Parameter {} not defined in parameters section".format(parameter))
- invalid_params = []
- for k1, v1 in yml["parameters"].items():
- if k1 in required_parameters and "constraints" in v1:
- invalid_params.append(k1)
+ assert (
+ "constraints" not in param
+ ), "Found constraints defined for parameter: {}".format(parameter)
- assert not set(invalid_params)
+
+@validates("R-55218")
+def test_vnf_id_parameter_has_no_constraints(yaml_file):
+ check_parameters_no_constraints(yaml_file, "vnf_id")
+
+
+@validates("R-98374")
+def test_vf_module_id_parameter_has_no_constraints(yaml_file):
+ check_parameters_no_constraints(yaml_file, "vf_module_id")
+
+
+@validates("R-44318")
+def test_vnf_name_parameter_has_no_constraints(yaml_file):
+ check_parameters_no_constraints(yaml_file, "vnf_name")
+
+
+@validates("R-34055")
+def test_workload_context_parameter_has_no_constraints(yaml_file):
+ check_parameters_no_constraints(yaml_file, "workload_context")
+
+
+@validates("R-56183")
+def test_environment_context_parameter_has_no_constraints(yaml_file):
+ check_parameters_no_constraints(yaml_file, "environment_context")
+
+
+@validates("R-15480")
+def test_vf_module_name_parameter_has_no_constraints(yaml_file):
+ check_parameters_no_constraints(yaml_file, "vf_module_name")
+
+
+@validates("R-67597")
+def test_vm_role_parameter_has_no_constraints(yaml_file):
+ check_parameters_no_constraints(yaml_file, "vm_role")
+
+
+@validates("R-09811")
+def test_vf_module_index_parameter_has_no_constraints(yaml_file):
+ check_parameters_no_constraints(yaml_file, "vf_module_index")
diff --git a/ice_validator/tests/test_required_parameters_specified_in_env_files.py b/ice_validator/tests/test_required_parameters_specified_in_env_files.py
deleted file mode 100644
index 63b890c..0000000
--- a/ice_validator/tests/test_required_parameters_specified_in_env_files.py
+++ /dev/null
@@ -1,81 +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.
-#
-
-import pytest
-
-from .helpers import get_environment_pair
-
-
-@pytest.mark.heat_only
-def test_required_parameters_provided_in_env_file(heat_template):
- '''
- Make sure all required parameters are specified properly
- in the environment file if a server is defined in the
- corresponding heat template
- '''
- environment_pair = get_environment_pair(heat_template)
- if not environment_pair:
- pytest.skip("No heat/env pair could be identified")
-
- required_parameters = ["vnf_id", "vf_module_id", "vnf_name"]
-
- if "resources" not in environment_pair["yyml"]:
- pytest.skip("No resources specified in the heat template")
-
- if "parameters" not in environment_pair["eyml"]:
- pytest.skip("No parameters specified in the environment file")
-
- server_count = 0
- for v in environment_pair["yyml"]['resources'].values():
- if "type" not in v:
- continue
- if v["type"] == "OS::Nova::Server":
- server_count += 1
-
- if server_count == 0:
- pytest.skip("No Nova Server resources specified in " +
- "the heat template")
-
- provided_parameters = []
- for k in environment_pair["eyml"]['parameters']:
- if k in required_parameters:
- provided_parameters.append(k)
-
- assert set(required_parameters) == set(provided_parameters)
diff --git a/ice_validator/tests/test_resource_ids_alphanumeric_only.py b/ice_validator/tests/test_resource_ids_alphanumeric_only.py
index d5080f4..f08e0c8 100644
--- a/ice_validator/tests/test_resource_ids_alphanumeric_only.py
+++ b/ice_validator/tests/test_resource_ids_alphanumeric_only.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -46,21 +46,21 @@ from tests import cached_yaml as yaml
from .helpers import validates
-@validates('R-75141')
+@validates("R-75141")
def test_alphanumeric_resource_ids_only(yaml_file):
- '''
- Check that all instance names are only using alphanumerics
- '''
- valid_format = re.compile(r'^[\w-]+$')
+ valid_format = re.compile(r"^[\w-]+$")
with open(yaml_file) as fh:
yml = yaml.load(fh)
- if 'resources' not in yml:
+ if "resources" not in yml:
pytest.skip("No resources specified in the heat template")
- invalid_resource_ids = [k
- for k in yml['resources'].keys()
- if not valid_format.match(k)]
+ invalid_resource_ids = [
+ k for k in yml["resources"].keys() if not valid_format.match(k)
+ ]
- assert not set(invalid_resource_ids)
+ msg = "Invalid character(s) detected in the following resource IDs: " + ", ".join(
+ invalid_resource_ids
+ )
+ assert not set(invalid_resource_ids), msg
diff --git a/ice_validator/tests/test_resource_indices.py b/ice_validator/tests/test_resource_indices.py
new file mode 100644
index 0000000..8e92567
--- /dev/null
+++ b/ice_validator/tests/test_resource_indices.py
@@ -0,0 +1,84 @@
+# -*- 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============================================
+#
+import collections
+from itertools import chain
+from .structures import Heat
+from .helpers import validates
+
+
+def has_next(seq, index):
+ """
+ Returns true if there is at least one more item after the current
+ index in the sequence
+ """
+ next_index = index + 1
+ return len(seq) > next_index
+
+
+@validates("R-11690")
+def test_indices_start_at_0_increment(yaml_files):
+ resources_ids = chain.from_iterable(Heat(f).resources.keys() for f in yaml_files)
+ prefix_indices = collections.defaultdict(set)
+ for r_id in resources_ids:
+ parts = r_id.split("_")
+ prefix_parts = []
+ for i, part in enumerate(parts):
+ if part.isdigit():
+ # It's an index so let's record it and its prefix
+ prefix = "_".join(prefix_parts) + "_"
+ index = int(part)
+ prefix_indices[prefix].add(index)
+ prefix_parts.append(part)
+ errors = []
+ for prefix, indices in prefix_indices.items():
+ indices = sorted(indices)
+ if indices[0] != 0:
+ errors.append(
+ (
+ "Index values associated with resource ID "
+ + "prefix {} do not start at 0".format(prefix)
+ )
+ )
+ elif indices[-1] != (len(indices) - 1):
+ errors.append(
+ (
+ "Index values associated with resource ID "
+ + "prefix {} are not contiguous: {}"
+ ).format(prefix, indices)
+ )
+ assert not errors, ". ".join(errors)
diff --git a/ice_validator/tests/test_server_parameters.py b/ice_validator/tests/test_server_parameters.py
new file mode 100644
index 0000000..ec49f02
--- /dev/null
+++ b/ice_validator/tests/test_server_parameters.py
@@ -0,0 +1,178 @@
+# -*- 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.
+#
+"""test
+"""
+import pytest
+from tests import cached_yaml as yaml
+
+from .helpers import validates
+
+VERSION = "1.1.0"
+
+
+def check_parameter_type(heat_template, parameter, parameter_type):
+ """
+ Make sure these OS::Nova::Server parameters are defined w/
+ the correct type
+ """
+
+ with open(heat_template) as fh:
+ yml = yaml.load(fh)
+
+ # skip if resources are not defined
+ if "parameters" not in yml:
+ pytest.skip("No parameters specified in the heat template")
+
+ invalid_parameters = []
+
+ for k1, v1 in yml["parameters"].items():
+ if not isinstance(v1, dict):
+ continue
+ if "type" not in v1:
+ continue
+
+ if k1.find(parameter) == -1:
+ continue
+
+ param_type = v1.get("type")
+
+ if not param_type:
+ continue
+
+ if param_type != parameter_type:
+ invalid_parameters.append(k1)
+
+ assert (
+ not invalid_parameters
+ ), "{} parameters must be defined as type {}: {}".format(
+ parameter, parameter_type, invalid_parameters
+ )
+
+
+def check_server_parameter_name(heat_template, parameter, parameter_name):
+ """
+ Check each OS::Nova::Server metadata property
+ uses the same parameter name w/ get_param
+ """
+
+ 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")
+
+ invalid_parameters = []
+
+ for k1, v1 in yml["resources"].items():
+ if not isinstance(v1, dict):
+ continue
+ if "type" not in v1:
+ continue
+
+ if v1["type"] != "OS::Nova::Server":
+ continue
+
+ metadata = v1.get("properties", {}).get("metadata", {}).get(parameter)
+
+ if not metadata or not isinstance(metadata, dict):
+ continue
+
+ get_param = metadata.get("get_param")
+
+ if not get_param:
+ continue
+
+ if get_param != parameter_name:
+ invalid_parameters.append(
+ {
+ "resource": k1,
+ "metadata property": parameter_name,
+ "get_param": get_param,
+ }
+ )
+
+ assert not invalid_parameters, (
+ "metadata property {} must use get_param and "
+ "the parameter name must be {}: {}".format(
+ parameter, parameter_name, invalid_parameters
+ )
+ )
+
+
+@validates("R-23311")
+def test_availability_zone_parameter_type(heat_template):
+ check_parameter_type(heat_template, "availability_zone_", "string")
+
+
+@validates("R-07507")
+def test_vnf_id_parameter_type_and_parameter_name(heat_template):
+ check_parameter_type(heat_template, "vnf_id", "string")
+ check_server_parameter_name(heat_template, "vnf_id", "vnf_id")
+
+
+@validates("R-82134")
+def test_vf_module_id_parameter_type_and_parameter_name(heat_template):
+ check_parameter_type(heat_template, "vf_module_id", "string")
+ check_server_parameter_name(heat_template, "vf_module_id", "vf_module_id")
+
+
+@validates("R-62428")
+def test_vnf_name_parameter_type_and_parameter_name(heat_template):
+ check_parameter_type(heat_template, "vnf_name", "string")
+ check_server_parameter_name(heat_template, "vnf_name", "vnf_name")
+
+
+@validates("R-39067")
+def test_vf_module_name_parameter_type_and_parameter_name(heat_template):
+ check_parameter_type(heat_template, "vf_module_name", "string")
+ check_server_parameter_name(heat_template, "vf_module_name", "vf_module_name")
+
+
+@validates("R-95430")
+def test_vm_role_parameter_type_and_parameter_name(heat_template):
+ check_parameter_type(heat_template, "vm_role", "string")
+ check_server_parameter_name(heat_template, "vm_role", "vm_role")
+
+
+@validates("R-54340")
+def test_vf_module_index_parameter_type_and_parameter_name(heat_template):
+ check_parameter_type(heat_template, "vf_module_index", "number")
+ check_server_parameter_name(heat_template, "vf_module_index", "vf_module_index")
diff --git a/ice_validator/tests/test_servers_have_optional_metadata.py b/ice_validator/tests/test_servers_have_optional_metadata.py
deleted file mode 100644
index 01e87e0..0000000
--- a/ice_validator/tests/test_servers_have_optional_metadata.py
+++ /dev/null
@@ -1,93 +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.
-#
-
-from tests import cached_yaml as yaml
-import pytest
-
-
-def test_servers_have_optional_metadata(yaml_file):
- '''
- Check that if optional metadata is included in the metadata
- for nova servers, they are specified in parameters
- '''
- with open(yaml_file) as fh:
- yml = yaml.load(fh)
-
- # skip if parameters are not defined
- if "parameters" not in yml:
- pytest.skip("No parameters specified in the heat template")
-
- # Check if the param vm_role is defined
- if "resources" not in yml:
- pytest.skip("No resources specified in the heat template")
-
- optional_metadata = ["vf_module_name", "vf_module_index"]
- specified_optional_metadata = [k
- for k in yml["parameters"].keys()
- if k in optional_metadata]
-
- need_optional_metadata = []
- for v in yml["resources"].values():
- keys = []
- if v.get("type") == "OS::Nova::Server":
- if 'properties' not in v:
- continue
- if 'metadata' not in v['properties']:
- continue
-
- keys = v["properties"]["metadata"].keys()
- elif v.get("type") == "OS::Heat::ResourceGroup":
- if 'resource_def' not in v:
- continue
- if 'properties' not in v['resource_def']:
- continue
-
- keys = v["resource_def"]["properties"].keys()
-
- for key in keys:
- if key in optional_metadata:
- need_optional_metadata.append(key)
-
- if not need_optional_metadata:
- pytest.skip("No optional metadata is specified in the heat template")
-
- # Check that if optional metadata is included in the metadata
- # for nova servers, they are specified in parameters
- assert set(specified_optional_metadata) == set(need_optional_metadata)
diff --git a/ice_validator/tests/test_servers_have_required_metadata.py b/ice_validator/tests/test_servers_have_required_metadata.py
index 3e84d43..8ea8869 100644
--- a/ice_validator/tests/test_servers_have_required_metadata.py
+++ b/ice_validator/tests/test_servers_have_required_metadata.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -44,12 +44,12 @@ from tests import cached_yaml as yaml
from .helpers import validates
-@validates('R-37437', 'R-71493', 'R-72483')
+@validates("R-37437", "R-71493", "R-72483")
def test_servers_have_required_metadata(yaml_file):
- '''
+ """
Check all defined nova server instances have the required metadata:
vnf_id and vf_module_id
- '''
+ """
with open(yaml_file) as fh:
yml = yaml.load(fh)
@@ -57,20 +57,24 @@ def test_servers_have_required_metadata(yaml_file):
if "resources" not in yml:
pytest.skip("No resources specified in the heat template")
- required_metadata = ["vnf_id", "vf_module_id", "vnf_name"]
+ required_metadata = {"vnf_id", "vf_module_id", "vnf_name"}
- invalid_nova_servers = []
+ errors = []
for k, v in yml["resources"].items():
if v.get("type") != "OS::Nova::Server":
continue
- if 'properties' not in v:
+ if "properties" not in v:
continue
- if 'metadata' not in v['properties']:
+ if "metadata" not in v["properties"]:
continue
- # do not add the server if it has the required metadata
- if set(required_metadata) <= set(v["properties"]["metadata"].keys()):
- continue
- invalid_nova_servers.append(k)
+ metadata = set(v.get("properties", {}).get("metadata", {}).keys())
+ missing_metadata = required_metadata.difference(metadata)
+ if missing_metadata:
+ msg_template = (
+ "OS::Nova::Server {} is missing the following "
+ + "metadata properties: {}"
+ )
+ errors.append(msg_template.format(k, missing_metadata))
- assert not set(invalid_nova_servers)
+ assert not errors, "\n".join(errors)
diff --git a/ice_validator/tests/test_servers_metadata_use_get_param.py b/ice_validator/tests/test_servers_metadata_use_get_param.py
index f7df880..f569edd 100644
--- a/ice_validator/tests/test_servers_metadata_use_get_param.py
+++ b/ice_validator/tests/test_servers_metadata_use_get_param.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -44,13 +44,11 @@ from tests import cached_yaml as yaml
from .helpers import validates
-@validates('R-97199')
-def test_servers_metadata_use_get_param(yaml_file):
- '''
+def check_servers_metadata_use_get_param(yaml_file, md):
+ """
Check all defined nova server instances include
metadata via the get_param function
- '''
- required_metadata = ["vnf_id", "vf_module_id"]
+ """
with open(yaml_file) as fh:
yml = yaml.load(fh)
@@ -67,11 +65,44 @@ def test_servers_metadata_use_get_param(yaml_file):
if v1["type"] == "OS::Nova::Server":
try:
for k2, v2 in v1["properties"]["metadata"].items():
- if (k2 in required_metadata and not
- v2["get_param"] in required_metadata):
- invalid_nova_servers.append(k1)
+ if k2 == md:
+ if isinstance(v2, dict):
+ metadata = v2.get("get_param")
+ if not metadata:
+ invalid_nova_servers.append(
+ {"server": k1, "metadata": k2}
+ )
+ else:
+ invalid_nova_servers.append({"server": k1, "metadata": k2})
except Exception as e:
print(e)
invalid_nova_servers.append(k1)
- assert not set(invalid_nova_servers)
+ assert (
+ not invalid_nova_servers
+ ), "OS::Nova::Server metadata MUST use get_param {}".format(invalid_nova_servers)
+
+
+@validates("R-37437")
+def test_servers_vnf_id_metadata_use_get_param(yaml_file):
+ check_servers_metadata_use_get_param(yaml_file, "vnf_id")
+
+
+@validates("R-71493")
+def test_servers_vf_module_id_metadata_use_get_param(yaml_file):
+ check_servers_metadata_use_get_param(yaml_file, "vf_module_id")
+
+
+@validates("R-72483")
+def test_servers_vnf_name_metadata_use_get_param(yaml_file):
+ check_servers_metadata_use_get_param(yaml_file, "vnf_name")
+
+
+@validates("R-68023")
+def test_servers_vf_module_name_metadata_use_get_param(yaml_file):
+ check_servers_metadata_use_get_param(yaml_file, "vf_module_name")
+
+
+@validates("R-50816")
+def test_servers_vf_module_index_metadata_use_get_param(yaml_file):
+ check_servers_metadata_use_get_param(yaml_file, "vf_module_index")
diff --git a/ice_validator/tests/fixtures/test_nova_servers_index/fail/fail2.yaml b/ice_validator/tests/test_software_config_resource_id.py
index 3d02a12..d15ed9d 100644
--- a/ice_validator/tests/fixtures/test_nova_servers_index/fail/fail2.yaml
+++ b/ice_validator/tests/test_software_config_resource_id.py
@@ -38,42 +38,47 @@
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-# VERSION = '1.0.0'
-
----
+"""
resources:
- vm_type_a_server_0:
- type: OS::Nova::Server
- properties:
- name: { get_param: [vm_type_a_names, 0] }
- flavor: { get_param: vm_type_a_flavor_name}
- image: { get_param: vm_type_a_image_name}
+{vm-type}_{vm-type_index}_{network-role}_port_{port-index}:
+"""
+
+import pytest
- vm_type_a_sErver_0:
- type: OS::Nova::Server
- properties:
- name: { get_param: [vm_type_a_names, 0] }
- flavor: { get_param: vm_type_a_flavor_name}
- image: { get_param: vm_type_a_image_name}
+from .structures import Heat
+from .helpers import validates
- vm_type_a_server_1:
- type: OS::Nova::Server
- properties:
- name: { get_param: [vm_type_a_names, 1] }
- flavor: { get_param: vm_type_a_flavor_name}
- image: { get_param: vm_type_a_image_name}
+VERSION = "1.1.0"
- vm_type_b_server_0:
- type: OS::Nova::Server
- properties:
- name: { get_param: vm_type_b_name_0 }
- flavor: { get_param: vm_type_b_flavor_name}
- image: { get_param: vm_type_b_image_name}
+# pylint: disable=invalid-name
- vm_type_b_server_1:
- type: OS::Nova::Server
- properties:
- name: { get_param: vm_type_b_name_1 }
- flavor: { get_param: vm_type_b_flavor_name}
- image: { get_param: vm_type_b_image_name}
+@validates("R-08975")
+def test_software_config_vm_type(heat_template):
+ """
+ A VNF's Heat Orchestration Template's Resource OS::Heat::SoftwareConfig
+ Resource ID **MUST** contain the {vm-type}.
+ """
+ heat = Heat(filepath=heat_template)
+ software_configs = heat.get_resource_by_type("OS::Heat::SoftwareConfig")
+ if not software_configs:
+ pytest.skip("No SoftwareConfig resources found")
+ vm_types = sorted(
+ list(
+ set(
+ x
+ for x in [
+ heat.get_vm_type(rid, resource=r)
+ for rid, r in heat.resources.items()
+ ]
+ if x
+ )
+ )
+ )
+ if not vm_types:
+ pytest.skip("No vm_types found")
+ bad = []
+ for rid in software_configs:
+ if not any(heat.part_is_in_name(part=v, name=rid) for v in vm_types):
+ bad.append("%s vm-type not in %s" % (rid, vm_types))
+ assert not bad, "; ".join(bad)
diff --git a/ice_validator/tests/test_subnet_format.py b/ice_validator/tests/test_subnet_format.py
deleted file mode 100644
index bc183ef..0000000
--- a/ice_validator/tests/test_subnet_format.py
+++ /dev/null
@@ -1,127 +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.
-#
-
-import re
-
-import pytest
-from tests import cached_yaml as yaml
-
-from .utils.network_roles import get_network_role_from_port, \
- property_uses_get_resource
-
-
-def test_subnet_format(heat_template):
- '''
- Make sure all subnet properties follow the allowed naming
- conventions
- '''
- formats = [
- ["subnet_id", "string", "internal",
- re.compile(r'int_(.+?)_subnet_id')],
- ["subnet_id", "string", "internal",
- re.compile(r'int_(.+?)_v6_subnet_id')],
- ["subnet_id", "string", "external",
- re.compile(r'(.+?)_subnet_id')],
- ["subnet_id", "string", "external",
- re.compile(r'(.+?)_v6_subnet_id')]]
-
- 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")
-
- invalid_subnets = []
- for v1 in yml["resources"].values():
- if not isinstance(v1, dict):
- continue
- if "properties" not in v1:
- 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
- try:
- network_param = v1["properties"]["network"]["get_param"]
- except KeyError:
- continue
-
- # define the network_type
- network_type = 'external'
- if network_param.startswith('int_'):
- network_type = 'internal'
-
- for k2, v2 in v1["properties"].items():
- if k2 != "fixed_ips":
- continue
-
- for v3 in v2:
- if "subnet_id" not in v3:
- continue
-
- subnet_id = v3["subnet_id"]
- for v4 in formats:
- if v4[2] != network_type:
- continue
-
- # get the param or resource
- if network_type == "external":
- param_or_res = subnet_id["get_param"]
- elif network_type == "internal":
- if subnet_id.get("get_param"):
- param_or_res = subnet_id["get_param"]
- elif subnet_id.get("get_resource"):
- param_or_res = subnet_id["get_resource"]
- else:
- continue
- else:
- continue
-
- m = v4[3].match(param_or_res)
- if m and m.group(1):
- snr = m.group(1)
- if snr.replace("_v6", "") != network_role:
- invalid_subnets.append(param_or_res)
-
- assert not set(invalid_subnets)
diff --git a/ice_validator/tests/test_subnet_format_use_get_param_or_get_resource.py b/ice_validator/tests/test_subnet_format_use_get_param_or_get_resource.py
deleted file mode 100644
index 7487089..0000000
--- a/ice_validator/tests/test_subnet_format_use_get_param_or_get_resource.py
+++ /dev/null
@@ -1,99 +0,0 @@
-# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
-# org.onap.vvp/validation-scripts
-# ===================================================================
-# Copyright © 2018 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 tests import cached_yaml as yaml
-
-
-def test_subnet_format_use_get_param_or_get_resource(heat_template):
- '''
- Make sure all subnet properties only use get_parm
- or get_resource of an internal network
- '''
-
- 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")
-
- invalid_subnets = []
- for v1 in yml["resources"].values():
- if not isinstance(v1, dict):
- continue
- if "properties" not in v1:
- continue
- if v1.get("type") != "OS::Neutron::Port":
- continue
-
- # get the network param to define the network_type
- try:
- network_param = v1["properties"]["network"]["get_param"]
- except KeyError:
- continue
-
- # define the network_type
- network_type = 'external'
- if network_param.startswith('int_'):
- network_type = 'internal'
-
- for k2, v2 in v1["properties"].items():
- if k2 != "fixed_ips":
- continue
-
- for v3 in v2:
- if "subnet_id" not in v3:
- continue
-
- subnet_id = v3["subnet_id"]
-
- # get the param or resource
- if network_type == "external" and\
- subnet_id.get("get_param"):
- continue
- elif network_type == "internal" and\
- (subnet_id.get("get_param") or
- subnet_id.get("get_resource")):
- continue
- else:
- invalid_subnets.append(subnet_id)
-
- assert not set(invalid_subnets)
diff --git a/ice_validator/tests/test_unique_name_resources.py b/ice_validator/tests/test_unique_name_resources.py
deleted file mode 100644
index bb09706..0000000
--- a/ice_validator/tests/test_unique_name_resources.py
+++ /dev/null
@@ -1,110 +0,0 @@
-# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
-# org.onap.vvp/validation-scripts
-# ===================================================================
-# Copyright © 2018 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.
-#
-
-from tests import cached_yaml as yaml
-import pytest
-
-from .helpers import validates
-
-
-@validates('R-40899')
-def test_unique_name_resources(yaml_files):
- '''
- Check that all resource names are unique across all yaml files.
- The specifics of str_replace naming is carried out in a
- different test
- '''
- resource_names = []
-
- params_using_index = {}
-
- for yaml_file in yaml_files:
- with open(yaml_file) as fh:
- yml = yaml.load(fh)
-
- # skip if resources are not defined
- if "resources" not in yml:
- continue
-
- for v1 in yml["resources"].values():
- if not isinstance(v1, dict):
- continue
- if "properties" not in v1:
- continue
-
- try:
- v2 = v1["properties"]["name"]
- except (TypeError, KeyError):
- continue
-
- try:
- param = v2["get_param"]
- except (TypeError, KeyError):
- param = None
-
- if param:
- if isinstance(param, list):
- name = param[0]
- index = param[1]
-
- if (isinstance(index, dict) and
- 'get_param' in index):
- get_param = index['get_param']
-
- if name not in params_using_index:
- params_using_index[name] = get_param
- param = name + get_param
- else:
- continue
- else:
- param = name + str(index)
-
- resource_names.append(param)
- else:
- try:
- template = v2["str_replace"]["yaml_file"]
- resource_names.append(template)
- except (TypeError, KeyError):
- continue
-
- if not resource_names:
- pytest.skip("No resource names could be detected")
-
- assert len(resource_names) == len(set(resource_names))
diff --git a/ice_validator/tests/test_unique_name_str_replace_use_req_params.py b/ice_validator/tests/test_unique_name_str_replace_use_req_params.py
index 45369b4..60a0567 100644
--- a/ice_validator/tests/test_unique_name_str_replace_use_req_params.py
+++ b/ice_validator/tests/test_unique_name_str_replace_use_req_params.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -41,13 +41,16 @@
from tests import cached_yaml as yaml
import pytest
+from tests.helpers import validates
+
+@validates("R-85734")
def test_unique_name_str_replace_use_req_params(yaml_file):
- '''
+ """
Check that all occurences of str_replace uses either vnf_name or
vf_module_id to construct the name
- '''
- req_params = ['vnf_name', 'vf_module_id']
+ """
+ req_params = {"vnf_name"}
with open(yaml_file) as fh:
yml = yaml.load(fh)
@@ -56,28 +59,30 @@ def test_unique_name_str_replace_use_req_params(yaml_file):
if "resources" not in yml:
pytest.skip("No resources specified in the heat template")
- has_req_params = []
- for v1 in yml["resources"].values():
+ missing_req_params = []
+ for r_id, v1 in yml["resources"].items():
if not isinstance(v1, dict):
continue
if "properties" not in v1:
continue
- if v1["type"] in ["OS::Nova::Server", "OS::Neutron::Port",
- "OS::Heat::ResourceGroup"]:
+ if v1["type"] in ["OS::Nova::Server"]:
continue
try:
v2 = v1["properties"]["name"]
str_replace = v2["str_replace"]
- all_params = []
+ all_params = set()
for v3 in str_replace["params"].values():
- all_params.append(v3["get_param"])
- detected_params = set(all_params) & set(req_params)
- has_req_params.append(len(detected_params) > 0)
+ all_params.add(v3["get_param"])
+ if req_params.difference(all_params):
+ msg = (
+ "Resource({}) does not use str_replace "
+ "and the vnf_name parameter to set "
+ "the name property"
+ ).format(r_id)
+ missing_req_params.append(msg)
except (TypeError, KeyError):
continue
- if not has_req_params:
- pytest.skip("No str_replace instances were detected")
- assert all(c for c in has_req_params)
+ assert not missing_req_params, ", ".join(missing_req_params)
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 f6a5f3a..f85ec57 100644
--- a/ice_validator/tests/test_unique_resources_across_all_templates.py
+++ b/ice_validator/tests/test_unique_resources_across_all_templates.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -39,28 +39,34 @@
#
import collections
+import os
from tests import cached_yaml as yaml
from .helpers import validates
-@validates('R-16447')
+@validates("R-16447")
def test_unique_resources_across_all_yaml_files(yaml_files):
- '''
+ """
Check that all instance names are unique
across all yaml files.
- '''
- resources_ids = []
+ """
+ resources_ids = collections.defaultdict(set)
for yaml_file in yaml_files:
with open(yaml_file) as fh:
yml = yaml.load(fh)
- if 'resources' not in yml:
+ if "resources" not in yml:
continue
- resources_ids.extend(yml['resources'].keys())
+ for resource_id in yml["resources"]:
+ resources_ids[resource_id].add(os.path.split(yaml_file)[1])
- dup_ids = [item
- for item, count in collections.Counter(resources_ids).items()
- if count > 1]
+ dup_ids = {r_id: files for r_id, files in resources_ids.items() if len(files) > 1}
- assert not dup_ids
+ msg = "The following resource IDs are duplicated in one or more files: "
+ errors = [
+ "ID ({}) appears in {}.".format(r_id, ", ".join(files))
+ for r_id, files in dup_ids.items()
+ ]
+ msg += ", ".join(errors)
+ assert not dup_ids, msg
diff --git a/ice_validator/tests/test_vm_type_case.py b/ice_validator/tests/test_vm_type_case.py
new file mode 100644
index 0000000..a7dbdaf
--- /dev/null
+++ b/ice_validator/tests/test_vm_type_case.py
@@ -0,0 +1,129 @@
+# -*- 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:
+{vm-type}_{vm-type_index}_{network-role}_port_{port-index}:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: ...}
+ fixed_ips: [ { "ipaddress": { get_param: ... } } ]
+ binding:vnic_type: direct #only SR-IOV ports, not OVS ports
+ value_specs: {
+ vlan_filter: { get_param: ... }, #all NC ports
+ public_vlans: { get_param: ... }, #all NC ports
+ private_vlans: { get_param: ... },#all NC ports
+ guest_vlans: { get_param: ... }, #SR-IOV Trunk Port only
+ vlan_mirror: { get_param: ... }, #SRIOV Trunk Port
+ # Receiving Mirrored Traffic only
+ ATT_FABRIC_CONFIGURATION_REQUIRED: true #all NC ports
+ }
+ metadata:
+ port_type: SR-IOV_Trunk #SR-IOV Trunk Port
+ port_type: SR-IOV_Non_Trunk #SR-IOV Non Trunk Port
+ port_type: OVS #OVS Port
+ port_type: SR-IOV_Mirrored_Trunk #SR-IOV Trunk Port
+ # Receiving Mirrored Traffic
+"""
+
+import collections
+import re
+
+import pytest
+
+from .structures import Heat
+from .helpers import validates
+
+VERSION = "1.2.0"
+
+
+def case_mismatch(vm_type, param):
+ """Return True if vm_type matches a portion of param in a case
+ insensitive search, but does not equal that portion;
+ return False otherwise.
+ The "portions" of param are delimited by "_".
+ """
+ re_portion = re.compile(
+ "(^(%(x)s)_)|(_(%(x)s)_)|(_(%(x)s)$)" % dict(x=vm_type), re.IGNORECASE
+ )
+ found = re_portion.search(param)
+ if found:
+ param_vm_type = [x for x in found.groups()[1::2] if x][0]
+ return param_vm_type != vm_type
+ else:
+ return False
+
+
+# pylint: disable=invalid-name
+
+
+@validates("R-32394")
+def test_vm_type_case(heat_template):
+ """
+ A VNF's Heat Orchestration Template's use of ``{vm-type}`` in all Resource
+ property parameter names **MUST** be the same case.
+ """
+ heat = Heat(filepath=heat_template)
+ resources = heat.resources
+ if not resources:
+ pytest.skip("No resources found")
+ bad = collections.defaultdict(list)
+ for rid, resource in resources.items():
+ vm_type = heat.get_vm_type(rid, resource=resource)
+ if vm_type:
+ properties = resource.get("properties")
+ if isinstance(properties, dict):
+ for prop, dic in properties.items():
+ param = heat.nested_get(dic, "get_param")
+ if isinstance(param, list):
+ param = param[0]
+ if isinstance(param, str) and case_mismatch(vm_type, param):
+ bad[(rid, vm_type)].append((prop, param))
+ if bad:
+ raise AssertionError(
+ "vm-type/parameter case mis-match %s"
+ % (
+ "; ".join(
+ "resource: %s vm-type: %s %s"
+ % (k[0], k[1], ", ".join("%s: %s" % i for i in v))
+ for k, v in bad.items()
+ )
+ )
+ )
diff --git a/ice_validator/tests/test_vm_type_resource_id.py b/ice_validator/tests/test_vm_type_resource_id.py
index beb6745..2a0150c 100644
--- a/ice_validator/tests/test_vm_type_resource_id.py
+++ b/ice_validator/tests/test_vm_type_resource_id.py
@@ -38,8 +38,8 @@
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-'''vm-type resource_id
-'''
+"""vm-type resource_id
+"""
import pytest
@@ -47,29 +47,28 @@ from .structures import Heat
from .helpers import validates
from .utils import vm_types as utils_vm_types
-VERSION = '1.1.0'
+VERSION = "1.1.0"
-@validates('R-46839')
+@validates("R-46839")
def test_vm_type_resource_id(heat_template):
- '''
+ """
A VNF's Heat Orchestration Template's use of ``{vm-type}``
in all Resource IDs **MUST** be the same case.
- '''
+ """
bad = {}
h = Heat(filepath=heat_template)
if not h.resources:
pytest.skip("No resources specified in the heat template")
- vm_types = {v + '_': v.lower() + '_'
- for v in utils_vm_types.get_vm_types(h.resources)}
+ vm_types = {
+ v + "_": v.lower() + "_" for v in utils_vm_types.get_vm_types(h.resources)
+ }
if not vm_types:
pytest.skip("No {vm-type} specified in the heat template")
for rid in h.resources:
lower_rid = rid.lower()
for vm_type, lower_vm_type in vm_types.items():
- if (lower_rid.startswith(lower_vm_type)
- and not rid.startswith(vm_type)):
- bad[rid] = vm_type
- assert not bad, 'resource_id which do not match their vm-type %s' % bad
-
+ if lower_rid.startswith(lower_vm_type) and not rid.startswith(vm_type):
+ bad[rid] = vm_type
+ assert not bad, "resource_id which do not match their vm-type %s" % bad
diff --git a/ice_validator/tests/test_vm_type_syntax.py b/ice_validator/tests/test_vm_type_syntax.py
index b2455c2..0a096b1 100644
--- a/ice_validator/tests/test_vm_type_syntax.py
+++ b/ice_validator/tests/test_vm_type_syntax.py
@@ -38,8 +38,8 @@
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-'''vm-type syntax
-'''
+"""vm-type syntax
+"""
import re
@@ -49,27 +49,25 @@ from .structures import Heat
from .helpers import validates
from .utils import vm_types
-VERSION = '1.0.0'
+VERSION = "1.0.0"
-RE_VM_TYPE = re.compile(r'[\w\d_]+$')
-RE_VM_TYPE_NG = re.compile(r'.*_int|_?int_.*$')
+RE_VM_TYPE = re.compile(r"[\w\d_]+$")
+RE_VM_TYPE_NG = re.compile(r".*_int|_?int_.*$")
-@validates('R-98407')
+@validates("R-98407")
def test_vm_type_syntax(heat_template):
- '''
+ """
A VNF's Heat Orchestration Template's ``{vm-type}``
**MUST** contain only
alphanumeric characters and/or underscores '_' and **MUST NOT**
contain any of the following strings:
``_int`` or ``int_`` or ``_int_``.
- '''
+ """
v = Heat(filepath=heat_template)
if not v.resources:
pytest.skip("No resources")
t = set()
- t.update(*[vm_types.get_vm_types_for_resource(r)
- for r in v.resources.values()])
+ t.update(*[vm_types.get_vm_types_for_resource(r) for r in v.resources.values()])
bad = [x for x in t if not RE_VM_TYPE.match(x) or RE_VM_TYPE_NG.match(x)]
- assert not bad, 'bad vm-types %s' % bad
-
+ assert not bad, "bad vm-types %s" % bad
diff --git a/ice_validator/tests/test_volume_module_naming.py b/ice_validator/tests/test_volume_module_naming.py
new file mode 100644
index 0000000..770ad26
--- /dev/null
+++ b/ice_validator/tests/test_volume_module_naming.py
@@ -0,0 +1,79 @@
+# -*- coding: utf8 -*-
+# ============LICENSE_START=======================================================
+# org.onap.vvp/validation-scripts
+# ===================================================================
+# Copyright © 2018 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============================================
+import os
+
+from tests.parametrizers import get_nested_files
+from tests.structures import Heat, Resource
+
+
+def non_nested_files(filenames):
+ nested_files = get_nested_files(filenames)
+ return set(filenames).difference(set(nested_files))
+
+
+# No requirement ID yet available
+def test_detected_volume_module_follows_naming_convention(template_dir):
+ all_files = [os.path.join(template_dir, f) for f in os.listdir(template_dir)]
+ yaml_files = [f for f in all_files if f.endswith(".yaml") or f.endswith(".yml")]
+ errors = []
+ for yaml_file in non_nested_files(yaml_files):
+ heat = Heat(filepath=yaml_file)
+ if not heat.resources:
+ continue
+ base_dir, filename = os.path.split(yaml_file)
+ resources = heat.get_all_resources(base_dir)
+ non_nested_ids = {
+ r_id
+ for r_id, r_data in resources.items()
+ if not Resource(r_id, r_data).is_nested()
+ }
+ volume_ids = {
+ r_id
+ for r_id, r_data in resources.items()
+ if Resource(r_id, r_data).resource_type == "OS::Cinder::Volume"
+ }
+ non_volume_ids = non_nested_ids.difference(volume_ids)
+ if non_volume_ids:
+ continue # Not a volume module
+ base_name, ext = os.path.splitext(filename)
+ if not base_name.endswith("_volume") or ext not in (".yaml", ".yml"):
+ errors.append(yaml_file)
+ msg = (
+ "Volume modules detected, but they do not follow the expected "
+ + " naming convention {{module_name}}_volume.[yaml|yml]: {}"
+ ).format(", ".join(errors))
+ assert not errors, msg
diff --git a/ice_validator/tests/test_volume_outputs_consumed.py b/ice_validator/tests/test_volume_outputs_consumed.py
index 575e5dc..cad1e7e 100644
--- a/ice_validator/tests/test_volume_outputs_consumed.py
+++ b/ice_validator/tests/test_volume_outputs_consumed.py
@@ -46,20 +46,36 @@ from tests import cached_yaml as yaml
from .helpers import validates
-def expected_template_module_pair(volume_path):
- """Returns the path to the expected base or incremental module for a given volume"""
- base_dir, filename = os.path.split(volume_path)
- return os.path.join(base_dir, filename.replace("_volume", ""))
+class VolumePairModule:
+ def __init__(self, volume_path):
+ self.volume_path = volume_path
+
+ @property
+ def path_options(self):
+ expected_path, _ = self.volume_path.rsplit("_volume", maxsplit=1)
+ return (expected_path + ".yaml", expected_path + ".yml")
+
+ @property
+ def exists(self):
+ return any(os.path.exists(option) for option in self.path_options)
+
+ def get_module_path(self):
+ """
+ Return the path of the volume module's pair if it exists,
+ otherwise None
+ """
+ for option in self.path_options:
+ if os.path.exists(option):
+ return option
+ return None
@validates("R-82732")
def test_volume_module_name_matches_incremental_or_base_module(volume_template):
- expected_template_name = expected_template_module_pair(volume_template)
- assert os.path.exists(
- expected_template_name
- ), "Could not find corresponding module ({}) for volume module ({}".format(
- expected_template_name, volume_template
- )
+ pair_module = VolumePairModule(volume_template)
+ assert pair_module.exists, (
+ "Could not find a corresponding module ({}) for " + "volume module ({})"
+ ).format(" or ".join(pair_module.path_options), volume_template)
@validates("R-11200", "R-07443")
@@ -68,15 +84,12 @@ def test_volume_outputs_consumed(template_dir, volume_template):
Check that all outputs in a volume template is consumed
by the corresponding heat template
"""
- pair_template = expected_template_module_pair(volume_template)
-
- # Make sure all the output parameters in the volume module are
- # consumed by the expected base or incremental module
- if not os.path.exists(pair_template):
- pytest.skip("Expected pair module not found")
+ pair_module = VolumePairModule(volume_template)
+ if not pair_module.exists:
+ pytest.skip("No pair module found for volume template")
with open(volume_template, "r") as f:
volume = yaml.load(f)
- with open(pair_template, "r") as f:
+ with open(pair_module.get_module_path(), "r") as f:
pair = yaml.load(f)
outputs = set(volume.get("outputs", {}).keys())
parameters = set(pair.get("parameters", {}).keys())
@@ -84,16 +97,16 @@ def test_volume_outputs_consumed(template_dir, volume_template):
assert not missing_output_parameters, (
"The output parameters ({}) in {} were not all "
"used by the expected module {}".format(
- ",".join(missing_output_parameters), volume_template, pair_template
+ ",".join(missing_output_parameters), volume_template, pair_module
)
)
# Now make sure that none of the output parameters appear in any other
# template
- template_files = set(glob.glob("*.yaml"))
+ template_files = set(glob.glob("*.yaml")).union(glob.glob(".yml"))
errors = {}
for template_path in template_files:
- if template_path in (pair_template, volume_template):
+ if template_path in (pair_module, volume_template):
continue # Skip these files since we already checked this pair
with open(template_path, "r") as f:
template = yaml.load(f)
@@ -104,5 +117,6 @@ def test_volume_outputs_consumed(template_dir, volume_template):
message = ", ".join(
"{} ({})".format(path, ", ".join(params)) for path, params in errors.items()
)
- assert not errors, "Volume output parameters detected in unexpected modules: " + \
- message
+ assert not errors, (
+ "Volume output parameters detected in unexpected modules: " + message
+ )
diff --git a/ice_validator/tests/test_volume_resource_ids.py b/ice_validator/tests/test_volume_resource_ids.py
index 9f0d176..dc5ed7d 100644
--- a/ice_validator/tests/test_volume_resource_ids.py
+++ b/ice_validator/tests/test_volume_resource_ids.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -47,11 +47,11 @@ from .utils.vm_types import get_vm_type_for_nova_server
def test_volume_resource_ids(heat_template):
- '''
+ """
Check that all resource ids for cinder volumes follow the right
naming convention to include the {vm_type} of the
nova server it is associated to
- '''
+ """
with open(heat_template) as fh:
yml = yaml.load(fh)
@@ -59,25 +59,24 @@ def test_volume_resource_ids(heat_template):
if "resources" not in yml:
pytest.skip("No resources specified in the heat template")
- volume_pattern = re.compile(r'(.+?)_volume_id_\d+')
- resources = yml['resources']
+ volume_pattern = re.compile(r"(.+?)_volume_id_\d+")
+ resources = yml["resources"]
invalid_volumes = []
for k, v in resources.items():
if not isinstance(v, dict):
continue
- if 'type' not in v:
+ if "type" not in v:
continue
- if v['type'] not in ['OS::Nova::Server',
- 'OS::Cinder::VolumeAttachment']:
+ if v["type"] not in ["OS::Nova::Server", "OS::Cinder::VolumeAttachment"]:
continue
- if v['type'] == 'OS::Nova::Server':
+ if v["type"] == "OS::Nova::Server":
# check block_device_mapping and make sure the right
# {vm_type} is used
- if 'properties' not in v:
+ if "properties" not in v:
continue
- if 'block_device_mapping' not in v['properties']:
+ if "block_device_mapping" not in v["properties"]:
continue
vm_type = get_vm_type_for_nova_server(v)
@@ -86,17 +85,15 @@ def test_volume_resource_ids(heat_template):
vm_type = vm_type.lower()
# get the volume_id from the block_device_mapping
- properties = v['properties']
- for v2 in properties['block_device_mapping']:
+ properties = v["properties"]
+ for v2 in properties["block_device_mapping"]:
for k3, v3 in v2.items():
- if k3 != 'volume_id':
+ if k3 != "volume_id":
continue
if not isinstance(v3, dict):
continue
- volume_id = (
- v3.get('get_param') or
- v3.get('get_resource'))
+ volume_id = v3.get("get_param") or v3.get("get_resource")
if not volume_id:
continue
if isinstance(volume_id, list):
@@ -107,27 +104,27 @@ def test_volume_resource_ids(heat_template):
if vm_type + "_" not in volume_id:
invalid_volumes.append(volume_id)
- elif v['type'] == 'OS::Cinder::VolumeAttachment':
+ elif v["type"] == "OS::Cinder::VolumeAttachment":
# check the volume attachment and the {vm_type}
# of the corresponding nova server
- if 'properties' not in v:
+ if "properties" not in v:
continue
- if 'volume_id' not in v['properties']:
+ if "volume_id" not in v["properties"]:
continue
- if 'instance_uuid' not in v['properties']:
+ if "instance_uuid" not in v["properties"]:
continue
- properties = v['properties']
+ properties = v["properties"]
# get the instance_uuid and when applicable
# the nova server instance
instance_uuid = None
nova_server = None
- if 'get_param' in properties['instance_uuid']:
+ if "get_param" in properties["instance_uuid"]:
continue
- elif 'get_resource' in properties['instance_uuid']:
- instance_uuid = properties['instance_uuid']['get_resource']
+ elif "get_resource" in properties["instance_uuid"]:
+ instance_uuid = properties["instance_uuid"]["get_resource"]
if not resources[instance_uuid]:
continue
nova_server = resources[instance_uuid]
@@ -137,9 +134,9 @@ def test_volume_resource_ids(heat_template):
# get the volume_id
volume_id = None
- volume_id = (
- properties['volume_id'].get('get_param') or
- properties['volume_id'].get('get_resource'))
+ volume_id = properties["volume_id"].get("get_param") or properties[
+ "volume_id"
+ ].get("get_resource")
if not volume_id:
continue
if isinstance(volume_id, list):
@@ -169,4 +166,7 @@ def test_volume_resource_ids(heat_template):
else:
continue
- assert not set(invalid_volumes)
+ msg = "The following volumes have invalid resource IDs: {}".format(
+ ", ".join(invalid_volumes)
+ )
+ assert not set(invalid_volumes), msg
diff --git a/ice_validator/tests/test_volume_templates.py b/ice_validator/tests/test_volume_templates.py
index 6d2a44c..bb358d5 100644
--- a/ice_validator/tests/test_volume_templates.py
+++ b/ice_validator/tests/test_volume_templates.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -37,16 +37,23 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-
from tests import cached_yaml as yaml
+
+from .helpers import validates
+from .utils.nested_files import get_list_of_nested_files
+
+import os
import pytest
-def test_volume_templates_only_contains_cinder(volume_template):
- '''
+@validates("R-270358")
+def test_volume_templates_contains_cinder_or_resource_group(volume_template):
+ """
Check that all templates marked as volume templates are
in fact volume templates
- '''
+ """
+ acceptable_resources = []
+
with open(volume_template) as fh:
yml = yaml.load(fh)
@@ -54,14 +61,43 @@ def test_volume_templates_only_contains_cinder(volume_template):
if "resources" not in yml:
pytest.skip("No resources specified in the heat template")
- non_volumes = []
- for k, v in yml["resources"].items():
- if not isinstance(v, dict):
- continue
- if "type" not in v:
- continue
- if v["type"] not in ["OS::Cinder::Volume",
- "OS::Heat::ResourceGroup"]:
- non_volumes.append(k)
-
- assert not set(non_volumes)
+ dirname = os.path.dirname(volume_template)
+ list_of_files = get_list_of_nested_files(yml, dirname)
+
+ list_of_files.append(volume_template)
+
+ for file in list_of_files:
+ with open(file) as fh:
+ yml = yaml.load(fh)
+
+ for k, v in yml["resources"].items():
+ if not isinstance(v, dict):
+ continue
+ if "type" not in v:
+ continue
+ if v["type"] in ["OS::Cinder::Volume", "OS::Heat::ResourceGroup"]:
+ acceptable_resources.append(k)
+
+ assert acceptable_resources, (
+ "No OS::Cinder::Volume or OS::Heat::ResourceGroup resources "
+ "found in volume module"
+ )
+
+
+@validates("R-55306")
+def test_no_vf_module_index_in_cinder(volume_template):
+ """
+ vf_module_index is prohibited in volume templates
+ """
+
+ with open(volume_template) as fh:
+ yml = yaml.load(fh)
+
+ if "parameters" not in yml:
+ pytest.skip("No parameters specified in the heat template")
+
+ parameters = yml.get("parameters")
+ if parameters and isinstance(parameters, dict):
+ assert (
+ "vf_module_index" not in parameters
+ ), "{} must not use vf_module_index as a parameter".format(volume_template)
diff --git a/ice_validator/tests/test_volume_templates_outputs.py b/ice_validator/tests/test_volume_templates_outputs.py
index 1a779c6..19fd1e9 100644
--- a/ice_validator/tests/test_volume_templates_outputs.py
+++ b/ice_validator/tests/test_volume_templates_outputs.py
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.vvp/validation-scripts
# ===================================================================
-# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
@@ -37,14 +37,51 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
+import pytest
from tests import cached_yaml as yaml
+from .helpers import validates
+@validates("R-89913")
def test_volume_templates_contains_outputs(volume_template):
- '''
+ """
Check that all volume templates include outputs
- '''
+ """
with open(volume_template) as fh:
yml = yaml.load(fh)
- assert "outputs" in yml
+
+ resources = yml.get("resources")
+ volume_resources = []
+ invalid_resource_ids = []
+ output_resources = []
+
+ if not resources:
+ pytest.skip("No resources detected in template")
+
+ for rid, rprop in resources.items():
+ rtype = rprop.get("type")
+ if not rtype:
+ continue
+ if rtype == "OS::Cinder::Volume":
+ volume_resources.append(rid)
+
+ outputs = yml.get("outputs")
+ if not outputs:
+ pytest.fail("No outputs detected in volume template")
+
+ for k1, v1 in outputs.items():
+ output_value = v1.get("value", {}).get("get_resource")
+ if not output_value:
+ continue
+ output_resources.append(output_value)
+
+ for rid in volume_resources:
+ if rid not in output_resources:
+ invalid_resource_ids.append(rid)
+
+ assert (
+ not invalid_resource_ids
+ ), "volumes resource IDs not found in outputs of volume module {}".format(
+ invalid_resource_ids
+ )
diff --git a/ice_validator/tests/utils/nested_dict.py b/ice_validator/tests/utils/nested_dict.py
index 24f7e5e..692ef5f 100644
--- a/ice_validator/tests/utils/nested_dict.py
+++ b/ice_validator/tests/utils/nested_dict.py
@@ -38,28 +38,30 @@
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
-'''nested_dict.get
-'''
+"""nested_dict.get
+"""
-VERSION = '1.0.0'
+VERSION = "1.1.1"
-def get(dic, *keys):
- '''Return the value of the last key given a (nested) dict
- and list of keys. If any key is missing, or if the value
- of any key except the last is not a dict, then None is returned.
- '''
+def get(dic, *keys, **kwargs):
+ """Return the value of the last key given a (nested) dict and
+ list of keys. If any key is missing, or if the value of any key
+ except the last is not a dict, then the default value is returned.
+ The default value may be passed in using the keyword 'default=',
+ otherwise the default value is None.
+ """
d = dic
+ default = kwargs.get("default", None)
for key in keys:
- if hasattr(d, 'get'):
- d = d.get(key)
+ if hasattr(d, "get"):
+ d = d.get(key, default)
else:
- return None
+ return default
return d
def is_dict_has_key(obj, key):
- '''return True/False `obj` is a dict and has `key`
- '''
+ """return True/False `obj` is a dict and has `key`
+ """
return isinstance(obj, dict) and key in obj
-
diff --git a/ice_validator/tests/utils/nested_files.py b/ice_validator/tests/utils/nested_files.py
index c551646..aff5a6b 100644
--- a/ice_validator/tests/utils/nested_files.py
+++ b/ice_validator/tests/utils/nested_files.py
@@ -44,16 +44,77 @@
from os import path
import re
from tests import cached_yaml as yaml
+from tests.structures import Heat
-VERSION = '1.0.2'
+VERSION = "1.4.0"
+
+"""
+test nesting depth
+0 -> 1 -> 2 -> too deep.
+"""
+MAX_DEPTH = 3
+
+
+def check_for_invalid_nesting( # pylint: disable=too-many-branches
+ yml, yaml_file, dirpath
+):
+ """
+ return a list of all nested files
+ """
+ if not hasattr(yml, "items"):
+ return []
+ invalid_nesting = []
+ p = re.compile("^[A-z]*::[A-z]*::[A-z]*$")
+
+ for v in yml.values():
+ if isinstance(v, dict) and "type" in v:
+ t = v["type"]
+ if t.endswith(".yml") or t.endswith(".yaml"):
+ filepath = path.join(dirpath, t)
+ elif t == "OS::Heat::ResourceGroup":
+ rd = v["properties"]["resource_def"]
+ if not isinstance(rd, dict) or "type" not in rd:
+ invalid_nesting.append(yaml_file)
+ continue
+ elif not p.match(rd["type"]):
+ filepath = path.join(dirpath, rd["type"])
+ else:
+ continue
+ else:
+ continue
+ try:
+ with open(filepath) as fh:
+ yml = yaml.load(fh)
+ except yaml.YAMLError as e:
+ invalid_nesting.append(filepath)
+ print(e) # pylint: disable=superfluous-parens
+ invalid_nesting.extend(check_for_invalid_nesting(yml, filepath, dirpath))
+ if isinstance(v, dict):
+ invalid_nesting.extend(check_for_invalid_nesting(v, yaml_file, dirpath))
+ elif isinstance(v, list):
+ for d in v:
+ invalid_nesting.extend(check_for_invalid_nesting(d, yaml_file, dirpath))
+ return invalid_nesting
+
+
+def get_dict_of_nested_files(yml, dirpath):
+ """Return dict.
+ key: resource id in yml which references a nested file.
+ value: the nested file name.
+ Nested files are either referenced through "type", or
+ for OS::Heat::ResourceGroup, through "resource_def type".
+ """
+ nested_files = get_type_nested_files(yml, dirpath)
+ nested_files.update(get_resourcegroup_nested_files(yml, dirpath))
+ return nested_files
def get_list_of_nested_files(yml, dirpath):
- '''
+ """
return a list of all nested files
- '''
+ """
- if not hasattr(yml, 'items'):
+ if not hasattr(yml, "items"):
return []
nested_files = []
@@ -69,72 +130,132 @@ def get_list_of_nested_files(yml, dirpath):
nested_files.append(filepath)
nested_files.extend(get_list_of_nested_files(t_yml, dirpath))
elif t == "OS::Heat::ResourceGroup":
- rdt = (v.get("properties", {})
- .get("resource_def", {})
- .get("type", None))
+ rdt = v.get("properties", {}).get("resource_def", {}).get("type", None)
if rdt and (rdt.endswith(".yml") or rdt.endswith(".yaml")):
filepath = path.join(dirpath, rdt)
if path.exists(filepath):
with open(filepath) as fh:
rdt_yml = yaml.load(fh)
nested_files.append(filepath)
- nested_files.extend(
- get_list_of_nested_files(rdt_yml, dirpath))
+ nested_files.extend(get_list_of_nested_files(rdt_yml, dirpath))
if isinstance(v, dict):
- nested_files.extend(
- get_list_of_nested_files(v, dirpath))
+ nested_files.extend(get_list_of_nested_files(v, dirpath))
elif isinstance(v, list):
for d in v:
- nested_files.extend(
- get_list_of_nested_files(d, dirpath))
+ nested_files.extend(get_list_of_nested_files(d, dirpath))
return nested_files
-def check_for_invalid_nesting(yml, yaml_file, dirpath):
- '''
- return a list of all nested files
- '''
- if not hasattr(yml, 'items'):
- return []
- invalid_nesting = []
- p = re.compile('^[A-z]*::[A-z]*::[A-z]*$')
+def get_nesting(yaml_files):
+ """return bad, files, heat, depths
+ bad - list of error messages.
+ files - dict: key is filename, value is dict of nested files.
+ This is the tree.
+ heat - dict,: key is filename, value is Heat instance.
+ depths - dict: key is filename, value is a depth tuple
- for v in yml.values():
- if isinstance(v, dict) and "type" in v:
- t = v["type"]
- if t.endswith(".yml") or t.endswith(".yaml"):
- filepath = path.join(dirpath, t)
- elif t == "OS::Heat::ResourceGroup":
- rd = v["properties"]["resource_def"]
- if not isinstance(rd, dict) or "type" not in rd:
- invalid_nesting.append(yaml_file)
- continue
- elif not p.match(rd["type"]):
- filepath = path.join(dirpath, rd["type"])
- else:
- continue
- else:
- continue
- try:
- with open(filepath) as fh:
- yml = yaml.load(fh)
- except yaml.YAMLError as e:
- invalid_nesting.append(filepath)
- print(e) # pylint: disable=superfluous-parens
- invalid_nesting.extend(check_for_invalid_nesting(
- yml,
- filepath,
- dirpath))
- if isinstance(v, dict):
- invalid_nesting.extend(check_for_invalid_nesting(
- v,
- yaml_file,
- dirpath))
- elif isinstance(v, list):
- for d in v:
- invalid_nesting.extend(check_for_invalid_nesting(
- d,
- yaml_file,
- dirpath))
- return invalid_nesting
+ level: 0 1 2 3
+ file: template -> nested -> nested -> nested
+ depth: 3 2 1 0
+ """
+ bad = []
+ files = {}
+ heat = {}
+ depths = {}
+ for yaml_file in yaml_files:
+ dirname, basename = path.split(yaml_file)
+ h = Heat(filepath=yaml_file)
+ heat[basename] = h
+ files[basename] = get_dict_of_nested_files(h.yml, dirname)
+ for filename in files:
+ depths[filename] = _get_nesting_depth_start(0, filename, files, [])
+ for depth in depths[filename]:
+ if depth[0] > MAX_DEPTH:
+ bad.append("{} {}".format(filename, str(depth[1])))
+ return bad, files, heat, depths
+
+
+def _get_nesting_depth_start(depth, filename, files, context):
+ depths = []
+ for rid, nf in files[filename].items():
+ depths.append(_get_nesting_depth(1, nf, files, context))
+ return depths
+
+
+def _get_nesting_depth(depth, filename, files, context):
+ """Return a depth tuple (max_depth, current_context).
+ `context` is the list of filenames.
+ `depth` is the length of `context`.
+ Finds the max_depth of all the resources of `filename`.
+ current_context is the updated list of filenames
+ and max_depth is its length.
+ """
+ max_depth = depth + 1
+ current_context = context + [filename]
+ if depth <= MAX_DEPTH:
+ nested_filenames = files.get(filename, {})
+ if nested_filenames:
+ max_depth, current_context = max(
+ _get_nesting_depth(depth + 1, nested_filename, files, current_context)
+ for nested_filename in nested_filenames.values()
+ )
+ return max_depth, current_context
+
+def get_resourcegroup_nested_files(yml, dirpath):
+ """
+ return a dict.
+ key: key in yml which references a nested ResourceGroup file.
+ (resource->type is ResourceGroup
+ and resource->properties->resource_def->type is a yaml file)
+ value: the nested file name.
+
+ The keys are assumed to be unique across files.
+ A separate test checks for that.
+ """
+
+ if not hasattr(yml, "get"):
+ return {}
+
+ nested_files = {}
+ for rid, r in yml.get("resources", {}).items():
+ if isinstance(r, dict) and "type" in r:
+ t = r["type"]
+ nested_file = None
+ if t == "OS::Heat::ResourceGroup":
+ rdt = r.get("properties", {}).get("resource_def", {}).get("type", None)
+ if rdt and (rdt.endswith(".yml") or rdt.endswith(".yaml")):
+ nested_file = rdt
+ if nested_file:
+ filepath = path.join(dirpath, nested_file)
+ if path.exists(filepath):
+ nested_files[rid] = nested_file
+ return nested_files
+
+
+def get_type_nested_files(yml, dirpath):
+ """
+ return a dict.
+ key: key in yml which references a nested type file.
+ (the resource "type" is a yaml file.)
+ value: the nested file name.
+
+ The keys are assumed to be unique across files.
+ A separate test checks for that.
+ """
+
+ if not hasattr(yml, "get"):
+ return {}
+
+ nested_files = {}
+ for rid, r in yml.get("resources", {}).items():
+ if isinstance(r, dict) and "type" in r:
+ t = r["type"]
+ nested_file = None
+ if t.endswith(".yml") or t.endswith(".yaml"):
+ nested_file = t
+ if nested_file:
+ filepath = path.join(dirpath, nested_file)
+ if path.exists(filepath):
+ nested_files[rid] = nested_file
+ return nested_files
diff --git a/ice_validator/tests/utils/nested_iterables.py b/ice_validator/tests/utils/nested_iterables.py
index b6deaba..0768339 100644
--- a/ice_validator/tests/utils/nested_iterables.py
+++ b/ice_validator/tests/utils/nested_iterables.py
@@ -40,10 +40,10 @@
def parse_nested_dict(d, key=""):
- '''
+ """
parse the nested dictionary and return values of
given key of function parameter only
- '''
+ """
nested_elements = []
for k, v in d.items():
if isinstance(v, dict):
@@ -60,29 +60,27 @@ def parse_nested_dict(d, key=""):
def find_all_get_param_in_yml(yml):
- '''
+ """
Recursively find all referenced parameters in a parsed yaml body
and return a list of parameters
- '''
- os_pseudo_parameters = ['OS::stack_name',
- 'OS::stack_id',
- 'OS::project_id']
+ """
+ os_pseudo_parameters = ["OS::stack_name", "OS::stack_id", "OS::project_id"]
- if not hasattr(yml, 'items'):
+ if not hasattr(yml, "items"):
return []
params = []
for k, v in yml.items():
- if k == 'get_param' and v not in os_pseudo_parameters:
+ 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]):
+ for item in v if isinstance(v, list) else [v]:
if isinstance(item, dict):
params.extend(find_all_get_param_in_yml(item))
continue
- elif k == 'list_join':
- for item in (v if isinstance(v, list) else [v]):
+ elif k == "list_join":
+ for item in v if isinstance(v, list) else [v]:
if isinstance(item, list):
for d in item:
params.extend(find_all_get_param_in_yml(d))
@@ -96,15 +94,15 @@ def find_all_get_param_in_yml(yml):
def find_all_get_resource_in_yml(yml):
- '''
+ """
Recursively find all referenced resources
in a parsed yaml body and return a list of resource ids
- '''
- if not hasattr(yml, 'items'):
+ """
+ if not hasattr(yml, "items"):
return []
resources = []
for k, v in yml.items():
- if k == 'get_resource':
+ if k == "get_resource":
if isinstance(v, list):
resources.append(v[0])
else:
@@ -119,15 +117,15 @@ def find_all_get_resource_in_yml(yml):
def find_all_get_file_in_yml(yml):
- '''
+ """
Recursively find all get_file in a parsed yaml body
and return the list of referenced files/urls
- '''
- if not hasattr(yml, 'items'):
+ """
+ if not hasattr(yml, "items"):
return []
resources = []
for k, v in yml.items():
- if k == 'get_file':
+ if k == "get_file":
if isinstance(v, list):
resources.append(v[0])
else:
@@ -142,37 +140,35 @@ def find_all_get_file_in_yml(yml):
def find_all_get_resource_in_resource(resource):
- '''
+ """
Recursively find all referenced resources
in a heat resource and return a list of resource ids
- '''
- if not hasattr(resource, 'items'):
+ """
+ if not hasattr(resource, "items"):
return []
resources = []
for k, v in resource.items():
- if k == 'get_resource':
+ if k == "get_resource":
if isinstance(v, list):
resources.append(v[0])
else:
resources.append(v)
continue
if isinstance(v, dict):
- resources.extend(
- find_all_get_resource_in_resource(v))
+ resources.extend(find_all_get_resource_in_resource(v))
elif isinstance(v, list):
for d in v:
- resources.extend(
- find_all_get_resource_in_resource(d))
+ resources.extend(find_all_get_resource_in_resource(d))
return resources
def get_associated_resources_per_resource(resources):
- '''
+ """
Recursively find all referenced resources for each resource
in a list of resource ids
- '''
- if not hasattr(resources, 'items'):
+ """
+ if not hasattr(resources, "items"):
return None
resources_dict = {}
@@ -183,8 +179,7 @@ def get_associated_resources_per_resource(resources):
get_resources = []
for k, v in res_value:
- if k == 'get_resource' and\
- isinstance(v, dict):
+ if k == "get_resource" and isinstance(v, dict):
get_resources = find_all_get_resource_in_resource(v)
# if resources found, add to dict
@@ -201,9 +196,9 @@ def get_associated_resources_per_resource(resources):
def flatten(items):
- '''
+ """
flatten items from any nested iterable
- '''
+ """
merged_list = []
for item in items:
diff --git a/ice_validator/tests/utils/network_roles.py b/ice_validator/tests/utils/network_roles.py
index bed3a5a..ffb9870 100644
--- a/ice_validator/tests/utils/network_roles.py
+++ b/ice_validator/tests/utils/network_roles.py
@@ -41,111 +41,114 @@
import re
import socket
-
-def get_network_role_from_port(resource):
- '''
- get the network role from a neutron port resource
- '''
+PARAM_FORMATS = [
+ ["network", "string", "internal", re.compile(r"int_(.+?)_net_id")],
+ ["network", "string", "internal", re.compile(r"int_(.+?)_net_name")],
+ ["network", "string", "external", re.compile(r"(.+?)_net_id")],
+ ["network", "string", "external", re.compile(r"(.+?)_net_name")],
+]
+
+RESOURCE_FORMATS = [
+ re.compile(r"int_(.+?)_network"), # OS::ContrailV2::VirtualNetwork
+ re.compile(r"int_(.+?)_RVN"), # OS::ContrailV2::VirtualNetwork
+ re.compile(r"int_(.+?)"), # OS::Neutron::Net
+]
+
+
+def get_network_role_and_type(resource):
+ """
+ Derive the network role and type (internal vs. external) from an
+ OS::Neutron::Port.
+
+ :param resource: dict of Resource attributes
+ :return: tuple of (network_role, network_type) where network_type is
+ 'internal' or 'external'. Returns (None, None) if resource
+ is not a port or the values cannot be derived.
+ """
if not isinstance(resource, dict):
- return None
- if 'type' not in resource:
- return None
- if resource['type'] != 'OS::Neutron::Port':
- return None
- if 'properties' not in resource:
- return None
-
- formats = [
- ["network", "string", "internal",
- re.compile(r'int_(.+?)_net_id')],
- ["network", "string", "internal",
- re.compile(r'int_(.+?)_net_name')],
- ["network", "string", "external",
- re.compile(r'(.+?)_net_id')],
- ["network", "string", "external",
- re.compile(r'(.+?)_net_name')]]
-
- for k1, v1 in resource["properties"].items():
- if k1 != 'network':
- continue
-
- # get the network id or name
- network = (
- v1.get('get_param') or
- v1.get('get_resource'))
- if not network:
- continue
-
- for v2 in formats:
- m = v2[3].match(network)
+ return None, None
+ if resource.get("type", "") != "OS::Neutron::Port":
+ return None, None
+
+ network_props = resource.get("properties", {}).get("network", {})
+ is_resource = "get_resource" in network_props
+ if is_resource:
+ network = network_props.get("get_resource", "")
+ else:
+ network = network_props.get("get_param", "")
+
+ if is_resource: # connecting to an network in the template
+ for format in RESOURCE_FORMATS:
+ m = format.match(network)
if m and m.group(1):
- return m.group(1)
-
- return None
+ return m.group(1), "internal"
+ else:
+ for format in PARAM_FORMATS:
+ m = format[3].match(network)
+ if m and m.group(1):
+ return m.group(1), format[2]
+ return None, None
-def get_network_roles(resources):
- network_roles = []
+def get_network_role_from_port(resource):
+ """
+ Get the network-role from a OS::Neutron::Port resource. Returns None
+ if resource is not a port or the network-role cannot be derived
+ """
+ return get_network_role_and_type(resource)[0]
+
+
+def get_network_roles(resources, of_type=""):
+ """
+ Returns the network roles derived from the OS::Neutron::Port resources
+ in the collection of ``resources``. If ``of_type`` is not specified
+ then all network roles will be returned, or ``external`` or ``internal``
+ can be passed to select only those network roles
+
+ :param resources: collection of resource attributes (dict)
+ :param of_type: "internal" or "external"
+ :return: set of network roles discovered
+ """
+ valid_of_type = ("", "external", "internal")
+ if of_type not in ("", "external", "internal"):
+ raise RuntimeError("of_type must one of " + ", ".join(valid_of_type))
+ network_roles = set()
for v in resources.values():
- nr = get_network_role_from_port(v)
- if nr:
- network_roles.append(nr)
-
- return set(network_roles)
+ nr, nt = get_network_role_and_type(v)
+ if not nr:
+ continue
+ if not of_type:
+ network_roles.add(nr)
+ elif of_type and of_type == nt:
+ network_roles.add(nr)
+ return network_roles
def get_network_type_from_port(resource):
- '''
- get the network type from a neutron port resource
- '''
- if not isinstance(resource, dict):
- return None
- if 'type' not in resource:
- return None
- if resource['type'] != 'OS::Neutron::Port':
- return None
- if 'properties' not in resource:
- return None
-
- formats = [
- ["network", "string", "internal",
- re.compile(r'int_(.+?)_net_id')],
- ["network", "string", "internal",
- re.compile(r'int_(.+?)_net_name')],
- ["network", "string", "external",
- re.compile(r'(.+?)_net_id')],
- ["network", "string", "external",
- re.compile(r'(.+?)_net_name')]]
-
- for k1, v1 in resource["properties"].items():
- if k1 != 'network':
- continue
- if "get_param" not in v1:
- continue
- for v2 in formats:
- m = v2[3].match(v1["get_param"])
- if m and m.group(1):
- return v2[2]
-
- return None
+ """
+ Get the network-type (internal or external) from an OS::Neutron::Port
+ resource. Returns None if the resource is not a port or the type
+ cannot be derived.
+ """
+ return get_network_role_and_type(resource)[1]
-def is_valid_ip_address(ip_address, ip_type='ipv4'):
- '''
+def is_valid_ip_address(ip_address, ip_type="ipv4"):
+ """
check if an ip address is valid
- '''
- if ip_type == 'ipv4':
+ """
+ if ip_type == "ipv4":
return is_valid_ipv4_address(ip_address)
- elif ip_type == 'ipv6':
+ elif ip_type == "ipv6":
return is_valid_ipv6_address(ip_address)
return False
def is_valid_ipv4_address(ip_address):
- '''
+ """
check if an ip address of the type ipv4
is valid
- '''
+ """
try:
socket.inet_pton(socket.AF_INET, ip_address)
except AttributeError:
@@ -153,17 +156,17 @@ def is_valid_ipv4_address(ip_address):
socket.inet_aton(ip_address)
except (OSError, socket.error):
return False
- return ip_address.count('.') == 3
+ return ip_address.count(".") == 3
except (OSError, socket.error):
return False
return True
def is_valid_ipv6_address(ip_address):
- '''
+ """
check if an ip address of the type ipv6
is valid
- '''
+ """
try:
socket.inet_pton(socket.AF_INET6, ip_address)
except (OSError, socket.error):
@@ -172,17 +175,17 @@ def is_valid_ipv6_address(ip_address):
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:
+ if "properties" not in resource:
return False
for k1, v1 in resource["properties"].items():
if k1 != property_name:
continue
- if "get_resource" in v1:
+ if isinstance(v1, dict) and "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 a2ae8a9..4029d3c 100644
--- a/ice_validator/tests/utils/ports.py
+++ b/ice_validator/tests/utils/ports.py
@@ -43,53 +43,96 @@ 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):
- '''
+def is_valid_ip_address(
+ ip_address, vm_type, network_role, port_property, parameter_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')]]
+ [
+ "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:
@@ -99,33 +142,30 @@ def is_valid_ip_address(ip_address, vm_type, network_role, port_property, parame
# 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):
+ 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
return False
def get_invalid_ip_addresses(resources, port_property, parameters):
- '''
+ """
Get a list of valid ip addresses for a heat resources section
- '''
+ """
invalid_ip_addresses = []
for k, v in resources.items():
if not isinstance(v, dict):
continue
- if 'type' not in v:
+ if "type" not in v:
continue
- if v['type'] not in 'OS::Nova::Server':
+ if v["type"] not in "OS::Nova::Server":
continue
- if 'properties' not in v:
+ if "properties" not in v:
continue
- if 'networks' not in v['properties']:
+ if "networks" not in v["properties"]:
continue
port_resource = None
@@ -135,16 +175,16 @@ def get_invalid_ip_addresses(resources, port_property, parameters):
continue
# get all ports associated with the nova server
- properties = v['properties']
- for network in properties['networks']:
+ properties = v["properties"]
+ for network in properties["networks"]:
for k3, v3 in network.items():
- if k3 != 'port':
+ if k3 != "port":
continue
if not isinstance(v3, dict):
continue
- if 'get_resource' in v3:
- port_id = v3['get_resource']
+ if "get_resource" in v3:
+ port_id = v3["get_resource"]
if not resources[port_id]:
continue
port_resource = resources[port_id]
@@ -175,11 +215,13 @@ def get_invalid_ip_addresses(resources, port_property, parameters):
if not parameter_type:
continue
- valid_ip_address = is_valid_ip_address(ip_address,
- vm_type,
- network_role,
- port_property,
- parameter_type)
+ valid_ip_address = is_valid_ip_address(
+ ip_address,
+ vm_type,
+ network_role,
+ port_property,
+ parameter_type,
+ )
if not valid_ip_address:
invalid_ip_addresses.append(ip_address)
@@ -187,18 +229,17 @@ def get_invalid_ip_addresses(resources, port_property, parameters):
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
+def get_list_of_ports_attached_to_nova_server(nova_server):
+ networks_list = nova_server.get("properties", {}).get("networks")
+
+ port_ids = []
+ if networks_list:
+ for network in networks_list:
+ network_prop = network.get("port")
+ if network_prop:
+ pid = network_prop.get("get_param")
+ if not pid:
+ pid = network_prop.get("get_resource")
+ port_ids.append(pid)
+
+ return port_ids
diff --git a/ice_validator/tests/utils/vm_types.py b/ice_validator/tests/utils/vm_types.py
index 6802666..78006b9 100644
--- a/ice_validator/tests/utils/vm_types.py
+++ b/ice_validator/tests/utils/vm_types.py
@@ -42,36 +42,33 @@ import re
def get_vm_types_for_resource(resource):
- '''
+ """
Get all unique vm_types for a resource
Notes:
- Returns set([]) if the resource is not formatted
properly, the passed resource is not a nova server
- If more than one vm_type is detected all vm_types will
be returned
- '''
+ """
if not isinstance(resource, dict):
return set()
- if 'type' not in resource:
+ if "type" not in resource:
return set()
- if resource['type'] != 'OS::Nova::Server':
+ if resource["type"] != "OS::Nova::Server":
return set()
- if 'properties' not in resource:
+ if "properties" not in resource:
return set()
key_values = ["name", "flavor", "image"]
key_value_formats = [
- ["name", "string",
- re.compile(r'(.+?)_name_\d+')],
- ["name", "comma_delimited_list",
- re.compile(r'(.+?)_names')],
- ["flavor", "string",
- re.compile(r'(.+?)_flavor_name')],
- ["image", "string",
- re.compile(r'(.+?)_image_name')]]
+ ["name", "string", re.compile(r"(.+?)_name_\d+")],
+ ["name", "comma_delimited_list", re.compile(r"(.+?)_names")],
+ ["flavor", "string", re.compile(r"(.+?)_flavor_name")],
+ ["image", "string", re.compile(r"(.+?)_image_name")],
+ ]
vm_types = []
- for k2, v2 in resource['properties'].items():
+ for k2, v2 in resource["properties"].items():
if k2 not in key_values:
continue
if "get_param" not in v2:
@@ -89,12 +86,12 @@ def get_vm_types_for_resource(resource):
def get_vm_type_for_nova_server(resource):
- '''
+ """
Get the vm_type for a resource
Note: Returns None if not exactly one vm_type
is detected, if the resource is not formatted properly, or
the passed resource is not a nova server
- '''
+ """
vm_types = get_vm_types_for_resource(resource)
# if more than one vm_type was identified, return None
@@ -105,10 +102,10 @@ def get_vm_type_for_nova_server(resource):
def get_vm_types(resources):
- '''
+ """
Get all vm_types for a list of heat resources, do note that
some of the values retrieved may be invalid
- '''
+ """
vm_types = []
for v in resources.values():
vm_types.extend(list(get_vm_types_for_resource(v)))
diff --git a/ice_validator/tests/utils/volumes.py b/ice_validator/tests/utils/volumes.py
index 40731bf..6f52dd8 100644
--- a/ice_validator/tests/utils/volumes.py
+++ b/ice_validator/tests/utils/volumes.py
@@ -44,19 +44,19 @@
from os import path
from tests import cached_yaml as yaml
-VERSION = '1.0.0'
+VERSION = "1.0.0"
def get_volume_resources(heat_template):
- '''
+ """
get the resources from the volume template
Note: Returns an empty dict if there is no
volume template or for any other error
- '''
+ """
basename = path.splitext(heat_template)[0]
- for ext in ['.yaml', '.yml']:
- volume_template = basename + '_volume' + ext
+ for ext in [".yaml", ".yml"]:
+ volume_template = basename + "_volume" + ext
if path.isfile(volume_template):
break
else:
@@ -66,12 +66,12 @@ def get_volume_resources(heat_template):
with open(volume_template) as fh:
yml = yaml.load(fh)
except yaml.YAMLError as e:
- print(e) # pylint: disable=superfluous-parens
+ print(e) # pylint: disable=superfluous-parens
return {}
- if 'outputs' not in yml:
+ if "outputs" not in yml:
return {}
- if 'resources' not in yml:
+ if "resources" not in yml:
return {}
- return yml['resources']
+ return yml["resources"]
diff --git a/ice_validator/tests/utils/yaml_custom_utils.py b/ice_validator/tests/utils/yaml_custom_utils.py
index 8a5006c..1e4b0e5 100644
--- a/ice_validator/tests/utils/yaml_custom_utils.py
+++ b/ice_validator/tests/utils/yaml_custom_utils.py
@@ -50,8 +50,11 @@ def raise_duplicates_keys(loader, node, deep=False):
value = loader.construct_object(value_node, deep=deep)
if key in mapping:
raise ConstructorError(
- "while constructing a mapping", node.start_mark,
- "found duplicate key (%s)" % key, key_node.start_mark)
+ "while constructing a mapping",
+ node.start_mark,
+ "found duplicate key (%s)" % key,
+ key_node.start_mark,
+ )
mapping[key] = value
return loader.construct_mapping(node, deep)