예제 #1
0
 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'
     params = {
         'cpus': 1,
         'storage_location': '/dev/vdc',
         'storage_size': '1 GB',
         'storage_snapshot_id': 'ssid'
     }
     diff1 = TranslationUtils.compare_tosca_translation_with_hot(
         tosca_file, hot_file1, params)
     try:
         self.assertEqual(
             {}, diff1, '<difference> : ' +
             json.dumps(diff1, indent=4, separators=(', ', ': ')))
     except Exception:
         diff2 = TranslationUtils.compare_tosca_translation_with_hot(
             tosca_file, hot_file2, params)
         self.assertEqual(
             {}, diff2, '<difference> : ' +
             json.dumps(diff2, indent=4, separators=(', ', ': ')))
 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'
     params = {'cpus': 1,
               'storage_location': '/dev/vdc',
               'storage_size': '1 GB',
               'storage_snapshot_id': 'ssid'}
     diff1 = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                 hot_file1,
                                                                 params)
     try:
         self.assertEqual({}, diff1, '<difference> : ' +
                          json.dumps(diff1, indent=4,
                                     separators=(', ', ': ')))
     except Exception:
         diff2 = TranslationUtils.compare_tosca_translation_with_hot(
             tosca_file, hot_file2, params)
         self.assertEqual({}, diff2, '<difference> : ' +
                          json.dumps(diff2, indent=4,
                                     separators=(', ', ': ')))
 def _test_successful_translation(self, tosca_file, hot_file, params=None):
     if not params:
         params = {}
     diff = TranslationUtils.compare_tosca_translation_with_hot(
         tosca_file, hot_file, params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #4
0
 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'
     diff = TranslationUtils.compare_tosca_translation_with_hot(
         tosca_file, hot_file, {})
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #5
0
 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'
     params = {'key_name': 'paramkey'}
     diff = TranslationUtils.compare_tosca_translation_with_hot(
         tosca_file, hot_file, params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
 def _test_successful_translation(self, tosca_file, hot_file, params=None):
     if not params:
         params = {}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #7
0
 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'
     params = {'key_name': 'userkey'}
     diff = TranslationUtils.compare_tosca_translation_with_hot(
         tosca_file, hot_file, params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #8
0
 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'
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                {})
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #9
0
 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'
     params = {'cpus': '2', 'context_root': 'my_web_app'}
     diff = TranslationUtils.compare_tosca_translation_with_hot(
         tosca_file, hot_file, params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #10
0
 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'
     params = {'objectstore_name': 'myobjstore'}
     diff = TranslationUtils.compare_tosca_translation_with_hot(
         tosca_file, hot_file, params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #11
0
 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'
     params = {'cpus': 1}
     diff = TranslationUtils.compare_tosca_translation_with_hot(
         tosca_file, hot_file, params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
 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'
     params = {'cpus': '2', 'context_root': 'my_web_app'}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #13
0
 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'
     params = {'install_path': '/home/custom/from/cli'}
     diff = TranslationUtils.compare_tosca_translation_with_hot(
         tosca_file, hot_file, params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #14
0
 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'
     params = {'cpus': 1}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #15
0
 def test_hot_translate_artifact(self):
     tosca_file = '../tests/data/test_tosca_artifact.yaml'
     hot_file = '../tests/data/hot_output/' \
         'hot_artifact.yaml'
     params = {}
     diff = TranslationUtils.compare_tosca_translation_with_hot(
         tosca_file, hot_file, params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #16
0
 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'
     params = {'objectstore_name': 'myobjstore'}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #17
0
 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'
     params = {'network_name': 'private_net'}
     diff = TranslationUtils.compare_tosca_translation_with_hot(
         tosca_file, hot_file, params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #18
0
    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'
        hot_file_without_input = '../tests/data/hot_output/' \
            'hot_single_server_with_defaults_without_input.yaml'

        params1 = {'cpus': '1'}
        diff1 = TranslationUtils.compare_tosca_translation_with_hot(
            tosca_file, hot_file_with_input, params1)
        self.assertEqual({}, diff1, '<difference> : ' +
                         json.dumps(diff1, indent=4, separators=(', ', ': ')))

        params2 = {}
        diff2 = TranslationUtils.compare_tosca_translation_with_hot(
            tosca_file, hot_file_without_input, params2)
        self.assertEqual({}, diff2, '<difference> : ' +
                         json.dumps(diff2, indent=4, separators=(', ', ': ')))
예제 #19
0
 def test_hot_translate_artifact(self):
     tosca_file = '../tests/data/test_tosca_artifact.yaml'
     hot_file = '../tests/data/hot_output/' \
         'hot_artifact.yaml'
     params = {}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #20
0
 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'
     params = {}
     diff = TranslationUtils.compare_tosca_translation_with_hot(
         tosca_file, hot_file, params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #21
0
 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'
     params = {}
     diff = TranslationUtils.compare_tosca_translation_with_hot(
         tosca_file, hot_file, params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #22
0
 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'
     params = {'cpus': '1',
               'download_url': 'http://www.software.com/download'}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #23
0
 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'
     params = {'network_name': 'private_net'}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #24
0
    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'
        hot_file_without_input = '../tests/data/hot_output/' \
            'hot_single_server_with_defaults_without_input.yaml'

        params1 = {'cpus': '1'}
        diff1 = TranslationUtils.compare_tosca_translation_with_hot(
            tosca_file, hot_file_with_input, params1)
        self.assertEqual({}, diff1, '<difference> : ' +
                         json.dumps(diff1, indent=4, separators=(', ', ': ')))

        params2 = {}
        diff2 = TranslationUtils.compare_tosca_translation_with_hot(
            tosca_file, hot_file_without_input, params2)
        self.assertEqual({}, diff2, '<difference> : ' +
                         json.dumps(diff2, indent=4, separators=(', ', ': ')))
예제 #25
0
 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'
     params = {}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #26
0
 def test_hot_translate_elk(self):
     tosca_file = '../tests/data/tosca_elk.yaml'
     hot_file = '../tests/data/hot_output/hot_elk.yaml'
     params = {'github_url':
               'http://github.com/paypal/rest-api-sample-app-nodejs.git',
               'my_cpus': 4}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #27
0
 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'
     params = {
         'cpus': '1',
         'download_url': 'http://www.software.com/download'
     }
     diff = TranslationUtils.compare_tosca_translation_with_hot(
         tosca_file, hot_file, params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #28
0
 def _test_successful_translation(self, tosca_file, hot_files, params=None,
                                  nested_resources=False):
     if not params:
         params = {}
     if not isinstance(hot_files, list):
         hot_files = [hot_files]
     diff =\
         TranslationUtils.compare_tosca_translation_with_hot(
             tosca_file, hot_files, params, nested_resources)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #29
0
 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'
     params = {'github_url':
               'http://github.com/paypal/rest-api-sample-app-nodejs.git',
               'my_cpus': 4}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #30
0
 def test_hot_translate_elk(self):
     tosca_file = '../tests/data/tosca_elk.yaml'
     hot_file = '../tests/data/hot_output/hot_elk.yaml'
     params = {
         'github_url':
         'http://github.com/paypal/rest-api-sample-app-nodejs.git',
         'my_cpus': 4
     }
     diff = TranslationUtils.compare_tosca_translation_with_hot(
         tosca_file, hot_file, params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #31
0
 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'
     params = {'cpus': 1,
               'storage_location': '/dev/vdc',
               'storage_size': '1 GB'}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #32
0
 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'
     params = {
         'github_url':
         'http://github.com/paypal/rest-api-sample-app-nodejs.git',
         'my_cpus': 4
     }
     diff = TranslationUtils.compare_tosca_translation_with_hot(
         tosca_file, hot_file, params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #33
0
 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'
     params = {'network_name': 'my_private_net',
               'network_cidr': '10.0.0.0/24',
               'network_start_ip': '10.0.0.100',
               'network_end_ip': '10.0.0.150'}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #34
0
 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'
     params = {
         'cpus': 1,
         'storage_location': '/dev/vdc',
         'storage_size': '1 GB'
     }
     diff = TranslationUtils.compare_tosca_translation_with_hot(
         tosca_file, hot_file, params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #35
0
 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'
     params = {
         'network_name': 'my_private_net',
         'network_cidr': '10.0.0.0/24',
         'network_start_ip': '10.0.0.100',
         'network_end_ip': '10.0.0.150'
     }
     diff = TranslationUtils.compare_tosca_translation_with_hot(
         tosca_file, hot_file, params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #36
0
 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'
     params = {'db_name': 'wordpress',
               'db_user': '******',
               'db_pwd': 'wp_pass',
               'db_root_pwd': 'passw0rd',
               'db_port': 3366,
               'cpus': 8}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
 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'
     params = {'cpus': 1,
               'storage_location': '/dev/vdc',
               'storage_size': '2000 MB',
               'storage_snapshot_id': 'ssid'}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_file,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #38
0
 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'
     params = {
         'db_name': 'wordpress',
         'db_user': '******',
         'db_pwd': 'wp_pass',
         'db_root_pwd': 'passw0rd',
         'db_port': 3366,
         'cpus': 8
     }
     diff = TranslationUtils.compare_tosca_translation_with_hot(
         tosca_file, hot_file, params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #39
0
 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'
     params = {'db_name': 'wordpress',
               'db_user': '******',
               'db_pwd': 'wp_pass',
               'db_root_pwd': 'passw0rd',
               'db_port': 3366,
               'cpus': 8}
     diff = TranslationUtils.compare_tosca_translation_with_hot(tosca_url,
                                                                hot_file,
                                                                params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))
예제 #40
0
 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'
     params = {
         'db_name': 'wordpress',
         'db_user': '******',
         'db_pwd': 'wp_pass',
         'db_root_pwd': 'passw0rd',
         'db_port': 3366,
         'cpus': 8
     }
     diff = TranslationUtils.compare_tosca_translation_with_hot(
         tosca_url, hot_file, params)
     self.assertEqual({}, diff, '<difference> : ' +
                      json.dumps(diff, indent=4, separators=(', ', ': ')))