blob: 3fb4c229f695365760d8eb5dc847d4676c2b533c [file] [log] [blame]
ZhiQiang Fan39f97222013-09-20 04:49:44 +08001# Copyright 2012 OpenStack Foundation
Jay Pipes3f981df2012-03-27 18:59:44 -04002# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +000016import copy
17
Doug Hellmann583ce2c2015-03-11 14:55:46 +000018from oslo_log import log as logging
Ken'ichi Ohmichi8e7a4f82015-09-16 21:26:19 +090019from tempest_lib.services.compute.agents_client import AgentsClient
ghanshyamd1dac392015-10-13 15:30:24 +090020from tempest_lib.services.compute.aggregates_client import AggregatesClient
ghanshyam384dc792015-10-13 16:03:13 +090021from tempest_lib.services.compute.availability_zone_client import \
22 AvailabilityZoneClient
ghanshyam9fab7cc2015-10-13 16:12:23 +090023from tempest_lib.services.compute.baremetal_nodes_client import \
24 BaremetalNodesClient
ghanshyam4328a962015-10-13 16:18:09 +090025from tempest_lib.services.compute.certificates_client import \
26 CertificatesClient
ghanshyam0805a9e2015-10-13 16:24:44 +090027from tempest_lib.services.compute.extensions_client import \
28 ExtensionsClient
ghanshyam969281e2015-10-14 14:17:57 +090029from tempest_lib.services.compute.fixed_ips_client import FixedIPsClient
ghanshyam2f6f5f12015-10-14 14:27:36 +090030from tempest_lib.services.compute.flavors_client import FlavorsClient
ghanshyambf9e6002015-10-14 14:32:30 +090031from tempest_lib.services.compute.floating_ip_pools_client import \
32 FloatingIPPoolsClient
ghanshyam1a286ab2015-10-14 14:37:07 +090033from tempest_lib.services.compute.floating_ips_bulk_client import \
34 FloatingIPsBulkClient
ghanshyamc898a282015-10-14 14:44:06 +090035from tempest_lib.services.compute.hosts_client import HostsClient
ghanshyam7dd1b492015-10-14 14:47:25 +090036from tempest_lib.services.compute.hypervisor_client import \
37 HypervisorClient
Ken'ichi Ohmichi5f80ce32015-09-10 23:51:14 +000038from tempest_lib.services.identity.v2.token_client import TokenClient
39from tempest_lib.services.identity.v3.token_client import V3TokenClient
Doug Hellmann583ce2c2015-03-11 14:55:46 +000040
Ken'ichi Ohmichi42662682015-01-05 05:00:04 +000041from tempest.common import negative_rest_client
Jay Pipesf38eaac2012-06-21 13:37:35 -040042from tempest import config
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +010043from tempest import exceptions
Andrea Frittolif9cde7e2014-02-18 09:57:04 +000044from tempest import manager
Ken'ichi Ohmichi884d1062015-01-23 03:24:41 +000045from tempest.services.baremetal.v1.json.baremetal_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000046 BaremetalClient
Attila Fazekas1aed6202013-02-11 14:47:45 +010047from tempest.services import botoclients
dwallecke62b9f02012-10-10 23:34:42 -050048from tempest.services.compute.json.floating_ips_client import \
John Warrene74890a2015-11-11 15:18:01 -050049 FloatingIPsClient as ComputeFloatingIPsClient
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000050from tempest.services.compute.json.images_client import ImagesClient
ivan-zhuef7a1bd2013-10-22 17:56:46 +080051from tempest.services.compute.json.instance_usage_audit_log_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000052 InstanceUsagesAuditLogClient
Sean Dague2416cf32013-04-10 08:29:07 -040053from tempest.services.compute.json.interfaces_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000054 InterfacesClient
55from tempest.services.compute.json.keypairs_client import KeyPairsClient
56from tempest.services.compute.json.limits_client import LimitsClient
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090057from tempest.services.compute.json.migrations_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000058 MigrationsClient
John Warren9487a182015-09-14 18:12:56 -040059from tempest.services.compute.json.networks_client import NetworksClient \
60 as ComputeNetworksClient
Ken'ichi Ohmichia89dd6b2015-06-15 05:25:14 +000061from tempest.services.compute.json.quota_classes_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000062 QuotaClassesClient
63from tempest.services.compute.json.quotas_client import QuotasClient
Ghanshyam9d9201d2014-04-16 19:28:09 +090064from tempest.services.compute.json.security_group_default_rules_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000065 SecurityGroupDefaultRulesClient
Ken'ichi Ohmichi685cd172015-07-13 01:29:57 +000066from tempest.services.compute.json.security_group_rules_client import \
67 SecurityGroupRulesClient
Matthew Treinisha83a16e2012-12-07 13:44:02 -050068from tempest.services.compute.json.security_groups_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000069 SecurityGroupsClient
Ken'ichi Ohmichi7ca54b82015-07-07 01:10:26 +000070from tempest.services.compute.json.server_groups_client import \
71 ServerGroupsClient
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000072from tempest.services.compute.json.servers_client import ServersClient
73from tempest.services.compute.json.services_client import ServicesClient
Ken'ichi Ohmichib7e27302015-09-29 00:11:20 +000074from tempest.services.compute.json.snapshots_client import \
75 SnapshotsClient as ComputeSnapshotsClient
Ken'ichi Ohmichic3dfdb22015-01-22 04:39:58 +000076from tempest.services.compute.json.tenant_networks_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000077 TenantNetworksClient
Leo Toyodad80b6a02013-05-08 12:15:13 +090078from tempest.services.compute.json.tenant_usages_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000079 TenantUsagesClient
Ken'ichi Ohmichi2b6012b2015-09-03 01:56:19 +000080from tempest.services.compute.json.versions_client import VersionsClient
Ken'ichi Ohmichiea3f26a2015-09-29 00:18:39 +000081from tempest.services.compute.json.volumes_client import \
82 VolumesClient as ComputeVolumesClient
Ken'ichi Ohmichidc5fe442015-02-13 04:00:47 +000083from tempest.services.data_processing.v1_1.data_processing_client import \
84 DataProcessingClient
Nikhil Manchandadd6886f2014-03-03 01:58:45 -080085from tempest.services.database.json.flavors_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000086 DatabaseFlavorsClient
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +000087from tempest.services.database.json.limits_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000088 DatabaseLimitsClient
Peter Stachowski320f9c72014-04-21 16:13:23 -040089from tempest.services.database.json.versions_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000090 DatabaseVersionsClient
Jamie Lennoxc429e6a2015-02-24 10:42:42 +110091from tempest.services.identity.v2.json.identity_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000092 IdentityClient
nayna-patel914b4712013-07-16 08:29:05 +000093from tempest.services.identity.v3.json.credentials_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000094 CredentialsClient
Sean Dague2416cf32013-04-10 08:29:07 -040095from tempest.services.identity.v3.json.endpoints_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000096 EndPointClient
rajalakshmi-ganesan7312bb52013-01-29 20:03:42 +053097from tempest.services.identity.v3.json.identity_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000098 IdentityV3Client
99from tempest.services.identity.v3.json.policy_client import PolicyClient
100from tempest.services.identity.v3.json.region_client import RegionClient
harika-vakadia92dd742013-02-19 20:41:22 +0530101from tempest.services.identity.v3.json.service_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000102 ServiceClient
103from tempest.services.image.v1.json.image_client import ImageClient
104from tempest.services.image.v2.json.image_client import ImageClientV2
Victoria Martínez de la Cruz1173b6e2014-09-22 18:32:13 -0300105from tempest.services.messaging.json.messaging_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000106 MessagingClient
107from tempest.services.network.json.network_client import NetworkClient
John Warren94d8faf2015-09-15 12:22:24 -0400108from tempest.services.network.json.networks_client import NetworksClient
John Warren49c0fe52015-10-22 12:35:54 -0400109from tempest.services.network.json.ports_client import PortsClient
John Warren3961acd2015-10-02 14:38:53 -0400110from tempest.services.network.json.subnets_client import SubnetsClient
dwalleck5d734432012-10-04 01:11:47 -0500111from tempest.services.object_storage.account_client import AccountClient
Attila Fazekas6968dd52013-02-15 17:05:53 +0100112from tempest.services.object_storage.container_client import ContainerClient
113from tempest.services.object_storage.object_client import ObjectClient
Steve Bakerc60e4e32013-05-06 15:22:41 +1200114from tempest.services.orchestration.json.orchestration_client import \
115 OrchestrationClient
Nikolay Pliashechnikovb053aab2013-11-05 06:06:44 -0800116from tempest.services.telemetry.json.telemetry_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000117 TelemetryClient
Nayna Patel4a5024c2013-11-18 07:08:23 +0000118from tempest.services.volume.json.admin.volume_hosts_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000119 VolumeHostsClient
Sylvain Baubeaufdd34592014-02-20 18:40:10 +0100120from tempest.services.volume.json.admin.volume_quotas_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000121 VolumeQuotasClient
Abhijeet.Jain0056b072014-04-15 09:32:29 +0530122from tempest.services.volume.json.admin.volume_services_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000123 VolumesServicesClient
Attila Fazekas6968dd52013-02-15 17:05:53 +0100124from tempest.services.volume.json.admin.volume_types_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000125 VolumeTypesClient
Abhijeet.Jain6109bb82014-05-01 10:29:15 +0530126from tempest.services.volume.json.availability_zone_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000127 VolumeAvailabilityZoneClient
128from tempest.services.volume.json.backups_client import BackupsClient
Matthew Treinish2324e6b2013-10-21 20:25:17 +0000129from tempest.services.volume.json.extensions_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000130 ExtensionsClient as VolumeExtensionClient
131from tempest.services.volume.json.qos_client import QosSpecsClient
132from tempest.services.volume.json.snapshots_client import SnapshotsClient
133from tempest.services.volume.json.volumes_client import VolumesClient
Chandan Kumar65eb8592014-11-12 18:32:32 +0530134from tempest.services.volume.v2.json.admin.volume_hosts_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000135 VolumeHostsV2Client
Chandan Kumardd23f632014-11-17 15:27:48 +0530136from tempest.services.volume.v2.json.admin.volume_quotas_client import \
137 VolumeQuotasV2Client
jun xie9f123822014-11-20 14:21:23 +0800138from tempest.services.volume.v2.json.admin.volume_services_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000139 VolumesServicesV2Client
Chandan Kumar449e4c02014-09-12 07:26:19 -0400140from tempest.services.volume.v2.json.admin.volume_types_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000141 VolumeTypesV2Client
Zhi Kun Liu53395522014-07-18 16:05:52 +0800142from tempest.services.volume.v2.json.availability_zone_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000143 VolumeV2AvailabilityZoneClient
144from tempest.services.volume.v2.json.backups_client import BackupsClientV2
Zhi Kun Liu53395522014-07-18 16:05:52 +0800145from tempest.services.volume.v2.json.extensions_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000146 ExtensionsV2Client as VolumeV2ExtensionClient
147from tempest.services.volume.v2.json.qos_client import QosSpecsV2Client
Zhi Kun Liu38641c62014-07-10 20:12:48 +0800148from tempest.services.volume.v2.json.snapshots_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000149 SnapshotsV2Client
150from tempest.services.volume.v2.json.volumes_client import VolumesV2Client
Vincent Hou6b8a7b72012-08-25 01:24:33 +0800151
Sean Dague86bd8422013-12-20 09:56:44 -0500152CONF = config.CONF
Jay Pipes3f981df2012-03-27 18:59:44 -0400153LOG = logging.getLogger(__name__)
154
Vincent Hou6b8a7b72012-08-25 01:24:33 +0800155
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000156class Manager(manager.Manager):
Ken'ichi Ohmichi2e2ee192015-11-19 09:48:27 +0000157 """Top level manager for OpenStack tempest clients"""
Jay Pipes3f981df2012-03-27 18:59:44 -0400158
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +0000159 default_params = {
160 'disable_ssl_certificate_validation':
161 CONF.identity.disable_ssl_certificate_validation,
162 'ca_certs': CONF.identity.ca_certificates_file,
163 'trace_requests': CONF.debug.trace_requests
164 }
165
Ken'ichi Ohmichi737a6032015-01-21 07:04:42 +0000166 # NOTE: Tempest uses timeout values of compute API if project specific
167 # timeout values don't exist.
168 default_params_with_timeout_values = {
169 'build_interval': CONF.compute.build_interval,
170 'build_timeout': CONF.compute.build_timeout
171 }
172 default_params_with_timeout_values.update(default_params)
173
Andrea Frittoli (andreaf)290b3e12015-10-08 10:25:02 +0100174 def __init__(self, credentials, service=None):
Andrea Frittoli422fbdf2014-03-20 10:05:18 +0000175 super(Manager, self).__init__(credentials=credentials)
Brant Knudsonc7ca3342013-03-28 21:08:50 -0500176
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000177 self._set_compute_clients()
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000178 self._set_database_clients()
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000179 self._set_identity_clients()
180 self._set_volume_clients()
Ken'ichi Ohmichic95eb852015-01-22 01:57:57 +0000181 self._set_object_storage_clients()
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000182
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000183 self.baremetal_client = BaremetalClient(
Ken'ichi Ohmichi1f88ece2015-01-23 03:33:11 +0000184 self.auth_provider,
185 CONF.baremetal.catalog_type,
186 CONF.identity.region,
187 endpoint_type=CONF.baremetal.endpoint_type,
188 **self.default_params_with_timeout_values)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000189 self.network_client = NetworkClient(
Ken'ichi Ohmichia182e862015-01-21 01:16:37 +0000190 self.auth_provider,
191 CONF.network.catalog_type,
192 CONF.network.region or CONF.identity.region,
193 endpoint_type=CONF.network.endpoint_type,
194 build_interval=CONF.network.build_interval,
195 build_timeout=CONF.network.build_timeout,
196 **self.default_params)
John Warren94d8faf2015-09-15 12:22:24 -0400197 self.networks_client = NetworksClient(
198 self.auth_provider,
199 CONF.network.catalog_type,
200 CONF.network.region or CONF.identity.region,
201 endpoint_type=CONF.network.endpoint_type,
202 build_interval=CONF.network.build_interval,
203 build_timeout=CONF.network.build_timeout,
204 **self.default_params)
John Warren3961acd2015-10-02 14:38:53 -0400205 self.subnets_client = SubnetsClient(
206 self.auth_provider,
207 CONF.network.catalog_type,
208 CONF.network.region or CONF.identity.region,
209 endpoint_type=CONF.network.endpoint_type,
210 build_interval=CONF.network.build_interval,
211 build_timeout=CONF.network.build_timeout,
212 **self.default_params)
John Warren49c0fe52015-10-22 12:35:54 -0400213 self.ports_client = PortsClient(
214 self.auth_provider,
215 CONF.network.catalog_type,
216 CONF.network.region or CONF.identity.region,
217 endpoint_type=CONF.network.endpoint_type,
218 build_interval=CONF.network.build_interval,
219 build_timeout=CONF.network.build_timeout,
220 **self.default_params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000221 self.messaging_client = MessagingClient(
Ken'ichi Ohmichi2183a652015-01-22 05:00:20 +0000222 self.auth_provider,
223 CONF.messaging.catalog_type,
224 CONF.identity.region,
225 **self.default_params_with_timeout_values)
Sean Daguef3c75912014-11-24 11:45:11 -0500226 if CONF.service_available.ceilometer:
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000227 self.telemetry_client = TelemetryClient(
Ken'ichi Ohmichid5dba1c2015-01-23 02:23:22 +0000228 self.auth_provider,
229 CONF.telemetry.catalog_type,
230 CONF.identity.region,
231 endpoint_type=CONF.telemetry.endpoint_type,
232 **self.default_params_with_timeout_values)
Sean Dague86bd8422013-12-20 09:56:44 -0500233 if CONF.service_available.glance:
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000234 self.image_client = ImageClient(
Masayuki Igawabc7e1892015-03-03 11:46:48 +0900235 self.auth_provider,
236 CONF.image.catalog_type,
237 CONF.image.region or CONF.identity.region,
238 endpoint_type=CONF.image.endpoint_type,
239 build_interval=CONF.image.build_interval,
240 build_timeout=CONF.image.build_timeout,
241 **self.default_params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000242 self.image_client_v2 = ImageClientV2(
Masayuki Igawabc7e1892015-03-03 11:46:48 +0900243 self.auth_provider,
244 CONF.image.catalog_type,
245 CONF.image.region or CONF.identity.region,
246 endpoint_type=CONF.image.endpoint_type,
247 build_interval=CONF.image.build_interval,
248 build_timeout=CONF.image.build_timeout,
249 **self.default_params)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000250 self.orchestration_client = OrchestrationClient(
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +0000251 self.auth_provider,
252 CONF.orchestration.catalog_type,
253 CONF.orchestration.region or CONF.identity.region,
254 endpoint_type=CONF.orchestration.endpoint_type,
255 build_interval=CONF.orchestration.build_interval,
256 build_timeout=CONF.orchestration.build_timeout,
257 **self.default_params)
Ken'ichi Ohmichi4e83b5e2015-02-13 04:07:34 +0000258 self.data_processing_client = DataProcessingClient(
259 self.auth_provider,
260 CONF.data_processing.catalog_type,
261 CONF.identity.region,
262 endpoint_type=CONF.data_processing.endpoint_type,
263 **self.default_params_with_timeout_values)
Ken'ichi Ohmichib38eb002015-01-23 02:35:01 +0000264 self.negative_client = negative_rest_client.NegativeRestClient(
David Kranz1e33e372015-03-20 09:42:56 -0400265 self.auth_provider, service, **self.default_params)
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +0000266
Andrea Frittoli32d74992015-03-06 17:01:07 +0000267 # Generating EC2 credentials in tempest is only supported
268 # with identity v2
269 if CONF.identity_feature_enabled.api_v2 and \
270 CONF.identity.auth_version == 'v2':
nayna-patel1dfbedb2015-08-04 11:07:56 +0000271 # EC2 and S3 clients, if used, will check configured AWS
272 # credentials and generate new ones if needed
Andrea Frittoli32d74992015-03-06 17:01:07 +0000273 self.ec2api_client = botoclients.APIClientEC2(self.identity_client)
274 self.s3_client = botoclients.ObjectClientS3(self.identity_client)
Jay Pipes50677282012-01-06 15:39:20 -0500275
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000276 def _set_compute_clients(self):
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000277 params = {
278 'service': CONF.compute.catalog_type,
279 'region': CONF.compute.region or CONF.identity.region,
280 'endpoint_type': CONF.compute.endpoint_type,
281 'build_interval': CONF.compute.build_interval,
282 'build_timeout': CONF.compute.build_timeout
283 }
284 params.update(self.default_params)
285
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000286 self.agents_client = AgentsClient(self.auth_provider, **params)
John Warren9487a182015-09-14 18:12:56 -0400287 self.compute_networks_client = ComputeNetworksClient(
288 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000289 self.migrations_client = MigrationsClient(self.auth_provider,
290 **params)
Ken'ichi Ohmichi65225ef2014-11-19 01:06:25 +0000291 self.security_group_default_rules_client = (
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000292 SecurityGroupDefaultRulesClient(self.auth_provider, **params))
293 self.certificates_client = CertificatesClient(self.auth_provider,
294 **params)
295 self.servers_client = ServersClient(
Masayuki Igawa8f9c0c82015-03-03 09:38:08 +0900296 self.auth_provider,
297 enable_instance_password=CONF.compute_feature_enabled
298 .enable_instance_password,
299 **params)
Ken'ichi Ohmichi7ca54b82015-07-07 01:10:26 +0000300 self.server_groups_client = ServerGroupsClient(
301 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000302 self.limits_client = LimitsClient(self.auth_provider, **params)
303 self.images_client = ImagesClient(self.auth_provider, **params)
304 self.keypairs_client = KeyPairsClient(self.auth_provider, **params)
305 self.quotas_client = QuotasClient(self.auth_provider, **params)
306 self.quota_classes_client = QuotaClassesClient(self.auth_provider,
307 **params)
308 self.flavors_client = FlavorsClient(self.auth_provider, **params)
309 self.extensions_client = ExtensionsClient(self.auth_provider,
310 **params)
Ken'ichi Ohmichif5767702015-07-29 23:39:10 +0000311 self.floating_ip_pools_client = FloatingIPPoolsClient(
Ken'ichi Ohmichi03af1c52015-07-13 00:28:05 +0000312 self.auth_provider, **params)
Ken'ichi Ohmichif5767702015-07-29 23:39:10 +0000313 self.floating_ips_bulk_client = FloatingIPsBulkClient(
Ken'ichi Ohmichi2b26e752015-07-13 00:44:36 +0000314 self.auth_provider, **params)
John Warrene74890a2015-11-11 15:18:01 -0500315 self.compute_floating_ips_client = ComputeFloatingIPsClient(
316 self.auth_provider, **params)
Ken'ichi Ohmichi685cd172015-07-13 01:29:57 +0000317 self.security_group_rules_client = SecurityGroupRulesClient(
318 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000319 self.security_groups_client = SecurityGroupsClient(
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000320 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000321 self.interfaces_client = InterfacesClient(self.auth_provider,
322 **params)
323 self.fixed_ips_client = FixedIPsClient(self.auth_provider,
324 **params)
325 self.availability_zone_client = AvailabilityZoneClient(
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000326 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000327 self.aggregates_client = AggregatesClient(self.auth_provider,
328 **params)
329 self.services_client = ServicesClient(self.auth_provider, **params)
330 self.tenant_usages_client = TenantUsagesClient(self.auth_provider,
331 **params)
332 self.hosts_client = HostsClient(self.auth_provider, **params)
333 self.hypervisor_client = HypervisorClient(self.auth_provider,
334 **params)
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000335 self.instance_usages_audit_log_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000336 InstanceUsagesAuditLogClient(self.auth_provider, **params)
Ken'ichi Ohmichic3dfdb22015-01-22 04:39:58 +0000337 self.tenant_networks_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000338 TenantNetworksClient(self.auth_provider, **params)
339 self.baremetal_nodes_client = BaremetalNodesClient(
YuikoTakadaac0879a2015-01-22 02:40:03 +0000340 self.auth_provider, **params)
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000341
342 # NOTE: The following client needs special timeout values because
343 # the API is a proxy for the other component.
344 params_volume = copy.deepcopy(params)
345 params_volume.update({
346 'build_interval': CONF.volume.build_interval,
347 'build_timeout': CONF.volume.build_timeout
348 })
Ken'ichi Ohmichiea3f26a2015-09-29 00:18:39 +0000349 self.volumes_extensions_client = ComputeVolumesClient(
Ken'ichi Ohmichic4921782015-08-05 08:14:42 +0000350 self.auth_provider, **params_volume)
Ken'ichi Ohmichi2b6012b2015-09-03 01:56:19 +0000351 self.compute_versions_client = VersionsClient(self.auth_provider,
352 **params_volume)
Ken'ichi Ohmichib7e27302015-09-29 00:11:20 +0000353 self.snapshots_extensions_client = ComputeSnapshotsClient(
Gaozexub9c9d6e2015-09-10 17:08:04 +0800354 self.auth_provider, **params_volume)
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000355
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000356 def _set_database_clients(self):
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000357 self.database_flavors_client = DatabaseFlavorsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000358 self.auth_provider,
359 CONF.database.catalog_type,
360 CONF.identity.region,
361 **self.default_params_with_timeout_values)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000362 self.database_limits_client = DatabaseLimitsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000363 self.auth_provider,
364 CONF.database.catalog_type,
365 CONF.identity.region,
366 **self.default_params_with_timeout_values)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000367 self.database_versions_client = DatabaseVersionsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000368 self.auth_provider,
369 CONF.database.catalog_type,
370 CONF.identity.region,
371 **self.default_params_with_timeout_values)
372
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000373 def _set_identity_clients(self):
ghanshyamd26b5cd2015-02-09 14:48:58 +0900374 params = {
375 'service': CONF.identity.catalog_type,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300376 'region': CONF.identity.region
ghanshyamd26b5cd2015-02-09 14:48:58 +0900377 }
378 params.update(self.default_params_with_timeout_values)
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300379 params_v2_admin = params.copy()
380 params_v2_admin['endpoint_type'] = CONF.identity.v2_admin_endpoint_type
381 # Client uses admin endpoint type of Keystone API v2
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000382 self.identity_client = IdentityClient(self.auth_provider,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300383 **params_v2_admin)
384 params_v2_public = params.copy()
385 params_v2_public['endpoint_type'] = (
386 CONF.identity.v2_public_endpoint_type)
387 # Client uses public endpoint type of Keystone API v2
388 self.identity_public_client = IdentityClient(self.auth_provider,
389 **params_v2_public)
390 params_v3 = params.copy()
391 params_v3['endpoint_type'] = CONF.identity.v3_endpoint_type
392 # Client uses the endpoint type of Keystone API v3
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000393 self.identity_v3_client = IdentityV3Client(self.auth_provider,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300394 **params_v3)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000395 self.endpoints_client = EndPointClient(self.auth_provider,
396 **params)
397 self.service_client = ServiceClient(self.auth_provider, **params)
398 self.policy_client = PolicyClient(self.auth_provider, **params)
399 self.region_client = RegionClient(self.auth_provider, **params)
400 self.credentials_client = CredentialsClient(self.auth_provider,
401 **params)
Andrea Frittoli90012352015-02-25 21:58:02 +0000402 # Token clients do not use the catalog. They only need default_params.
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100403 # They read auth_url, so they should only be set if the corresponding
404 # API version is marked as enabled
405 if CONF.identity_feature_enabled.api_v2:
406 if CONF.identity.uri:
Ken'ichi Ohmichi5f80ce32015-09-10 23:51:14 +0000407 self.token_client = TokenClient(
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100408 CONF.identity.uri, **self.default_params)
409 else:
410 msg = 'Identity v2 API enabled, but no identity.uri set'
411 raise exceptions.InvalidConfiguration(msg)
Ken'ichi Ohmichi41951b02014-11-19 01:57:43 +0000412 if CONF.identity_feature_enabled.api_v3:
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100413 if CONF.identity.uri_v3:
Ken'ichi Ohmichi5f80ce32015-09-10 23:51:14 +0000414 self.token_v3_client = V3TokenClient(
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100415 CONF.identity.uri_v3, **self.default_params)
416 else:
417 msg = 'Identity v3 API enabled, but no identity.uri_v3 set'
418 raise exceptions.InvalidConfiguration(msg)
Ken'ichi Ohmichi41951b02014-11-19 01:57:43 +0000419
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000420 def _set_volume_clients(self):
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000421 params = {
422 'service': CONF.volume.catalog_type,
423 'region': CONF.volume.region or CONF.identity.region,
424 'endpoint_type': CONF.volume.endpoint_type,
425 'build_interval': CONF.volume.build_interval,
426 'build_timeout': CONF.volume.build_timeout
427 }
428 params.update(self.default_params)
429
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000430 self.volume_qos_client = QosSpecsClient(self.auth_provider,
431 **params)
432 self.volume_qos_v2_client = QosSpecsV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000433 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000434 self.volume_services_v2_client = VolumesServicesV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000435 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000436 self.backups_client = BackupsClient(self.auth_provider, **params)
437 self.backups_v2_client = BackupsClientV2(self.auth_provider,
438 **params)
439 self.snapshots_client = SnapshotsClient(self.auth_provider,
440 **params)
441 self.snapshots_v2_client = SnapshotsV2Client(self.auth_provider,
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000442 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000443 self.volumes_client = VolumesClient(
Ken'ichi Ohmichi234da802015-02-13 04:48:06 +0000444 self.auth_provider, default_volume_size=CONF.volume.volume_size,
445 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000446 self.volumes_v2_client = VolumesV2Client(
Ken'ichi Ohmichi234da802015-02-13 04:48:06 +0000447 self.auth_provider, default_volume_size=CONF.volume.volume_size,
448 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000449 self.volume_types_client = VolumeTypesClient(self.auth_provider,
450 **params)
451 self.volume_services_client = VolumesServicesClient(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000452 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000453 self.volume_hosts_client = VolumeHostsClient(self.auth_provider,
454 **params)
455 self.volume_hosts_v2_client = VolumeHostsV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000456 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000457 self.volume_quotas_client = VolumeQuotasClient(self.auth_provider,
458 **params)
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000459 self.volume_quotas_v2_client = VolumeQuotasV2Client(self.auth_provider,
460 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000461 self.volumes_extension_client = VolumeExtensionClient(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000462 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000463 self.volumes_v2_extension_client = VolumeV2ExtensionClient(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000464 self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000465 self.volume_availability_zone_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000466 VolumeAvailabilityZoneClient(self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000467 self.volume_v2_availability_zone_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000468 VolumeV2AvailabilityZoneClient(self.auth_provider, **params)
469 self.volume_types_v2_client = VolumeTypesV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000470 self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000471
Ken'ichi Ohmichic95eb852015-01-22 01:57:57 +0000472 def _set_object_storage_clients(self):
Ken'ichi Ohmichi564b2ad2015-01-22 02:08:59 +0000473 params = {
474 'service': CONF.object_storage.catalog_type,
475 'region': CONF.object_storage.region or CONF.identity.region,
476 'endpoint_type': CONF.object_storage.endpoint_type
477 }
478 params.update(self.default_params_with_timeout_values)
479
480 self.account_client = AccountClient(self.auth_provider, **params)
481 self.container_client = ContainerClient(self.auth_provider, **params)
482 self.object_client = ObjectClient(self.auth_provider, **params)