Beispiel #1
0
    def setUpClass(cls):
        super(ObjectStorageIntegrationFixture, cls).setUpClass()
        cls.object_storage_config = ObjectStorageConfig()
        cls.object_storage_api_config = ObjectStorageAPIConfig()

        objectstorage_service = cls.access_data.get_service(
            cls.object_storage_config.identity_service_name)
        objectstorage_url_check = objectstorage_service.get_endpoint(
            cls.object_storage_config.region)
        # If endpoint validation fails, fail immediately
        if objectstorage_url_check is None:
            cls.assertClassSetupFailure('Endpoint validation failed')
        alt_objectstorage_service = cls.alt_access_data.get_service(
            cls.object_storage_config.identity_service_name)
        alt_objectstorage_url_check = alt_objectstorage_service.get_endpoint(
            cls.object_storage_config.region)
        # If endpoint validation fails, fail immediately
        if alt_objectstorage_url_check is None:
            cls.assertClassSetupFailure('Endpoint validation failed')

        cls.storage_url = objectstorage_service.get_endpoint(
            cls.object_storage_config.region).public_url
        cls.alt_storage_url = alt_objectstorage_service.get_endpoint(
            cls.object_storage_config.region).public_url

        cls.object_storage_client = ObjectStorageAPIClient(
            cls.storage_url, cls.access_data.token.id_)
        cls.alt_object_storage_client = ObjectStorageAPIClient(
            cls.alt_storage_url, cls.alt_access_data.token.id_)

        cls.object_storage_behaviors = ObjectStorageAPI_Behaviors(
            cls.object_storage_client, cls.object_storage_api_config)
        cls.alt_object_storage_behaviors = ObjectStorageAPI_Behaviors(
            cls.alt_object_storage_client, cls.object_storage_api_config)
Beispiel #2
0
    def setUpClass(cls):
        super(ObjectStorageFixture, cls).setUpClass()

        endpoint_config = UserAuthConfig()
        user_config = UserConfig()
        objectstorage_config = ObjectStorageConfig()
        objectstorage_api_config = ObjectStorageAPIConfig()

        auth_provider = AuthProvider()
        access_data = auth_provider.get_access_data(endpoint_config,
                                                    user_config)

        service = access_data.get_service(
            objectstorage_config.identity_service_name)

        endpoint = service.get_endpoint(objectstorage_config.region)
        storage_url = endpoint.public_url
        auth_token = access_data.token.id_

        cls.base_container_name = objectstorage_api_config.base_container_name
        cls.base_object_name = objectstorage_api_config.base_object_name

        cls.client = ObjectStorageAPIClient(storage_url, auth_token)

        cls.behaviors = ObjectStorageAPI_Behaviors(client=cls.client)
Beispiel #3
0
    def get_auth_data():
        """
        Authenticate and return a dictionary containing the storage url and
        auth token.
        """
        result = {
            'storage_url': None,
            'auth_token': None}

        endpoint_config = UserAuthConfig()
        user_config = UserConfig()
        objectstorage_config = ObjectStorageConfig()
        auth_provider = AuthProvider()
        access_data = auth_provider.get_access_data(
            endpoint_config, user_config)

        if endpoint_config.strategy.lower() == 'saio_tempauth':
            result['storage_url'] = access_data.storage_url
            result['auth_token'] = access_data.auth_token
        else:
            service = access_data.get_service(
                objectstorage_config.identity_service_name)
            endpoint = service.get_endpoint(objectstorage_config.region)
            result['storage_url'] = endpoint.public_url
            result['auth_token'] = access_data.token.id_

        return result
Beispiel #4
0
    def __init__(self, username=None, password=None):
        self.storage_url = None
        self.auth_token = None

        self._access_data = AuthComposite.authenticate(username, password)
        self.endpoint_config = UserAuthConfig()
        self.objectstorage_config = ObjectStorageConfig()

        if self.endpoint_config.strategy.lower() == 'saio_tempauth':
            self.storage_url = self._access_data.storage_url
            self.auth_token = self._access_data.auth_token
        else:
            service = self._access_data.get_service(
                self.objectstorage_config.identity_service_name)
            endpoint = service.get_endpoint(self.objectstorage_config.region)
            self.storage_url = endpoint.public_url
            self.auth_token = self._access_data.token.id_
Beispiel #5
0
    def setUpClass(cls):
        super(ImagesIntegrationFixture, cls).setUpClass()
        cls.object_storage_client = cls.client
        cls.object_storage_behaviors = cls.behaviors

        # Work around to create compute/obj storage additional user composites
        auth_endpoint_config = UserAuthConfig()
        compute_endpoint = ComputeEndpointConfig()
        images_config = ImagesConfig()
        flavors_config = FlavorsConfig()
        marshalling_config = MarshallingConfig()
        object_storage_config = ObjectStorageConfig()
        object_storage_api_config = ObjectStorageAPIConfig()
        servers_config = ServersConfig()
        user_config_alt_one = AltOneUserConfig()

        access_data_alt_one = AuthProvider.get_access_data(
            auth_endpoint_config, user_config_alt_one)

        # Create compute clients and behaviors for alt_one user
        compute_service_alt_one = access_data_alt_one.get_service(
            compute_endpoint.compute_endpoint_name)
        compute_url_check_alt_one = compute_service_alt_one.get_endpoint(
            compute_endpoint.region)
        # If compute endpoint validation fails, fail immediately
        if compute_url_check_alt_one is None:
            cls.assertClassSetupFailure('Compute endpoint validation failed')
        compute_url_alt_one = compute_service_alt_one.get_endpoint(
            compute_endpoint.region).public_url

        cls.compute_alt_one_images_client = ComputeImagesClient(
            compute_url_alt_one, access_data_alt_one.token.id_,
            marshalling_config.serializer, marshalling_config.deserializer)

        cls.compute_alt_one_servers_client = ServersClient(
            compute_url_alt_one, access_data_alt_one.token.id_,
            marshalling_config.serializer, marshalling_config.deserializer)

        cls.compute_alt_one_images_behaviors = ComputeImageBehaviors(
            images_client=cls.compute_alt_one_images_client,
            servers_client=cls.compute_alt_one_servers_client,
            config=images_config)

        cls.compute_alt_one_servers_behaviors = ServerBehaviors(
            servers_client=cls.compute_alt_one_servers_client,
            images_client=cls.compute_alt_one_images_client,
            servers_config=servers_config, images_config=images_config,
            flavors_config=flavors_config)

        # Create object storage client and behaviors for alt_one user
        object_storage_service_alt_one = access_data_alt_one.get_service(
            object_storage_config.identity_service_name)
        object_storage_url_check_alt_one = (
            object_storage_service_alt_one.get_endpoint(
                object_storage_config.region))
        # If endpoint validation fails, fail immediately
        if object_storage_url_check_alt_one is None:
            cls.assertClassSetupFailure('Endpoint validation failed')
        storage_url_alt_one = object_storage_service_alt_one.get_endpoint(
            object_storage_config.region).public_url

        cls.object_storage_alt_one_client = ObjectStorageAPIClient(
            storage_url_alt_one, access_data_alt_one.token.id_)

        cls.object_storage_alt_one_behaviors = ObjectStorageAPI_Behaviors(
            cls.object_storage_alt_one_client, object_storage_api_config)

        # Needed in order to allow assertions on exceptions
        cls.compute.flavors.client.delete_exception_handler(
            cls.compute_exception_handler)
Beispiel #6
0
    def __init__(self):
        self.config = ObjectStorageConfig()

        super(_ObjectStorageAuthComposite,
              self).__init__(self.config.identity_service_name,
                             self.config.region)