Ejemplo n.º 1
0
 def test_osc_translate_software_component(self):
     tosca_file = utils.get_template_path("tosca_software_component.yaml")
     hot_file = utils.get_template_path(
         "hot_output/hot_software_component.yaml")
     params = {'cpus': '1',
               'download_url': 'http://www.software.com/download'}
     self._check_success(tosca_file, hot_file, params)
Ejemplo n.º 2
0
    def test_osc_translate_single_server(self):
        tosca_file = utils.get_template_path("tosca_single_server.yaml")

        hot_file = utils.get_template_path("hot_output/hot_single_server.yaml")

        params = {'cpus': 1}
        self._check_success(tosca_file, hot_file, params)
Ejemplo n.º 3
0
    def test_osc_translate_single_server(self):
        tosca_file = utils.get_template_path("tosca_single_server.yaml")

        hot_file = utils.get_template_path("hot_output/hot_single_server.yaml")

        params = {"cpus": 1}
        self._check_success(tosca_file, hot_file, params)
Ejemplo n.º 4
0
    def test_osc_translate_single_server_defaults_with_input(self):
        tosca_file = utils.get_template_path("tosca_single_server_with_defaults.yaml")

        hot_file = utils.get_template_path("hot_output/hot_single_server_with_defaults_with_input.yaml")

        params = {"cpus": "1"}
        self._check_success(tosca_file, hot_file, params)
Ejemplo n.º 5
0
 def test_osc_translate_single_object_store(self):
     tosca_file = utils.get_template_path(
         "storage/tosca_single_object_store.yaml")
     hot_file = utils.get_template_path(
         "hot_output/hot_single_object_store.yaml")
     params = {'objectstore_name': 'myobjstore'}
     self._check_success(tosca_file, hot_file, params)
Ejemplo n.º 6
0
 def test_osc_translate_server_on_existing_network(self):
     tosca_file = utils.get_template_path(
         "network/" + "tosca_server_on_existing_network.yaml")
     hot_file = utils.get_template_path(
         "hot_output/network/" + "hot_server_on_existing_network.yaml")
     params = {'network_name': 'private_net'}
     self._check_success(tosca_file, hot_file, params)
Ejemplo n.º 7
0
    def test_osc_translate_single_server_defaults_without_input(self):
        tosca_file = utils.get_template_path(
            "tosca_single_server_with_defaults.yaml")

        hot_file = utils.get_template_path(
            "hot_output/hot_single_server_with_defaults_without_input.yaml")

        self._check_success(tosca_file, hot_file, {})
Ejemplo n.º 8
0
 def test_osc_translate_one_server_three_networks(self):
     tosca_file = utils.get_template_path(
         "network/" +
         "tosca_one_server_three_networks.yaml")
     hot_file = utils.get_template_path(
         "hot_output/network/" +
         "hot_one_server_three_networks.yaml")
     self._check_success(tosca_file, hot_file, {})
Ejemplo n.º 9
0
 def test_osc_translate_nodejs_mongodb_two_instances(self):
     tosca_file = utils.get_template_path(
         "tosca_nodejs_mongodb_two_instances.yaml")
     hot_file = utils.get_template_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._check_success(tosca_file, hot_file, params)
Ejemplo n.º 10
0
 def test_osc_translate_two_servers_one_network(self):
     tosca_file = utils.get_template_path("network/tosca_two_servers_one_network.yaml")
     hot_file = utils.get_template_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",
         "network_end_ip": "10.0.0.150",
     }
     self._check_success(tosca_file, hot_file, params)
Ejemplo n.º 11
0
 def test_osc_translate_blockstorage_with_attachment(self):
     tosca_file = utils.get_template_path(
         "storage/tosca_blockstorage_with_attachment.yaml")
     hot_file = utils.get_template_path(
         "hot_output/storage/hot_blockstorage_with_attachment.yaml")
     params = {'cpus': 1,
               'storage_location': '/dev/vdc',
               'storage_size': '2000 MB',
               'storage_snapshot_id': 'ssid'}
     self._check_success(tosca_file, hot_file, params)
Ejemplo n.º 12
0
 def test_osc_translate_blockstorage_with_relationship_template(self):
     tosca_file = utils.get_template_path(
         "storage/" +
         "tosca_blockstorage_with_relationship_template.yaml")
     hot_file = utils.get_template_path(
         "hot_output/storage/" +
         "hot_blockstorage_with_relationship_template.yaml")
     params = {'cpus': 1,
               'storage_location': '/dev/vdc',
               'storage_size': '1 GB'}
     self._check_success(tosca_file, hot_file, params)
Ejemplo n.º 13
0
 def test_osc_translate_two_servers_one_network(self):
     tosca_file = utils.get_template_path(
         "network/tosca_two_servers_one_network.yaml")
     hot_file = utils.get_template_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',
               'network_end_ip': '10.0.0.150'}
     self._check_success(tosca_file, hot_file, params)
Ejemplo n.º 14
0
 def test_osc_translate_template_with_url_import(self):
     tosca_file = utils.get_template_path(
         "tosca_single_instance_wordpress_with_url_import.yaml")
     hot_file = utils.get_template_path(
         "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}
     self._check_success(tosca_file, hot_file, params)
Ejemplo n.º 15
0
 def test_osc_translate_wordpress_single_instance(self):
     tosca_file = utils.get_template_path("tosca_single_instance_wordpress.yaml")
     hot_file = utils.get_template_path("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,
     }
     self._check_success(tosca_file, hot_file, params)
Ejemplo n.º 16
0
 def test_osc_translate_multiple_blockstorage_with_attachment(self):
     tosca_file = utils.get_template_path("storage/" + "tosca_multiple_blockstorage_with_attachment.yaml")
     hot_file1 = utils.get_template_path(
         "hot_output/storage/" + "hot_multiple_blockstorage_with_attachment_alt1.yaml"
     )
     hot_file2 = utils.get_template_path(
         "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"}
     try:
         self._check_success(tosca_file, hot_file1, params)
     except Exception:
         self._check_success(tosca_file, hot_file2, params)
Ejemplo n.º 17
0
 def test_osc_single_instance_wordpress_csar(self):
     tosca_file = utils.get_template_path(
         "csar_single_instance_wordpress.zip")
     hot_file = utils.get_template_path(
         "hot_output/" +
         "hot_single_instance_wordpress_from_csar.yaml")
     params = {'db_name': 'wordpress',
               'db_user': '******',
               'db_pwd': 'wp_pass',
               'db_root_pwd': 'passw0rd',
               'db_port': 3366,
               'cpus': 8}
     self._check_success(tosca_file, hot_file, params)
Ejemplo n.º 18
0
    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")
        params = {
            "db_name": "wordpress",
            "db_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".'
        )
        self._check_error(tosca_file, hot_file, params, ValidationError, expected_msg, ImportError)
Ejemplo n.º 19
0
 def test_osc_translate_csar_metadata_not_yaml(self):
     tosca_file = utils.get_template_path("csar_metadata_not_yaml.zip")
     hot_file = ""
     expected_msg = (
         _('The file "TOSCA-Metadata/TOSCA.meta" in the CSAR ' '"%s" does not contain valid YAML' " content.")
         % tosca_file
     )
     self._check_error(tosca_file, hot_file, {}, ValidationError, expected_msg, ValidationError)
Ejemplo n.º 20
0
 def test_osc_translate_csar_wordpress_invalid_import_path(self):
     tosca_file = utils.get_template_path(
         "csar_wordpress_invalid_import_path.zip")
     hot_file = ''
     expected_msg = _('Import '
                      '"Invalid_import_path/wordpress.yaml" is not valid.')
     self._check_error(tosca_file, hot_file, {}, ValidationError,
                       expected_msg, ImportError)
Ejemplo n.º 21
0
 def test_osc_translate_csar_metadata_not_yaml(self):
     tosca_file = utils.get_template_path("csar_metadata_not_yaml.zip")
     hot_file = ''
     expected_msg = _('The file "TOSCA-Metadata/TOSCA.meta" in the CSAR '
                      '"%s" does not contain valid YAML'
                      ' content.') % tosca_file
     self._check_error(tosca_file, hot_file, {}, ValidationError,
                       expected_msg, ValidationError)
Ejemplo n.º 22
0
    def test_osc_translate_csar_wrong_metadata_file(self):
        tosca_file = utils.get_template_path("csar_wrong_metadata_file.zip")
        hot_file = ''

        expected_msg = _('"%s" is not a valid CSAR as it does not contain the '
                         'required file "TOSCA.meta" in the folder '
                         '"TOSCA-Metadata".') % tosca_file
        self._check_error(tosca_file, hot_file, {}, ValidationError,
                          expected_msg, ValidationError)
Ejemplo n.º 23
0
 def test_osc_translate_multiple_blockstorage_with_attachment(self):
     tosca_file = utils.get_template_path(
         "storage/" +
         "tosca_multiple_blockstorage_with_attachment.yaml")
     hot_file1 = utils.get_template_path(
         "hot_output/storage/" +
         "hot_multiple_blockstorage_with_attachment_alt1.yaml")
     hot_file2 = utils.get_template_path(
         "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'}
     try:
         self._check_success(tosca_file, hot_file1, params)
     except Exception:
         self._check_success(tosca_file, hot_file2, params)
Ejemplo n.º 24
0
 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")
     params = {'github_url':
               'http://github.com/paypal/rest-api-sample-app-nodejs.git',
               'my_cpus': 4}
     self._check_success(tosca_file, hot_file, params)
Ejemplo n.º 25
0
 def test_osc_translate_csar_wordpress_invalid_script_url(self):
     tosca_file = utils.get_template_path("csar_wordpress_invalid_script_url.zip")
     hot_file = ""
     expected_msg = _(
         "The resource at "
         '"https://raw.githubusercontent.com/openstack/'
         "heat-translator/master/translator/tests/data/"
         'custom_types/wordpress1.yaml" cannot be accessed.'
     )
     self._check_error(tosca_file, hot_file, {}, ValidationError, expected_msg, URLException)
Ejemplo n.º 26
0
 def test_osc_translate_csar_wordpress_invalid_script_url(self):
     tosca_file = utils.get_template_path(
         "csar_wordpress_invalid_script_url.zip")
     hot_file = ''
     expected_msg = _('The resource at '
                      '"https://raw.githubusercontent.com/openstack/'
                      'heat-translator/master/translator/tests/data/'
                      'custom_types/wordpress1.yaml" cannot be accessed.')
     self._check_error(tosca_file, hot_file, {}, ValidationError,
                       expected_msg, URLException)
Ejemplo n.º 27
0
    def test_osc_translate_csar_wrong_metadata_file(self):
        tosca_file = utils.get_template_path("csar_wrong_metadata_file.zip")
        hot_file = ""

        expected_msg = (
            _(
                '"%s" is not a valid CSAR as it does not contain the '
                'required file "TOSCA.meta" in the folder '
                '"TOSCA-Metadata".'
            )
            % tosca_file
        )
        self._check_error(tosca_file, hot_file, {}, ValidationError, expected_msg, ValidationError)
Ejemplo n.º 28
0
 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")
     params = {'db_name': 'wordpress',
               'db_user': '******',
               'db_pwd': 'wp_pass',
               'db_root_pwd': 'passw0rd',
               'db_port': 3366,
               'cpus': 8}
     self._check_success(tosca_url, hot_file, params)
Ejemplo n.º 29
0
 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")
     params = {
         "db_name": "wordpress",
         "db_user": "******",
         "db_pwd": "wp_pass",
         "db_root_pwd": "passw0rd",
         "db_port": 3366,
         "cpus": 8,
     }
     self._check_success(tosca_url, hot_file, params)
Ejemplo n.º 30
0
    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")
        params = {'db_name': 'wordpress',
                  'db_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".')
        self._check_error(tosca_file, hot_file, params, ValidationError,
                          expected_msg, ImportError)
Ejemplo n.º 31
0
 def test_osc_translate_hello_world_csar(self):
     tosca_file = utils.get_template_path("csar_hello_world.zip")
     hot_file = utils.get_template_path(
         "hot_output/hot_hello_world.yaml")
     self._check_success(tosca_file, hot_file, {})
Ejemplo n.º 32
0
 def test_osc_translate_web_application(self):
     tosca_file = utils.get_template_path("tosca_web_application.yaml")
     hot_file = utils.get_template_path(
         "hot_output/hot_web_application.yaml")
     params = {'cpus': '2', 'context_root': 'my_web_app'}
     self._check_success(tosca_file, hot_file, params)
Ejemplo n.º 33
0
 def test_osc_translate_host_assignment(self):
     tosca_file = utils.get_template_path(
         "test_host_assignment.yaml")
     hot_file = utils.get_template_path(
         "hot_output/hot_host_assignment.yaml")
     self._check_success(tosca_file, hot_file, {})
Ejemplo n.º 34
0
 def test_osc_translate_csar_wordpress_invalid_import_path(self):
     tosca_file = utils.get_template_path("csar_wordpress_invalid_import_path.zip")
     hot_file = ""
     expected_msg = _("Import " '"Invalid_import_path/wordpress.yaml" is not valid.')
     self._check_error(tosca_file, hot_file, {}, ValidationError, expected_msg, ImportError)
Ejemplo n.º 35
0
 def test_osc_translate_csar_not_zip(self):
     tosca_file = utils.get_template_path("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)
Ejemplo n.º 36
0
 def test_osc_translate_host_assignment(self):
     tosca_file = utils.get_template_path("test_host_assignment.yaml")
     hot_file = utils.get_template_path("hot_output/hot_host_assignment.yaml")
     self._check_success(tosca_file, hot_file, {})
Ejemplo n.º 37
0
 def test_osc_translate_hello_world_csar(self):
     tosca_file = utils.get_template_path("csar_hello_world.zip")
     hot_file = utils.get_template_path("hot_output/hot_hello_world.yaml")
     self._check_success(tosca_file, hot_file, {})
Ejemplo n.º 38
0
 def test_osc_translate_single_object_store(self):
     tosca_file = utils.get_template_path("storage/tosca_single_object_store.yaml")
     hot_file = utils.get_template_path("hot_output/hot_single_object_store.yaml")
     params = {"objectstore_name": "myobjstore"}
     self._check_success(tosca_file, hot_file, params)
Ejemplo n.º 39
0
 def test_osc_translate_blockstorage_with_attachment(self):
     tosca_file = utils.get_template_path("storage/tosca_blockstorage_with_attachment.yaml")
     hot_file = utils.get_template_path("hot_output/storage/hot_blockstorage_with_attachment.yaml")
     params = {"cpus": 1, "storage_location": "/dev/vdc", "storage_size": "2000 MB", "storage_snapshot_id": "ssid"}
     self._check_success(tosca_file, hot_file, params)
Ejemplo n.º 40
0
 def test_osc_translate_nodejs_mongodb_two_instances(self):
     tosca_file = utils.get_template_path("tosca_nodejs_mongodb_two_instances.yaml")
     hot_file = utils.get_template_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._check_success(tosca_file, hot_file, params)
Ejemplo n.º 41
0
 def test_osc_translate_web_application(self):
     tosca_file = utils.get_template_path("tosca_web_application.yaml")
     hot_file = utils.get_template_path("hot_output/hot_web_application.yaml")
     params = {"cpus": "2", "context_root": "my_web_app"}
     self._check_success(tosca_file, hot_file, params)
Ejemplo n.º 42
0
 def test_osc_translate_software_component(self):
     tosca_file = utils.get_template_path("tosca_software_component.yaml")
     hot_file = utils.get_template_path("hot_output/hot_software_component.yaml")
     params = {"cpus": "1", "download_url": "http://www.software.com/download"}
     self._check_success(tosca_file, hot_file, params)
Ejemplo n.º 43
0
 def test_osc_translate_one_server_three_networks(self):
     tosca_file = utils.get_template_path("network/" + "tosca_one_server_three_networks.yaml")
     hot_file = utils.get_template_path("hot_output/network/" + "hot_one_server_three_networks.yaml")
     self._check_success(tosca_file, hot_file, {})
Ejemplo n.º 44
0
 def test_osc_translate_csar_not_zip(self):
     tosca_file = utils.get_template_path("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)
Ejemplo n.º 45
0
 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")
     params = {"github_url": "http://github.com/paypal/rest-api-sample-app-nodejs.git", "my_cpus": 4}
     self._check_success(tosca_file, hot_file, params)
Ejemplo n.º 46
0
 def test_osc_translate_blockstorage_with_relationship_template(self):
     tosca_file = utils.get_template_path("storage/" + "tosca_blockstorage_with_relationship_template.yaml")
     hot_file = utils.get_template_path("hot_output/storage/" + "hot_blockstorage_with_relationship_template.yaml")
     params = {"cpus": 1, "storage_location": "/dev/vdc", "storage_size": "1 GB"}
     self._check_success(tosca_file, hot_file, params)
Ejemplo n.º 47
0
 def test_osc_translate_server_on_existing_network(self):
     tosca_file = utils.get_template_path("network/" + "tosca_server_on_existing_network.yaml")
     hot_file = utils.get_template_path("hot_output/network/" + "hot_server_on_existing_network.yaml")
     params = {"network_name": "private_net"}
     self._check_success(tosca_file, hot_file, params)