コード例 #1
0
 def __init__(self, images_client, images_config):
     super(ImagesBehaviors, self).__init__()
     self.config = images_config
     self.client = images_client
     self.resources = ResourcePool()
     self.error_msg = Messages.ERROR_MSG
     self.id_regex = re.compile(ImageProperties.ID_REGEX)
コード例 #2
0
ファイル: fixtures.py プロジェクト: isabella232/cloudroast
    def setUpClass(cls):
        super(ComputeFixture, cls).setUpClass()
        cls.flavors_config = FlavorsConfig()
        cls.images_config = ImagesConfig()
        cls.servers_config = ServersConfig()
        cls.compute_endpoint = ComputeEndpointConfig()
        cls.marshalling = MarshallingConfig()
        cls.config_drive_config = ConfigDriveConfig()

        cls.flavor_ref = cls.flavors_config.primary_flavor
        cls.flavor_ref_alt = cls.flavors_config.secondary_flavor
        cls.image_ref = cls.images_config.primary_image
        cls.image_ref_alt = cls.images_config.secondary_image
        cls.disk_path = cls.servers_config.instance_disk_path

        cls.endpoint_config = UserAuthConfig()
        cls.user_config = UserConfig()
        access_data = AuthProvider.get_access_data(cls.endpoint_config,
                                                   cls.user_config)
        # If authentication fails, halt
        if access_data is None:
            cls.assertClassSetupFailure('Authentication failed.')

        compute_service = access_data.get_service(
            cls.compute_endpoint.compute_endpoint_name)
        url = compute_service.get_endpoint(
            cls.compute_endpoint.region).public_url
        # If a url override was provided, use that value instead
        if cls.compute_endpoint.compute_endpoint_url:
            url = '{0}/{1}'.format(cls.compute_endpoint.compute_endpoint_url,
                                   cls.user_config.tenant_id)

        client_args = {'url': url, 'auth_token': access_data.token.id_,
                       'serialize_format': cls.marshalling.serializer,
                       'deserialize_format': cls.marshalling.deserializer}

        cls.flavors_client = FlavorsClient(**client_args)
        cls.servers_client = ServersClient(**client_args)
        cls.images_client = ImagesClient(**client_args)
        cls.keypairs_client = KeypairsClient(**client_args)
        cls.security_groups_client = SecurityGroupsClient(**client_args)
        cls.security_group_rule_client = SecurityGroupRulesClient(
            **client_args)
        cls.rescue_client = RescueClient(**client_args)
        cls.vnc_client = VncConsoleClient(**client_args)
        cls.console_output_client = ConsoleOutputClient(**client_args)
        cls.server_behaviors = ServerBehaviors(cls.servers_client,
                                               cls.servers_config,
                                               cls.images_config,
                                               cls.flavors_config)
        cls.image_behaviors = ImageBehaviors(cls.images_client,
                                             cls.servers_client,
                                             cls.images_config)
        cls.config_drive_behaviors = ConfigDriveBehaviors(cls.servers_client,
                                                          cls.servers_config,
                                                          cls.server_behaviors)
        cls.flavors_client.add_exception_handler(ExceptionHandler())
        cls.resources = ResourcePool()
コード例 #3
0
    def setUpClass(cls):
        super(ComputeFixture, cls).setUpClass()
        cls.compute = ComputeComposite()

        # Configs
        cls.flavors_config = cls.compute.flavors.config
        cls.images_config = cls.compute.images.config
        cls.servers_config = cls.compute.servers.config
        cls.volumes_config = VolumesAPIConfig()
        cls.compute_endpoint = ComputeEndpointConfig()
        cls.marshalling = MarshallingConfig()
        cls.config_drive_config = cls.compute.config_drive.config
        cls.cloud_init_config = cls.compute.config_drive.cloud_init_config
        cls.user_config = cls.compute.user
        cls.security_groups_config = cls.compute.security_groups.config

        # Common config values
        cls.flavor_ref = cls.flavors_config.primary_flavor
        cls.flavor_ref_alt = cls.flavors_config.secondary_flavor
        cls.image_ref = cls.images_config.primary_image
        cls.image_ref_alt = cls.images_config.secondary_image
        cls.bootable_volume_ref = cls.volumes_config.primary_bootable_volume

        cls.disk_path = cls.servers_config.instance_disk_path
        cls.split_ephemeral_disk_enabled = \
            cls.servers_config.split_ephemeral_disk_enabled
        cls.ephemeral_disk_max_size = \
            cls.servers_config.ephemeral_disk_max_size
        cls.disk_format_type = cls.servers_config.disk_format_type
        cls.expected_networks = cls.servers_config.expected_networks
        cls.file_injection_enabled = \
            cls.servers_config.personality_file_injection_enabled
        cls.keep_resources_on_failure =\
            cls.servers_config.keep_resources_on_failure
        cls.compute_exception_handler = ExceptionHandler()

        # Clients
        cls.flavors_client = cls.compute.flavors.client
        cls.servers_client = cls.compute.servers.client
        cls.boot_from_volume_client = cls.compute.boot_from_volume.client
        cls.images_client = cls.compute.images.client
        cls.keypairs_client = cls.compute.keypairs.client
        cls.security_groups_client = cls.compute.security_groups.client
        cls.security_group_rule_client = \
            cls.compute.security_groups.rules_client
        cls.volume_attachments_client = cls.compute.volume_attachments.client
        cls.rescue_client = cls.compute.rescue.client
        cls.vnc_client = cls.compute.vnc_console.client
        cls.console_output_client = cls.compute.console_output.client
        cls.limits_client = cls.compute.limits.client
        cls.server_behaviors = cls.compute.servers.behaviors
        cls.volume_server_behaviors = cls.compute.boot_from_volume.behaviors
        cls.image_behaviors = cls.compute.images.behaviors
        cls.config_drive_behaviors = cls.compute.config_drive.behaviors
        cls.flavors_client.add_exception_handler(cls.compute_exception_handler)
        cls.resources = ResourcePool()
        cls.addClassCleanup(cls.resources.release)
コード例 #4
0
    def setUpClass(cls):
        super(BareMetalFixture, cls).setUpClass()
        cls.bare_metal = BareMetalComposite()

        cls.chassis_client = cls.bare_metal.chassis.client
        cls.drivers_client = cls.bare_metal.drivers.client
        cls.nodes_client = cls.bare_metal.nodes.client
        cls.ports_client = cls.bare_metal.ports.client

        cls.resources = ResourcePool()
        cls.addClassCleanup(cls.resources.release)
コード例 #5
0
ファイル: fixtures.py プロジェクト: bhushan5/cloudroast
    def setUpClass(cls):
        super(ImagesFixture, cls).setUpClass()
        cls.resources = ResourcePool()

        cls.user_one = ImagesAuthComposite()
        cls.user_two = ImagesAuthCompositeAltOne()
        cls.user_three = ImagesAuthCompositeAltTwo()

        cls.images = ImagesComposite(cls.user_one)
        cls.images_alt_one = ImagesComposite(cls.user_two)
        cls.images_alt_two = ImagesComposite(cls.user_three)

        cls.addClassCleanup(cls.resources.release)
コード例 #6
0
    def setUpClass(cls):
        super(ImagesV2Fixture, cls).setUpClass()
        cls.config = ImagesConfig()
        cls.resources = ResourcePool()

        access_data = AuthProvider.get_access_data()

        cls.images_endpoint = '{base_url}/v2'.format(
            base_url=cls.config.base_url)

        cls.api_client = ImagesV2Client(cls.images_endpoint,
                                        access_data.token.id_,
                                        'json', 'json')
コード例 #7
0
ファイル: fixtures.py プロジェクト: souravrack/cloudroast
    def setUpClass(cls):
        super(ImagesFixture, cls).setUpClass()
        cls.images_config = ImagesConfig()
        cls.marshalling = MarshallingConfig()
        cls.endpoint_config = UserAuthConfig()
        cls.user_config = UserConfig()
        cls.alt_user_config = AltUserConfig()
        cls.third_user_config = ThirdUserConfig()
        cls.resources = ResourcePool()
        cls.serialize_format = cls.marshalling.serializer
        cls.deserialize_format = cls.marshalling.deserializer

        cls.user_list = cls.generate_user_list(cls.images_config.account_list)

        cls.access_data = cls.user_list['user'][cls.ACCESS_DATA]
        cls.images_client = cls.user_list['user'][cls.CLIENT]
        cls.images_behavior = cls.user_list['user'][cls.BEHAVIOR]
        cls.tenant_id = cls.access_data.token.tenant.id_
        cls.addClassCleanup(cls.images_behavior.resources.release)

        if cls.user_list.get('alt_user'):
            cls.alt_access_data = cls.user_list['alt_user'][cls.ACCESS_DATA]
            cls.alt_images_client = cls.user_list['alt_user'][cls.CLIENT]
            cls.alt_images_behavior = cls.user_list['alt_user'][cls.BEHAVIOR]
            cls.alt_tenant_id = cls.alt_access_data.token.tenant.id_
            cls.addClassCleanup(cls.alt_images_behavior.resources.release)

        if cls.user_list.get('third_user'):
            cls.third_access_data = (
                cls.user_list['third_user'][cls.ACCESS_DATA])
            cls.third_images_client = cls.user_list['third_user'][cls.CLIENT]
            cls.third_images_behavior = (
                cls.user_list['third_user'][cls.BEHAVIOR])
            cls.third_tenant_id = cls.third_access_data.token.tenant.id_
            cls.addClassCleanup(cls.third_images_behavior.resources.release)

        cls.error_msg = Messages.ERROR_MSG
        cls.id_regex = re.compile(ImageProperties.ID_REGEX)
        cls.import_from = cls.images_config.import_from
        cls.import_from_bootable = cls.images_config.import_from_bootable
        cls.import_from_format = cls.images_config.import_from_format
        cls.export_to = cls.images_config.export_to
        cls.max_created_at_delta = cls.images_config.max_created_at_delta
        cls.max_expires_at_delta = cls.images_config.max_expires_at_delta
        cls.max_updated_at_delta = cls.images_config.max_updated_at_delta
        cls.test_file = cls.read_data_file(cls.images_config.test_file)

        cls.addClassCleanup(cls.resources.release)

        cls.exception_handler = ExceptionHandler()
        cls.images_client.add_exception_handler(cls.exception_handler)
コード例 #8
0
ファイル: fixtures.py プロジェクト: bhushan5/cloudroast
    def setUpClass(cls):
        super(NetworkingFixture, cls).setUpClass()
        cls.net = NetworkingComposite()

        # base config from networking/networks/common/config.py
        cls.config = cls.net.config

        # sub-composites
        cls.networks = cls.net.networks
        cls.subnets = cls.net.subnets
        cls.ports = cls.net.ports

        # base behavior from networking/networks/common/behaviors.py to be
        # used by child behaviors mainly, still, it can be accessed in the
        # composite at cls.net.common.behaviors

        # Integrated API behavior methods for networks, subnets and ports
        # from /networking/networks/behaviors.py
        cls.behaviors = cls.net.behaviors

        # Other reusable values (service_network_id aka Private Network)
        cls.public_network_id = cls.net.networks.config.public_network_id
        cls.service_network_id = cls.net.networks.config.service_network_id

        # Lists to add networks, subnets and ports IDs for resource deletes
        # by the networkingCleanUp method
        cls.delete_networks = []
        cls.failed_networks = []
        cls.delete_subnets = []
        cls.failed_subnets = []
        cls.delete_ports = []
        cls.failed_ports = []
        cls.delete_secgroups = []
        cls.failed_secgroups = []
        cls.delete_secgroups_rules = []
        cls.failed_secgroups_rules = []

        # Getting user data for testing
        cls.user = cls.net.networking_auth_composite()
        cls.alt_user = NetworkingSecondUserConfig()

        # Using the networkingCleanup method
        cls.addClassCleanup(cls.networkingCleanUp)

        # For resources delete management like Compute, Images or alternative
        # to the networkingCleanUp
        cls.resources = ResourcePool()
        cls.addClassCleanup(cls.resources.release_lifo)
コード例 #9
0
ファイル: fixtures.py プロジェクト: kaofelix/cloudroast
    def setUpClass(cls):
        super(ComputeFixture, cls).setUpClass()
        cls.flavors_config = FlavorsConfig()
        cls.images_config = ImagesConfig()
        cls.servers_config = ServersConfig()
        cls.compute_endpoint = ComputeEndpointConfig()

        cls.flavor_ref = cls.flavors_config.primary_flavor
        cls.flavor_ref_alt = cls.flavors_config.secondary_flavor
        cls.image_ref = cls.images_config.primary_image
        cls.image_ref_alt = cls.images_config.secondary_image
        cls.disk_path = cls.servers_config.instance_disk_path

        cls.endpoint_config = UserAuthConfig()
        user_config = UserConfig()
        access_data = AuthProvider.get_access_data(cls.endpoint_config,
                                                   user_config)

        compute_service = access_data.get_service(
            cls.compute_endpoint.compute_endpoint_name)
        url = compute_service.get_endpoint(
            cls.compute_endpoint.region).public_url
        cls.flavors_client = FlavorsClient(url, access_data.token.id_, 'json',
                                           'json')
        cls.servers_client = ServersClient(url, access_data.token.id_, 'json',
                                           'json')
        cls.images_client = ImagesClient(url, access_data.token.id_, 'json',
                                         'json')
        cls.keypairs_client = KeypairsClient(url, access_data.token.id_,
                                             'json', 'json')
        cls.sec_groups_client = SecurityGroupsClient(url,
                                                     access_data.token.id_,
                                                     'json', 'json')
        cls.rescue_client = RescueClient(url, access_data.token.id_, 'json',
                                         'json')
        cls.server_behaviors = ServerBehaviors(cls.servers_client,
                                               cls.servers_config,
                                               cls.images_config,
                                               cls.flavors_config)
        cls.image_behaviors = ImageBehaviors(cls.images_client,
                                             cls.servers_client,
                                             cls.images_config)
        cls.flavors_client.add_exception_handler(ExceptionHandler())
        cls.resources = ResourcePool()
コード例 #10
0
    def setUpClass(cls):
        super(BareMetalFixture, cls).setUpClass()
        cls.marshalling = MarshallingConfig()
        cls.bare_metal_endpoint = BareMetalEndpointConfig()

        cls.endpoint_config = UserAuthConfig()
        cls.user_config = UserConfig()
        cls.access_data = AuthProvider.get_access_data(cls.endpoint_config,
                                                       cls.user_config)

        # If authentication fails, halt
        if cls.access_data is None:
            cls.assertClassSetupFailure('Authentication failed.')

        bare_metal_service = cls.access_data.get_service(
            cls.bare_metal_endpoint.bare_metal_endpoint_name)
        url = bare_metal_service.get_endpoint(
            cls.bare_metal_endpoint.region).public_url

        # If a url override was provided, use that value instead
        if cls.bare_metal_endpoint.bare_metal_endpoint_url:
            url = cls.bare_metal_endpoint.bare_metal_endpoint_url

        client_args = {
            'url': url,
            'auth_token': cls.access_data.token.id_,
            'serialize_format': cls.marshalling.serializer,
            'deserialize_format': cls.marshalling.deserializer
        }

        cls.chassis_client = ChassisClient(**client_args)
        cls.drivers_client = DriversClient(**client_args)
        cls.nodes_client = NodesClient(**client_args)
        cls.ports_client = PortsClient(**client_args)

        cls.resources = ResourcePool()
        cls.addClassCleanup(cls.resources.release)
コード例 #11
0
ファイル: fixtures.py プロジェクト: pallipuspa/cloudroast
 def setUpClass(cls):
     super(ImagesFixture, cls).setUpClass()
     cls.config = ImagesConfig()
     cls.resources = ResourcePool()
コード例 #12
0
ファイル: fixtures.py プロジェクト: sharwell/otter
    def setUpClass(cls):
        """
        Initialize autoscale configs, behaviors and client
        """
        super(AutoscaleFixture, cls).setUpClass()
        cls.resources = ResourcePool()
        cls.autoscale_config = AutoscaleConfig()
        cls.endpoint_config = UserAuthConfig()
        user_config = UserConfig()
        access_data = AuthProvider.get_access_data(cls.endpoint_config,
                                                   user_config)
        server_service = access_data.get_service(
            cls.autoscale_config.server_endpoint_name)
        load_balancer_service = access_data.get_service(
            cls.autoscale_config.load_balancer_endpoint_name)
        server_url = server_service.get_endpoint(
            cls.autoscale_config.region).public_url
        lbaas_url = load_balancer_service.get_endpoint(
            cls.autoscale_config.region).public_url

        cls.tenant_id = cls.autoscale_config.tenant_id

        env = os.environ['OSTNG_CONFIG_FILE']
        if ('preprod' in env.lower()) or ('dev' in env.lower()):
            cls.url = str(cls.autoscale_config.server_endpoint) + '/' + str(
                cls.tenant_id)
        else:
            autoscale_service = access_data.get_service(
                cls.autoscale_config.autoscale_endpoint_name)
            cls.url = autoscale_service.get_endpoint(
                cls.autoscale_config.region).public_url

        cls.autoscale_client = AutoscalingAPIClient(cls.url,
                                                    access_data.token.id_,
                                                    'json', 'json')
        cls.server_client = ServersClient(server_url, access_data.token.id_,
                                          'json', 'json')
        cls.lbaas_client = LbaasAPIClient(lbaas_url, access_data.token.id_,
                                          'json', 'json')
        cls.autoscale_behaviors = AutoscaleBehaviors(cls.autoscale_config,
                                                     cls.autoscale_client)
        cls.gc_name = cls.autoscale_config.gc_name
        cls.gc_cooldown = int(cls.autoscale_config.gc_cooldown)
        cls.gc_min_entities = int(cls.autoscale_config.gc_min_entities)
        cls.gc_min_entities_alt = int(cls.autoscale_config.gc_min_entities_alt)
        cls.gc_max_entities = int(cls.autoscale_config.gc_max_entities)
        cls.lc_name = cls.autoscale_config.lc_name
        cls.lc_flavor_ref = cls.autoscale_config.lc_flavor_ref
        cls.lc_image_ref = cls.autoscale_config.lc_image_ref
        cls.lc_image_ref_alt = cls.autoscale_config.lc_image_ref_alt
        cls.sp_name = rand_name(cls.autoscale_config.sp_name)
        cls.sp_cooldown = int(cls.autoscale_config.sp_cooldown)
        cls.sp_change = int(cls.autoscale_config.sp_change)
        cls.sp_change_percent = int(cls.autoscale_config.sp_change_percent)
        cls.sp_desired_capacity = int(cls.autoscale_config.sp_desired_capacity)
        cls.sp_policy_type = cls.autoscale_config.sp_policy_type
        cls.upd_sp_change = int(cls.autoscale_config.upd_sp_change)
        cls.lc_load_balancers = cls.autoscale_config.lc_load_balancers
        cls.sp_list = cls.autoscale_config.sp_list
        cls.wb_name = rand_name(cls.autoscale_config.wb_name)
        cls.load_balancer_1 = int(cls.autoscale_config.load_balancer_1)
        cls.load_balancer_2 = int(cls.autoscale_config.load_balancer_2)
        cls.load_balancer_3 = int(cls.autoscale_config.load_balancer_3)
        cls.lb_other_region = int(cls.autoscale_config.lb_other_region)
        cls.interval_time = int(cls.autoscale_config.interval_time)
        cls.timeout = int(cls.autoscale_config.timeout)
        cls.scheduler_interval = OtterConstants.SCHEDULER_INTERVAL
        cls.scheduler_batch = OtterConstants.SCHEDULER_BATCH
        cls.max_maxentities = OtterConstants.MAX_MAXENTITIES
        cls.max_cooldown = OtterConstants.MAX_COOLDOWN
        cls.max_groups = OtterConstants.MAX_GROUPS
        cls.max_policies = OtterConstants.MAX_POLICIES
        cls.max_webhooks = OtterConstants.MAX_WEBHOOKS
        cls.limit_value_all = OtterConstants.LIMIT_VALUE_ALL
        cls.limit_unit_all = OtterConstants.LIMIT_UNIT_ALL
        cls.limit_value_webhook = OtterConstants.LIMIT_VALUE_WEBHOOK
        cls.limit_unit_webhook = OtterConstants.LIMIT_UNIT_WEBHOOK
        cls.non_autoscale_username = cls.autoscale_config.non_autoscale_username
        cls.non_autoscale_password = cls.autoscale_config.non_autoscale_password
        cls.non_autoscale_tenant = cls.autoscale_config.non_autoscale_tenant
コード例 #13
0
    def setUpClass(cls):
        super(ImagesFixture, cls).setUpClass()
        cls.images_config = ImagesConfig()
        cls.marshalling = MarshallingConfig()
        cls.endpoint_config = UserAuthConfig()
        cls.user_config = UserConfig()
        cls.alt_user_config = AltUserConfig()
        cls.third_user_config = ThirdUserConfig()
        cls.resources = ResourcePool()
        cls.serialize_format = cls.marshalling.serializer
        cls.deserialize_format = cls.marshalling.deserializer

        cls.access_data = AuthProvider.get_access_data(cls.endpoint_config,
                                                       cls.user_config)
        # If authentication fails, fail immediately
        if cls.access_data is None:
            cls.assertClassSetupFailure('Authentication failed')

        cls.alt_access_data = AuthProvider.get_access_data(
            cls.endpoint_config, cls.alt_user_config)
        # If authentication fails, fail immediately
        if cls.alt_access_data is None:
            cls.assertClassSetupFailure('Authentication failed')
        cls.third_access_data = AuthProvider.get_access_data(
            cls.endpoint_config, cls.third_user_config)
        # If authentication fails, fail immediately
        if cls.third_access_data is None:
            cls.assertClassSetupFailure('Authentication failed')

        images_service = cls.access_data.get_service(
            cls.images_config.endpoint_name)

        images_url_check = images_service.get_endpoint(
            cls.images_config.region)
        # If endpoint validation fails, fail immediately
        if images_url_check is None:
            cls.assertClassSetupFailure('Endpoint validation failed')

        cls.url = (images_service.get_endpoint(
            cls.images_config.region).public_url)
        # If a url override was provided, use it instead
        if cls.images_config.override_url:
            cls.url = cls.images_config.override_url

        cls.images_client = cls.generate_images_client(cls.access_data)
        cls.alt_images_client = cls.generate_images_client(cls.alt_access_data)
        cls.third_images_client = cls.generate_images_client(
            cls.third_access_data)

        cls.images_behavior = ImagesBehaviors(images_client=cls.images_client,
                                              images_config=cls.images_config)
        cls.alt_images_behavior = ImagesBehaviors(
            images_client=cls.alt_images_client,
            images_config=cls.images_config)
        cls.third_images_behavior = ImagesBehaviors(
            images_client=cls.third_images_client,
            images_config=cls.images_config)

        cls.alt_tenant_id = cls.alt_access_data.token.tenant.id_
        cls.error_msg = Messages.ERROR_MSG
        cls.export_to = cls.images_config.export_to
        cls.id_regex = re.compile(ImageProperties.ID_REGEX)
        cls.import_from = cls.images_config.import_from
        cls.import_from_bootable = cls.images_config.import_from_bootable
        cls.import_from_format = cls.images_config.import_from_format
        cls.max_created_at_delta = cls.images_config.max_created_at_delta
        cls.max_expires_at_delta = cls.images_config.max_expires_at_delta
        cls.max_updated_at_delta = cls.images_config.max_updated_at_delta
        cls.tenant_id = cls.access_data.token.tenant.id_
        cls.third_tenant_id = cls.third_access_data.token.tenant.id_

        cls.test_file = cls.read_data_file(cls.images_config.test_file)
        cls.image_schema_json = cls.read_data_file(
            cls.images_config.image_schema_json)
        cls.images_schema_json = cls.read_data_file(
            cls.images_config.images_schema_json)
        cls.image_member_schema_json = cls.read_data_file(
            cls.images_config.image_member_schema_json)
        cls.image_members_schema_json = cls.read_data_file(
            cls.images_config.image_members_schema_json)
        cls.task_schema_json = cls.read_data_file(
            cls.images_config.task_schema_json)
        cls.tasks_schema_json = cls.read_data_file(
            cls.images_config.tasks_schema_json)

        cls.addClassCleanup(cls.resources.release)
        cls.addClassCleanup(cls.images_behavior.resources.release)
        cls.addClassCleanup(cls.alt_images_behavior.resources.release)
        cls.addClassCleanup(cls.third_images_behavior.resources.release)
コード例 #14
0
    def setUpClass(cls):
        """
        Initialize autoscale configs, behaviors and client
        """
        super(AutoscaleFixture, cls).setUpClass()
        cls.resources = ResourcePool()
        cls.autoscale_config = autoscale_config
        cls.endpoint_config = endpoint_config

        cls.tenant_id = cls.autoscale_config.tenant_id

        cls.gc_name = cls.autoscale_config.gc_name
        cls.gc_cooldown = int(cls.autoscale_config.gc_cooldown)
        cls.gc_min_entities = int(cls.autoscale_config.gc_min_entities)
        cls.gc_min_entities_alt = int(cls.autoscale_config.gc_min_entities_alt)
        cls.gc_max_entities = int(cls.autoscale_config.gc_max_entities)
        cls.lc_name = cls.autoscale_config.lc_name
        cls.lc_flavor_ref = cls.autoscale_config.lc_flavor_ref
        cls.sp_name = rand_name(cls.autoscale_config.sp_name)
        cls.sp_cooldown = int(cls.autoscale_config.sp_cooldown)
        cls.sp_change = int(cls.autoscale_config.sp_change)
        cls.sp_change_percent = int(cls.autoscale_config.sp_change_percent)
        cls.sp_desired_capacity = int(cls.autoscale_config.sp_desired_capacity)
        cls.sp_policy_type = cls.autoscale_config.sp_policy_type
        cls.upd_sp_change = int(cls.autoscale_config.upd_sp_change)
        cls.lc_load_balancers = cls.autoscale_config.lc_load_balancers
        cls.sp_list = cls.autoscale_config.sp_list
        cls.wb_name = rand_name(cls.autoscale_config.wb_name)
        cls.interval_time = int(cls.autoscale_config.interval_time)
        cls.timeout = int(cls.autoscale_config.timeout)
        cls.scheduler_interval = OtterConstants.SCHEDULER_INTERVAL
        cls.cron_wait_timeout = 60 + cls.scheduler_interval + 5
        cls.scheduler_batch = OtterConstants.SCHEDULER_BATCH
        cls.max_maxentities = OtterConstants.MAX_MAXENTITIES
        cls.max_cooldown = OtterConstants.MAX_COOLDOWN
        cls.max_groups = OtterConstants.MAX_GROUPS
        cls.max_policies = OtterConstants.MAX_POLICIES
        cls.max_webhooks = OtterConstants.MAX_WEBHOOKS
        cls.limit_value_all = OtterConstants.LIMIT_VALUE_ALL
        cls.limit_unit_all = OtterConstants.LIMIT_UNIT_ALL
        cls.limit_value_webhook = OtterConstants.LIMIT_VALUE_WEBHOOK
        cls.limit_unit_webhook = OtterConstants.LIMIT_UNIT_WEBHOOK
        cls.pagination_limit = OtterConstants.PAGINATION_LIMIT
        cls.personality_maxlength = OtterConstants.PERSONALITY_MAXLENGTH
        cls.max_personalities = OtterConstants.PERSONALITIES_PER_SERVER
        cls.personality_max_file_size = OtterConstants.PERSONAITY_FILE_SIZE
        cls.non_autoscale_username = (
            cls.autoscale_config.non_autoscale_username)
        cls.non_autoscale_password = (
            cls.autoscale_config.non_autoscale_password)
        cls.non_autoscale_tenant = cls.autoscale_config.non_autoscale_tenant

        cls.autoscale_client = autoscale_client
        cls.server_client = server_client
        cls.lbaas_client = lbaas_client
        cls.rcv3_client = rcv3_client

        # ImageRefs of ununtu and non-ubuntu images that will be used
        # when creating groups
        image_refs = image_ids_with_and_without_name(images_client)
        cls.lc_image_ref, cls.lc_image_ref_alt = image_refs
        # Unfortunately some of the tests use imageRef from config instead of
        # this class. So, storing the same in config too
        autoscale_config.lc_image_ref = cls.lc_image_ref
        autoscale_config.lc_image_ref_alt = cls.lc_image_ref_alt

        cls.rcv3_load_balancer_pool = _rcv3_load_balancer_pool
        cls.rcv3_cloud_network = _rcv3_cloud_network

        cls.url = autoscale_client.url

        cls.autoscale_behaviors = AutoscaleBehaviors(
            autoscale_config, autoscale_client,
            rcv3_client=rcv3_client
        )
コード例 #15
0
 def __init__(self, images_client, images_config):
     super(ImagesBehaviors, self).__init__()
     self.config = images_config
     self.client = images_client
     self.resources = ResourcePool()
コード例 #16
0
    def setUpClass(cls):
        super(ComputeFixture, cls).setUpClass()
        cls.flavors_config = FlavorsConfig()
        cls.images_config = ImagesConfig()
        cls.servers_config = ServersConfig()
        cls.compute_endpoint = ComputeEndpointConfig()
        cls.marshalling = MarshallingConfig()
        cls.config_drive_config = ConfigDriveConfig()
        cls.cloud_init_config = CloudInitConfig()

        cls.flavor_ref = cls.flavors_config.primary_flavor
        cls.flavor_ref_alt = cls.flavors_config.secondary_flavor
        cls.image_ref = cls.images_config.primary_image
        cls.image_ref_alt = cls.images_config.secondary_image
        cls.disk_path = cls.servers_config.instance_disk_path
        cls.split_ephemeral_disk_enabled = \
            cls.servers_config.split_ephemeral_disk_enabled
        cls.ephemeral_disk_max_size = \
            cls.servers_config.ephemeral_disk_max_size
        cls.disk_format_type = cls.servers_config.disk_format_type
        cls.expected_networks = cls.servers_config.expected_networks
        cls.file_injection_enabled = \
            cls.servers_config.personality_file_injection_enabled

        cls.endpoint_config = UserAuthConfig()
        cls.user_config = UserConfig()
        cls.access_data = AuthProvider.get_access_data(cls.endpoint_config,
                                                       cls.user_config)
        # If authentication fails, halt
        if cls.access_data is None:
            cls.assertClassSetupFailure('Authentication failed.')

        compute_service = cls.access_data.get_service(
            cls.compute_endpoint.compute_endpoint_name)
        url = compute_service.get_endpoint(
            cls.compute_endpoint.region).public_url
        # If a url override was provided, use that value instead
        if cls.compute_endpoint.compute_endpoint_url:
            url = '{0}/{1}'.format(cls.compute_endpoint.compute_endpoint_url,
                                   cls.user_config.tenant_id)

        client_args = {'url': url, 'auth_token': cls.access_data.token.id_,
                       'serialize_format': cls.marshalling.serializer,
                       'deserialize_format': cls.marshalling.deserializer}

        cls.flavors_client = FlavorsClient(**client_args)
        cls.servers_client = ServersClient(**client_args)
        cls.boot_from_volume_client = VolumesBootClient(**client_args)
        cls.images_client = ImagesClient(**client_args)
        cls.keypairs_client = KeypairsClient(**client_args)
        cls.security_groups_client = SecurityGroupsClient(**client_args)
        cls.security_group_rule_client = SecurityGroupRulesClient(
            **client_args)
        cls.volume_attachments_client = VolumeAttachmentsAPIClient(
            url=url, auth_token=cls.access_data.token.id_,
            serialize_format=cls.marshalling.serializer,
            deserialize_format=cls.marshalling.deserializer)
        cls.rescue_client = RescueClient(**client_args)
        cls.vnc_client = VncConsoleClient(**client_args)
        cls.console_output_client = ConsoleOutputClient(**client_args)
        cls.limits_client = LimitsClient(**client_args)
        cls.server_behaviors = ServerBehaviors(
            servers_client=cls.servers_client,
            images_client=cls.images_client,
            servers_config=cls.servers_config,
            images_config=cls.images_config,
            flavors_config=cls.flavors_config)
        cls.volume_server_behaviors = VolumeServerBehaviors(
            servers_client=cls.servers_client,
            images_client=cls.images_client,
            servers_config=cls.servers_config,
            images_config=cls.images_config,
            flavors_config=cls.flavors_config,
            server_behaviors=cls.server_behaviors,
            boot_from_volume_client=cls.boot_from_volume_client)
        cls.image_behaviors = ImageBehaviors(cls.images_client,
                                             cls.servers_client,
                                             cls.images_config)
        cls.config_drive_behaviors = ConfigDriveBehaviors(cls.servers_client,
                                                          cls.servers_config,
                                                          cls.server_behaviors)
        cls.flavors_client.add_exception_handler(ExceptionHandler())
        cls.resources = ResourcePool()
        cls.addClassCleanup(cls.resources.release)