Example #1
0
 def _set_compute_json_clients(self):
     self.certificates_client = CertificatesClientJSON(self.auth_provider)
     self.certificates_v3_client = CertificatesV3ClientJSON(
         self.auth_provider)
     self.servers_client = ServersClientJSON(self.auth_provider)
     self.servers_v3_client = ServersV3ClientJSON(self.auth_provider)
     self.limits_client = LimitsClientJSON(self.auth_provider)
     self.images_client = ImagesClientJSON(self.auth_provider)
     self.keypairs_client = KeyPairsClientJSON(self.auth_provider)
     self.keypairs_v3_client = KeyPairsV3ClientJSON(self.auth_provider)
     self.quotas_client = QuotasClientJSON(self.auth_provider)
     self.quota_classes_client = QuotaClassesClientJSON(self.auth_provider)
     self.quotas_v3_client = QuotasV3ClientJSON(self.auth_provider)
     self.flavors_client = FlavorsClientJSON(self.auth_provider)
     self.flavors_v3_client = FlavorsV3ClientJSON(self.auth_provider)
     self.extensions_client = ExtensionsClientJSON(self.auth_provider)
     self.extensions_v3_client = ExtensionsV3ClientJSON(self.auth_provider)
     self.volumes_extensions_client = VolumesExtensionsClientJSON(
         self.auth_provider)
     self.floating_ips_client = FloatingIPsClientJSON(self.auth_provider)
     self.security_groups_client = SecurityGroupsClientJSON(
         self.auth_provider)
     self.interfaces_client = InterfacesClientJSON(self.auth_provider)
     self.interfaces_v3_client = InterfacesV3ClientJSON(self.auth_provider)
     self.fixed_ips_client = FixedIPsClientJSON(self.auth_provider)
     self.availability_zone_client = AvailabilityZoneClientJSON(
         self.auth_provider)
     self.availability_zone_v3_client = AvailabilityZoneV3ClientJSON(
         self.auth_provider)
     self.services_v3_client = ServicesV3ClientJSON(self.auth_provider)
     self.agents_v3_client = AgentsV3ClientJSON(self.auth_provider)
     self.aggregates_client = AggregatesClientJSON(self.auth_provider)
     self.aggregates_v3_client = AggregatesV3ClientJSON(self.auth_provider)
     self.services_client = ServicesClientJSON(self.auth_provider)
     self.tenant_usages_client = TenantUsagesClientJSON(self.auth_provider)
     self.version_v3_client = VersionV3ClientJSON(self.auth_provider)
     self.migrations_v3_client = MigrationsV3ClientJSON(self.auth_provider)
     self.hosts_client = HostsClientJSON(self.auth_provider)
     self.hosts_v3_client = HostsV3ClientJSON(self.auth_provider)
     self.hypervisor_client = HypervisorClientJSON(self.auth_provider)
     self.hypervisor_v3_client = HypervisorV3ClientJSON(self.auth_provider)
     self.instance_usages_audit_log_client = \
         InstanceUsagesAuditLogClientJSON(self.auth_provider)
Example #2
0
    def __init__(self, credentials=None, interface='json', service=None):
        # Set interface and client type first
        self.interface = interface
        self.client_type = 'tempest'
        # super cares for credentials validation
        super(Manager, self).__init__(credentials=credentials)

        if self.interface == 'xml':
            self.certificates_client = CertificatesClientXML(
                self.auth_provider)
            self.servers_client = ServersClientXML(self.auth_provider)
            self.limits_client = LimitsClientXML(self.auth_provider)
            self.images_client = ImagesClientXML(self.auth_provider)
            self.keypairs_client = KeyPairsClientXML(self.auth_provider)
            self.quotas_client = QuotasClientXML(self.auth_provider)
            self.quota_classes_client = QuotaClassesClientXML(
                self.auth_provider)
            self.flavors_client = FlavorsClientXML(self.auth_provider)
            self.extensions_client = ExtensionsClientXML(self.auth_provider)
            self.volumes_extensions_client = VolumesExtensionsClientXML(
                self.auth_provider)
            self.floating_ips_client = FloatingIPsClientXML(self.auth_provider)
            self.backups_client = BackupsClientXML(self.auth_provider)
            self.snapshots_client = SnapshotsClientXML(self.auth_provider)
            self.volumes_client = VolumesClientXML(self.auth_provider)
            self.volumes_v2_client = VolumesV2ClientXML(self.auth_provider)
            self.volume_types_client = VolumeTypesClientXML(self.auth_provider)
            self.identity_client = IdentityClientXML(self.auth_provider)
            self.identity_v3_client = IdentityV3ClientXML(self.auth_provider)
            self.security_groups_client = SecurityGroupsClientXML(
                self.auth_provider)
            self.interfaces_client = InterfacesClientXML(self.auth_provider)
            self.endpoints_client = EndPointClientXML(self.auth_provider)
            self.fixed_ips_client = FixedIPsClientXML(self.auth_provider)
            self.availability_zone_client = AvailabilityZoneClientXML(
                self.auth_provider)
            self.service_client = ServiceClientXML(self.auth_provider)
            self.volume_services_client = VolumesServicesClientXML(
                self.auth_provider)
            self.aggregates_client = AggregatesClientXML(self.auth_provider)
            self.services_client = ServicesClientXML(self.auth_provider)
            self.tenant_usages_client = TenantUsagesClientXML(
                self.auth_provider)
            self.policy_client = PolicyClientXML(self.auth_provider)
            self.region_client = RegionClientXML(self.auth_provider)
            self.hosts_client = HostsClientXML(self.auth_provider)
            self.hypervisor_client = HypervisorClientXML(self.auth_provider)
            self.network_client = NetworkClientXML(self.auth_provider)
            self.credentials_client = CredentialsClientXML(self.auth_provider)
            self.instance_usages_audit_log_client = \
                InstanceUsagesAuditLogClientXML(self.auth_provider)
            self.volume_hosts_client = VolumeHostsClientXML(self.auth_provider)
            self.volume_quotas_client = VolumeQuotasClientXML(
                self.auth_provider)
            self.volumes_extension_client = VolumeExtensionClientXML(
                self.auth_provider)
            if CONF.service_available.ceilometer:
                self.telemetry_client = TelemetryClientXML(self.auth_provider)
            self.token_client = TokenClientXML()
            self.token_v3_client = V3TokenClientXML()
            self.volume_availability_zone_client = \
                VolumeAvailabilityZoneClientXML(self.auth_provider)

        elif self.interface == 'json':
            self.certificates_client = CertificatesClientJSON(
                self.auth_provider)
            self.certificates_v3_client = CertificatesV3ClientJSON(
                self.auth_provider)
            self.baremetal_client = BaremetalClientJSON(self.auth_provider)
            self.servers_client = ServersClientJSON(self.auth_provider)
            self.servers_v3_client = ServersV3ClientJSON(self.auth_provider)
            self.limits_client = LimitsClientJSON(self.auth_provider)
            self.images_client = ImagesClientJSON(self.auth_provider)
            self.keypairs_v3_client = KeyPairsV3ClientJSON(self.auth_provider)
            self.keypairs_client = KeyPairsClientJSON(self.auth_provider)
            self.keypairs_v3_client = KeyPairsV3ClientJSON(self.auth_provider)
            self.quotas_client = QuotasClientJSON(self.auth_provider)
            self.quota_classes_client = QuotaClassesClientJSON(
                self.auth_provider)
            self.quotas_v3_client = QuotasV3ClientJSON(self.auth_provider)
            self.flavors_client = FlavorsClientJSON(self.auth_provider)
            self.flavors_v3_client = FlavorsV3ClientJSON(self.auth_provider)
            self.extensions_v3_client = ExtensionsV3ClientJSON(
                self.auth_provider)
            self.extensions_client = ExtensionsClientJSON(self.auth_provider)
            self.volumes_extensions_client = VolumesExtensionsClientJSON(
                self.auth_provider)
            self.floating_ips_client = FloatingIPsClientJSON(
                self.auth_provider)
            self.backups_client = BackupsClientJSON(self.auth_provider)
            self.snapshots_client = SnapshotsClientJSON(self.auth_provider)
            self.volumes_client = VolumesClientJSON(self.auth_provider)
            self.volumes_v2_client = VolumesV2ClientJSON(self.auth_provider)
            self.volume_types_client = VolumeTypesClientJSON(
                self.auth_provider)
            self.identity_client = IdentityClientJSON(self.auth_provider)
            self.identity_v3_client = IdentityV3ClientJSON(self.auth_provider)
            self.security_groups_client = SecurityGroupsClientJSON(
                self.auth_provider)
            self.interfaces_v3_client = InterfacesV3ClientJSON(
                self.auth_provider)
            self.interfaces_client = InterfacesClientJSON(self.auth_provider)
            self.endpoints_client = EndPointClientJSON(self.auth_provider)
            self.fixed_ips_client = FixedIPsClientJSON(self.auth_provider)
            self.availability_zone_v3_client = AvailabilityZoneV3ClientJSON(
                self.auth_provider)
            self.availability_zone_client = AvailabilityZoneClientJSON(
                self.auth_provider)
            self.services_v3_client = ServicesV3ClientJSON(self.auth_provider)
            self.service_client = ServiceClientJSON(self.auth_provider)
            self.volume_services_client = VolumesServicesClientJSON(
                self.auth_provider)
            self.agents_v3_client = AgentsV3ClientJSON(self.auth_provider)
            self.aggregates_v3_client = AggregatesV3ClientJSON(
                self.auth_provider)
            self.aggregates_client = AggregatesClientJSON(self.auth_provider)
            self.services_client = ServicesClientJSON(self.auth_provider)
            self.tenant_usages_client = TenantUsagesClientJSON(
                self.auth_provider)
            self.version_v3_client = VersionV3ClientJSON(self.auth_provider)
            self.migrations_v3_client = MigrationsV3ClientJSON(
                self.auth_provider)
            self.policy_client = PolicyClientJSON(self.auth_provider)
            self.region_client = RegionClientJSON(self.auth_provider)
            self.hosts_client = HostsClientJSON(self.auth_provider)
            self.hypervisor_v3_client = HypervisorV3ClientJSON(
                self.auth_provider)
            self.hypervisor_client = HypervisorClientJSON(self.auth_provider)
            self.network_client = NetworkClientJSON(self.auth_provider)
            self.credentials_client = CredentialsClientJSON(self.auth_provider)
            self.instance_usages_audit_log_client = \
                InstanceUsagesAuditLogClientJSON(self.auth_provider)
            self.volume_hosts_client = VolumeHostsClientJSON(
                self.auth_provider)
            self.volume_quotas_client = VolumeQuotasClientJSON(
                self.auth_provider)
            self.volumes_extension_client = VolumeExtensionClientJSON(
                self.auth_provider)
            self.hosts_v3_client = HostsV3ClientJSON(self.auth_provider)
            self.database_flavors_client = DatabaseFlavorsClientJSON(
                self.auth_provider)
            self.database_versions_client = DatabaseVersionsClientJSON(
                self.auth_provider)
            self.queuing_client = QueuingClientJSON(self.auth_provider)
            if CONF.service_available.ceilometer:
                self.telemetry_client = TelemetryClientJSON(self.auth_provider)
            self.token_client = TokenClientJSON()
            self.token_v3_client = V3TokenClientJSON()
            self.negative_client = rest_client.NegativeRestClient(
                self.auth_provider)
            self.negative_client.service = service
            self.volume_availability_zone_client = \
                VolumeAvailabilityZoneClientJSON(self.auth_provider)

        else:
            msg = "Unsupported interface type `%s'" % interface
            raise exceptions.InvalidConfiguration(msg)

        # TODO(andreaf) EC2 client still do their auth, v2 only
        ec2_client_args = (self.credentials.username,
                           self.credentials.password, CONF.identity.uri,
                           self.credentials.tenant_name)

        # common clients
        self.account_client = AccountClient(self.auth_provider)
        self.agents_client = AgentsClientJSON(self.auth_provider)
        if CONF.service_available.glance:
            self.image_client = ImageClientJSON(self.auth_provider)
            self.image_client_v2 = ImageClientV2JSON(self.auth_provider)
        self.container_client = ContainerClient(self.auth_provider)
        self.object_client = ObjectClient(self.auth_provider)
        self.orchestration_client = OrchestrationClient(self.auth_provider)
        self.ec2api_client = botoclients.APIClientEC2(*ec2_client_args)
        self.s3_client = botoclients.ObjectClientS3(*ec2_client_args)
        self.custom_object_client = ObjectClientCustomizedHeader(
            self.auth_provider)
        self.custom_account_client = \
            AccountClientCustomizedHeader(self.auth_provider)
        self.data_processing_client = DataProcessingClient(self.auth_provider)
        self.migrations_client = MigrationsClientJSON(self.auth_provider)
Example #3
0
    def __init__(self,
                 username=None,
                 password=None,
                 tenant_name=None,
                 interface='json',
                 service=None):
        """
        We allow overriding of the credentials used within the various
        client classes managed by the Manager object. Left as None, the
        standard username/password/tenant_name is used.

        :param username: Override of the username
        :param password: Override of the password
        :param tenant_name: Override of the tenant name
        """
        self.interface = interface
        self.auth_version = CONF.identity.auth_version
        # FIXME(andreaf) Change Manager __init__ to accept a credentials dict
        if username is None or password is None:
            # Tenant None is a valid use case
            self.credentials = self.get_default_credentials()
        else:
            self.credentials = dict(username=username,
                                    password=password,
                                    tenant_name=tenant_name)
        if self.auth_version == 'v3':
            self.credentials['domain_name'] = 'Default'
        # Setup an auth provider
        auth_provider = self.get_auth_provider(self.credentials)

        if self.interface == 'xml':
            self.certificates_client = CertificatesClientXML(auth_provider)
            self.servers_client = ServersClientXML(auth_provider)
            self.limits_client = LimitsClientXML(auth_provider)
            self.images_client = ImagesClientXML(auth_provider)
            self.keypairs_client = KeyPairsClientXML(auth_provider)
            self.quotas_client = QuotasClientXML(auth_provider)
            self.flavors_client = FlavorsClientXML(auth_provider)
            self.extensions_client = ExtensionsClientXML(auth_provider)
            self.volumes_extensions_client = VolumesExtensionsClientXML(
                auth_provider)
            self.floating_ips_client = FloatingIPsClientXML(auth_provider)
            self.snapshots_client = SnapshotsClientXML(auth_provider)
            self.volumes_client = VolumesClientXML(auth_provider)
            self.volume_types_client = VolumeTypesClientXML(auth_provider)
            self.identity_client = IdentityClientXML(auth_provider)
            self.identity_v3_client = IdentityV3ClientXML(auth_provider)
            self.security_groups_client = SecurityGroupsClientXML(
                auth_provider)
            self.interfaces_client = InterfacesClientXML(auth_provider)
            self.endpoints_client = EndPointClientXML(auth_provider)
            self.fixed_ips_client = FixedIPsClientXML(auth_provider)
            self.availability_zone_client = AvailabilityZoneClientXML(
                auth_provider)
            self.service_client = ServiceClientXML(auth_provider)
            self.aggregates_client = AggregatesClientXML(auth_provider)
            self.services_client = ServicesClientXML(auth_provider)
            self.tenant_usages_client = TenantUsagesClientXML(auth_provider)
            self.policy_client = PolicyClientXML(auth_provider)
            self.hosts_client = HostsClientXML(auth_provider)
            self.hypervisor_client = HypervisorClientXML(auth_provider)
            self.network_client = NetworkClientXML(auth_provider)
            self.credentials_client = CredentialsClientXML(auth_provider)
            self.instance_usages_audit_log_client = \
                InstanceUsagesAuditLogClientXML(auth_provider)
            self.volume_hosts_client = VolumeHostsClientXML(auth_provider)
            self.volumes_extension_client = VolumeExtensionClientXML(
                auth_provider)
            if CONF.service_available.ceilometer:
                self.telemetry_client = TelemetryClientXML(auth_provider)
            self.token_client = TokenClientXML()
            self.token_v3_client = V3TokenClientXML()

        elif self.interface == 'json':
            self.certificates_client = CertificatesClientJSON(auth_provider)
            self.certificates_v3_client = CertificatesV3ClientJSON(
                auth_provider)
            self.baremetal_client = BaremetalClientJSON(auth_provider)
            self.servers_client = ServersClientJSON(auth_provider)
            self.servers_v3_client = ServersV3ClientJSON(auth_provider)
            self.limits_client = LimitsClientJSON(auth_provider)
            self.images_client = ImagesClientJSON(auth_provider)
            self.keypairs_v3_client = KeyPairsV3ClientJSON(auth_provider)
            self.keypairs_client = KeyPairsClientJSON(auth_provider)
            self.keypairs_v3_client = KeyPairsV3ClientJSON(auth_provider)
            self.quotas_client = QuotasClientJSON(auth_provider)
            self.quotas_v3_client = QuotasV3ClientJSON(auth_provider)
            self.flavors_client = FlavorsClientJSON(auth_provider)
            self.flavors_v3_client = FlavorsV3ClientJSON(auth_provider)
            self.extensions_v3_client = ExtensionsV3ClientJSON(auth_provider)
            self.extensions_client = ExtensionsClientJSON(auth_provider)
            self.volumes_extensions_client = VolumesExtensionsClientJSON(
                auth_provider)
            self.floating_ips_client = FloatingIPsClientJSON(auth_provider)
            self.snapshots_client = SnapshotsClientJSON(auth_provider)
            self.volumes_client = VolumesClientJSON(auth_provider)
            self.volume_types_client = VolumeTypesClientJSON(auth_provider)
            self.identity_client = IdentityClientJSON(auth_provider)
            self.identity_v3_client = IdentityV3ClientJSON(auth_provider)
            self.security_groups_client = SecurityGroupsClientJSON(
                auth_provider)
            self.interfaces_v3_client = InterfacesV3ClientJSON(auth_provider)
            self.interfaces_client = InterfacesClientJSON(auth_provider)
            self.endpoints_client = EndPointClientJSON(auth_provider)
            self.fixed_ips_client = FixedIPsClientJSON(auth_provider)
            self.availability_zone_v3_client = AvailabilityZoneV3ClientJSON(
                auth_provider)
            self.availability_zone_client = AvailabilityZoneClientJSON(
                auth_provider)
            self.services_v3_client = ServicesV3ClientJSON(auth_provider)
            self.service_client = ServiceClientJSON(auth_provider)
            self.aggregates_v3_client = AggregatesV3ClientJSON(auth_provider)
            self.aggregates_client = AggregatesClientJSON(auth_provider)
            self.services_client = ServicesClientJSON(auth_provider)
            self.tenant_usages_v3_client = TenantUsagesV3ClientJSON(
                auth_provider)
            self.tenant_usages_client = TenantUsagesClientJSON(auth_provider)
            self.version_v3_client = VersionV3ClientJSON(auth_provider)
            self.policy_client = PolicyClientJSON(auth_provider)
            self.hosts_client = HostsClientJSON(auth_provider)
            self.hypervisor_v3_client = HypervisorV3ClientJSON(auth_provider)
            self.hypervisor_client = HypervisorClientJSON(auth_provider)
            self.network_client = NetworkClientJSON(auth_provider)
            self.credentials_client = CredentialsClientJSON(auth_provider)
            self.instance_usages_audit_log_client = \
                InstanceUsagesAuditLogClientJSON(auth_provider)
            self.instance_usages_audit_log_v3_client = \
                InstanceUsagesAuditLogV3ClientJSON(auth_provider)
            self.volume_hosts_client = VolumeHostsClientJSON(auth_provider)
            self.volumes_extension_client = VolumeExtensionClientJSON(
                auth_provider)
            self.hosts_v3_client = HostsV3ClientJSON(auth_provider)
            if CONF.service_available.ceilometer:
                self.telemetry_client = TelemetryClientJSON(auth_provider)
            self.token_client = TokenClientJSON()
            self.token_v3_client = V3TokenClientJSON()
            self.negative_client = NegativeRestClient(auth_provider)
            self.negative_client.service = service

        else:
            msg = "Unsupported interface type `%s'" % interface
            raise exceptions.InvalidConfiguration(msg)

        # TODO(andreaf) EC2 client still do their auth, v2 only
        ec2_client_args = (self.credentials.get('username'),
                           self.credentials.get('password'), CONF.identity.uri,
                           self.credentials.get('tenant_name'))

        # common clients
        self.account_client = AccountClient(auth_provider)
        if CONF.service_available.glance:
            self.image_client = ImageClientJSON(auth_provider)
            self.image_client_v2 = ImageClientV2JSON(auth_provider)
        self.container_client = ContainerClient(auth_provider)
        self.object_client = ObjectClient(auth_provider)
        self.orchestration_client = OrchestrationClient(auth_provider)
        self.ec2api_client = botoclients.APIClientEC2(*ec2_client_args)
        self.s3_client = botoclients.ObjectClientS3(*ec2_client_args)
        self.custom_object_client = ObjectClientCustomizedHeader(auth_provider)
        self.custom_account_client = \
            AccountClientCustomizedHeader(auth_provider)
        self.data_processing_client = DataProcessingClient(auth_provider)