From 10569ba4a44a64ecd252dbc3c74e7437c54fd135 Mon Sep 17 00:00:00 2001 From: Yoshiro Watanabe Date: Wed, 10 Apr 2024 03:07:47 +0000 Subject: [PATCH] [WIP]Move test samples to reduce setuptools warnings Previously there are a lot of warning messages of setuptools in the log files of tox jobs. This is mainly caused by test samples because these are in python codes directories. This patch moves test samples from under {heat-translator_root}/translator/tests to under {heat-translator_root}/samples/tests. This patch also contains the following changes: * Remove "skipsdist = True" from tox.ini * Fixed usage.rst command example. * Changeing unit tests that reference external URL to use mock Change-Id: I25f5bd945bfcfa029641de4828cfad13e3d3d516 --- doc/source/usage.rst | 22 +- .../container => samples}/docker/dockerfile | 0 .../tests/data/artifacts/collectd/config.py | 0 .../tests/data/artifacts/collectd/create.sh | 0 .../tests/data/artifacts/collectd/start.sh | 0 .../data/artifacts/elasticsearch/create.sh | 0 .../data/artifacts/elasticsearch/start.sh | 0 .../tests/data/artifacts/kibana/config.sh | 0 .../tests/data/artifacts/kibana/create.sh | 0 .../tests/data/artifacts/kibana/start.sh | 0 .../artifacts/logstash/configure_collectd.py | 0 .../logstash/configure_elasticsearch.py | 0 .../artifacts/logstash/configure_rsyslog.py | 0 .../tests/data/artifacts/logstash/create.sh | 0 .../tests/data/artifacts/logstash/start.sh | 0 .../tests/data/artifacts/mongodb/config.sh | 0 .../tests/data/artifacts/mongodb/create.sh | 0 .../data/artifacts/mongodb/create_database.sh | 0 .../tests/data/artifacts/mongodb/start.sh | 0 .../mysql/mysql_database_configure.sh | 0 .../artifacts/mysql/mysql_dbms_configure.sh | 0 .../artifacts/mysql/mysql_dbms_install.sh | 0 .../data/artifacts/mysql/mysql_dbms_start.sh | 0 .../tests/data/artifacts/nodejs/config.sh | 0 .../tests/data/artifacts/nodejs/create.sh | 0 .../tests/data/artifacts/nodejs/start.sh | 0 .../tests/data/artifacts/rsyslog/config.sh | 0 .../tests/data/artifacts/rsyslog/create.sh | 0 .../tests/data/artifacts/rsyslog/start.sh | 0 .../data/artifacts/ssh/ssh_generate_keys.sh | 0 .../artifacts/ssh/ssh_import_public_key.sh | 0 .../artifacts/webserver/webserver_install.sh | 0 .../artifacts/webserver/webserver_start.sh | 0 .../wordpress/wordpress_configure.sh | 0 .../artifacts/wordpress/wordpress_install.sh | 0 .../data/autoscaling/tosca_autoscaling.yaml | 0 .../tosca_cluster_autoscaling.yaml | 0 .../tests/data/csar_elk.zip | Bin .../tests/data/csar_hello_world.zip | Bin .../tests/data/csar_metadata_not_yaml.zip | Bin .../tests/data/csar_not_zip.zip | 0 .../data/csar_single_instance_wordpress.zip | Bin .../csar_wordpress_invalid_import_path.zip | Bin .../csar_wordpress_invalid_script_url.zip | Bin .../tests/data/csar_wrong_metadata_file.zip | Bin .../tests/data/custom_types/collectd.yaml | 0 .../data/custom_types/custom_monitoring.yaml | 0 .../data/custom_types/elasticsearch.yaml | 0 .../tests/data/custom_types/kibana.yaml | 0 .../tests/data/custom_types/logstash.yaml | 0 .../paypalpizzastore_nodejs_app.yaml | 0 .../tests/data/custom_types/rsyslog.yaml | 0 .../custom_types/senlin_cluster_policies.yaml | 0 .../tests/data/custom_types/wordpress.yaml | 0 .../etsi_nfv_sol001_common_types.yaml | 0 .../etsi_nfv/etsi_nfv_sol001_vnfd_types.yaml | 0 .../data/etsi_nfv/tosca_nfv_blockstorage.yaml | 0 .../etsi_nfv/tosca_nfv_check_cp_order.yaml | 0 .../tests/data/etsi_nfv/tosca_nfv_cp.yaml | 0 .../tosca_nfv_cp_with_extended_vnic_type.yaml | 0 .../etsi_nfv/tosca_nfv_non_leaf_in_vl.yaml | 0 ...fv_scaling_non_deltas_in_aspect_delta.yaml | 0 ...caling_non_target_vdu_in_aspect_delta.yaml | 0 ...aling_non_target_vdu_in_initial_delta.yaml | 0 .../tests/data/etsi_nfv/tosca_nfv_vdu.yaml | 0 ...osca_nfv_vdu_affinity_with_scope_nfvi.yaml | 0 ...v_vdu_affinity_with_unsupported_scope.yaml | 0 ...vdu_affinity_with_unsupported_targets.yaml | 0 ...osca_nfv_vdu_cp_vl_with_mixed_scaling.yaml | 0 ...nfv_vdu_cp_with_scaling_multi_aspects.yaml | 0 ...sca_nfv_vdu_with_compute_requirements.yaml | 0 ...vdu_with_invalid_compute_requirements.yaml | 0 .../tosca_nfv_vdu_with_logical_node.yaml | 0 ...osca_nfv_vdu_with_unsupported_storage.yaml | 0 .../tests/data/etsi_nfv/tosca_nfv_vl.yaml | 0 ...osca_nfv_vl_with_unsupported_protocol.yaml | 0 .../tests/data/etsi_nfv/tosca_nfv_vnf.yaml | 0 ...f_vdu_cp_vl_blockstorage_with_scaling.yaml | 0 .../data/hot_output/autoscaling/asg_res.yaml | 0 .../autoscaling/hot_autoscaling.yaml | 0 .../autoscaling/hot_cluster_autoscaling.yaml | 0 .../etsi_nfv/hot_nfv_blockstorage.yaml | 0 .../etsi_nfv/hot_nfv_check_cp_order.yaml | 0 .../data/hot_output/etsi_nfv/hot_nfv_cp.yaml | 0 .../hot_nfv_cp_with_extended_vnic_type.yaml | 0 .../etsi_nfv/hot_nfv_non_leaf_in_vl.yaml | 0 .../data/hot_output/etsi_nfv/hot_nfv_vdu.yaml | 0 .../hot_nfv_vdu_affinity_with_scope_nfvi.yaml | 0 ...v_vdu_affinity_with_unsupported_scope.yaml | 0 ...vdu_affinity_with_unsupported_targets.yaml | 0 ...hot_nfv_vdu_with_compute_requirements.yaml | 0 ...vdu_with_invalid_compute_requirements.yaml | 0 .../hot_nfv_vdu_with_logical_node.yaml | 0 .../hot_nfv_vdu_with_unsupported_storage.yaml | 0 .../data/hot_output/etsi_nfv/hot_nfv_vl.yaml | 0 .../hot_nfv_vl_with_unsupported_protocol.yaml | 0 .../data/hot_output/etsi_nfv/hot_nfv_vnf.yaml | 0 ...fv_scaling_non_deltas_in_aspect_delta.yaml | 0 .../worker_instance.hot.yaml | 0 ...caling_non_target_vdu_in_aspect_delta.yaml | 0 .../worker_instance.hot.yaml | 0 ...aling_non_target_vdu_in_initial_delta.yaml | 0 .../worker_instance.hot.yaml | 0 .../hot_nfv_vdu_cp_vl_with_mixed_scaling.yaml | 0 .../worker_instance.hot.yaml | 0 ...nfv_vdu_cp_with_scaling_multi_aspects.yaml | 0 .../worker_instance1.hot.yaml | 0 .../worker_instance2.hot.yaml | 0 ...f_vdu_cp_vl_blockstorage_with_scaling.yaml | 0 .../worker_instance.hot.yaml | 0 .../tests/data/hot_output/hot_artifact.yaml | 0 .../data/hot_output/hot_custom_type.yaml | 0 .../hot_custom_type_with_override.yaml | 0 .../hot_custom_type_with_param_override.yaml | 0 .../tests/data/hot_output/hot_elk.yaml | 0 .../data/hot_output/hot_elk_from_csar.yaml | 0 .../hot_exchange_public_ssh_key.yaml | 0 .../data/hot_output/hot_flavor_and_image.yaml | 0 .../hot_flavor_and_image_params.yaml | 0 .../hot_get_functions_semantic.yaml | 0 .../data/hot_output/hot_hello_world.yaml | 0 .../hot_output/hot_hello_world_userkey.yaml | 0 .../data/hot_output/hot_host_assignment.yaml | 0 .../hot_nodejs_mongodb_two_instances.yaml | 0 .../data/hot_output/hot_script_types.yaml | 0 .../hot_single_instance_wordpress.yaml | 0 ...t_single_instance_wordpress_from_csar.yaml | 0 .../hot_output/hot_single_object_store.yaml | 0 .../data/hot_output/hot_single_server.yaml | 0 ...ingle_server_with_defaults_with_input.yaml | 0 ...le_server_with_defaults_without_input.yaml | 0 ...ingle_server_without_tosca_os_version.yaml | 0 .../hot_output/hot_software_component.yaml | 0 ...hot_software_component_multiple_hosts.yaml | 0 .../data/hot_output/hot_web_application.yaml | 0 .../interfaces/hot_interface_on_compute.yaml | 0 .../data/hot_output/monitoring/asg_res.yaml | 0 .../monitoring/hot_monitoring_scaling.yaml | 0 .../network/hot_custom_network_nodes.yaml | 0 .../network/hot_one_server_one_network.yaml | 0 .../hot_one_server_three_networks.yaml | 0 .../hot_server_on_existing_network.yaml | 0 .../network/hot_two_servers_one_network.yaml | 0 .../tests/data/hot_output/nfv/SP1_res.yaml | 0 .../tests/data/hot_output/nfv/SP_res.yaml | 0 .../data/hot_output/nfv/hot_nfv_sample.yaml | 0 .../nfv/hot_policy_anti_affinity.yaml | 0 .../nfv/hot_policy_soft_affinity.yaml | 0 .../nfv/hot_tosca_nfv_autoscaling.yaml | 0 .../hot_tosca_nfv_autoscaling_with_param.yaml | 0 .../hot_output/policies/hot_policies.yaml | 0 .../hot_output/reservation/SP_RSV_res.yaml | 0 .../reservation/hot_reservation_scaling.yaml | 0 .../hot_blockstorage_with_attachment.yaml | 0 ...torage_with_attachment_notation1_alt1.yaml | 0 ...torage_with_attachment_notation1_alt2.yaml | 0 ...torage_with_attachment_notation2_alt1.yaml | 0 ...torage_with_attachment_notation2_alt2.yaml | 0 ...storage_with_custom_relationship_type.yaml | 0 ...ockstorage_with_relationship_template.yaml | 0 ...le_blockstorage_w_multiple_attachment.yaml | 0 ...ple_blockstorage_with_attachment_alt1.yaml | 0 ...ple_blockstorage_with_attachment_alt2.yaml | 0 .../test_tosca_interface_on_compute.yaml | 0 .../interfaces/test_tosca_script_types.yaml | 0 .../monitoring/tosca_monitoring_scaling.yaml | 0 .../test_tosca_custom_network_nodes_defs.yaml | 0 ...st_tosca_custom_network_nodes_imports.yaml | 0 ...est_tosca_custom_network_nodes_inline.yaml | 0 .../network/tosca_one_server_one_network.yaml | 0 .../tosca_one_server_three_networks.yaml | 0 .../tosca_server_on_existing_network.yaml | 0 .../tosca_two_servers_one_network.yaml | 0 .../tests/data/nfv/tacker_defs.yaml | 0 .../tests/data/nfv/tacker_nfv_defs.yaml | 0 .../data/nfv/test_tosca_nfv_autoscaling.yaml | 0 ...est_tosca_nfv_autoscaling_with_params.yaml | 0 .../tests/data/nfv/test_tosca_nfv_sample.yaml | 0 .../test_tosca_unsupported_policy_type.yaml | 0 .../nfv/tosca_placement_policy_affinity.yaml | 0 .../tosca_placement_policy_anti_affinity.yaml | 0 .../tosca_placement_policy_soft_affinity.yaml | 0 .../tests/data/policies/tosca_policies.yaml | 0 .../tosca-vnfd-reservation-id.yaml | 4 +- .../tosca_blockstorage_with_attachment.yaml | 0 ...lockstorage_with_attachment_notation1.yaml | 0 ...lockstorage_with_attachment_notation2.yaml | 0 ...storage_with_custom_relationship_type.yaml | 0 ...ockstorage_with_relationship_template.yaml | 0 ...le_blockstorage_w_multiple_attachment.yaml | 0 ...multiple_blockstorage_with_attachment.yaml | 0 .../storage/tosca_single_object_store.yaml | 0 .../tests/data/test_host_assignment.yaml | 0 ..._server_without_optional_version_prop.yaml | 0 .../tests/data/test_tosca_artifact.yaml | 0 .../tests/data/test_tosca_custom_type.yaml | 0 .../test_tosca_custom_type_with_override.yaml | 0 .../data/test_tosca_flavor_and_image.yaml | 0 .../test_tosca_get_functions_semantic.yaml | 0 .../data/test_tosca_unsupported_type.yaml | 0 .../tests/data/tosca_elk.yaml | 0 .../data/tosca_exchange_public_ssh_key.yaml | 0 .../tests/data/tosca_helloworld.yaml | 0 .../tests/data/tosca_helloworld_invalid.yaml | 0 .../tosca_nodejs_mongodb_two_instances.yaml | 0 .../data/tosca_single_instance_wordpress.yaml | 0 ...e_wordpress_with_local_abspath_import.yaml | 0 ...le_instance_wordpress_with_url_import.yaml | 2 +- .../tests/data/tosca_single_server.yaml | 0 .../tosca_single_server_with_defaults.yaml | 0 .../tests/data/tosca_software_component.yaml | 0 ...sca_software_component_multiple_hosts.yaml | 0 .../tests/data/tosca_web_application.yaml | 0 tox.ini | 1 - .../hot/tests/test_translate_outputs.py | 6 +- .../etsi_nfv/common_affinityrule/__init__.py | 0 translator/osc/v1/tests/test_translate.py | 193 +++---- translator/osc/v1/translate.py | 3 +- .../tests/test_etsi_tosca_hot_translation.py | 155 +++--- translator/tests/test_shell.py | 14 +- translator/tests/test_template.py | 6 +- .../tests/test_tosca_hot_translation.py | 473 ++++++++++-------- translator/tests/test_utils.py | 22 +- translator/{osc/v1 => }/tests/utils.py | 21 +- 224 files changed, 503 insertions(+), 419 deletions(-) rename {translator/container => samples}/docker/dockerfile (100%) rename {translator => samples}/tests/data/artifacts/collectd/config.py (100%) rename {translator => samples}/tests/data/artifacts/collectd/create.sh (100%) rename {translator => samples}/tests/data/artifacts/collectd/start.sh (100%) rename {translator => samples}/tests/data/artifacts/elasticsearch/create.sh (100%) rename {translator => samples}/tests/data/artifacts/elasticsearch/start.sh (100%) rename {translator => samples}/tests/data/artifacts/kibana/config.sh (100%) rename {translator => samples}/tests/data/artifacts/kibana/create.sh (100%) rename {translator => samples}/tests/data/artifacts/kibana/start.sh (100%) rename {translator => samples}/tests/data/artifacts/logstash/configure_collectd.py (100%) rename {translator => samples}/tests/data/artifacts/logstash/configure_elasticsearch.py (100%) rename {translator => samples}/tests/data/artifacts/logstash/configure_rsyslog.py (100%) rename {translator => samples}/tests/data/artifacts/logstash/create.sh (100%) rename {translator => samples}/tests/data/artifacts/logstash/start.sh (100%) rename {translator => samples}/tests/data/artifacts/mongodb/config.sh (100%) mode change 100644 => 100755 rename {translator => samples}/tests/data/artifacts/mongodb/create.sh (100%) mode change 100644 => 100755 rename {translator => samples}/tests/data/artifacts/mongodb/create_database.sh (100%) mode change 100644 => 100755 rename {translator => samples}/tests/data/artifacts/mongodb/start.sh (100%) mode change 100644 => 100755 rename {translator => samples}/tests/data/artifacts/mysql/mysql_database_configure.sh (100%) rename {translator => samples}/tests/data/artifacts/mysql/mysql_dbms_configure.sh (100%) rename {translator => samples}/tests/data/artifacts/mysql/mysql_dbms_install.sh (100%) rename {translator => samples}/tests/data/artifacts/mysql/mysql_dbms_start.sh (100%) rename {translator => samples}/tests/data/artifacts/nodejs/config.sh (100%) mode change 100644 => 100755 rename {translator => samples}/tests/data/artifacts/nodejs/create.sh (100%) mode change 100644 => 100755 rename {translator => samples}/tests/data/artifacts/nodejs/start.sh (100%) mode change 100644 => 100755 rename {translator => samples}/tests/data/artifacts/rsyslog/config.sh (100%) mode change 100644 => 100755 rename {translator => samples}/tests/data/artifacts/rsyslog/create.sh (100%) rename {translator => samples}/tests/data/artifacts/rsyslog/start.sh (100%) rename {translator => samples}/tests/data/artifacts/ssh/ssh_generate_keys.sh (100%) mode change 100644 => 100755 rename {translator => samples}/tests/data/artifacts/ssh/ssh_import_public_key.sh (100%) mode change 100644 => 100755 rename {translator => samples}/tests/data/artifacts/webserver/webserver_install.sh (100%) rename {translator => samples}/tests/data/artifacts/webserver/webserver_start.sh (100%) rename {translator => samples}/tests/data/artifacts/wordpress/wordpress_configure.sh (100%) rename {translator => samples}/tests/data/artifacts/wordpress/wordpress_install.sh (100%) rename {translator => samples}/tests/data/autoscaling/tosca_autoscaling.yaml (100%) rename {translator => samples}/tests/data/autoscaling/tosca_cluster_autoscaling.yaml (100%) rename {translator => samples}/tests/data/csar_elk.zip (100%) rename {translator => samples}/tests/data/csar_hello_world.zip (100%) rename {translator => samples}/tests/data/csar_metadata_not_yaml.zip (100%) rename {translator => samples}/tests/data/csar_not_zip.zip (100%) rename {translator => samples}/tests/data/csar_single_instance_wordpress.zip (100%) rename {translator => samples}/tests/data/csar_wordpress_invalid_import_path.zip (100%) rename {translator => samples}/tests/data/csar_wordpress_invalid_script_url.zip (100%) rename {translator => samples}/tests/data/csar_wrong_metadata_file.zip (100%) rename {translator => samples}/tests/data/custom_types/collectd.yaml (100%) rename {translator => samples}/tests/data/custom_types/custom_monitoring.yaml (100%) rename {translator => samples}/tests/data/custom_types/elasticsearch.yaml (100%) rename {translator => samples}/tests/data/custom_types/kibana.yaml (100%) rename {translator => samples}/tests/data/custom_types/logstash.yaml (100%) rename {translator => samples}/tests/data/custom_types/paypalpizzastore_nodejs_app.yaml (100%) rename {translator => samples}/tests/data/custom_types/rsyslog.yaml (100%) rename {translator => samples}/tests/data/custom_types/senlin_cluster_policies.yaml (100%) rename {translator => samples}/tests/data/custom_types/wordpress.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/etsi_nfv_sol001_common_types.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/etsi_nfv_sol001_vnfd_types.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_blockstorage.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_check_cp_order.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_cp.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_cp_with_extended_vnic_type.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_non_leaf_in_vl.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_scaling_non_deltas_in_aspect_delta.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_scaling_non_target_vdu_in_aspect_delta.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_scaling_non_target_vdu_in_initial_delta.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_vdu.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_vdu_affinity_with_scope_nfvi.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_vdu_affinity_with_unsupported_scope.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_vdu_affinity_with_unsupported_targets.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_vdu_cp_vl_with_mixed_scaling.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_vdu_cp_with_scaling_multi_aspects.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_vdu_with_compute_requirements.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_vdu_with_invalid_compute_requirements.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_vdu_with_logical_node.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_vdu_with_unsupported_storage.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_vl.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_vl_with_unsupported_protocol.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_vnf.yaml (100%) rename {translator => samples}/tests/data/etsi_nfv/tosca_nfv_vnf_vdu_cp_vl_blockstorage_with_scaling.yaml (100%) rename {translator => samples}/tests/data/hot_output/autoscaling/asg_res.yaml (100%) rename {translator => samples}/tests/data/hot_output/autoscaling/hot_autoscaling.yaml (100%) rename {translator => samples}/tests/data/hot_output/autoscaling/hot_cluster_autoscaling.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/hot_nfv_blockstorage.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/hot_nfv_check_cp_order.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/hot_nfv_cp.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/hot_nfv_cp_with_extended_vnic_type.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/hot_nfv_non_leaf_in_vl.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/hot_nfv_vdu.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_affinity_with_scope_nfvi.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_affinity_with_unsupported_scope.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_affinity_with_unsupported_targets.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_with_compute_requirements.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_with_invalid_compute_requirements.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_with_logical_node.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_with_unsupported_storage.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/hot_nfv_vl.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/hot_nfv_vl_with_unsupported_protocol.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/hot_nfv_vnf.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/scaling_non_deltas_in_aspect_delta/hot_nfv_scaling_non_deltas_in_aspect_delta.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/scaling_non_deltas_in_aspect_delta/worker_instance.hot.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/scaling_non_target_vdu_in_aspect_delta/hot_nfv_scaling_non_target_vdu_in_aspect_delta.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/scaling_non_target_vdu_in_aspect_delta/worker_instance.hot.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/scaling_non_target_vdu_in_initial_delta/hot_nfv_scaling_non_target_vdu_in_initial_delta.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/scaling_non_target_vdu_in_initial_delta/worker_instance.hot.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/vdu_cp_vl_with_mixed_scaling/hot_nfv_vdu_cp_vl_with_mixed_scaling.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/vdu_cp_vl_with_mixed_scaling/worker_instance.hot.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/vdu_cp_with_scaling_multi_aspects/hot_nfv_vdu_cp_with_scaling_multi_aspects.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/vdu_cp_with_scaling_multi_aspects/worker_instance1.hot.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/vdu_cp_with_scaling_multi_aspects/worker_instance2.hot.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/vnf_vdu_cp_vl_blockstorage_with_scaling/hot_nfv_vnf_vdu_cp_vl_blockstorage_with_scaling.yaml (100%) rename {translator => samples}/tests/data/hot_output/etsi_nfv/vnf_vdu_cp_vl_blockstorage_with_scaling/worker_instance.hot.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_artifact.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_custom_type.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_custom_type_with_override.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_custom_type_with_param_override.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_elk.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_elk_from_csar.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_exchange_public_ssh_key.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_flavor_and_image.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_flavor_and_image_params.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_get_functions_semantic.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_hello_world.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_hello_world_userkey.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_host_assignment.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_nodejs_mongodb_two_instances.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_script_types.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_single_instance_wordpress.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_single_instance_wordpress_from_csar.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_single_object_store.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_single_server.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_single_server_with_defaults_with_input.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_single_server_with_defaults_without_input.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_single_server_without_tosca_os_version.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_software_component.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_software_component_multiple_hosts.yaml (100%) rename {translator => samples}/tests/data/hot_output/hot_web_application.yaml (100%) rename {translator => samples}/tests/data/hot_output/interfaces/hot_interface_on_compute.yaml (100%) rename {translator => samples}/tests/data/hot_output/monitoring/asg_res.yaml (100%) rename {translator => samples}/tests/data/hot_output/monitoring/hot_monitoring_scaling.yaml (100%) rename {translator => samples}/tests/data/hot_output/network/hot_custom_network_nodes.yaml (100%) rename {translator => samples}/tests/data/hot_output/network/hot_one_server_one_network.yaml (100%) rename {translator => samples}/tests/data/hot_output/network/hot_one_server_three_networks.yaml (100%) rename {translator => samples}/tests/data/hot_output/network/hot_server_on_existing_network.yaml (100%) rename {translator => samples}/tests/data/hot_output/network/hot_two_servers_one_network.yaml (100%) rename {translator => samples}/tests/data/hot_output/nfv/SP1_res.yaml (100%) rename {translator => samples}/tests/data/hot_output/nfv/SP_res.yaml (100%) rename {translator => samples}/tests/data/hot_output/nfv/hot_nfv_sample.yaml (100%) rename {translator => samples}/tests/data/hot_output/nfv/hot_policy_anti_affinity.yaml (100%) rename {translator => samples}/tests/data/hot_output/nfv/hot_policy_soft_affinity.yaml (100%) rename {translator => samples}/tests/data/hot_output/nfv/hot_tosca_nfv_autoscaling.yaml (100%) rename {translator => samples}/tests/data/hot_output/nfv/hot_tosca_nfv_autoscaling_with_param.yaml (100%) rename {translator => samples}/tests/data/hot_output/policies/hot_policies.yaml (100%) rename {translator => samples}/tests/data/hot_output/reservation/SP_RSV_res.yaml (100%) rename {translator => samples}/tests/data/hot_output/reservation/hot_reservation_scaling.yaml (100%) rename {translator => samples}/tests/data/hot_output/storage/hot_blockstorage_with_attachment.yaml (100%) rename {translator => samples}/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation1_alt1.yaml (100%) rename {translator => samples}/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation1_alt2.yaml (100%) rename {translator => samples}/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation2_alt1.yaml (100%) rename {translator => samples}/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation2_alt2.yaml (100%) rename {translator => samples}/tests/data/hot_output/storage/hot_blockstorage_with_custom_relationship_type.yaml (100%) rename {translator => samples}/tests/data/hot_output/storage/hot_blockstorage_with_relationship_template.yaml (100%) rename {translator => samples}/tests/data/hot_output/storage/hot_multiple_blockstorage_w_multiple_attachment.yaml (100%) rename {translator => samples}/tests/data/hot_output/storage/hot_multiple_blockstorage_with_attachment_alt1.yaml (100%) rename {translator => samples}/tests/data/hot_output/storage/hot_multiple_blockstorage_with_attachment_alt2.yaml (100%) rename {translator => samples}/tests/data/interfaces/test_tosca_interface_on_compute.yaml (100%) rename {translator => samples}/tests/data/interfaces/test_tosca_script_types.yaml (100%) rename {translator => samples}/tests/data/monitoring/tosca_monitoring_scaling.yaml (100%) rename {translator => samples}/tests/data/network/test_tosca_custom_network_nodes_defs.yaml (100%) rename {translator => samples}/tests/data/network/test_tosca_custom_network_nodes_imports.yaml (100%) rename {translator => samples}/tests/data/network/test_tosca_custom_network_nodes_inline.yaml (100%) rename {translator => samples}/tests/data/network/tosca_one_server_one_network.yaml (100%) rename {translator => samples}/tests/data/network/tosca_one_server_three_networks.yaml (100%) rename {translator => samples}/tests/data/network/tosca_server_on_existing_network.yaml (100%) rename {translator => samples}/tests/data/network/tosca_two_servers_one_network.yaml (100%) rename {translator => samples}/tests/data/nfv/tacker_defs.yaml (100%) rename {translator => samples}/tests/data/nfv/tacker_nfv_defs.yaml (100%) rename {translator => samples}/tests/data/nfv/test_tosca_nfv_autoscaling.yaml (100%) rename {translator => samples}/tests/data/nfv/test_tosca_nfv_autoscaling_with_params.yaml (100%) rename {translator => samples}/tests/data/nfv/test_tosca_nfv_sample.yaml (100%) rename {translator => samples}/tests/data/nfv/test_tosca_unsupported_policy_type.yaml (100%) rename {translator => samples}/tests/data/nfv/tosca_placement_policy_affinity.yaml (100%) rename {translator => samples}/tests/data/nfv/tosca_placement_policy_anti_affinity.yaml (100%) rename {translator => samples}/tests/data/nfv/tosca_placement_policy_soft_affinity.yaml (100%) rename {translator => samples}/tests/data/policies/tosca_policies.yaml (100%) rename {translator => samples}/tests/data/reservation/tosca-vnfd-reservation-id.yaml (93%) rename {translator => samples}/tests/data/storage/tosca_blockstorage_with_attachment.yaml (100%) rename {translator => samples}/tests/data/storage/tosca_blockstorage_with_attachment_notation1.yaml (100%) rename {translator => samples}/tests/data/storage/tosca_blockstorage_with_attachment_notation2.yaml (100%) rename {translator => samples}/tests/data/storage/tosca_blockstorage_with_custom_relationship_type.yaml (100%) rename {translator => samples}/tests/data/storage/tosca_blockstorage_with_relationship_template.yaml (100%) rename {translator => samples}/tests/data/storage/tosca_multiple_blockstorage_w_multiple_attachment.yaml (100%) rename {translator => samples}/tests/data/storage/tosca_multiple_blockstorage_with_attachment.yaml (100%) rename {translator => samples}/tests/data/storage/tosca_single_object_store.yaml (100%) rename {translator => samples}/tests/data/test_host_assignment.yaml (100%) rename {translator => samples}/tests/data/test_single_server_without_optional_version_prop.yaml (100%) rename {translator => samples}/tests/data/test_tosca_artifact.yaml (100%) rename {translator => samples}/tests/data/test_tosca_custom_type.yaml (100%) rename {translator => samples}/tests/data/test_tosca_custom_type_with_override.yaml (100%) rename {translator => samples}/tests/data/test_tosca_flavor_and_image.yaml (100%) rename {translator => samples}/tests/data/test_tosca_get_functions_semantic.yaml (100%) rename {translator => samples}/tests/data/test_tosca_unsupported_type.yaml (100%) rename {translator => samples}/tests/data/tosca_elk.yaml (100%) rename {translator => samples}/tests/data/tosca_exchange_public_ssh_key.yaml (100%) rename {translator => samples}/tests/data/tosca_helloworld.yaml (100%) rename {translator => samples}/tests/data/tosca_helloworld_invalid.yaml (100%) rename {translator => samples}/tests/data/tosca_nodejs_mongodb_two_instances.yaml (100%) rename {translator => samples}/tests/data/tosca_single_instance_wordpress.yaml (100%) rename {translator => samples}/tests/data/tosca_single_instance_wordpress_with_local_abspath_import.yaml (100%) rename {translator => samples}/tests/data/tosca_single_instance_wordpress_with_url_import.yaml (96%) rename {translator => samples}/tests/data/tosca_single_server.yaml (100%) rename {translator => samples}/tests/data/tosca_single_server_with_defaults.yaml (100%) rename {translator => samples}/tests/data/tosca_software_component.yaml (100%) rename {translator => samples}/tests/data/tosca_software_component_multiple_hosts.yaml (100%) rename {translator => samples}/tests/data/tosca_web_application.yaml (100%) create mode 100644 translator/hot/tosca/etsi_nfv/common_affinityrule/__init__.py rename translator/{osc/v1 => }/tests/utils.py (55%) diff --git a/doc/source/usage.rst b/doc/source/usage.rst index 198f1d95..76551f71 100644 --- a/doc/source/usage.rst +++ b/doc/source/usage.rst @@ -17,15 +17,15 @@ only supported template type at present. Currently you can use Heat-Translator i Translate and get output on command line. For example: :: - openstack translate template --template-file /home/openstack/heat-translator/translator/tests/data/tosca_helloworld.yaml --template-type tosca + openstack translate template --template-file /home/openstack/heat-translator/samples/tests/data/tosca_helloworld.yaml --template-type tosca Translate and save output of translated file to a desired destination. For example: :: - openstack translate template --template-file /home/openstack/heat-translator/translator/tests/data/tosca_helloworld.yaml --template-type tosca --output-file /tmp/hot_hello_world.yaml + openstack translate template --template-file /home/openstack/heat-translator/samples/tests/data/tosca_helloworld.yaml --template-type tosca --output-file /tmp/hot_hello_world.yaml Do not translate but only validate template file. For example: :: - openstack translate template --template-file /home/openstack/heat-translator/translator/tests/data/tosca_helloworld.yaml --template-type tosca --validate-only=true + openstack translate template --template-file /home/openstack/heat-translator/samples/tests/data/tosca_helloworld.yaml --template-type tosca --validate-only=true You can learn more about available options by running following help command:: @@ -46,12 +46,12 @@ system or via URL. For example, a TOSCA hello world template can be translated by running the following command from the project location:: - python heat_translator.py --template-file=translator/tests/data/tosca_helloworld.yaml + python heat_translator.py --template-file=samples/tests/data/tosca_helloworld.yaml This should produce a translated Heat Orchestration Template on the command line. The translated content can be saved to a desired file by setting --output-file=. For example: :: - python heat_translator.py --template-file=translator/tests/data/tosca_helloworld.yaml --template-type=tosca --output-file=/tmp/hot_helloworld.yaml + python heat_translator.py --template-file=samples/tests/data/tosca_helloworld.yaml --template-type=tosca --output-file=/tmp/hot_helloworld.yaml An optional argument can be provided to handle user inputs parameters. Also, a template file can only be validated instead of translation by using --validate-only=true optional argument. The command below shows an example usage:: @@ -61,7 +61,7 @@ optional argument. The command below shows an example usage:: Alternatively, you can install a particular release of Heat-Translator as available at https://pypi.org/project/heat-translator. In this case, you can simply run translation via CLI entry point:: - heat-translator --template-file=translator/tests/data/tosca_helloworld.yaml --template-type=tosca + heat-translator --template-file=samples/tests/data/tosca_helloworld.yaml --template-type=tosca Things To Consider ------------------ @@ -77,14 +77,14 @@ Things To Consider * The ``flavor`` and ``image`` properties of ``OS::Nova::Server`` resource is irrelevant to the TOSCA specification and can not be used in the TOSCA template as such. Heat-Translator sets these properties in the translated template based on constraints defined per TOSCA Compute OS and HOST capabilities. However, user may required to use these properties in template in certain circumstances, so in that case, TOSCA Compute can be extended - with these properties and later used in the node template. For a good example, refer to the ``translator/tests/data/test_tosca_flavor_and_image.yaml`` test + with these properties and later used in the node template. For a good example, refer to the ``samples/tests/data/test_tosca_flavor_and_image.yaml`` test template. * The Heat-Translator can be used to automatically deploy translated TOSCA template given that your environment has python-heatclient and python-keystoneclient. This can be achieved by providing ``--deploy`` argument to the Heat-Translator. You can provide desired stack name by providing it as ``--stack-name `` argument. If you do not provide ``--stack-name``, an unique name will be created and used. Below is an example command to deploy translated template with a desired stack name:: - heat-translator --template-file translator/tests/data/tosca_helloworld.yaml --stack-name mystack --deploy + heat-translator --template-file samples/tests/data/tosca_helloworld.yaml --stack-name mystack --deploy * The Heat-Translator supports translation of TOSCA templates to Heat Senlin resources (e.g. ``OS::Senlin::Cluster``) but that requires to use a specific @@ -92,8 +92,8 @@ Things To Consider The ``tosca.policies.Scaling.Cluster`` is a custom type that derives from ``tosca.policies.Scaling``. For example usage, refer to the ``tosca_cluster_autoscaling.yaml`` and ``hot_cluster_autoscaling.yaml`` - provided under the ``translator/tests/data/autoscaling`` and - ``translator/tests/data/hot_output/autoscaling`` directories respectively in + provided under the ``samples/tests/data/autoscaling`` and + ``samples/tests/data/hot_output/autoscaling`` directories respectively in the heat-translator project (``https://github.com/openstack/heat-translator``). When you use ``tosca.policies.Scaling`` normative node type, the Heat-Translator will translate it to ``OS::Heat::AutoScalingGroup`` Heat @@ -118,4 +118,4 @@ Things To Consider Below is an example of how to use this on the command line:: - heat-translator --template-file translator/tests/data/autoscaling/tosca_autoscaling.yaml --output-file /tmp/hot.yaml + heat-translator --template-file samples/tests/data/autoscaling/tosca_autoscaling.yaml --output-file /tmp/hot.yaml diff --git a/translator/container/docker/dockerfile b/samples/docker/dockerfile similarity index 100% rename from translator/container/docker/dockerfile rename to samples/docker/dockerfile diff --git a/translator/tests/data/artifacts/collectd/config.py b/samples/tests/data/artifacts/collectd/config.py similarity index 100% rename from translator/tests/data/artifacts/collectd/config.py rename to samples/tests/data/artifacts/collectd/config.py diff --git a/translator/tests/data/artifacts/collectd/create.sh b/samples/tests/data/artifacts/collectd/create.sh similarity index 100% rename from translator/tests/data/artifacts/collectd/create.sh rename to samples/tests/data/artifacts/collectd/create.sh diff --git a/translator/tests/data/artifacts/collectd/start.sh b/samples/tests/data/artifacts/collectd/start.sh similarity index 100% rename from translator/tests/data/artifacts/collectd/start.sh rename to samples/tests/data/artifacts/collectd/start.sh diff --git a/translator/tests/data/artifacts/elasticsearch/create.sh b/samples/tests/data/artifacts/elasticsearch/create.sh similarity index 100% rename from translator/tests/data/artifacts/elasticsearch/create.sh rename to samples/tests/data/artifacts/elasticsearch/create.sh diff --git a/translator/tests/data/artifacts/elasticsearch/start.sh b/samples/tests/data/artifacts/elasticsearch/start.sh similarity index 100% rename from translator/tests/data/artifacts/elasticsearch/start.sh rename to samples/tests/data/artifacts/elasticsearch/start.sh diff --git a/translator/tests/data/artifacts/kibana/config.sh b/samples/tests/data/artifacts/kibana/config.sh similarity index 100% rename from translator/tests/data/artifacts/kibana/config.sh rename to samples/tests/data/artifacts/kibana/config.sh diff --git a/translator/tests/data/artifacts/kibana/create.sh b/samples/tests/data/artifacts/kibana/create.sh similarity index 100% rename from translator/tests/data/artifacts/kibana/create.sh rename to samples/tests/data/artifacts/kibana/create.sh diff --git a/translator/tests/data/artifacts/kibana/start.sh b/samples/tests/data/artifacts/kibana/start.sh similarity index 100% rename from translator/tests/data/artifacts/kibana/start.sh rename to samples/tests/data/artifacts/kibana/start.sh diff --git a/translator/tests/data/artifacts/logstash/configure_collectd.py b/samples/tests/data/artifacts/logstash/configure_collectd.py similarity index 100% rename from translator/tests/data/artifacts/logstash/configure_collectd.py rename to samples/tests/data/artifacts/logstash/configure_collectd.py diff --git a/translator/tests/data/artifacts/logstash/configure_elasticsearch.py b/samples/tests/data/artifacts/logstash/configure_elasticsearch.py similarity index 100% rename from translator/tests/data/artifacts/logstash/configure_elasticsearch.py rename to samples/tests/data/artifacts/logstash/configure_elasticsearch.py diff --git a/translator/tests/data/artifacts/logstash/configure_rsyslog.py b/samples/tests/data/artifacts/logstash/configure_rsyslog.py similarity index 100% rename from translator/tests/data/artifacts/logstash/configure_rsyslog.py rename to samples/tests/data/artifacts/logstash/configure_rsyslog.py diff --git a/translator/tests/data/artifacts/logstash/create.sh b/samples/tests/data/artifacts/logstash/create.sh similarity index 100% rename from translator/tests/data/artifacts/logstash/create.sh rename to samples/tests/data/artifacts/logstash/create.sh diff --git a/translator/tests/data/artifacts/logstash/start.sh b/samples/tests/data/artifacts/logstash/start.sh similarity index 100% rename from translator/tests/data/artifacts/logstash/start.sh rename to samples/tests/data/artifacts/logstash/start.sh diff --git a/translator/tests/data/artifacts/mongodb/config.sh b/samples/tests/data/artifacts/mongodb/config.sh old mode 100644 new mode 100755 similarity index 100% rename from translator/tests/data/artifacts/mongodb/config.sh rename to samples/tests/data/artifacts/mongodb/config.sh diff --git a/translator/tests/data/artifacts/mongodb/create.sh b/samples/tests/data/artifacts/mongodb/create.sh old mode 100644 new mode 100755 similarity index 100% rename from translator/tests/data/artifacts/mongodb/create.sh rename to samples/tests/data/artifacts/mongodb/create.sh diff --git a/translator/tests/data/artifacts/mongodb/create_database.sh b/samples/tests/data/artifacts/mongodb/create_database.sh old mode 100644 new mode 100755 similarity index 100% rename from translator/tests/data/artifacts/mongodb/create_database.sh rename to samples/tests/data/artifacts/mongodb/create_database.sh diff --git a/translator/tests/data/artifacts/mongodb/start.sh b/samples/tests/data/artifacts/mongodb/start.sh old mode 100644 new mode 100755 similarity index 100% rename from translator/tests/data/artifacts/mongodb/start.sh rename to samples/tests/data/artifacts/mongodb/start.sh diff --git a/translator/tests/data/artifacts/mysql/mysql_database_configure.sh b/samples/tests/data/artifacts/mysql/mysql_database_configure.sh similarity index 100% rename from translator/tests/data/artifacts/mysql/mysql_database_configure.sh rename to samples/tests/data/artifacts/mysql/mysql_database_configure.sh diff --git a/translator/tests/data/artifacts/mysql/mysql_dbms_configure.sh b/samples/tests/data/artifacts/mysql/mysql_dbms_configure.sh similarity index 100% rename from translator/tests/data/artifacts/mysql/mysql_dbms_configure.sh rename to samples/tests/data/artifacts/mysql/mysql_dbms_configure.sh diff --git a/translator/tests/data/artifacts/mysql/mysql_dbms_install.sh b/samples/tests/data/artifacts/mysql/mysql_dbms_install.sh similarity index 100% rename from translator/tests/data/artifacts/mysql/mysql_dbms_install.sh rename to samples/tests/data/artifacts/mysql/mysql_dbms_install.sh diff --git a/translator/tests/data/artifacts/mysql/mysql_dbms_start.sh b/samples/tests/data/artifacts/mysql/mysql_dbms_start.sh similarity index 100% rename from translator/tests/data/artifacts/mysql/mysql_dbms_start.sh rename to samples/tests/data/artifacts/mysql/mysql_dbms_start.sh diff --git a/translator/tests/data/artifacts/nodejs/config.sh b/samples/tests/data/artifacts/nodejs/config.sh old mode 100644 new mode 100755 similarity index 100% rename from translator/tests/data/artifacts/nodejs/config.sh rename to samples/tests/data/artifacts/nodejs/config.sh diff --git a/translator/tests/data/artifacts/nodejs/create.sh b/samples/tests/data/artifacts/nodejs/create.sh old mode 100644 new mode 100755 similarity index 100% rename from translator/tests/data/artifacts/nodejs/create.sh rename to samples/tests/data/artifacts/nodejs/create.sh diff --git a/translator/tests/data/artifacts/nodejs/start.sh b/samples/tests/data/artifacts/nodejs/start.sh old mode 100644 new mode 100755 similarity index 100% rename from translator/tests/data/artifacts/nodejs/start.sh rename to samples/tests/data/artifacts/nodejs/start.sh diff --git a/translator/tests/data/artifacts/rsyslog/config.sh b/samples/tests/data/artifacts/rsyslog/config.sh old mode 100644 new mode 100755 similarity index 100% rename from translator/tests/data/artifacts/rsyslog/config.sh rename to samples/tests/data/artifacts/rsyslog/config.sh diff --git a/translator/tests/data/artifacts/rsyslog/create.sh b/samples/tests/data/artifacts/rsyslog/create.sh similarity index 100% rename from translator/tests/data/artifacts/rsyslog/create.sh rename to samples/tests/data/artifacts/rsyslog/create.sh diff --git a/translator/tests/data/artifacts/rsyslog/start.sh b/samples/tests/data/artifacts/rsyslog/start.sh similarity index 100% rename from translator/tests/data/artifacts/rsyslog/start.sh rename to samples/tests/data/artifacts/rsyslog/start.sh diff --git a/translator/tests/data/artifacts/ssh/ssh_generate_keys.sh b/samples/tests/data/artifacts/ssh/ssh_generate_keys.sh old mode 100644 new mode 100755 similarity index 100% rename from translator/tests/data/artifacts/ssh/ssh_generate_keys.sh rename to samples/tests/data/artifacts/ssh/ssh_generate_keys.sh diff --git a/translator/tests/data/artifacts/ssh/ssh_import_public_key.sh b/samples/tests/data/artifacts/ssh/ssh_import_public_key.sh old mode 100644 new mode 100755 similarity index 100% rename from translator/tests/data/artifacts/ssh/ssh_import_public_key.sh rename to samples/tests/data/artifacts/ssh/ssh_import_public_key.sh diff --git a/translator/tests/data/artifacts/webserver/webserver_install.sh b/samples/tests/data/artifacts/webserver/webserver_install.sh similarity index 100% rename from translator/tests/data/artifacts/webserver/webserver_install.sh rename to samples/tests/data/artifacts/webserver/webserver_install.sh diff --git a/translator/tests/data/artifacts/webserver/webserver_start.sh b/samples/tests/data/artifacts/webserver/webserver_start.sh similarity index 100% rename from translator/tests/data/artifacts/webserver/webserver_start.sh rename to samples/tests/data/artifacts/webserver/webserver_start.sh diff --git a/translator/tests/data/artifacts/wordpress/wordpress_configure.sh b/samples/tests/data/artifacts/wordpress/wordpress_configure.sh similarity index 100% rename from translator/tests/data/artifacts/wordpress/wordpress_configure.sh rename to samples/tests/data/artifacts/wordpress/wordpress_configure.sh diff --git a/translator/tests/data/artifacts/wordpress/wordpress_install.sh b/samples/tests/data/artifacts/wordpress/wordpress_install.sh similarity index 100% rename from translator/tests/data/artifacts/wordpress/wordpress_install.sh rename to samples/tests/data/artifacts/wordpress/wordpress_install.sh diff --git a/translator/tests/data/autoscaling/tosca_autoscaling.yaml b/samples/tests/data/autoscaling/tosca_autoscaling.yaml similarity index 100% rename from translator/tests/data/autoscaling/tosca_autoscaling.yaml rename to samples/tests/data/autoscaling/tosca_autoscaling.yaml diff --git a/translator/tests/data/autoscaling/tosca_cluster_autoscaling.yaml b/samples/tests/data/autoscaling/tosca_cluster_autoscaling.yaml similarity index 100% rename from translator/tests/data/autoscaling/tosca_cluster_autoscaling.yaml rename to samples/tests/data/autoscaling/tosca_cluster_autoscaling.yaml diff --git a/translator/tests/data/csar_elk.zip b/samples/tests/data/csar_elk.zip similarity index 100% rename from translator/tests/data/csar_elk.zip rename to samples/tests/data/csar_elk.zip diff --git a/translator/tests/data/csar_hello_world.zip b/samples/tests/data/csar_hello_world.zip similarity index 100% rename from translator/tests/data/csar_hello_world.zip rename to samples/tests/data/csar_hello_world.zip diff --git a/translator/tests/data/csar_metadata_not_yaml.zip b/samples/tests/data/csar_metadata_not_yaml.zip similarity index 100% rename from translator/tests/data/csar_metadata_not_yaml.zip rename to samples/tests/data/csar_metadata_not_yaml.zip diff --git a/translator/tests/data/csar_not_zip.zip b/samples/tests/data/csar_not_zip.zip similarity index 100% rename from translator/tests/data/csar_not_zip.zip rename to samples/tests/data/csar_not_zip.zip diff --git a/translator/tests/data/csar_single_instance_wordpress.zip b/samples/tests/data/csar_single_instance_wordpress.zip similarity index 100% rename from translator/tests/data/csar_single_instance_wordpress.zip rename to samples/tests/data/csar_single_instance_wordpress.zip diff --git a/translator/tests/data/csar_wordpress_invalid_import_path.zip b/samples/tests/data/csar_wordpress_invalid_import_path.zip similarity index 100% rename from translator/tests/data/csar_wordpress_invalid_import_path.zip rename to samples/tests/data/csar_wordpress_invalid_import_path.zip diff --git a/translator/tests/data/csar_wordpress_invalid_script_url.zip b/samples/tests/data/csar_wordpress_invalid_script_url.zip similarity index 100% rename from translator/tests/data/csar_wordpress_invalid_script_url.zip rename to samples/tests/data/csar_wordpress_invalid_script_url.zip diff --git a/translator/tests/data/csar_wrong_metadata_file.zip b/samples/tests/data/csar_wrong_metadata_file.zip similarity index 100% rename from translator/tests/data/csar_wrong_metadata_file.zip rename to samples/tests/data/csar_wrong_metadata_file.zip diff --git a/translator/tests/data/custom_types/collectd.yaml b/samples/tests/data/custom_types/collectd.yaml similarity index 100% rename from translator/tests/data/custom_types/collectd.yaml rename to samples/tests/data/custom_types/collectd.yaml diff --git a/translator/tests/data/custom_types/custom_monitoring.yaml b/samples/tests/data/custom_types/custom_monitoring.yaml similarity index 100% rename from translator/tests/data/custom_types/custom_monitoring.yaml rename to samples/tests/data/custom_types/custom_monitoring.yaml diff --git a/translator/tests/data/custom_types/elasticsearch.yaml b/samples/tests/data/custom_types/elasticsearch.yaml similarity index 100% rename from translator/tests/data/custom_types/elasticsearch.yaml rename to samples/tests/data/custom_types/elasticsearch.yaml diff --git a/translator/tests/data/custom_types/kibana.yaml b/samples/tests/data/custom_types/kibana.yaml similarity index 100% rename from translator/tests/data/custom_types/kibana.yaml rename to samples/tests/data/custom_types/kibana.yaml diff --git a/translator/tests/data/custom_types/logstash.yaml b/samples/tests/data/custom_types/logstash.yaml similarity index 100% rename from translator/tests/data/custom_types/logstash.yaml rename to samples/tests/data/custom_types/logstash.yaml diff --git a/translator/tests/data/custom_types/paypalpizzastore_nodejs_app.yaml b/samples/tests/data/custom_types/paypalpizzastore_nodejs_app.yaml similarity index 100% rename from translator/tests/data/custom_types/paypalpizzastore_nodejs_app.yaml rename to samples/tests/data/custom_types/paypalpizzastore_nodejs_app.yaml diff --git a/translator/tests/data/custom_types/rsyslog.yaml b/samples/tests/data/custom_types/rsyslog.yaml similarity index 100% rename from translator/tests/data/custom_types/rsyslog.yaml rename to samples/tests/data/custom_types/rsyslog.yaml diff --git a/translator/tests/data/custom_types/senlin_cluster_policies.yaml b/samples/tests/data/custom_types/senlin_cluster_policies.yaml similarity index 100% rename from translator/tests/data/custom_types/senlin_cluster_policies.yaml rename to samples/tests/data/custom_types/senlin_cluster_policies.yaml diff --git a/translator/tests/data/custom_types/wordpress.yaml b/samples/tests/data/custom_types/wordpress.yaml similarity index 100% rename from translator/tests/data/custom_types/wordpress.yaml rename to samples/tests/data/custom_types/wordpress.yaml diff --git a/translator/tests/data/etsi_nfv/etsi_nfv_sol001_common_types.yaml b/samples/tests/data/etsi_nfv/etsi_nfv_sol001_common_types.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/etsi_nfv_sol001_common_types.yaml rename to samples/tests/data/etsi_nfv/etsi_nfv_sol001_common_types.yaml diff --git a/translator/tests/data/etsi_nfv/etsi_nfv_sol001_vnfd_types.yaml b/samples/tests/data/etsi_nfv/etsi_nfv_sol001_vnfd_types.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/etsi_nfv_sol001_vnfd_types.yaml rename to samples/tests/data/etsi_nfv/etsi_nfv_sol001_vnfd_types.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_blockstorage.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_blockstorage.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_blockstorage.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_blockstorage.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_check_cp_order.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_check_cp_order.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_check_cp_order.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_check_cp_order.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_cp.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_cp.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_cp.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_cp.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_cp_with_extended_vnic_type.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_cp_with_extended_vnic_type.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_cp_with_extended_vnic_type.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_cp_with_extended_vnic_type.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_non_leaf_in_vl.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_non_leaf_in_vl.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_non_leaf_in_vl.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_non_leaf_in_vl.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_scaling_non_deltas_in_aspect_delta.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_scaling_non_deltas_in_aspect_delta.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_scaling_non_deltas_in_aspect_delta.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_scaling_non_deltas_in_aspect_delta.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_scaling_non_target_vdu_in_aspect_delta.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_scaling_non_target_vdu_in_aspect_delta.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_scaling_non_target_vdu_in_aspect_delta.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_scaling_non_target_vdu_in_aspect_delta.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_scaling_non_target_vdu_in_initial_delta.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_scaling_non_target_vdu_in_initial_delta.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_scaling_non_target_vdu_in_initial_delta.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_scaling_non_target_vdu_in_initial_delta.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_vdu.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_vdu.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_vdu.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_vdu.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_vdu_affinity_with_scope_nfvi.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_vdu_affinity_with_scope_nfvi.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_vdu_affinity_with_scope_nfvi.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_vdu_affinity_with_scope_nfvi.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_vdu_affinity_with_unsupported_scope.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_vdu_affinity_with_unsupported_scope.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_vdu_affinity_with_unsupported_scope.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_vdu_affinity_with_unsupported_scope.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_vdu_affinity_with_unsupported_targets.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_vdu_affinity_with_unsupported_targets.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_vdu_affinity_with_unsupported_targets.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_vdu_affinity_with_unsupported_targets.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_vdu_cp_vl_with_mixed_scaling.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_vdu_cp_vl_with_mixed_scaling.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_vdu_cp_vl_with_mixed_scaling.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_vdu_cp_vl_with_mixed_scaling.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_vdu_cp_with_scaling_multi_aspects.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_vdu_cp_with_scaling_multi_aspects.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_vdu_cp_with_scaling_multi_aspects.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_vdu_cp_with_scaling_multi_aspects.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_vdu_with_compute_requirements.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_vdu_with_compute_requirements.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_vdu_with_compute_requirements.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_vdu_with_compute_requirements.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_vdu_with_invalid_compute_requirements.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_vdu_with_invalid_compute_requirements.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_vdu_with_invalid_compute_requirements.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_vdu_with_invalid_compute_requirements.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_vdu_with_logical_node.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_vdu_with_logical_node.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_vdu_with_logical_node.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_vdu_with_logical_node.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_vdu_with_unsupported_storage.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_vdu_with_unsupported_storage.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_vdu_with_unsupported_storage.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_vdu_with_unsupported_storage.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_vl.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_vl.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_vl.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_vl.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_vl_with_unsupported_protocol.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_vl_with_unsupported_protocol.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_vl_with_unsupported_protocol.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_vl_with_unsupported_protocol.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_vnf.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_vnf.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_vnf.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_vnf.yaml diff --git a/translator/tests/data/etsi_nfv/tosca_nfv_vnf_vdu_cp_vl_blockstorage_with_scaling.yaml b/samples/tests/data/etsi_nfv/tosca_nfv_vnf_vdu_cp_vl_blockstorage_with_scaling.yaml similarity index 100% rename from translator/tests/data/etsi_nfv/tosca_nfv_vnf_vdu_cp_vl_blockstorage_with_scaling.yaml rename to samples/tests/data/etsi_nfv/tosca_nfv_vnf_vdu_cp_vl_blockstorage_with_scaling.yaml diff --git a/translator/tests/data/hot_output/autoscaling/asg_res.yaml b/samples/tests/data/hot_output/autoscaling/asg_res.yaml similarity index 100% rename from translator/tests/data/hot_output/autoscaling/asg_res.yaml rename to samples/tests/data/hot_output/autoscaling/asg_res.yaml diff --git a/translator/tests/data/hot_output/autoscaling/hot_autoscaling.yaml b/samples/tests/data/hot_output/autoscaling/hot_autoscaling.yaml similarity index 100% rename from translator/tests/data/hot_output/autoscaling/hot_autoscaling.yaml rename to samples/tests/data/hot_output/autoscaling/hot_autoscaling.yaml diff --git a/translator/tests/data/hot_output/autoscaling/hot_cluster_autoscaling.yaml b/samples/tests/data/hot_output/autoscaling/hot_cluster_autoscaling.yaml similarity index 100% rename from translator/tests/data/hot_output/autoscaling/hot_cluster_autoscaling.yaml rename to samples/tests/data/hot_output/autoscaling/hot_cluster_autoscaling.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/hot_nfv_blockstorage.yaml b/samples/tests/data/hot_output/etsi_nfv/hot_nfv_blockstorage.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/hot_nfv_blockstorage.yaml rename to samples/tests/data/hot_output/etsi_nfv/hot_nfv_blockstorage.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/hot_nfv_check_cp_order.yaml b/samples/tests/data/hot_output/etsi_nfv/hot_nfv_check_cp_order.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/hot_nfv_check_cp_order.yaml rename to samples/tests/data/hot_output/etsi_nfv/hot_nfv_check_cp_order.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/hot_nfv_cp.yaml b/samples/tests/data/hot_output/etsi_nfv/hot_nfv_cp.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/hot_nfv_cp.yaml rename to samples/tests/data/hot_output/etsi_nfv/hot_nfv_cp.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/hot_nfv_cp_with_extended_vnic_type.yaml b/samples/tests/data/hot_output/etsi_nfv/hot_nfv_cp_with_extended_vnic_type.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/hot_nfv_cp_with_extended_vnic_type.yaml rename to samples/tests/data/hot_output/etsi_nfv/hot_nfv_cp_with_extended_vnic_type.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/hot_nfv_non_leaf_in_vl.yaml b/samples/tests/data/hot_output/etsi_nfv/hot_nfv_non_leaf_in_vl.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/hot_nfv_non_leaf_in_vl.yaml rename to samples/tests/data/hot_output/etsi_nfv/hot_nfv_non_leaf_in_vl.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/hot_nfv_vdu.yaml b/samples/tests/data/hot_output/etsi_nfv/hot_nfv_vdu.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/hot_nfv_vdu.yaml rename to samples/tests/data/hot_output/etsi_nfv/hot_nfv_vdu.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_affinity_with_scope_nfvi.yaml b/samples/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_affinity_with_scope_nfvi.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_affinity_with_scope_nfvi.yaml rename to samples/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_affinity_with_scope_nfvi.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_affinity_with_unsupported_scope.yaml b/samples/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_affinity_with_unsupported_scope.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_affinity_with_unsupported_scope.yaml rename to samples/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_affinity_with_unsupported_scope.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_affinity_with_unsupported_targets.yaml b/samples/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_affinity_with_unsupported_targets.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_affinity_with_unsupported_targets.yaml rename to samples/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_affinity_with_unsupported_targets.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_with_compute_requirements.yaml b/samples/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_with_compute_requirements.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_with_compute_requirements.yaml rename to samples/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_with_compute_requirements.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_with_invalid_compute_requirements.yaml b/samples/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_with_invalid_compute_requirements.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_with_invalid_compute_requirements.yaml rename to samples/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_with_invalid_compute_requirements.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_with_logical_node.yaml b/samples/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_with_logical_node.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_with_logical_node.yaml rename to samples/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_with_logical_node.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_with_unsupported_storage.yaml b/samples/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_with_unsupported_storage.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_with_unsupported_storage.yaml rename to samples/tests/data/hot_output/etsi_nfv/hot_nfv_vdu_with_unsupported_storage.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/hot_nfv_vl.yaml b/samples/tests/data/hot_output/etsi_nfv/hot_nfv_vl.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/hot_nfv_vl.yaml rename to samples/tests/data/hot_output/etsi_nfv/hot_nfv_vl.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/hot_nfv_vl_with_unsupported_protocol.yaml b/samples/tests/data/hot_output/etsi_nfv/hot_nfv_vl_with_unsupported_protocol.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/hot_nfv_vl_with_unsupported_protocol.yaml rename to samples/tests/data/hot_output/etsi_nfv/hot_nfv_vl_with_unsupported_protocol.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/hot_nfv_vnf.yaml b/samples/tests/data/hot_output/etsi_nfv/hot_nfv_vnf.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/hot_nfv_vnf.yaml rename to samples/tests/data/hot_output/etsi_nfv/hot_nfv_vnf.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/scaling_non_deltas_in_aspect_delta/hot_nfv_scaling_non_deltas_in_aspect_delta.yaml b/samples/tests/data/hot_output/etsi_nfv/scaling_non_deltas_in_aspect_delta/hot_nfv_scaling_non_deltas_in_aspect_delta.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/scaling_non_deltas_in_aspect_delta/hot_nfv_scaling_non_deltas_in_aspect_delta.yaml rename to samples/tests/data/hot_output/etsi_nfv/scaling_non_deltas_in_aspect_delta/hot_nfv_scaling_non_deltas_in_aspect_delta.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/scaling_non_deltas_in_aspect_delta/worker_instance.hot.yaml b/samples/tests/data/hot_output/etsi_nfv/scaling_non_deltas_in_aspect_delta/worker_instance.hot.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/scaling_non_deltas_in_aspect_delta/worker_instance.hot.yaml rename to samples/tests/data/hot_output/etsi_nfv/scaling_non_deltas_in_aspect_delta/worker_instance.hot.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/scaling_non_target_vdu_in_aspect_delta/hot_nfv_scaling_non_target_vdu_in_aspect_delta.yaml b/samples/tests/data/hot_output/etsi_nfv/scaling_non_target_vdu_in_aspect_delta/hot_nfv_scaling_non_target_vdu_in_aspect_delta.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/scaling_non_target_vdu_in_aspect_delta/hot_nfv_scaling_non_target_vdu_in_aspect_delta.yaml rename to samples/tests/data/hot_output/etsi_nfv/scaling_non_target_vdu_in_aspect_delta/hot_nfv_scaling_non_target_vdu_in_aspect_delta.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/scaling_non_target_vdu_in_aspect_delta/worker_instance.hot.yaml b/samples/tests/data/hot_output/etsi_nfv/scaling_non_target_vdu_in_aspect_delta/worker_instance.hot.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/scaling_non_target_vdu_in_aspect_delta/worker_instance.hot.yaml rename to samples/tests/data/hot_output/etsi_nfv/scaling_non_target_vdu_in_aspect_delta/worker_instance.hot.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/scaling_non_target_vdu_in_initial_delta/hot_nfv_scaling_non_target_vdu_in_initial_delta.yaml b/samples/tests/data/hot_output/etsi_nfv/scaling_non_target_vdu_in_initial_delta/hot_nfv_scaling_non_target_vdu_in_initial_delta.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/scaling_non_target_vdu_in_initial_delta/hot_nfv_scaling_non_target_vdu_in_initial_delta.yaml rename to samples/tests/data/hot_output/etsi_nfv/scaling_non_target_vdu_in_initial_delta/hot_nfv_scaling_non_target_vdu_in_initial_delta.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/scaling_non_target_vdu_in_initial_delta/worker_instance.hot.yaml b/samples/tests/data/hot_output/etsi_nfv/scaling_non_target_vdu_in_initial_delta/worker_instance.hot.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/scaling_non_target_vdu_in_initial_delta/worker_instance.hot.yaml rename to samples/tests/data/hot_output/etsi_nfv/scaling_non_target_vdu_in_initial_delta/worker_instance.hot.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/vdu_cp_vl_with_mixed_scaling/hot_nfv_vdu_cp_vl_with_mixed_scaling.yaml b/samples/tests/data/hot_output/etsi_nfv/vdu_cp_vl_with_mixed_scaling/hot_nfv_vdu_cp_vl_with_mixed_scaling.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/vdu_cp_vl_with_mixed_scaling/hot_nfv_vdu_cp_vl_with_mixed_scaling.yaml rename to samples/tests/data/hot_output/etsi_nfv/vdu_cp_vl_with_mixed_scaling/hot_nfv_vdu_cp_vl_with_mixed_scaling.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/vdu_cp_vl_with_mixed_scaling/worker_instance.hot.yaml b/samples/tests/data/hot_output/etsi_nfv/vdu_cp_vl_with_mixed_scaling/worker_instance.hot.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/vdu_cp_vl_with_mixed_scaling/worker_instance.hot.yaml rename to samples/tests/data/hot_output/etsi_nfv/vdu_cp_vl_with_mixed_scaling/worker_instance.hot.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/vdu_cp_with_scaling_multi_aspects/hot_nfv_vdu_cp_with_scaling_multi_aspects.yaml b/samples/tests/data/hot_output/etsi_nfv/vdu_cp_with_scaling_multi_aspects/hot_nfv_vdu_cp_with_scaling_multi_aspects.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/vdu_cp_with_scaling_multi_aspects/hot_nfv_vdu_cp_with_scaling_multi_aspects.yaml rename to samples/tests/data/hot_output/etsi_nfv/vdu_cp_with_scaling_multi_aspects/hot_nfv_vdu_cp_with_scaling_multi_aspects.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/vdu_cp_with_scaling_multi_aspects/worker_instance1.hot.yaml b/samples/tests/data/hot_output/etsi_nfv/vdu_cp_with_scaling_multi_aspects/worker_instance1.hot.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/vdu_cp_with_scaling_multi_aspects/worker_instance1.hot.yaml rename to samples/tests/data/hot_output/etsi_nfv/vdu_cp_with_scaling_multi_aspects/worker_instance1.hot.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/vdu_cp_with_scaling_multi_aspects/worker_instance2.hot.yaml b/samples/tests/data/hot_output/etsi_nfv/vdu_cp_with_scaling_multi_aspects/worker_instance2.hot.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/vdu_cp_with_scaling_multi_aspects/worker_instance2.hot.yaml rename to samples/tests/data/hot_output/etsi_nfv/vdu_cp_with_scaling_multi_aspects/worker_instance2.hot.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/vnf_vdu_cp_vl_blockstorage_with_scaling/hot_nfv_vnf_vdu_cp_vl_blockstorage_with_scaling.yaml b/samples/tests/data/hot_output/etsi_nfv/vnf_vdu_cp_vl_blockstorage_with_scaling/hot_nfv_vnf_vdu_cp_vl_blockstorage_with_scaling.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/vnf_vdu_cp_vl_blockstorage_with_scaling/hot_nfv_vnf_vdu_cp_vl_blockstorage_with_scaling.yaml rename to samples/tests/data/hot_output/etsi_nfv/vnf_vdu_cp_vl_blockstorage_with_scaling/hot_nfv_vnf_vdu_cp_vl_blockstorage_with_scaling.yaml diff --git a/translator/tests/data/hot_output/etsi_nfv/vnf_vdu_cp_vl_blockstorage_with_scaling/worker_instance.hot.yaml b/samples/tests/data/hot_output/etsi_nfv/vnf_vdu_cp_vl_blockstorage_with_scaling/worker_instance.hot.yaml similarity index 100% rename from translator/tests/data/hot_output/etsi_nfv/vnf_vdu_cp_vl_blockstorage_with_scaling/worker_instance.hot.yaml rename to samples/tests/data/hot_output/etsi_nfv/vnf_vdu_cp_vl_blockstorage_with_scaling/worker_instance.hot.yaml diff --git a/translator/tests/data/hot_output/hot_artifact.yaml b/samples/tests/data/hot_output/hot_artifact.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_artifact.yaml rename to samples/tests/data/hot_output/hot_artifact.yaml diff --git a/translator/tests/data/hot_output/hot_custom_type.yaml b/samples/tests/data/hot_output/hot_custom_type.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_custom_type.yaml rename to samples/tests/data/hot_output/hot_custom_type.yaml diff --git a/translator/tests/data/hot_output/hot_custom_type_with_override.yaml b/samples/tests/data/hot_output/hot_custom_type_with_override.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_custom_type_with_override.yaml rename to samples/tests/data/hot_output/hot_custom_type_with_override.yaml diff --git a/translator/tests/data/hot_output/hot_custom_type_with_param_override.yaml b/samples/tests/data/hot_output/hot_custom_type_with_param_override.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_custom_type_with_param_override.yaml rename to samples/tests/data/hot_output/hot_custom_type_with_param_override.yaml diff --git a/translator/tests/data/hot_output/hot_elk.yaml b/samples/tests/data/hot_output/hot_elk.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_elk.yaml rename to samples/tests/data/hot_output/hot_elk.yaml diff --git a/translator/tests/data/hot_output/hot_elk_from_csar.yaml b/samples/tests/data/hot_output/hot_elk_from_csar.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_elk_from_csar.yaml rename to samples/tests/data/hot_output/hot_elk_from_csar.yaml diff --git a/translator/tests/data/hot_output/hot_exchange_public_ssh_key.yaml b/samples/tests/data/hot_output/hot_exchange_public_ssh_key.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_exchange_public_ssh_key.yaml rename to samples/tests/data/hot_output/hot_exchange_public_ssh_key.yaml diff --git a/translator/tests/data/hot_output/hot_flavor_and_image.yaml b/samples/tests/data/hot_output/hot_flavor_and_image.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_flavor_and_image.yaml rename to samples/tests/data/hot_output/hot_flavor_and_image.yaml diff --git a/translator/tests/data/hot_output/hot_flavor_and_image_params.yaml b/samples/tests/data/hot_output/hot_flavor_and_image_params.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_flavor_and_image_params.yaml rename to samples/tests/data/hot_output/hot_flavor_and_image_params.yaml diff --git a/translator/tests/data/hot_output/hot_get_functions_semantic.yaml b/samples/tests/data/hot_output/hot_get_functions_semantic.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_get_functions_semantic.yaml rename to samples/tests/data/hot_output/hot_get_functions_semantic.yaml diff --git a/translator/tests/data/hot_output/hot_hello_world.yaml b/samples/tests/data/hot_output/hot_hello_world.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_hello_world.yaml rename to samples/tests/data/hot_output/hot_hello_world.yaml diff --git a/translator/tests/data/hot_output/hot_hello_world_userkey.yaml b/samples/tests/data/hot_output/hot_hello_world_userkey.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_hello_world_userkey.yaml rename to samples/tests/data/hot_output/hot_hello_world_userkey.yaml diff --git a/translator/tests/data/hot_output/hot_host_assignment.yaml b/samples/tests/data/hot_output/hot_host_assignment.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_host_assignment.yaml rename to samples/tests/data/hot_output/hot_host_assignment.yaml diff --git a/translator/tests/data/hot_output/hot_nodejs_mongodb_two_instances.yaml b/samples/tests/data/hot_output/hot_nodejs_mongodb_two_instances.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_nodejs_mongodb_two_instances.yaml rename to samples/tests/data/hot_output/hot_nodejs_mongodb_two_instances.yaml diff --git a/translator/tests/data/hot_output/hot_script_types.yaml b/samples/tests/data/hot_output/hot_script_types.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_script_types.yaml rename to samples/tests/data/hot_output/hot_script_types.yaml diff --git a/translator/tests/data/hot_output/hot_single_instance_wordpress.yaml b/samples/tests/data/hot_output/hot_single_instance_wordpress.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_single_instance_wordpress.yaml rename to samples/tests/data/hot_output/hot_single_instance_wordpress.yaml diff --git a/translator/tests/data/hot_output/hot_single_instance_wordpress_from_csar.yaml b/samples/tests/data/hot_output/hot_single_instance_wordpress_from_csar.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_single_instance_wordpress_from_csar.yaml rename to samples/tests/data/hot_output/hot_single_instance_wordpress_from_csar.yaml diff --git a/translator/tests/data/hot_output/hot_single_object_store.yaml b/samples/tests/data/hot_output/hot_single_object_store.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_single_object_store.yaml rename to samples/tests/data/hot_output/hot_single_object_store.yaml diff --git a/translator/tests/data/hot_output/hot_single_server.yaml b/samples/tests/data/hot_output/hot_single_server.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_single_server.yaml rename to samples/tests/data/hot_output/hot_single_server.yaml diff --git a/translator/tests/data/hot_output/hot_single_server_with_defaults_with_input.yaml b/samples/tests/data/hot_output/hot_single_server_with_defaults_with_input.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_single_server_with_defaults_with_input.yaml rename to samples/tests/data/hot_output/hot_single_server_with_defaults_with_input.yaml diff --git a/translator/tests/data/hot_output/hot_single_server_with_defaults_without_input.yaml b/samples/tests/data/hot_output/hot_single_server_with_defaults_without_input.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_single_server_with_defaults_without_input.yaml rename to samples/tests/data/hot_output/hot_single_server_with_defaults_without_input.yaml diff --git a/translator/tests/data/hot_output/hot_single_server_without_tosca_os_version.yaml b/samples/tests/data/hot_output/hot_single_server_without_tosca_os_version.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_single_server_without_tosca_os_version.yaml rename to samples/tests/data/hot_output/hot_single_server_without_tosca_os_version.yaml diff --git a/translator/tests/data/hot_output/hot_software_component.yaml b/samples/tests/data/hot_output/hot_software_component.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_software_component.yaml rename to samples/tests/data/hot_output/hot_software_component.yaml diff --git a/translator/tests/data/hot_output/hot_software_component_multiple_hosts.yaml b/samples/tests/data/hot_output/hot_software_component_multiple_hosts.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_software_component_multiple_hosts.yaml rename to samples/tests/data/hot_output/hot_software_component_multiple_hosts.yaml diff --git a/translator/tests/data/hot_output/hot_web_application.yaml b/samples/tests/data/hot_output/hot_web_application.yaml similarity index 100% rename from translator/tests/data/hot_output/hot_web_application.yaml rename to samples/tests/data/hot_output/hot_web_application.yaml diff --git a/translator/tests/data/hot_output/interfaces/hot_interface_on_compute.yaml b/samples/tests/data/hot_output/interfaces/hot_interface_on_compute.yaml similarity index 100% rename from translator/tests/data/hot_output/interfaces/hot_interface_on_compute.yaml rename to samples/tests/data/hot_output/interfaces/hot_interface_on_compute.yaml diff --git a/translator/tests/data/hot_output/monitoring/asg_res.yaml b/samples/tests/data/hot_output/monitoring/asg_res.yaml similarity index 100% rename from translator/tests/data/hot_output/monitoring/asg_res.yaml rename to samples/tests/data/hot_output/monitoring/asg_res.yaml diff --git a/translator/tests/data/hot_output/monitoring/hot_monitoring_scaling.yaml b/samples/tests/data/hot_output/monitoring/hot_monitoring_scaling.yaml similarity index 100% rename from translator/tests/data/hot_output/monitoring/hot_monitoring_scaling.yaml rename to samples/tests/data/hot_output/monitoring/hot_monitoring_scaling.yaml diff --git a/translator/tests/data/hot_output/network/hot_custom_network_nodes.yaml b/samples/tests/data/hot_output/network/hot_custom_network_nodes.yaml similarity index 100% rename from translator/tests/data/hot_output/network/hot_custom_network_nodes.yaml rename to samples/tests/data/hot_output/network/hot_custom_network_nodes.yaml diff --git a/translator/tests/data/hot_output/network/hot_one_server_one_network.yaml b/samples/tests/data/hot_output/network/hot_one_server_one_network.yaml similarity index 100% rename from translator/tests/data/hot_output/network/hot_one_server_one_network.yaml rename to samples/tests/data/hot_output/network/hot_one_server_one_network.yaml diff --git a/translator/tests/data/hot_output/network/hot_one_server_three_networks.yaml b/samples/tests/data/hot_output/network/hot_one_server_three_networks.yaml similarity index 100% rename from translator/tests/data/hot_output/network/hot_one_server_three_networks.yaml rename to samples/tests/data/hot_output/network/hot_one_server_three_networks.yaml diff --git a/translator/tests/data/hot_output/network/hot_server_on_existing_network.yaml b/samples/tests/data/hot_output/network/hot_server_on_existing_network.yaml similarity index 100% rename from translator/tests/data/hot_output/network/hot_server_on_existing_network.yaml rename to samples/tests/data/hot_output/network/hot_server_on_existing_network.yaml diff --git a/translator/tests/data/hot_output/network/hot_two_servers_one_network.yaml b/samples/tests/data/hot_output/network/hot_two_servers_one_network.yaml similarity index 100% rename from translator/tests/data/hot_output/network/hot_two_servers_one_network.yaml rename to samples/tests/data/hot_output/network/hot_two_servers_one_network.yaml diff --git a/translator/tests/data/hot_output/nfv/SP1_res.yaml b/samples/tests/data/hot_output/nfv/SP1_res.yaml similarity index 100% rename from translator/tests/data/hot_output/nfv/SP1_res.yaml rename to samples/tests/data/hot_output/nfv/SP1_res.yaml diff --git a/translator/tests/data/hot_output/nfv/SP_res.yaml b/samples/tests/data/hot_output/nfv/SP_res.yaml similarity index 100% rename from translator/tests/data/hot_output/nfv/SP_res.yaml rename to samples/tests/data/hot_output/nfv/SP_res.yaml diff --git a/translator/tests/data/hot_output/nfv/hot_nfv_sample.yaml b/samples/tests/data/hot_output/nfv/hot_nfv_sample.yaml similarity index 100% rename from translator/tests/data/hot_output/nfv/hot_nfv_sample.yaml rename to samples/tests/data/hot_output/nfv/hot_nfv_sample.yaml diff --git a/translator/tests/data/hot_output/nfv/hot_policy_anti_affinity.yaml b/samples/tests/data/hot_output/nfv/hot_policy_anti_affinity.yaml similarity index 100% rename from translator/tests/data/hot_output/nfv/hot_policy_anti_affinity.yaml rename to samples/tests/data/hot_output/nfv/hot_policy_anti_affinity.yaml diff --git a/translator/tests/data/hot_output/nfv/hot_policy_soft_affinity.yaml b/samples/tests/data/hot_output/nfv/hot_policy_soft_affinity.yaml similarity index 100% rename from translator/tests/data/hot_output/nfv/hot_policy_soft_affinity.yaml rename to samples/tests/data/hot_output/nfv/hot_policy_soft_affinity.yaml diff --git a/translator/tests/data/hot_output/nfv/hot_tosca_nfv_autoscaling.yaml b/samples/tests/data/hot_output/nfv/hot_tosca_nfv_autoscaling.yaml similarity index 100% rename from translator/tests/data/hot_output/nfv/hot_tosca_nfv_autoscaling.yaml rename to samples/tests/data/hot_output/nfv/hot_tosca_nfv_autoscaling.yaml diff --git a/translator/tests/data/hot_output/nfv/hot_tosca_nfv_autoscaling_with_param.yaml b/samples/tests/data/hot_output/nfv/hot_tosca_nfv_autoscaling_with_param.yaml similarity index 100% rename from translator/tests/data/hot_output/nfv/hot_tosca_nfv_autoscaling_with_param.yaml rename to samples/tests/data/hot_output/nfv/hot_tosca_nfv_autoscaling_with_param.yaml diff --git a/translator/tests/data/hot_output/policies/hot_policies.yaml b/samples/tests/data/hot_output/policies/hot_policies.yaml similarity index 100% rename from translator/tests/data/hot_output/policies/hot_policies.yaml rename to samples/tests/data/hot_output/policies/hot_policies.yaml diff --git a/translator/tests/data/hot_output/reservation/SP_RSV_res.yaml b/samples/tests/data/hot_output/reservation/SP_RSV_res.yaml similarity index 100% rename from translator/tests/data/hot_output/reservation/SP_RSV_res.yaml rename to samples/tests/data/hot_output/reservation/SP_RSV_res.yaml diff --git a/translator/tests/data/hot_output/reservation/hot_reservation_scaling.yaml b/samples/tests/data/hot_output/reservation/hot_reservation_scaling.yaml similarity index 100% rename from translator/tests/data/hot_output/reservation/hot_reservation_scaling.yaml rename to samples/tests/data/hot_output/reservation/hot_reservation_scaling.yaml diff --git a/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment.yaml b/samples/tests/data/hot_output/storage/hot_blockstorage_with_attachment.yaml similarity index 100% rename from translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment.yaml rename to samples/tests/data/hot_output/storage/hot_blockstorage_with_attachment.yaml diff --git a/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation1_alt1.yaml b/samples/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation1_alt1.yaml similarity index 100% rename from translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation1_alt1.yaml rename to samples/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation1_alt1.yaml diff --git a/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation1_alt2.yaml b/samples/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation1_alt2.yaml similarity index 100% rename from translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation1_alt2.yaml rename to samples/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation1_alt2.yaml diff --git a/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation2_alt1.yaml b/samples/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation2_alt1.yaml similarity index 100% rename from translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation2_alt1.yaml rename to samples/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation2_alt1.yaml diff --git a/translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation2_alt2.yaml b/samples/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation2_alt2.yaml similarity index 100% rename from translator/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation2_alt2.yaml rename to samples/tests/data/hot_output/storage/hot_blockstorage_with_attachment_notation2_alt2.yaml diff --git a/translator/tests/data/hot_output/storage/hot_blockstorage_with_custom_relationship_type.yaml b/samples/tests/data/hot_output/storage/hot_blockstorage_with_custom_relationship_type.yaml similarity index 100% rename from translator/tests/data/hot_output/storage/hot_blockstorage_with_custom_relationship_type.yaml rename to samples/tests/data/hot_output/storage/hot_blockstorage_with_custom_relationship_type.yaml diff --git a/translator/tests/data/hot_output/storage/hot_blockstorage_with_relationship_template.yaml b/samples/tests/data/hot_output/storage/hot_blockstorage_with_relationship_template.yaml similarity index 100% rename from translator/tests/data/hot_output/storage/hot_blockstorage_with_relationship_template.yaml rename to samples/tests/data/hot_output/storage/hot_blockstorage_with_relationship_template.yaml diff --git a/translator/tests/data/hot_output/storage/hot_multiple_blockstorage_w_multiple_attachment.yaml b/samples/tests/data/hot_output/storage/hot_multiple_blockstorage_w_multiple_attachment.yaml similarity index 100% rename from translator/tests/data/hot_output/storage/hot_multiple_blockstorage_w_multiple_attachment.yaml rename to samples/tests/data/hot_output/storage/hot_multiple_blockstorage_w_multiple_attachment.yaml diff --git a/translator/tests/data/hot_output/storage/hot_multiple_blockstorage_with_attachment_alt1.yaml b/samples/tests/data/hot_output/storage/hot_multiple_blockstorage_with_attachment_alt1.yaml similarity index 100% rename from translator/tests/data/hot_output/storage/hot_multiple_blockstorage_with_attachment_alt1.yaml rename to samples/tests/data/hot_output/storage/hot_multiple_blockstorage_with_attachment_alt1.yaml diff --git a/translator/tests/data/hot_output/storage/hot_multiple_blockstorage_with_attachment_alt2.yaml b/samples/tests/data/hot_output/storage/hot_multiple_blockstorage_with_attachment_alt2.yaml similarity index 100% rename from translator/tests/data/hot_output/storage/hot_multiple_blockstorage_with_attachment_alt2.yaml rename to samples/tests/data/hot_output/storage/hot_multiple_blockstorage_with_attachment_alt2.yaml diff --git a/translator/tests/data/interfaces/test_tosca_interface_on_compute.yaml b/samples/tests/data/interfaces/test_tosca_interface_on_compute.yaml similarity index 100% rename from translator/tests/data/interfaces/test_tosca_interface_on_compute.yaml rename to samples/tests/data/interfaces/test_tosca_interface_on_compute.yaml diff --git a/translator/tests/data/interfaces/test_tosca_script_types.yaml b/samples/tests/data/interfaces/test_tosca_script_types.yaml similarity index 100% rename from translator/tests/data/interfaces/test_tosca_script_types.yaml rename to samples/tests/data/interfaces/test_tosca_script_types.yaml diff --git a/translator/tests/data/monitoring/tosca_monitoring_scaling.yaml b/samples/tests/data/monitoring/tosca_monitoring_scaling.yaml similarity index 100% rename from translator/tests/data/monitoring/tosca_monitoring_scaling.yaml rename to samples/tests/data/monitoring/tosca_monitoring_scaling.yaml diff --git a/translator/tests/data/network/test_tosca_custom_network_nodes_defs.yaml b/samples/tests/data/network/test_tosca_custom_network_nodes_defs.yaml similarity index 100% rename from translator/tests/data/network/test_tosca_custom_network_nodes_defs.yaml rename to samples/tests/data/network/test_tosca_custom_network_nodes_defs.yaml diff --git a/translator/tests/data/network/test_tosca_custom_network_nodes_imports.yaml b/samples/tests/data/network/test_tosca_custom_network_nodes_imports.yaml similarity index 100% rename from translator/tests/data/network/test_tosca_custom_network_nodes_imports.yaml rename to samples/tests/data/network/test_tosca_custom_network_nodes_imports.yaml diff --git a/translator/tests/data/network/test_tosca_custom_network_nodes_inline.yaml b/samples/tests/data/network/test_tosca_custom_network_nodes_inline.yaml similarity index 100% rename from translator/tests/data/network/test_tosca_custom_network_nodes_inline.yaml rename to samples/tests/data/network/test_tosca_custom_network_nodes_inline.yaml diff --git a/translator/tests/data/network/tosca_one_server_one_network.yaml b/samples/tests/data/network/tosca_one_server_one_network.yaml similarity index 100% rename from translator/tests/data/network/tosca_one_server_one_network.yaml rename to samples/tests/data/network/tosca_one_server_one_network.yaml diff --git a/translator/tests/data/network/tosca_one_server_three_networks.yaml b/samples/tests/data/network/tosca_one_server_three_networks.yaml similarity index 100% rename from translator/tests/data/network/tosca_one_server_three_networks.yaml rename to samples/tests/data/network/tosca_one_server_three_networks.yaml diff --git a/translator/tests/data/network/tosca_server_on_existing_network.yaml b/samples/tests/data/network/tosca_server_on_existing_network.yaml similarity index 100% rename from translator/tests/data/network/tosca_server_on_existing_network.yaml rename to samples/tests/data/network/tosca_server_on_existing_network.yaml diff --git a/translator/tests/data/network/tosca_two_servers_one_network.yaml b/samples/tests/data/network/tosca_two_servers_one_network.yaml similarity index 100% rename from translator/tests/data/network/tosca_two_servers_one_network.yaml rename to samples/tests/data/network/tosca_two_servers_one_network.yaml diff --git a/translator/tests/data/nfv/tacker_defs.yaml b/samples/tests/data/nfv/tacker_defs.yaml similarity index 100% rename from translator/tests/data/nfv/tacker_defs.yaml rename to samples/tests/data/nfv/tacker_defs.yaml diff --git a/translator/tests/data/nfv/tacker_nfv_defs.yaml b/samples/tests/data/nfv/tacker_nfv_defs.yaml similarity index 100% rename from translator/tests/data/nfv/tacker_nfv_defs.yaml rename to samples/tests/data/nfv/tacker_nfv_defs.yaml diff --git a/translator/tests/data/nfv/test_tosca_nfv_autoscaling.yaml b/samples/tests/data/nfv/test_tosca_nfv_autoscaling.yaml similarity index 100% rename from translator/tests/data/nfv/test_tosca_nfv_autoscaling.yaml rename to samples/tests/data/nfv/test_tosca_nfv_autoscaling.yaml diff --git a/translator/tests/data/nfv/test_tosca_nfv_autoscaling_with_params.yaml b/samples/tests/data/nfv/test_tosca_nfv_autoscaling_with_params.yaml similarity index 100% rename from translator/tests/data/nfv/test_tosca_nfv_autoscaling_with_params.yaml rename to samples/tests/data/nfv/test_tosca_nfv_autoscaling_with_params.yaml diff --git a/translator/tests/data/nfv/test_tosca_nfv_sample.yaml b/samples/tests/data/nfv/test_tosca_nfv_sample.yaml similarity index 100% rename from translator/tests/data/nfv/test_tosca_nfv_sample.yaml rename to samples/tests/data/nfv/test_tosca_nfv_sample.yaml diff --git a/translator/tests/data/nfv/test_tosca_unsupported_policy_type.yaml b/samples/tests/data/nfv/test_tosca_unsupported_policy_type.yaml similarity index 100% rename from translator/tests/data/nfv/test_tosca_unsupported_policy_type.yaml rename to samples/tests/data/nfv/test_tosca_unsupported_policy_type.yaml diff --git a/translator/tests/data/nfv/tosca_placement_policy_affinity.yaml b/samples/tests/data/nfv/tosca_placement_policy_affinity.yaml similarity index 100% rename from translator/tests/data/nfv/tosca_placement_policy_affinity.yaml rename to samples/tests/data/nfv/tosca_placement_policy_affinity.yaml diff --git a/translator/tests/data/nfv/tosca_placement_policy_anti_affinity.yaml b/samples/tests/data/nfv/tosca_placement_policy_anti_affinity.yaml similarity index 100% rename from translator/tests/data/nfv/tosca_placement_policy_anti_affinity.yaml rename to samples/tests/data/nfv/tosca_placement_policy_anti_affinity.yaml diff --git a/translator/tests/data/nfv/tosca_placement_policy_soft_affinity.yaml b/samples/tests/data/nfv/tosca_placement_policy_soft_affinity.yaml similarity index 100% rename from translator/tests/data/nfv/tosca_placement_policy_soft_affinity.yaml rename to samples/tests/data/nfv/tosca_placement_policy_soft_affinity.yaml diff --git a/translator/tests/data/policies/tosca_policies.yaml b/samples/tests/data/policies/tosca_policies.yaml similarity index 100% rename from translator/tests/data/policies/tosca_policies.yaml rename to samples/tests/data/policies/tosca_policies.yaml diff --git a/translator/tests/data/reservation/tosca-vnfd-reservation-id.yaml b/samples/tests/data/reservation/tosca-vnfd-reservation-id.yaml similarity index 93% rename from translator/tests/data/reservation/tosca-vnfd-reservation-id.yaml rename to samples/tests/data/reservation/tosca-vnfd-reservation-id.yaml index 6545147b..9d1a30cd 100644 --- a/translator/tests/data/reservation/tosca-vnfd-reservation-id.yaml +++ b/samples/tests/data/reservation/tosca-vnfd-reservation-id.yaml @@ -3,8 +3,8 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0 description: VNF TOSCA template with reservation_id input parameters. imports: - - translator/tests/data/nfv/tacker_defs.yaml - - translator/tests/data/nfv/tacker_nfv_defs.yaml + - samples/tests/data/nfv/tacker_defs.yaml + - samples/tests/data/nfv/tacker_nfv_defs.yaml topology_template: inputs: diff --git a/translator/tests/data/storage/tosca_blockstorage_with_attachment.yaml b/samples/tests/data/storage/tosca_blockstorage_with_attachment.yaml similarity index 100% rename from translator/tests/data/storage/tosca_blockstorage_with_attachment.yaml rename to samples/tests/data/storage/tosca_blockstorage_with_attachment.yaml diff --git a/translator/tests/data/storage/tosca_blockstorage_with_attachment_notation1.yaml b/samples/tests/data/storage/tosca_blockstorage_with_attachment_notation1.yaml similarity index 100% rename from translator/tests/data/storage/tosca_blockstorage_with_attachment_notation1.yaml rename to samples/tests/data/storage/tosca_blockstorage_with_attachment_notation1.yaml diff --git a/translator/tests/data/storage/tosca_blockstorage_with_attachment_notation2.yaml b/samples/tests/data/storage/tosca_blockstorage_with_attachment_notation2.yaml similarity index 100% rename from translator/tests/data/storage/tosca_blockstorage_with_attachment_notation2.yaml rename to samples/tests/data/storage/tosca_blockstorage_with_attachment_notation2.yaml diff --git a/translator/tests/data/storage/tosca_blockstorage_with_custom_relationship_type.yaml b/samples/tests/data/storage/tosca_blockstorage_with_custom_relationship_type.yaml similarity index 100% rename from translator/tests/data/storage/tosca_blockstorage_with_custom_relationship_type.yaml rename to samples/tests/data/storage/tosca_blockstorage_with_custom_relationship_type.yaml diff --git a/translator/tests/data/storage/tosca_blockstorage_with_relationship_template.yaml b/samples/tests/data/storage/tosca_blockstorage_with_relationship_template.yaml similarity index 100% rename from translator/tests/data/storage/tosca_blockstorage_with_relationship_template.yaml rename to samples/tests/data/storage/tosca_blockstorage_with_relationship_template.yaml diff --git a/translator/tests/data/storage/tosca_multiple_blockstorage_w_multiple_attachment.yaml b/samples/tests/data/storage/tosca_multiple_blockstorage_w_multiple_attachment.yaml similarity index 100% rename from translator/tests/data/storage/tosca_multiple_blockstorage_w_multiple_attachment.yaml rename to samples/tests/data/storage/tosca_multiple_blockstorage_w_multiple_attachment.yaml diff --git a/translator/tests/data/storage/tosca_multiple_blockstorage_with_attachment.yaml b/samples/tests/data/storage/tosca_multiple_blockstorage_with_attachment.yaml similarity index 100% rename from translator/tests/data/storage/tosca_multiple_blockstorage_with_attachment.yaml rename to samples/tests/data/storage/tosca_multiple_blockstorage_with_attachment.yaml diff --git a/translator/tests/data/storage/tosca_single_object_store.yaml b/samples/tests/data/storage/tosca_single_object_store.yaml similarity index 100% rename from translator/tests/data/storage/tosca_single_object_store.yaml rename to samples/tests/data/storage/tosca_single_object_store.yaml diff --git a/translator/tests/data/test_host_assignment.yaml b/samples/tests/data/test_host_assignment.yaml similarity index 100% rename from translator/tests/data/test_host_assignment.yaml rename to samples/tests/data/test_host_assignment.yaml diff --git a/translator/tests/data/test_single_server_without_optional_version_prop.yaml b/samples/tests/data/test_single_server_without_optional_version_prop.yaml similarity index 100% rename from translator/tests/data/test_single_server_without_optional_version_prop.yaml rename to samples/tests/data/test_single_server_without_optional_version_prop.yaml diff --git a/translator/tests/data/test_tosca_artifact.yaml b/samples/tests/data/test_tosca_artifact.yaml similarity index 100% rename from translator/tests/data/test_tosca_artifact.yaml rename to samples/tests/data/test_tosca_artifact.yaml diff --git a/translator/tests/data/test_tosca_custom_type.yaml b/samples/tests/data/test_tosca_custom_type.yaml similarity index 100% rename from translator/tests/data/test_tosca_custom_type.yaml rename to samples/tests/data/test_tosca_custom_type.yaml diff --git a/translator/tests/data/test_tosca_custom_type_with_override.yaml b/samples/tests/data/test_tosca_custom_type_with_override.yaml similarity index 100% rename from translator/tests/data/test_tosca_custom_type_with_override.yaml rename to samples/tests/data/test_tosca_custom_type_with_override.yaml diff --git a/translator/tests/data/test_tosca_flavor_and_image.yaml b/samples/tests/data/test_tosca_flavor_and_image.yaml similarity index 100% rename from translator/tests/data/test_tosca_flavor_and_image.yaml rename to samples/tests/data/test_tosca_flavor_and_image.yaml diff --git a/translator/tests/data/test_tosca_get_functions_semantic.yaml b/samples/tests/data/test_tosca_get_functions_semantic.yaml similarity index 100% rename from translator/tests/data/test_tosca_get_functions_semantic.yaml rename to samples/tests/data/test_tosca_get_functions_semantic.yaml diff --git a/translator/tests/data/test_tosca_unsupported_type.yaml b/samples/tests/data/test_tosca_unsupported_type.yaml similarity index 100% rename from translator/tests/data/test_tosca_unsupported_type.yaml rename to samples/tests/data/test_tosca_unsupported_type.yaml diff --git a/translator/tests/data/tosca_elk.yaml b/samples/tests/data/tosca_elk.yaml similarity index 100% rename from translator/tests/data/tosca_elk.yaml rename to samples/tests/data/tosca_elk.yaml diff --git a/translator/tests/data/tosca_exchange_public_ssh_key.yaml b/samples/tests/data/tosca_exchange_public_ssh_key.yaml similarity index 100% rename from translator/tests/data/tosca_exchange_public_ssh_key.yaml rename to samples/tests/data/tosca_exchange_public_ssh_key.yaml diff --git a/translator/tests/data/tosca_helloworld.yaml b/samples/tests/data/tosca_helloworld.yaml similarity index 100% rename from translator/tests/data/tosca_helloworld.yaml rename to samples/tests/data/tosca_helloworld.yaml diff --git a/translator/tests/data/tosca_helloworld_invalid.yaml b/samples/tests/data/tosca_helloworld_invalid.yaml similarity index 100% rename from translator/tests/data/tosca_helloworld_invalid.yaml rename to samples/tests/data/tosca_helloworld_invalid.yaml diff --git a/translator/tests/data/tosca_nodejs_mongodb_two_instances.yaml b/samples/tests/data/tosca_nodejs_mongodb_two_instances.yaml similarity index 100% rename from translator/tests/data/tosca_nodejs_mongodb_two_instances.yaml rename to samples/tests/data/tosca_nodejs_mongodb_two_instances.yaml diff --git a/translator/tests/data/tosca_single_instance_wordpress.yaml b/samples/tests/data/tosca_single_instance_wordpress.yaml similarity index 100% rename from translator/tests/data/tosca_single_instance_wordpress.yaml rename to samples/tests/data/tosca_single_instance_wordpress.yaml diff --git a/translator/tests/data/tosca_single_instance_wordpress_with_local_abspath_import.yaml b/samples/tests/data/tosca_single_instance_wordpress_with_local_abspath_import.yaml similarity index 100% rename from translator/tests/data/tosca_single_instance_wordpress_with_local_abspath_import.yaml rename to samples/tests/data/tosca_single_instance_wordpress_with_local_abspath_import.yaml diff --git a/translator/tests/data/tosca_single_instance_wordpress_with_url_import.yaml b/samples/tests/data/tosca_single_instance_wordpress_with_url_import.yaml similarity index 96% rename from translator/tests/data/tosca_single_instance_wordpress_with_url_import.yaml rename to samples/tests/data/tosca_single_instance_wordpress_with_url_import.yaml index 69dbfebc..f641206b 100644 --- a/translator/tests/data/tosca_single_instance_wordpress_with_url_import.yaml +++ b/samples/tests/data/tosca_single_instance_wordpress_with_url_import.yaml @@ -4,7 +4,7 @@ description: > TOSCA simple profile with wordpress, web server and mysql on the same server. imports: - - https://raw.githubusercontent.com/openstack/heat-translator/master/translator/tests/data/custom_types/wordpress.yaml + - samples/tests/data/custom_types/wordpress.yaml topology_template: inputs: diff --git a/translator/tests/data/tosca_single_server.yaml b/samples/tests/data/tosca_single_server.yaml similarity index 100% rename from translator/tests/data/tosca_single_server.yaml rename to samples/tests/data/tosca_single_server.yaml diff --git a/translator/tests/data/tosca_single_server_with_defaults.yaml b/samples/tests/data/tosca_single_server_with_defaults.yaml similarity index 100% rename from translator/tests/data/tosca_single_server_with_defaults.yaml rename to samples/tests/data/tosca_single_server_with_defaults.yaml diff --git a/translator/tests/data/tosca_software_component.yaml b/samples/tests/data/tosca_software_component.yaml similarity index 100% rename from translator/tests/data/tosca_software_component.yaml rename to samples/tests/data/tosca_software_component.yaml diff --git a/translator/tests/data/tosca_software_component_multiple_hosts.yaml b/samples/tests/data/tosca_software_component_multiple_hosts.yaml similarity index 100% rename from translator/tests/data/tosca_software_component_multiple_hosts.yaml rename to samples/tests/data/tosca_software_component_multiple_hosts.yaml diff --git a/translator/tests/data/tosca_web_application.yaml b/samples/tests/data/tosca_web_application.yaml similarity index 100% rename from translator/tests/data/tosca_web_application.yaml rename to samples/tests/data/tosca_web_application.yaml diff --git a/tox.ini b/tox.ini index 9f2694ff..3a7b696c 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,6 @@ envlist = py38,pep8 ignore_basepython_conflict = true minversion = 3.2.0 -skipsdist = True [testenv] basepython = python3 diff --git a/translator/hot/tests/test_translate_outputs.py b/translator/hot/tests/test_translate_outputs.py index 955150e5..b0e41411 100644 --- a/translator/hot/tests/test_translate_outputs.py +++ b/translator/hot/tests/test_translate_outputs.py @@ -10,19 +10,17 @@ # License for the specific language governing permissions and limitations # under the License. -import os from toscaparser.tests.base import TestCase from toscaparser.tosca_template import ToscaTemplate import toscaparser.utils.yamlparser from translator.hot.tosca_translator import TOSCATranslator +from translator.tests import utils class ToscaTemplateOutputTest(TestCase): def test_translate_output(self): - tosca_tpl = os.path.join( - os.path.dirname(os.path.abspath(__file__)), - "../../tests/data/" + tosca_tpl = utils.test_sample( "tosca_nodejs_mongodb_two_instances.yaml") tosca = ToscaTemplate(tosca_tpl) translate = TOSCATranslator(tosca, []) diff --git a/translator/hot/tosca/etsi_nfv/common_affinityrule/__init__.py b/translator/hot/tosca/etsi_nfv/common_affinityrule/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/translator/osc/v1/tests/test_translate.py b/translator/osc/v1/tests/test_translate.py index 67bcf9cf..5fcb5cda 100644 --- a/translator/osc/v1/tests/test_translate.py +++ b/translator/osc/v1/tests/test_translate.py @@ -10,6 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. +import os import testtools from unittest import mock @@ -19,15 +20,17 @@ except ImportError: from io import StringIO import toscaparser.utils.yamlparser +import toscaparser from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import URLException from toscaparser.common.exception import ValidationError +from toscaparser.tosca_template import ToscaTemplate from toscaparser.utils.gettextutils import _ from translator.common.utils import CompareUtils from translator.common.utils import YamlUtils from translator.osc.v1.tests import fakes -from translator.osc.v1.tests import utils from translator.osc.v1 import translate +from translator.tests import utils class TestTranslateTemplate(testtools.TestCase): @@ -77,36 +80,36 @@ class TestTranslateTemplate(testtools.TestCase): actual_output, expected_output)) def test_osc_translate_single_server(self): - tosca_file = utils.get_template_path("tosca_single_server.yaml") + tosca_file = utils.test_sample("tosca_single_server.yaml") - hot_file = utils.get_template_path("hot_output/hot_single_server.yaml") + hot_file = utils.test_sample("hot_output/hot_single_server.yaml") params = {'cpus': 1} self._check_success(tosca_file, hot_file, params) def test_osc_translate_single_server_defaults_with_input(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "tosca_single_server_with_defaults.yaml") - hot_file = utils.get_template_path( + hot_file = utils.test_sample( "hot_output/hot_single_server_with_defaults_with_input.yaml") params = {'cpus': '1'} self._check_success(tosca_file, hot_file, params) def test_osc_translate_single_server_defaults_without_input(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "tosca_single_server_with_defaults.yaml") - hot_file = utils.get_template_path( + hot_file = utils.test_sample( "hot_output/hot_single_server_with_defaults_without_input.yaml") self._check_success(tosca_file, hot_file, {}) def test_osc_translate_wordpress_single_instance(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "tosca_single_instance_wordpress.yaml") - hot_file = utils.get_template_path( + hot_file = utils.test_sample( "hot_output/hot_single_instance_wordpress.yaml") params = {'db_name': 'wordpress', 'db_user': 'wp_user', @@ -117,23 +120,23 @@ class TestTranslateTemplate(testtools.TestCase): self._check_success(tosca_file, hot_file, params) def test_osc_translate_helloworld(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "tosca_helloworld.yaml") - hot_file = utils.get_template_path( + hot_file = utils.test_sample( "hot_output/hot_hello_world.yaml") self._check_success(tosca_file, hot_file, {}) def test_osc_translate_host_assignment(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "test_host_assignment.yaml") - hot_file = utils.get_template_path( + hot_file = utils.test_sample( "hot_output/hot_host_assignment.yaml") self._check_success(tosca_file, hot_file, {}) def test_osc_translate_elk(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "tosca_elk.yaml") - hot_file = utils.get_template_path( + hot_file = utils.test_sample( "hot_output/hot_elk.yaml") params = {'github_url': 'http://github.com/paypal/rest-api-sample-app-nodejs.git', @@ -141,9 +144,9 @@ class TestTranslateTemplate(testtools.TestCase): self._check_success(tosca_file, hot_file, params) def test_osc_translate_nodejs_mongodb_two_instances(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "tosca_nodejs_mongodb_two_instances.yaml") - hot_file = utils.get_template_path( + hot_file = utils.test_sample( "hot_output/hot_nodejs_mongodb_two_instances.yaml") params = {'github_url': 'http://github.com/paypal/rest-api-sample-app-nodejs.git', @@ -151,9 +154,9 @@ class TestTranslateTemplate(testtools.TestCase): self._check_success(tosca_file, hot_file, params) def test_osc_translate_blockstorage_with_attachment(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "storage/tosca_blockstorage_with_attachment.yaml") - hot_file = utils.get_template_path( + hot_file = utils.test_sample( "hot_output/storage/hot_blockstorage_with_attachment.yaml") params = {'cpus': 1, 'storage_location': '/dev/vdc', @@ -162,9 +165,9 @@ class TestTranslateTemplate(testtools.TestCase): self._check_success(tosca_file, hot_file, params) def test_osc_translate_blockstorage_with_custom_relationship_type(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "storage/tosca_blockstorage_with_custom_relationship_type.yaml") - hot_file = utils.get_template_path( + hot_file = utils.test_sample( "hot_output/storage/" "hot_blockstorage_with_custom_relationship_type.yaml") params = {'cpus': 1, @@ -174,10 +177,10 @@ class TestTranslateTemplate(testtools.TestCase): self._check_success(tosca_file, hot_file, params) def test_osc_translate_blockstorage_with_relationship_template(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "storage/" + "tosca_blockstorage_with_relationship_template.yaml") - hot_file = utils.get_template_path( + hot_file = utils.test_sample( "hot_output/storage/" + "hot_blockstorage_with_relationship_template.yaml") params = {'cpus': 1, @@ -186,13 +189,13 @@ class TestTranslateTemplate(testtools.TestCase): self._check_success(tosca_file, hot_file, params) def test_osc_translate_blockstorage_with_attachment_notation1(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "storage/" + "tosca_blockstorage_with_attachment_notation1.yaml") - hot_file1 = utils.get_template_path( + hot_file1 = utils.test_sample( "hot_output/storage/" + "hot_blockstorage_with_attachment_notation1_alt1.yaml") - hot_file2 = utils.get_template_path( + hot_file2 = utils.test_sample( "hot_output/storage/" + "hot_blockstorage_with_attachment_notation1_alt2.yaml") params = {'cpus': 1, @@ -205,13 +208,13 @@ class TestTranslateTemplate(testtools.TestCase): self._check_success(tosca_file, hot_file2, params) def test_osc_translate_blockstorage_with_attachment_notation2(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "storage/" + "tosca_blockstorage_with_attachment_notation2.yaml") - hot_file1 = utils.get_template_path( + hot_file1 = utils.test_sample( "hot_output/storage/" + "hot_blockstorage_with_attachment_notation2_alt1.yaml") - hot_file2 = utils.get_template_path( + hot_file2 = utils.test_sample( "hot_output/storage/" + "hot_blockstorage_with_attachment_notation2_alt2.yaml") params = {'cpus': 1, @@ -224,13 +227,13 @@ class TestTranslateTemplate(testtools.TestCase): self._check_success(tosca_file, hot_file2, params) def test_osc_translate_multiple_blockstorage_with_attachment(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "storage/" + "tosca_multiple_blockstorage_with_attachment.yaml") - hot_file1 = utils.get_template_path( + hot_file1 = utils.test_sample( "hot_output/storage/" + "hot_multiple_blockstorage_with_attachment_alt1.yaml") - hot_file2 = utils.get_template_path( + hot_file2 = utils.test_sample( "hot_output/storage/" + "hot_multiple_blockstorage_with_attachment_alt2.yaml") params = {'cpus': 1, @@ -243,36 +246,36 @@ class TestTranslateTemplate(testtools.TestCase): self._check_success(tosca_file, hot_file2, params) def test_osc_translate_single_object_store(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "storage/tosca_single_object_store.yaml") - hot_file = utils.get_template_path( + hot_file = utils.test_sample( "hot_output/hot_single_object_store.yaml") params = {'objectstore_name': 'myobjstore'} self._check_success(tosca_file, hot_file, params) def test_osc_translate_one_server_one_network(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "network/tosca_one_server_one_network.yaml") - hot_file = utils.get_template_path( + hot_file = utils.test_sample( "hot_output/network/" + "hot_one_server_one_network.yaml") params = {'network_name': 'private_net'} self._check_success(tosca_file, hot_file, params) def test_osc_translate_server_on_existing_network(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "network/" + "tosca_server_on_existing_network.yaml") - hot_file = utils.get_template_path( + hot_file = utils.test_sample( "hot_output/network/" + "hot_server_on_existing_network.yaml") params = {'network_name': 'private_net'} self._check_success(tosca_file, hot_file, params) def test_osc_translate_two_servers_one_network(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "network/tosca_two_servers_one_network.yaml") - hot_file = utils.get_template_path( + hot_file = utils.test_sample( "hot_output/network/" + "hot_two_servers_one_network.yaml") params = {'network_name': 'my_private_net', @@ -282,33 +285,33 @@ class TestTranslateTemplate(testtools.TestCase): self._check_success(tosca_file, hot_file, params) def test_osc_translate_one_server_three_networks(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "network/" + "tosca_one_server_three_networks.yaml") - hot_file = utils.get_template_path( + hot_file = utils.test_sample( "hot_output/network/" + "hot_one_server_three_networks.yaml") self._check_success(tosca_file, hot_file, {}) def test_osc_translate_software_component(self): - tosca_file = utils.get_template_path("tosca_software_component.yaml") - hot_file = utils.get_template_path( + tosca_file = utils.test_sample("tosca_software_component.yaml") + hot_file = utils.test_sample( "hot_output/hot_software_component.yaml") params = {'cpus': '1', 'download_url': 'http://www.software.com/download'} self._check_success(tosca_file, hot_file, params) def test_osc_translate_web_application(self): - tosca_file = utils.get_template_path("tosca_web_application.yaml") - hot_file = utils.get_template_path( + tosca_file = utils.test_sample("tosca_web_application.yaml") + hot_file = utils.test_sample( "hot_output/hot_web_application.yaml") params = {'cpus': '2', 'context_root': 'my_web_app'} self._check_success(tosca_file, hot_file, params) def test_osc_translate_template_with_url_import(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "tosca_single_instance_wordpress_with_url_import.yaml") - hot_file = utils.get_template_path( + hot_file = utils.test_sample( "hot_output/hot_single_instance_wordpress.yaml") params = {'db_name': 'wordpress', 'db_user': 'wp_user', @@ -318,69 +321,78 @@ class TestTranslateTemplate(testtools.TestCase): 'cpus': 8} self._check_success(tosca_file, hot_file, params) - def test_osc_translate_template_by_url_with_local_import(self): - tosca_file = ("https://raw.githubusercontent.com/openstack/" + - "heat-translator/master/translator/tests/data/" + - "tosca_single_instance_wordpress.yaml") - hot_file = utils.get_template_path( - "hot_output/" + - "hot_single_instance_wordpress.yaml") + @mock.patch.object(toscaparser.tosca_template, 'ToscaTemplate') + def test_osc_translate_template_by_url_with_local_import( + self, mock_tosca_template): + tosca_file = "https://example.com/tosca_single_instance_wordpress.yaml" + hot_file = utils.test_sample( + "hot_output/hot_single_instance_wordpress.yaml") params = {'db_name': 'wordpress', 'db_user': 'wp_user', 'db_pwd': 'wp_pass', 'db_root_pwd': 'passw0rd', 'db_port': 3366, 'cpus': 8} + file_path = utils.test_sample("tosca_single_instance_wordpress.yaml") + mock_tosca_template.return_value = ToscaTemplate( + file_path, params, True) self._check_success(tosca_file, hot_file, params) - def test_osc_translate_template_by_url_with_local_abspath_import(self): - tosca_file = ("https://raw.githubusercontent.com/openstack/" + - "heat-translator/master/translator/tests/data/" + - "tosca_single_instance_wordpress_with_local_abspath" + - "_import.yaml") - hot_file = utils.get_template_path( - "hot_output/" + - "hot_single_instance_wordpress.yaml") + @mock.patch.object(toscaparser.utils.urlutils.UrlUtils, 'validate_url') + @mock.patch.object(os.path, 'isfile') + @mock.patch.object(ToscaTemplate, '_get_path') + def test_osc_translate_template_by_url_with_local_abspath_import( + self, mock_get_path, mock_isfile, mock_validate_url): + tosca_file = ("https://example.com/tosca_single_instance_wordpress_" + "with_local_abspath_import.yaml") + hot_file = utils.test_sample( + "hot_output/hot_single_instance_wordpress.yaml") params = {'db_name': 'wordpress', 'db_user': 'wp_user', 'db_pwd': 'wp_pass', 'db_root_pwd': 'passw0rd', 'db_port': 3366, 'cpus': 8} + file_path = utils.test_sample( + 'tosca_single_instance_wordpress_with_local_abspath_import.yaml') + mock_get_path.return_value = file_path + mock_isfile.return_value = True + mock_validate_url.side_effect = [False, True, False, True] - expected_msg = _('Absolute file name "/tmp/wordpress.yaml" cannot be ' - 'used in a URL-based input template "https://raw.' - 'githubusercontent.com/openstack/heat-translator/' - 'master/translator/tests/data/tosca_single_instance_' - 'wordpress_with_local_abspath_import.yaml".') + expected_msg = ('Absolute file name "/tmp/wordpress.yaml" cannot be ' + f'used in a URL-based input template "{file_path}".') self._check_error(tosca_file, hot_file, params, ValidationError, expected_msg, ImportError) - def test_osc_translate_template_by_url_with_url_import(self): - tosca_url = ("https://raw.githubusercontent.com/openstack/" + - "heat-translator/master/translator/tests/data/" + - "tosca_single_instance_wordpress_with_url_import.yaml") - hot_file = utils.get_template_path( - "hot_output/" + - "hot_single_instance_wordpress.yaml") + @mock.patch.object(toscaparser.tosca_template, 'ToscaTemplate') + def test_osc_translate_template_by_url_with_url_import( + self, mock_tosca_template): + tosca_url = ("https://example.com/tosca_single_instance_wordpress_" + "with_url_import.yaml") + hot_file = utils.test_sample( + "hot_output/hot_single_instance_wordpress.yaml") params = {'db_name': 'wordpress', 'db_user': 'wp_user', 'db_pwd': 'wp_pass', 'db_root_pwd': 'passw0rd', 'db_port': 3366, 'cpus': 8} + file_path = utils.test_sample( + "tosca_single_instance_wordpress_with_url_import.yaml") + mock_tosca_template.return_value = ToscaTemplate( + file_path, params, True) self._check_success(tosca_url, hot_file, params) def test_osc_translate_hello_world_csar(self): - tosca_file = utils.get_template_path("csar_hello_world.zip") - hot_file = utils.get_template_path( + tosca_file = utils.test_sample("csar_hello_world.zip") + hot_file = utils.test_sample( "hot_output/hot_hello_world.yaml") self._check_success(tosca_file, hot_file, {}) def test_osc_single_instance_wordpress_csar(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "csar_single_instance_wordpress.zip") - hot_file = utils.get_template_path( + hot_file = utils.test_sample( "hot_output/" + "hot_single_instance_wordpress_from_csar.yaml") params = {'db_name': 'wordpress', @@ -391,25 +403,28 @@ class TestTranslateTemplate(testtools.TestCase): 'cpus': 8} self._check_success(tosca_file, hot_file, params) - def test_osc_translate_elk_csar_from_url(self): - tosca_file = ("https://github.com/openstack/heat-translator/raw/" + - "master/translator/tests/data/csar_elk.zip") - hot_file = utils.get_template_path( - "hot_output/hot_elk_from_csar.yaml") + @mock.patch.object(toscaparser.tosca_template, 'ToscaTemplate') + def test_osc_translate_elk_csar_from_url( + self, mock_tosca_template): + tosca_file = "https://example.com/csar_elk.zip" + hot_file = utils.test_sample("hot_output/hot_elk_from_csar.yaml") params = {'github_url': 'http://github.com/paypal/rest-api-sample-app-nodejs.git', 'my_cpus': 4} + zip_file_path = utils.test_sample("csar_elk.zip") + mock_tosca_template.return_value = ToscaTemplate( + zip_file_path, params, True) self._check_success(tosca_file, hot_file, params) def test_osc_translate_csar_not_zip(self): - tosca_file = utils.get_template_path("csar_not_zip.zip") + tosca_file = utils.test_sample("csar_not_zip.zip") hot_file = '' expected_msg = _('"%s" is not a valid zip file.') % tosca_file self._check_error(tosca_file, hot_file, {}, ValidationError, expected_msg, ValidationError) def test_osc_translate_csar_metadata_not_yaml(self): - tosca_file = utils.get_template_path("csar_metadata_not_yaml.zip") + tosca_file = utils.test_sample("csar_metadata_not_yaml.zip") hot_file = '' expected_msg = _('The file "TOSCA-Metadata/TOSCA.meta" in the CSAR ' '"%s" does not contain valid YAML' @@ -418,7 +433,7 @@ class TestTranslateTemplate(testtools.TestCase): expected_msg, ValidationError) def test_osc_translate_csar_wrong_metadata_file(self): - tosca_file = utils.get_template_path("csar_wrong_metadata_file.zip") + tosca_file = utils.test_sample("csar_wrong_metadata_file.zip") hot_file = '' expected_msg = _('"%s" is not a valid CSAR as it does not contain the ' @@ -428,7 +443,7 @@ class TestTranslateTemplate(testtools.TestCase): expected_msg, ValidationError) def test_osc_translate_csar_wordpress_invalid_import_path(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "csar_wordpress_invalid_import_path.zip") hot_file = '' expected_msg = _('Import ' @@ -437,7 +452,7 @@ class TestTranslateTemplate(testtools.TestCase): expected_msg, ImportError) def test_osc_translate_csar_wordpress_invalid_script_url(self): - tosca_file = utils.get_template_path( + tosca_file = utils.test_sample( "csar_wordpress_invalid_script_url.zip") hot_file = '' expected_msg = _('The resource at ' diff --git a/translator/osc/v1/translate.py b/translator/osc/v1/translate.py index 926d42a1..bc5f5340 100644 --- a/translator/osc/v1/translate.py +++ b/translator/osc/v1/translate.py @@ -18,7 +18,6 @@ import sys from cliff import command from oslo_log import log as logging -from toscaparser.tosca_template import ToscaTemplate from toscaparser.utils.gettextutils import _ from translator.common import flavors from translator.common import images @@ -67,6 +66,8 @@ class TranslateTemplate(command.Command): return parser def take_action(self, parsed_args): + from toscaparser.tosca_template import ToscaTemplate + LOG.debug(_('Translating the template with input parameters' '(%s).'), parsed_args) output = None diff --git a/translator/tests/test_etsi_tosca_hot_translation.py b/translator/tests/test_etsi_tosca_hot_translation.py index a3cb66ac..c2307000 100644 --- a/translator/tests/test_etsi_tosca_hot_translation.py +++ b/translator/tests/test_etsi_tosca_hot_translation.py @@ -21,6 +21,8 @@ from translator.tests.base import TestCase class EtsiToscaHotTranslationTest(TestCase): + test_data_relative_path = "../../samples/tests/data/" + def _test_successful_translation(self, tosca_file, hot_files, params=None): if not params: params = {} @@ -45,38 +47,38 @@ class EtsiToscaHotTranslationTest(TestCase): ExceptionCollector.assertExceptionMessage(error_collect, msg) def test_hot_translate_etsi_nfv_vnf(self): - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_vnf.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_vnf.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' - 'hot_nfv_vnf.yaml', + f'{self.test_data_relative_path}hot_output/' + 'etsi_nfv/hot_nfv_vnf.yaml', ] self._test_successful_translation(tosca_file, hot_files, params={}) def test_hot_translate_etsi_nfv_vdu(self): - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_vdu.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_vdu.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' - 'hot_nfv_vdu.yaml', + f'{self.test_data_relative_path}hot_output/' + 'etsi_nfv/hot_nfv_vdu.yaml', ] self._test_successful_translation(tosca_file, hot_files, params={}) def test_hot_translate_etsi_nfv_vdu_with_compute_requirements(self): - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_vdu_with_compute_requirements.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_vdu_with_compute_requirements.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'hot_nfv_vdu_with_compute_requirements.yaml', ] self._test_successful_translation(tosca_file, hot_files, params={}) def test_hot_translate_etsi_nfv_vdu_with_invalid_compute_requirements( self): - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_vdu_with_invalid_compute_requirements.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_vdu_with_invalid_compute_requirements.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'hot_nfv_vdu_with_invalid_compute_requirements.yaml', ] expected_msg = _('Unsupported format of ' @@ -89,19 +91,19 @@ class EtsiToscaHotTranslationTest(TestCase): ) def test_hot_translate_etsi_nfv_vdu_with_logical_node(self): - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_vdu_with_logical_node.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_vdu_with_logical_node.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'hot_nfv_vdu_with_logical_node.yaml', ] self._test_successful_translation(tosca_file, hot_files, params={}) def test_hot_translate_etsi_nfv_vdu_with_unsupported_storage(self): - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_vdu_with_unsupported_storage.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_vdu_with_unsupported_storage.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'hot_nfv_vdu_with_unsupported_storage.yaml', ] expected_msg = _('Unsupported virtual_storage, ' @@ -114,46 +116,46 @@ class EtsiToscaHotTranslationTest(TestCase): ) def test_hot_translate_etsi_nfv_cp(self): - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_cp.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_cp.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'hot_nfv_cp.yaml', ] self._test_successful_translation(tosca_file, hot_files, params={}) def test_hot_translate_etsi_nfv_cp_with_extended_vnic_type(self): - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_cp_with_extended_vnic_type.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_cp_with_extended_vnic_type.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'hot_nfv_cp_with_extended_vnic_type.yaml', ] self._test_successful_translation(tosca_file, hot_files, params={}) def test_hot_translate_etsi_nfv_check_cp_order(self): - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_check_cp_order.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_check_cp_order.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'hot_nfv_check_cp_order.yaml', ] self._test_successful_translation(tosca_file, hot_files, params={}) def test_hot_translate_etsi_nfv_vl(self): - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_vl.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_vl.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'hot_nfv_vl.yaml', ] self._test_successful_translation(tosca_file, hot_files, params={}) def test_hot_translate_etsi_nfv_vl_with_unsupported_protocol(self): - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_vl_with_unsupported_protocol.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_vl_with_unsupported_protocol.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'hot_nfv_vl_with_unsupported_protocol.yaml', ] expected_msgs = ( @@ -175,10 +177,10 @@ class EtsiToscaHotTranslationTest(TestCase): def test_hot_translate_etsi_nfv_non_leaf_in_vl(self): vl_name = 'VL1' - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_non_leaf_in_vl.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_non_leaf_in_vl.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'hot_nfv_non_leaf_in_vl.yaml', ] expected_msgs = ( @@ -193,23 +195,23 @@ class EtsiToscaHotTranslationTest(TestCase): ) def test_hot_translate_etsi_nfv_blockstorage(self): - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_blockstorage.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_blockstorage.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'hot_nfv_blockstorage.yaml', ] self._test_successful_translation(tosca_file, hot_files, params={}) def test_hot_translate_etsi_nfv_vnf_vdu_cp_vl_blockstorage_with_scaling( self): - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_vnf_vdu_cp_vl_blockstorage_with_scaling.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_vnf_vdu_cp_vl_blockstorage_with_scaling.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'vnf_vdu_cp_vl_blockstorage_with_scaling/' 'hot_nfv_vnf_vdu_cp_vl_blockstorage_with_scaling.yaml', - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'vnf_vdu_cp_vl_blockstorage_with_scaling/' 'worker_instance.hot.yaml', ] @@ -217,13 +219,13 @@ class EtsiToscaHotTranslationTest(TestCase): def test_hot_translate_etsi_nfv_vdu_cp_vl_with_mixed_scaling( self): - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_vdu_cp_vl_with_mixed_scaling.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_vdu_cp_vl_with_mixed_scaling.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'vdu_cp_vl_with_mixed_scaling/' 'hot_nfv_vdu_cp_vl_with_mixed_scaling.yaml', - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'vdu_cp_vl_with_mixed_scaling/' 'worker_instance.hot.yaml', ] @@ -231,16 +233,16 @@ class EtsiToscaHotTranslationTest(TestCase): def test_hot_translate_etsi_nfv_vdu_cp_with_scaling_multi_aspects( self): - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_vdu_cp_with_scaling_multi_aspects.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_vdu_cp_with_scaling_multi_aspects.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'vdu_cp_with_scaling_multi_aspects/' 'hot_nfv_vdu_cp_with_scaling_multi_aspects.yaml', - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'vdu_cp_with_scaling_multi_aspects/' 'worker_instance1.hot.yaml', - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'vdu_cp_with_scaling_multi_aspects/' 'worker_instance2.hot.yaml', ] @@ -250,13 +252,13 @@ class EtsiToscaHotTranslationTest(TestCase): self): aspect_name = 'worker_instance' vdu_name = 'VDU1' - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_scaling_non_target_vdu_in_initial_delta.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_scaling_non_target_vdu_in_initial_delta.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'scaling_non_target_vdu_in_initial_delta/' 'hot_nfv_scaling_non_target_vdu_in_initial_delta.yaml', - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'scaling_non_target_vdu_in_initial_delta/' 'worker_instance.hot.yaml', ] @@ -283,15 +285,14 @@ class EtsiToscaHotTranslationTest(TestCase): aspect_name = 'worker_instance' vdu_name = None delta_name = None - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_scaling_non_target_vdu_in_aspect_delta.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_scaling_non_target_vdu_in_aspect_delta.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'scaling_non_target_vdu_in_aspect_delta/' 'hot_nfv_scaling_non_target_vdu_in_aspect_delta.yaml', - '../tests/data/hot_output/etsi_nfv/' - 'scaling_non_target_vdu_in_aspect_delta/' - 'worker_instance.hot.yaml', + f'{self.test_data_relative_path}hot_output/etsi_nfv/' + 'scaling_non_target_vdu_in_aspect_delta/worker_instance.hot.yaml', ] expected_msgs = ( 'Can not create %s node ' @@ -311,13 +312,13 @@ class EtsiToscaHotTranslationTest(TestCase): aspect_name = 'worker_instance' vdu_name = 'VDU1' delta_name = 'delta_2' - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_scaling_non_deltas_in_aspect_delta.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_scaling_non_deltas_in_aspect_delta.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'scaling_non_deltas_in_aspect_delta/' 'hot_nfv_scaling_non_deltas_in_aspect_delta.yaml', - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'scaling_non_deltas_in_aspect_delta/' 'worker_instance.hot.yaml', ] @@ -333,28 +334,28 @@ class EtsiToscaHotTranslationTest(TestCase): ) def test_hot_translate_etsi_nfv_vdu_with_scope_nfvi(self): - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_vdu_affinity_with_scope_nfvi.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_vdu_affinity_with_scope_nfvi.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'hot_nfv_vdu_affinity_with_scope_nfvi.yaml', ] self._test_successful_translation(tosca_file, hot_files, params={}) def test_hot_translate_etsi_nfv_vdu_with_unsupported_scope(self): - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_vdu_affinity_with_unsupported_scope.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_vdu_affinity_with_unsupported_scope.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'hot_nfv_vdu_affinity_with_unsupported_scope.yaml', ] self._test_successful_translation(tosca_file, hot_files, params={}) def test_hot_translate_etsi_nfv_vdu_with_unsupported_targets(self): - tosca_file = '../tests/data/etsi_nfv/' \ - 'tosca_nfv_vdu_affinity_with_unsupported_targets.yaml' + tosca_file = (f'{self.test_data_relative_path}etsi_nfv/' + 'tosca_nfv_vdu_affinity_with_unsupported_targets.yaml') hot_files = [ - '../tests/data/hot_output/etsi_nfv/' + f'{self.test_data_relative_path}hot_output/etsi_nfv/' 'hot_nfv_vdu_affinity_with_unsupported_targets.yaml', ] self._test_successful_translation(tosca_file, hot_files, params={}) diff --git a/translator/tests/test_shell.py b/translator/tests/test_shell.py index 58757e9d..fb0739db 100644 --- a/translator/tests/test_shell.py +++ b/translator/tests/test_shell.py @@ -21,12 +21,11 @@ from toscaparser.common import exception from toscaparser.utils.gettextutils import _ import translator.shell as shell from translator.tests.base import TestCase +from translator.tests import utils class ShellTest(TestCase): - tosca_helloworld = os.path.join( - os.path.dirname(os.path.abspath(__file__)), - "data/tosca_helloworld.yaml") + tosca_helloworld = utils.test_sample("tosca_helloworld.yaml") template_file = '--template-file=' + tosca_helloworld template_type = '--template-type=tosca' template_validation = "--validate-only" @@ -58,9 +57,8 @@ class ShellTest(TestCase): self.fail(self.failure_msg) def test_valid_template_with_parameters(self): - tosca_single_instance_wordpress = os.path.join( - os.path.dirname(os.path.abspath(__file__)), - "data/tosca_single_instance_wordpress.yaml") + tosca_single_instance_wordpress = utils.test_sample( + "tosca_single_instance_wordpress.yaml") parameters = '--parameters="cpus=2;db_name=wpdb;db_user=test;'\ 'db_port=2000;db_root_pwd=fun2test;db_pwd=fun2test"' template = '--template-file=' + tosca_single_instance_wordpress @@ -76,9 +74,7 @@ class ShellTest(TestCase): except Exception: self.fail(self.failure_msg) - template = os.path.join( - os.path.dirname(os.path.abspath(__file__)), - "data/tosca_helloworld_invalid.yaml") + template = utils.test_sample("tosca_helloworld_invalid.yaml") invalid_template = '--template-file=' + template self.assertRaises(exception.ValidationError, shell.main, [invalid_template, self.template_type, diff --git a/translator/tests/test_template.py b/translator/tests/test_template.py index 7cced369..f897e42f 100755 --- a/translator/tests/test_template.py +++ b/translator/tests/test_template.py @@ -10,9 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. -import os from toscaparser.tosca_template import ToscaTemplate from translator.tests.base import TestCase +from translator.tests import utils class ToscaMongoNodejsTest(TestCase): @@ -21,9 +21,7 @@ class ToscaMongoNodejsTest(TestCase): 'storage_size': '1'} '''TOSCA template with nodejs, app and mongodb on 2 servers.''' - tosca_tpl = os.path.join( - os.path.dirname(os.path.abspath(__file__)), - "../tests/data/tosca_nodejs_mongodb_two_instances.yaml") + tosca_tpl = utils.test_sample('tosca_nodejs_mongodb_two_instances.yaml') tosca = ToscaTemplate(tosca_tpl, parsed_params) def test_relationship_def(self): diff --git a/translator/tests/test_tosca_hot_translation.py b/translator/tests/test_tosca_hot_translation.py index 21d9fd03..e947582a 100644 --- a/translator/tests/test_tosca_hot_translation.py +++ b/translator/tests/test_tosca_hot_translation.py @@ -12,7 +12,9 @@ import json import os +from unittest import mock +import toscaparser from toscaparser.common.exception import ExceptionCollector from toscaparser.common.exception import URLException from toscaparser.common.exception import ValidationError @@ -22,10 +24,13 @@ from translator.common.exception import UnsupportedTypeError from translator.common.utils import TranslationUtils from translator.hot.tosca_translator import TOSCATranslator from translator.tests.base import TestCase +from translator.tests import utils class ToscaHotTranslationTest(TestCase): + test_data_relative_path = "../../samples/tests/data/" + def _test_successful_translation(self, tosca_file, hot_files, params=None): if not params: params = {} @@ -50,31 +55,34 @@ class ToscaHotTranslationTest(TestCase): ExceptionCollector.assertExceptionMessage(error_collect, msg) def test_hot_translate_single_server(self): - tosca_file = '../tests/data/tosca_single_server.yaml' - hot_file = '../tests/data/hot_output/hot_single_server.yaml' + tosca_file = f'{self.test_data_relative_path}tosca_single_server.yaml' + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_single_server.yaml') params = {'cpus': 1} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_single_server_with_defaults(self): - tosca_file = \ - '../tests/data/tosca_single_server_with_defaults.yaml' - - hot_file_with_input = '../tests/data/hot_output/' \ - 'hot_single_server_with_defaults_with_input.yaml' + tosca_file = (f'{self.test_data_relative_path}' + 'tosca_single_server_with_defaults.yaml') + hot_file_with_input = (f'{self.test_data_relative_path}hot_output/' + 'hot_single_server_with_defaults_with_' + 'input.yaml') params1 = {'cpus': '1'} self._test_successful_translation(tosca_file, hot_file_with_input, params1) - hot_file_without_input = '../tests/data/hot_output/' \ - 'hot_single_server_with_defaults_without_input.yaml' + hot_file_without_input = (f'{self.test_data_relative_path}hot_output/' + 'hot_single_server_with_defaults_without_' + 'input.yaml') params2 = {} self._test_successful_translation(tosca_file, hot_file_without_input, params2) def test_hot_translate_wordpress_single_instance(self): - tosca_file = '../tests/data/tosca_single_instance_wordpress.yaml' - hot_file = '../tests/data/hot_output/' \ - 'hot_single_instance_wordpress.yaml' + tosca_file = (f'{self.test_data_relative_path}' + 'tosca_single_instance_wordpress.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_single_instance_wordpress.yaml') params = {'db_name': 'wordpress', 'db_user': 'wp_user', 'db_pwd': 'wp_pass', @@ -84,37 +92,40 @@ class ToscaHotTranslationTest(TestCase): self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_helloworld(self): - tosca_file = '../tests/data/tosca_helloworld.yaml' - hot_file = '../tests/data/hot_output/hot_hello_world.yaml' + tosca_file = f'{self.test_data_relative_path}tosca_helloworld.yaml' + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_hello_world.yaml') self._test_successful_translation(tosca_file, hot_file) def test_hot_translate_host_assignment(self): - tosca_file = '../tests/data/test_host_assignment.yaml' - hot_file = '../tests/data/hot_output/hot_host_assignment.yaml' + tosca_file = f'{self.test_data_relative_path}test_host_assignment.yaml' + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_host_assignment.yaml') self._test_successful_translation(tosca_file, hot_file) def test_hot_translate_elk(self): - tosca_file = '../tests/data/tosca_elk.yaml' - hot_file = '../tests/data/hot_output/hot_elk.yaml' + tosca_file = f'{self.test_data_relative_path}tosca_elk.yaml' + hot_file = f'{self.test_data_relative_path}hot_output/hot_elk.yaml' params = {'github_url': 'http://github.com/paypal/rest-api-sample-app-nodejs.git', 'my_cpus': 4} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_nodejs_mongodb_two_instances(self): - tosca_file = '../tests/data/tosca_nodejs_mongodb_two_instances.yaml' - hot_file = '../tests/data/hot_output/' \ - 'hot_nodejs_mongodb_two_instances.yaml' + tosca_file = (f'{self.test_data_relative_path}' + 'tosca_nodejs_mongodb_two_instances.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_nodejs_mongodb_two_instances.yaml') params = {'github_url': 'http://github.com/paypal/rest-api-sample-app-nodejs.git', 'my_cpus': 4} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_blockstorage_with_attachment(self): - tosca_file = '../tests/data/storage/' \ - 'tosca_blockstorage_with_attachment.yaml' - hot_file = '../tests/data/hot_output/storage/' \ - 'hot_blockstorage_with_attachment.yaml' + tosca_file = (f'{self.test_data_relative_path}storage/' + 'tosca_blockstorage_with_attachment.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'storage/hot_blockstorage_with_attachment.yaml') params = {'cpus': 1, 'storage_location': '/dev/vdc', 'storage_size': '2000 MB', @@ -122,10 +133,10 @@ class ToscaHotTranslationTest(TestCase): self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_blockstorage_with_custom_relationship_type(self): - tosca_file = '../tests/data/storage/' \ - 'tosca_blockstorage_with_custom_relationship_type.yaml' - hot_file = '../tests/data/hot_output/storage/' \ - 'hot_blockstorage_with_custom_relationship_type.yaml' + tosca_file = (f'{self.test_data_relative_path}storage/' + 'tosca_blockstorage_with_custom_relationship_type.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/storage/' + 'hot_blockstorage_with_custom_relationship_type.yaml') params = {'cpus': 1, 'storage_location': '/dev/vdc', 'storage_size': '1 GB', @@ -133,22 +144,22 @@ class ToscaHotTranslationTest(TestCase): self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_blockstorage_with_relationship_template(self): - tosca_file = '../tests/data/storage/' \ - 'tosca_blockstorage_with_relationship_template.yaml' - hot_file = '../tests/data/hot_output/storage/' \ - 'hot_blockstorage_with_relationship_template.yaml' + tosca_file = (f'{self.test_data_relative_path}storage/' + 'tosca_blockstorage_with_relationship_template.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/storage/' + 'hot_blockstorage_with_relationship_template.yaml') params = {'cpus': 1, 'storage_location': '/dev/vdc', 'storage_size': '1 GB'} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_blockstorage_with_attachment_notation1(self): - tosca_file = '../tests/data/storage/' \ - 'tosca_blockstorage_with_attachment_notation1.yaml' - hot_file1 = '../tests/data/hot_output/storage/' \ - 'hot_blockstorage_with_attachment_notation1_alt1.yaml' - hot_file2 = '../tests/data/hot_output/storage/' \ - 'hot_blockstorage_with_attachment_notation1_alt2.yaml' + tosca_file = (f'{self.test_data_relative_path}storage/' + 'tosca_blockstorage_with_attachment_notation1.yaml') + hot_file1 = (f'{self.test_data_relative_path}hot_output/storage/' + 'hot_blockstorage_with_attachment_notation1_alt1.yaml') + hot_file2 = (f'{self.test_data_relative_path}hot_output/storage/' + 'hot_blockstorage_with_attachment_notation1_alt2.yaml') params = {'cpus': 1, 'storage_location': 'some_folder', 'storage_size': '1 GB', @@ -160,12 +171,12 @@ class ToscaHotTranslationTest(TestCase): self._test_successful_translation(tosca_file, hot_file2, params) def test_hot_translate_blockstorage_with_attachment_notation2(self): - tosca_file = '../tests/data/storage/' \ - 'tosca_blockstorage_with_attachment_notation2.yaml' - hot_file1 = '../tests/data/hot_output/storage/' \ - 'hot_blockstorage_with_attachment_notation2_alt1.yaml' - hot_file2 = '../tests/data/hot_output/storage/' \ - 'hot_blockstorage_with_attachment_notation2_alt2.yaml' + tosca_file = (f'{self.test_data_relative_path}storage/' + 'tosca_blockstorage_with_attachment_notation2.yaml') + hot_file1 = (f'{self.test_data_relative_path}hot_output/storage/' + 'hot_blockstorage_with_attachment_notation2_alt1.yaml') + hot_file2 = (f'{self.test_data_relative_path}hot_output/storage/' + 'hot_blockstorage_with_attachment_notation2_alt2.yaml') params = {'cpus': 1, 'storage_location': '/dev/vdc', 'storage_size': '1 GB', @@ -176,12 +187,12 @@ class ToscaHotTranslationTest(TestCase): self._test_successful_translation(tosca_file, hot_file2, params) def test_hot_translate_multiple_blockstorage_with_attachment(self): - tosca_file = '../tests/data/storage/' \ - 'tosca_multiple_blockstorage_with_attachment.yaml' - hot_file1 = '../tests/data/hot_output/storage/' \ - 'hot_multiple_blockstorage_with_attachment_alt1.yaml' - hot_file2 = '../tests/data/hot_output/storage/' \ - 'hot_multiple_blockstorage_with_attachment_alt2.yaml' + tosca_file = (f'{self.test_data_relative_path}storage/' + 'tosca_multiple_blockstorage_with_attachment.yaml') + hot_file1 = (f'{self.test_data_relative_path}hot_output/storage/' + 'hot_multiple_blockstorage_with_attachment_alt1.yaml') + hot_file2 = (f'{self.test_data_relative_path}hot_output/storage/' + 'hot_multiple_blockstorage_with_attachment_alt2.yaml') params = {'cpus': 1, 'storage_location': '/dev/vdc', 'storage_size': '1 GB', @@ -192,10 +203,10 @@ class ToscaHotTranslationTest(TestCase): self._test_successful_translation(tosca_file, hot_file2, params) def test_hot_translate_multiple_blockstorage_w_multiple_attachment(self): - tosca_file = '../tests/data/storage/' \ - 'tosca_multiple_blockstorage_w_multiple_attachment.yaml' - hot_file = '../tests/data/hot_output/storage/' \ - 'hot_multiple_blockstorage_w_multiple_attachment.yaml' + tosca_file = (f'{self.test_data_relative_path}storage/' + 'tosca_multiple_blockstorage_w_multiple_attachment.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/storage/' + 'hot_multiple_blockstorage_w_multiple_attachment.yaml') params = {'cpus': 1, 'storage_location1': '/dev/vdb', 'storage_location2': '/dev/vdc', @@ -204,30 +215,34 @@ class ToscaHotTranslationTest(TestCase): self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_single_object_store(self): - tosca_file = '../tests/data/storage/tosca_single_object_store.yaml' - hot_file = '../tests/data/hot_output/hot_single_object_store.yaml' + tosca_file = (f'{self.test_data_relative_path}storage/' + 'tosca_single_object_store.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_single_object_store.yaml') params = {'objectstore_name': 'myobjstore'} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_one_server_one_network(self): - tosca_file = '../tests/data/network/tosca_one_server_one_network.yaml' - hot_file = '../tests/data/hot_output/network/' \ - 'hot_one_server_one_network.yaml' + tosca_file = (f'{self.test_data_relative_path}network' + '/tosca_one_server_one_network.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/network/' + 'hot_one_server_one_network.yaml') params = {'network_name': 'private_net'} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_server_on_existing_network(self): - tosca_file = '../tests/data/network/' \ - 'tosca_server_on_existing_network.yaml' - hot_file = '../tests/data/hot_output/network/' \ - 'hot_server_on_existing_network.yaml' + tosca_file = (f'{self.test_data_relative_path}network/' + 'tosca_server_on_existing_network.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/network/' + 'hot_server_on_existing_network.yaml') params = {'network_name': 'private_net'} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_two_servers_one_network(self): - tosca_file = '../tests/data/network/tosca_two_servers_one_network.yaml' - hot_file = '../tests/data/hot_output/network/' \ - 'hot_two_servers_one_network.yaml' + tosca_file = (f'{self.test_data_relative_path}network/' + 'tosca_two_servers_one_network.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/network/' + 'hot_two_servers_one_network.yaml') params = {'network_name': 'my_private_net', 'network_cidr': '10.0.0.0/24', 'network_start_ip': '10.0.0.100', @@ -235,40 +250,44 @@ class ToscaHotTranslationTest(TestCase): self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_one_server_three_networks(self): - tosca_file = '../tests/data/network/' \ - 'tosca_one_server_three_networks.yaml' - hot_file = '../tests/data/hot_output/network/' \ - 'hot_one_server_three_networks.yaml' + tosca_file = (f'{self.test_data_relative_path}network/' + 'tosca_one_server_three_networks.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/network/' + 'hot_one_server_three_networks.yaml') params = {} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_software_component(self): - tosca_file = '../tests/data/tosca_software_component.yaml' - hot_file = '../tests/data/hot_output/hot_software_component.yaml' + tosca_file = (f'{self.test_data_relative_path}' + 'tosca_software_component.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_software_component.yaml') params = {'cpus': '1', 'download_url': 'http://www.software.com/download'} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_software_component_multiple_hosts(self): - tosca_file = '../tests/data/tosca_software_component'\ - '_multiple_hosts.yaml' - hot_file = '../tests/data/hot_output/hot_software_component'\ - '_multiple_hosts.yaml' + tosca_file = (f'{self.test_data_relative_path}' + 'tosca_software_component_multiple_hosts.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_software_component_multiple_hosts.yaml') params = {'cpus': '1', 'download_url': 'http://www.software.com/download'} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_web_application(self): - tosca_file = '../tests/data/tosca_web_application.yaml' - hot_file = '../tests/data/hot_output/hot_web_application.yaml' + tosca_file = (f'{self.test_data_relative_path}' + 'tosca_web_application.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_web_application.yaml') params = {'cpus': '2', 'context_root': 'my_web_app'} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_template_with_url_import(self): - tosca_file = '../tests/data/' \ - 'tosca_single_instance_wordpress_with_url_import.yaml' - hot_file = '../tests/data/hot_output/' \ - 'hot_single_instance_wordpress.yaml' + tosca_file = (f'{self.test_data_relative_path}' + 'tosca_single_instance_wordpress_with_url_import.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_single_instance_wordpress.yaml') params = {'db_name': 'wordpress', 'db_user': 'wp_user', 'db_pwd': 'wp_pass', @@ -277,66 +296,82 @@ class ToscaHotTranslationTest(TestCase): 'cpus': 8} self._test_successful_translation(tosca_file, hot_file, params) - def test_hot_translate_template_by_url_with_local_import(self): - tosca_file = 'https://raw.githubusercontent.com/openstack/' \ - 'heat-translator/master/translator/tests/data/' \ - 'tosca_single_instance_wordpress.yaml' - hot_file = '../tests/data/hot_output/' \ - 'hot_single_instance_wordpress.yaml' + @mock.patch.object(toscaparser.tosca_template, 'ToscaTemplate') + def test_hot_translate_template_by_url_with_local_import( + self, mock_tosca_template): + tosca_file = "https://example.com/tosca_single_instance_wordpress.yaml" + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_single_instance_wordpress.yaml') params = {'db_name': 'wordpress', 'db_user': 'wp_user', 'db_pwd': 'wp_pass', 'db_root_pwd': 'passw0rd', 'db_port': 3366, 'cpus': 8} + file_path = utils.test_sample( + "tosca_single_instance_wordpress.yaml") + mock_tosca_template.return_value = ToscaTemplate( + file_path, params, True) self._test_successful_translation(tosca_file, hot_file, params) - def test_hot_translate_template_by_url_with_local_abspath_import(self): - tosca_file = 'https://raw.githubusercontent.com/openstack/' \ - 'heat-translator/master/translator/tests/data/' \ - 'tosca_single_instance_wordpress_with_local_abspath' \ - '_import.yaml' - hot_file = '../tests/data/hot_output/' \ - 'hot_single_instance_wordpress.yaml' + @mock.patch.object(toscaparser.utils.urlutils.UrlUtils, 'validate_url') + @mock.patch.object(os.path, 'isfile') + @mock.patch.object(ToscaTemplate, '_get_path') + def test_hot_translate_template_by_url_with_local_abspath_import( + self, mock_get_path, mock_isfile, mock_validate_url): + tosca_file = ("https://example.com/tosca_single_instance_wordpress_" + "with_local_abspath_import.yaml") + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_single_instance_wordpress.yaml') params = {'db_name': 'wordpress', 'db_user': 'wp_user', 'db_pwd': 'wp_pass', 'db_root_pwd': 'passw0rd', 'db_port': 3366, 'cpus': 8} - expected_msg = _('Absolute file name "/tmp/wordpress.yaml" cannot be ' - 'used in a URL-based input template "https://raw.' - 'githubusercontent.com/openstack/heat-translator/' - 'master/translator/tests/data/tosca_single_instance_' - 'wordpress_with_local_abspath_import.yaml".') + file_path = utils.test_sample( + 'tosca_single_instance_wordpress_with_local_abspath_import.yaml') + mock_get_path.return_value = file_path + mock_isfile.return_value = True + mock_validate_url.side_effect = [False, True, False, True] + + expected_msg = ('Absolute file name "/tmp/wordpress.yaml" cannot be ' + f'used in a URL-based input template "{file_path}".') msg_path = False self._test_failed_translation(tosca_file, hot_file, params, expected_msg, msg_path, ValidationError, ImportError) - def test_hot_translate_template_by_url_with_url_import(self): - tosca_url = 'https://raw.githubusercontent.com/openstack/' \ - 'heat-translator/master/translator/tests/data/' \ - 'tosca_single_instance_wordpress_with_url_import.yaml' - hot_file = '../tests/data/hot_output/' \ - 'hot_single_instance_wordpress.yaml' + @mock.patch.object(toscaparser.tosca_template, 'ToscaTemplate') + def test_hot_translate_template_by_url_with_url_import( + self, mock_tosca_template): + tosca_url = ("https://example.com/tosca_single_instance_wordpress_" + "with_url_import.yaml") + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_single_instance_wordpress.yaml') params = {'db_name': 'wordpress', 'db_user': 'wp_user', 'db_pwd': 'wp_pass', 'db_root_pwd': 'passw0rd', 'db_port': 3366, 'cpus': 8} + file_path = utils.test_sample( + "tosca_single_instance_wordpress_with_url_import.yaml") + mock_tosca_template.return_value = ToscaTemplate( + file_path, params, True) self._test_successful_translation(tosca_url, hot_file, params) def test_translate_hello_world_csar(self): - tosca_file = '../tests/data/csar_hello_world.zip' - hot_file = '../tests/data/hot_output/hot_hello_world.yaml' + tosca_file = f'{self.test_data_relative_path}csar_hello_world.zip' + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_hello_world.yaml') self._test_successful_translation(tosca_file, hot_file) def test_translate_single_instance_wordpress_csar(self): - tosca_file = '../tests/data/csar_single_instance_wordpress.zip' - hot_file = '../tests/data/hot_output/' \ - 'hot_single_instance_wordpress_from_csar.yaml' + tosca_file = (f'{self.test_data_relative_path}' + 'csar_single_instance_wordpress.zip') + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_single_instance_wordpress_from_csar.yaml') params = {'db_name': 'wordpress', 'db_user': 'wp_user', 'db_pwd': 'wp_pass', @@ -345,17 +380,22 @@ class ToscaHotTranslationTest(TestCase): 'cpus': 8} self._test_successful_translation(tosca_file, hot_file, params) - def test_translate_elk_csar_from_url(self): - tosca_file = 'https://github.com/openstack/heat-translator/raw/' \ - 'master/translator/tests/data/csar_elk.zip' - hot_file = '../tests/data/hot_output/hot_elk_from_csar.yaml' + @mock.patch.object(toscaparser.tosca_template, 'ToscaTemplate') + def test_translate_elk_csar_from_url( + self, mock_tosca_template): + tosca_file = "https://example.com/csar_elk.zip" + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_elk_from_csar.yaml') params = {'github_url': 'http://github.com/paypal/rest-api-sample-app-nodejs.git', 'my_cpus': 4} + zip_file_path = utils.test_sample("csar_elk.zip") + mock_tosca_template.return_value = ToscaTemplate( + zip_file_path, params, True) self._test_successful_translation(tosca_file, hot_file, params) def test_translate_csar_not_zip(self): - tosca_file = '../tests/data/csar_not_zip.zip' + tosca_file = f'{self.test_data_relative_path}csar_not_zip.zip' hot_file = '' params = {} expected_msg = _('"%s" is not a valid zip file.') @@ -365,7 +405,8 @@ class ToscaHotTranslationTest(TestCase): ValidationError) def test_translate_csar_metadata_not_yaml(self): - tosca_file = '../tests/data/csar_metadata_not_yaml.zip' + tosca_file = (f'{self.test_data_relative_path}' + 'csar_metadata_not_yaml.zip') hot_file = '' params = {} expected_msg = _('The file "TOSCA-Metadata/TOSCA.meta" in the CSAR ' @@ -376,7 +417,8 @@ class ToscaHotTranslationTest(TestCase): ValidationError) def test_translate_csar_wrong_metadata_file(self): - tosca_file = '../tests/data/csar_wrong_metadata_file.zip' + tosca_file = (f'{self.test_data_relative_path}' + 'csar_wrong_metadata_file.zip') hot_file = '' params = {} expected_msg = _('"%s" is not a valid CSAR as it does not contain the ' @@ -388,7 +430,8 @@ class ToscaHotTranslationTest(TestCase): ValidationError) def test_translate_csar_wordpress_invalid_import_path(self): - tosca_file = '../tests/data/csar_wordpress_invalid_import_path.zip' + tosca_file = (f'{self.test_data_relative_path}' + 'csar_wordpress_invalid_import_path.zip') hot_file = '' params = {} expected_msg = _('Import ' @@ -399,7 +442,8 @@ class ToscaHotTranslationTest(TestCase): ImportError) def test_translate_csar_wordpress_invalid_script_url(self): - tosca_file = '../tests/data/csar_wordpress_invalid_script_url.zip' + tosca_file = (f'{self.test_data_relative_path}' + 'csar_wordpress_invalid_script_url.zip') hot_file = '' params = {} expected_msg = _('The resource at ' @@ -412,148 +456,171 @@ class ToscaHotTranslationTest(TestCase): URLException) def test_hot_translate_flavor_image(self): - tosca_file = '../tests/data/test_tosca_flavor_and_image.yaml' - hot_file = '../tests/data/hot_output/hot_flavor_and_image.yaml' + tosca_file = (f'{self.test_data_relative_path}' + 'test_tosca_flavor_and_image.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_flavor_and_image.yaml') self._test_successful_translation(tosca_file, hot_file) def test_hot_translate_flavor_image_params(self): - tosca_file = '../tests/data/test_tosca_flavor_and_image.yaml' - hot_file = '../tests/data/hot_output/hot_flavor_and_image_params.yaml' + tosca_file = (f'{self.test_data_relative_path}' + 'test_tosca_flavor_and_image.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_flavor_and_image_params.yaml') params = {'key_name': 'paramkey'} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_custom_type(self): - tosca_file = '../tests/data/test_tosca_custom_type.yaml' - hot_file = '../tests/data/hot_output/' \ - 'hot_custom_type.yaml' + tosca_file = (f'{self.test_data_relative_path}' + 'test_tosca_custom_type.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_custom_type.yaml') params = {} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_custom_type_with_override(self): - tosca_file = '../tests/data/test_tosca_custom_type_with_override.yaml' - hot_file = '../tests/data/hot_output/' \ - 'hot_custom_type_with_override.yaml' + tosca_file = (f'{self.test_data_relative_path}' + 'test_tosca_custom_type_with_override.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_custom_type_with_override.yaml') params = {} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_custom_type_with_param_override(self): - tosca_file = '../tests/data/test_tosca_custom_type_with_override.yaml' - hot_file = '../tests/data/hot_output/' \ - 'hot_custom_type_with_param_override.yaml' + tosca_file = (f'{self.test_data_relative_path}' + 'test_tosca_custom_type_with_override.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_custom_type_with_param_override.yaml') params = {'install_path': '/home/custom/from/cli'} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_artifact(self): - tosca_file = '../tests/data/test_tosca_artifact.yaml' - hot_file = '../tests/data/hot_output/' \ - 'hot_artifact.yaml' + tosca_file = (f'{self.test_data_relative_path}' + 'test_tosca_artifact.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_artifact.yaml') params = {} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_without_tosca_os_version(self): - tosca_file = '../tests/data/' \ - 'test_single_server_without_optional_version_prop.yaml' - hot_file = '../tests/data/hot_output/' \ - 'hot_single_server_without_tosca_os_version.yaml' + tosca_file = (f'{self.test_data_relative_path}' + 'test_single_server_without_optional_version_prop.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_single_server_without_tosca_os_version.yaml') params = {} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_helloworld_with_userkey(self): - tosca_file = '../tests/data/tosca_helloworld.yaml' - hot_file = '../tests/data/hot_output/hot_hello_world_userkey.yaml' + tosca_file = (f'{self.test_data_relative_path}' + 'tosca_helloworld.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_hello_world_userkey.yaml') params = {'key_name': 'userkey'} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_custom_networks_nodes_inline(self): - tosca_file = '../tests/data/network/' \ - 'test_tosca_custom_network_nodes_inline.yaml' - hot_file = '../tests/data/hot_output/network/' \ - 'hot_custom_network_nodes.yaml' + tosca_file = (f'{self.test_data_relative_path}network/' + 'test_tosca_custom_network_nodes_inline.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/network/' + 'hot_custom_network_nodes.yaml') params = {} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_custom_networks_nodes_imports(self): - tosca_file = '../tests/data/network/' \ - 'test_tosca_custom_network_nodes_imports.yaml' - hot_file = '../tests/data/hot_output/network/' \ - 'hot_custom_network_nodes.yaml' + tosca_file = (f'{self.test_data_relative_path}network/' + 'test_tosca_custom_network_nodes_imports.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/network/' + 'hot_custom_network_nodes.yaml') params = {} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_nfv_sample(self): - tosca_file = '../tests/data/nfv/test_tosca_nfv_sample.yaml' - hot_file = '../tests/data/hot_output/nfv/hot_nfv_sample.yaml' + tosca_file = (f'{self.test_data_relative_path}nfv/' + 'test_tosca_nfv_sample.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/nfv/' + 'hot_nfv_sample.yaml') params = {} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_placement_policy_default_affinity(self): - tosca_file = '../tests/data/policies/tosca_policies.yaml' - hot_file = '../tests/data/hot_output/policies/hot_policies.yaml' + tosca_file = (f'{self.test_data_relative_path}policies/' + 'tosca_policies.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/policies/' + 'hot_policies.yaml') params = {} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_placement_policy_affinity(self): - tosca_file = ('../tests/data/nfv/' + tosca_file = (f'{self.test_data_relative_path}nfv/' 'tosca_placement_policy_affinity.yaml') - hot_file = '../tests/data/hot_output/policies/hot_policies.yaml' + hot_file = (f'{self.test_data_relative_path}hot_output/policies/' + 'hot_policies.yaml') params = {} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_placement_policy_anti_affinity(self): - tosca_file = ('../tests/data/nfv/' + tosca_file = (f'{self.test_data_relative_path}nfv/' 'tosca_placement_policy_anti_affinity.yaml') - hot_file = ('../tests/data/hot_output/nfv/' + hot_file = (f'{self.test_data_relative_path}hot_output/nfv/' 'hot_policy_anti_affinity.yaml') params = {} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_placement_policy_soft_affinity(self): - tosca_file = ('../tests/data/nfv/' + tosca_file = (f'{self.test_data_relative_path}nfv/' 'tosca_placement_policy_soft_affinity.yaml') - hot_file = ('../tests/data/hot_output/nfv/' + hot_file = (f'{self.test_data_relative_path}hot_output/nfv/' 'hot_policy_soft_affinity.yaml') params = {} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_script_types(self): - tosca_file = '../tests/data/interfaces/test_tosca_script_types.yaml' - hot_file = '../tests/data/hot_output/hot_script_types.yaml' + tosca_file = (f'{self.test_data_relative_path}interfaces/' + 'test_tosca_script_types.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_script_types.yaml') + params = {} params = {} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_interface_on_compute(self): - tosca_file = '../tests/data/interfaces/' \ - 'test_tosca_interface_on_compute.yaml' - hot_file = '../tests/data/hot_output/interfaces/' \ - 'hot_interface_on_compute.yaml' + tosca_file = (f'{self.test_data_relative_path}interfaces/' + 'test_tosca_interface_on_compute.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/interfaces/' + 'hot_interface_on_compute.yaml') params = {} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_get_functions_semantic(self): - tosca_file = '../tests/data/test_tosca_get_functions_semantic.yaml' - hot_file = '../tests/data/hot_output/hot_get_functions_semantic.yaml' + tosca_file = (f'{self.test_data_relative_path}' + 'test_tosca_get_functions_semantic.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_get_functions_semantic.yaml') params = {} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_exchange_public_ssh_key(self): - tosca_file = '../tests/data/tosca_exchange_public_ssh_key.yaml' - hot_file = '../tests/data/hot_output/hot_exchange_public_ssh_key.yaml' + tosca_file = (f'{self.test_data_relative_path}' + 'tosca_exchange_public_ssh_key.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/' + 'hot_exchange_public_ssh_key.yaml') params = {} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_scaling_policy(self): - tosca_file = '../tests/data/autoscaling/tosca_autoscaling.yaml' + tosca_file = (f'{self.test_data_relative_path}autoscaling/' + 'tosca_autoscaling.yaml') hot_files = [ - '../tests/data/hot_output/autoscaling/hot_autoscaling.yaml', - '../tests/data/hot_output/autoscaling/asg_res.yaml', - ] + f'{self.test_data_relative_path}hot_output/autoscaling/' + 'hot_autoscaling.yaml', + f'{self.test_data_relative_path}hot_output/autoscaling/' + 'asg_res.yaml', + ] params = {} self._test_successful_translation(tosca_file, hot_files, params) def test_translate_unsupported_tosca_type(self): - tosca_file = '../tests/data/test_tosca_unsupported_type.yaml' - tosca_tpl = os.path.normpath(os.path.join( - os.path.dirname(os.path.abspath(__file__)), tosca_file)) + tosca_tpl = utils.test_sample('test_tosca_unsupported_type.yaml') params = {} expected_msg = _('Type "tosca.nodes.LoadBalancer" is valid TOSCA ' 'type but translation support is not yet available.') @@ -564,10 +631,8 @@ class ToscaHotTranslationTest(TestCase): self.assertEqual(expected_msg, err.__str__()) def test_translate_unsupported_tosca_policy_type(self): - tosca_file = ('../tests/data/nfv/' - 'test_tosca_unsupported_policy_type.yaml') - tosca_tpl = os.path.normpath(os.path.join( - os.path.dirname(os.path.abspath(__file__)), tosca_file)) + tosca_tpl = utils.test_sample( + 'nfv/test_tosca_unsupported_policy_type.yaml') params = {} expected_msg = _('Type "tosca.policies.tacker.ABC" is valid TOSCA ' 'type but translation support is not yet available.') @@ -578,47 +643,55 @@ class ToscaHotTranslationTest(TestCase): self.assertEqual(expected_msg, err.__str__()) def test_hot_translate_cluster_scaling_policy(self): - tosca_file = '../tests/data/autoscaling/tosca_cluster_autoscaling.yaml' - hot_file = '../tests/data/hot_output/autoscaling/' \ - 'hot_cluster_autoscaling.yaml' + tosca_file = (f'{self.test_data_relative_path}autoscaling/' + 'tosca_cluster_autoscaling.yaml') + hot_file = (f'{self.test_data_relative_path}hot_output/autoscaling/' + 'hot_cluster_autoscaling.yaml') params = {} self._test_successful_translation(tosca_file, hot_file, params) def test_hot_translate_nfv_scaling(self): - tosca_file = '../tests/data/nfv/test_tosca_nfv_autoscaling.yaml' + tosca_file = (f'{self.test_data_relative_path}nfv/' + 'test_tosca_nfv_autoscaling.yaml') hot_files = [ - '../tests/data/hot_output/nfv/hot_tosca_nfv_autoscaling.yaml', - '../tests/data/hot_output/nfv/SP1_res.yaml', - ] + f'{self.test_data_relative_path}hot_output/nfv/' + 'hot_tosca_nfv_autoscaling.yaml', + f'{self.test_data_relative_path}hot_output/nfv/SP1_res.yaml', + ] params = {} self._test_successful_translation(tosca_file, hot_files, params) def test_hot_translate_nfv_scaling_with_params(self): - tosca_file = '../tests/data/nfv/test_tosca_nfv_autoscaling_with_' \ - 'params.yaml' + tosca_file = (f'{self.test_data_relative_path}nfv/' + 'test_tosca_nfv_autoscaling_with_params.yaml') hot_files = [ - '../tests/data/hot_output/nfv/hot_tosca_nfv_autoscaling_with_' - 'param.yaml', - '../tests/data/hot_output/nfv/SP_res.yaml', + f'{self.test_data_relative_path}hot_output/nfv/' + 'hot_tosca_nfv_autoscaling_with_param.yaml', + f'{self.test_data_relative_path}hot_output/nfv/SP_res.yaml', ] params = {'image_name': 'cirros-0.3.5-x86_64-disk', 'flavor': 'm1.tiny'} self._test_successful_translation(tosca_file, hot_files, params) def test_hot_translate_mon_scaling_policy(self): - tosca_file = '../tests/data/monitoring/tosca_monitoring_scaling.yaml' + tosca_file = (f'{self.test_data_relative_path}monitoring/' + 'tosca_monitoring_scaling.yaml') hot_files = [ - '../tests/data/hot_output/monitoring/hot_monitoring_scaling.yaml', - '../tests/data/hot_output/monitoring/asg_res.yaml', + f'{self.test_data_relative_path}hot_output/monitoring/' + 'hot_monitoring_scaling.yaml', + f'{self.test_data_relative_path}hot_output/monitoring/' + 'asg_res.yaml', ] params = {} self._test_successful_translation(tosca_file, hot_files, params) def test_hot_translate_reservation_policy(self): - tosca_file = '../tests/data/reservation/tosca-vnfd-reservation-id.yaml' + tosca_file = (f'{self.test_data_relative_path}reservation/' + 'tosca-vnfd-reservation-id.yaml') hot_files = [ - '../tests/data/hot_output/reservation/' + f'{self.test_data_relative_path}hot_output/reservation/' 'hot_reservation_scaling.yaml', - '../tests/data/hot_output/reservation/SP_RSV_res.yaml', + f'{self.test_data_relative_path}hot_output/reservation/' + 'SP_RSV_res.yaml', ] self._test_successful_translation(tosca_file, hot_files, params={}) diff --git a/translator/tests/test_utils.py b/translator/tests/test_utils.py index 71b187b5..30fd3841 100644 --- a/translator/tests/test_utils.py +++ b/translator/tests/test_utils.py @@ -10,9 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. -import os from toscaparser.tests.base import TestCase import translator.common.utils +from translator.tests import utils class CommonUtilsTest(TestCase): @@ -170,9 +170,7 @@ class CommonUtilsTest(TestCase): self.assertIsNone(self.yamlUtils.get_dict('./no_file.yaml')) def test_yamlutils_get_dict(self): - yaml_file = os.path.join( - os.path.dirname(os.path.abspath(__file__)), - '../tests/data/custom_types/rsyslog.yaml') + yaml_file = utils.test_sample('custom_types/rsyslog.yaml') dict = \ {'tosca_definitions_version': 'tosca_simple_yaml_1_0', 'description': @@ -188,22 +186,14 @@ class CommonUtilsTest(TestCase): self.assertEqual(dict, self.yamlUtils.get_dict(yaml_file)) def test_yamlutils_compare_yamls(self): - yaml_file1 = os.path.join( - os.path.dirname(os.path.abspath(__file__)), - '../tests/data/custom_types/kibana.yaml') - yaml_file2 = os.path.join( - os.path.dirname(os.path.abspath(__file__)), - '../tests/data/custom_types/collectd.yaml') + yaml_file1 = utils.test_sample('custom_types/kibana.yaml') + yaml_file2 = utils.test_sample('custom_types/collectd.yaml') self.assertTrue(self.yamlUtils.compare_yamls(yaml_file1, yaml_file1)) self.assertFalse(self.yamlUtils.compare_yamls(yaml_file1, yaml_file2)) def test_yamlutils_compare_yaml_dict(self): - yaml_file1 = os.path.join( - os.path.dirname(os.path.abspath(__file__)), - '../tests/data/custom_types/rsyslog.yaml') - yaml_file2 = os.path.join( - os.path.dirname(os.path.abspath(__file__)), - '../tests/data/custom_types/collectd.yaml') + yaml_file1 = utils.test_sample('custom_types/rsyslog.yaml') + yaml_file2 = utils.test_sample('custom_types/collectd.yaml') dict = \ {'tosca_definitions_version': 'tosca_simple_yaml_1_0', 'description': diff --git a/translator/osc/v1/tests/utils.py b/translator/tests/utils.py similarity index 55% rename from translator/osc/v1/tests/utils.py rename to translator/tests/utils.py index edd45a74..eebe6371 100644 --- a/translator/osc/v1/tests/utils.py +++ b/translator/tests/utils.py @@ -13,7 +13,20 @@ import os -def get_template_path(path): - data_folder = "../../../tests/data/" - return os.path.join(os.path.dirname(os.path.abspath(__file__)), - data_folder + path) +def sample_root(): + return os.path.abspath(os.path.join(os.path.dirname(__file__), + '../../samples/')) + + +def test_sample_root(): + # {heat-translator}/samples/tests + return os.path.join(sample_root(), 'tests/') + + +def test_sample_data_root(): + # {heat-translator}/samples/tests/data + return os.path.join(test_sample_root(), 'data/') + + +def test_sample(*p): + return os.path.join(test_sample_data_root(), *p)