Exemplo n.º 1
0
    def test_nova_connect_fail(self):
        """
        Tests to ensure that the improper credentials cannot connect.
        """

        with self.assertRaises(RuntimeError):
            magnum_utils.magnum_client(
                OSCreds(username='******', password='******',
                        auth_url=self.os_creds.auth_url,
                        project_name=self.os_creds.project_name,
                        proxy_settings=self.os_creds.proxy_settings))
Exemplo n.º 2
0
    def setUp(self):
        """
        Instantiates the CreateClusterTemplate object that is responsible for
        downloading and creating an OS template config file within OpenStack
        """
        super(self.__class__, self).__start__()

        self.guid = self.__class__.__name__ + '-' + str(uuid.uuid4())
        self.cluster_type_name = self.guid + '-cluster-type'
        self.magnum = magnum_utils.magnum_client(self.os_creds,
                                                 self.os_session)

        metadata = self.image_metadata
        if not metadata:
            metadata = dict()
        if 'extra_properties' not in metadata:
            metadata['extra_properties'] = dict()
        metadata['extra_properties']['os_distro'] = 'cirros'

        os_image_settings = openstack_tests.cirros_image_settings(
            name=self.guid + '-image', image_metadata=metadata)

        self.image_creator = OpenStackImage(self.os_creds, os_image_settings)

        flavor_config = openstack_tests.get_flavor_config(
            name=self.guid + '-flavor',
            ram=512,
            disk=10,
            vcpus=1,
            metadata=self.flavor_metadata)
        self.flavor_creator = OpenStackFlavor(self.os_creds, flavor_config)

        keypair_priv_filepath = 'tmp/' + self.guid
        keypair_pub_filepath = keypair_priv_filepath + '.pub'

        self.keypair_creator = OpenStackKeypair(
            self.os_creds,
            KeypairConfig(name=self.guid + '-keypair',
                          public_filepath=keypair_pub_filepath,
                          private_filepath=keypair_priv_filepath))

        self.cluster_template_creator = None

        self.cluster_template_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)

        try:
            self.image_creator.create()
            self.flavor_creator.create()
            self.keypair_creator.create()
        except:
            self.tearDown()
            raise
Exemplo n.º 3
0
    def test_connect_success(self):
        """
        Tests to ensure that the proper credentials can connect.
        """
        magnum = magnum_utils.magnum_client(
            self.os_creds, self.os_session)

        # This should not throw an exception
        self.assertIsNotNone(magnum.clusters.list())
Exemplo n.º 4
0
    def setUp(self):
        self.guid = self.__class__.__name__ + '-' + str(uuid.uuid4())
        self.cluster_type_name = self.guid + '-cluster-type'
        self.magnum = magnum_utils.magnum_client(
            self.os_creds, self.os_session)

        metadata = self.image_metadata
        if not metadata:
            metadata = dict()
        if 'extra_properties' not in metadata:
            metadata['extra_properties'] = dict()
        metadata['extra_properties']['os_distro'] = 'cirros'

        os_image_settings = openstack_tests.cirros_image_settings(
            name=self.guid + '-image', image_metadata=metadata)

        self.image_creator = OpenStackImage(self.os_creds, os_image_settings)

        self.flavor_creator = OpenStackFlavor(
            self.os_creds, FlavorConfig(
                name=self.guid + '-flavor', ram=512, disk=10, vcpus=1))

        keypair_priv_filepath = 'tmp/' + self.guid
        keypair_pub_filepath = keypair_priv_filepath + '.pub'

        self.keypair_creator = OpenStackKeypair(
            self.os_creds, KeypairConfig(
                name=self.guid + '-keypair',
                public_filepath=keypair_pub_filepath,
                private_filepath=keypair_priv_filepath))

        self.cluster_template = None

        try:
            self.image_creator.create()
            self.flavor_creator.create()
            self.keypair_creator.create()
        except:
            self.tearDown()
            raise
Exemplo n.º 5
0
 def initialize(self):
     super(OpenStackMagnumObject, self).initialize()
     self._magnum = magnum_utils.magnum_client(self._os_creds,
                                               self._os_session)