Пример #1
0
    def test_create_cluster_template_all(self):
        config = ClusterTemplateConfig(
            name=self.cluster_type_name,
            image=self.image_creator.image_settings.name,
            keypair=self.keypair_creator.keypair_settings.name,
            network_driver='flannel', external_net=self.ext_net_name,
            floating_ip_enabled=True, docker_volume_size=100,
            server_type=ServerType.vm,
            flavor=self.flavor_creator.flavor_settings.name,
            master_flavor=self.flavor_creator.flavor_settings.name,
            coe=ContainerOrchestrationEngine.kubernetes,
            fixed_net='foo', fixed_subnet='bar',
            registry_enabled=True, insecure_registry='localhost',
            docker_storage_driver=DockerStorageDriver.overlay,
            dns_nameserver='8.8.4.4', public=True, tls_disabled=True,
            http_proxy=None, https_proxy=None, volume_driver='cinder',
            master_lb_enabled=False, labels={'foo': 'bar'})

        self.cluster_template = magnum_utils.create_cluster_template(
            self.magnum, config)
        self.assertIsNotNone(self.cluster_template)
        self.assertTrue(
            validate_cluster_template(config, self.cluster_template))

        template_by_name = magnum_utils.get_cluster_template(
            self.magnum, template_name=config.name)
        self.assertEqual(self.cluster_template, template_by_name)
        template_by_id = magnum_utils.get_cluster_template_by_id(
            self.magnum, self.cluster_template.id)
        self.assertEqual(self.cluster_template, template_by_id)
Пример #2
0
    def initialize(self):
        """
        Loads the existing Volume
        :return: The Volume domain object or None
        """
        super(self.__class__, self).initialize()

        self.__cluster_template = magnum_utils.get_cluster_template(
            self._magnum, template_config=self.cluster_template_config)

        return self.__cluster_template
Пример #3
0
    def test_create_delete_cluster_template(self):
        """
        Tests the creation then deletion of an OpenStack template config to
        ensure clean() does not raise an Exception.
        """
        # Create ClusterTemplate
        self.cluster_template_creator = OpenStackClusterTemplate(
            self.os_creds, self.cluster_template_config)
        created_cluster_template = self.cluster_template_creator.create()
        self.assertIsNotNone(created_cluster_template)

        self.cluster_template_creator.clean()

        tmplt = magnum_utils.get_cluster_template(
            self.magnum, template_name=self.cluster_template_config.name)
        self.assertIsNone(tmplt)
Пример #4
0
    def test_create_same_cluster_template(self):
        """
        Tests the creation of an OpenStack cluster_template when one already
        exists.
        """
        # Create ClusterTemplate
        self.cluster_template_creator = OpenStackClusterTemplate(
            self.os_creds, self.cluster_template_config)
        cluster_template1 = self.cluster_template_creator.create()

        retrieved_cluster_template = magnum_utils.get_cluster_template(
            self.magnum, template_config=self.cluster_template_config)
        self.assertEqual(cluster_template1, retrieved_cluster_template)

        # Should be retrieving the instance data
        os_cluster_template_2 = OpenStackClusterTemplate(
            self.os_creds, self.cluster_template_config)
        cluster_template2 = os_cluster_template_2.create()
        self.assertEqual(cluster_template2, cluster_template2)
Пример #5
0
    def test_create_cluster_template(self):
        """
        Tests the creation of an OpenStack cluster template.
        """
        # Create ClusterTemplate
        self.cluster_template_creator = OpenStackClusterTemplate(
            self.os_creds, self.cluster_template_config)
        created_cluster_template = self.cluster_template_creator.create()
        self.assertIsNotNone(created_cluster_template)
        self.assertEqual(self.cluster_template_config.name,
                         created_cluster_template.name)

        retrieved_cluster_template1 = magnum_utils.get_cluster_template(
            self.magnum, template_config=self.cluster_template_config)
        self.assertIsNotNone(retrieved_cluster_template1)
        self.assertEqual(created_cluster_template, retrieved_cluster_template1)

        retrieved_cluster_template2 = magnum_utils.get_cluster_template_by_id(
            self.magnum, created_cluster_template.id)
        self.assertEqual(created_cluster_template, retrieved_cluster_template2)
Пример #6
0
    def test_create_cluster_template_simple(self):
        config = ClusterTemplateConfig(
            name=self.cluster_type_name,
            image=self.image_creator.image_settings.name,
            keypair=self.keypair_creator.keypair_settings.name,
            external_net=self.ext_net_name,
            flavor=self.flavor_creator.flavor_settings.name)

        self.cluster_template = magnum_utils.create_cluster_template(
            self.magnum, config)
        self.assertIsNotNone(self.cluster_template)
        self.assertTrue(
            validate_cluster_template(config, self.cluster_template))

        template_by_name = magnum_utils.get_cluster_template(
            self.magnum, template_name=config.name)
        self.assertEqual(self.cluster_template, template_by_name)
        template_by_id = magnum_utils.get_cluster_template_by_id(
            self.magnum, self.cluster_template.id)
        self.assertEqual(self.cluster_template, template_by_id)