blob: fc0cc896e39d6e9b9706650c9da298086b0a75e7 [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
19
Ken'ichi Ohmichi42662682015-01-05 05:00:04 +000020from tempest.common import negative_rest_client
Jay Pipesf38eaac2012-06-21 13:37:35 -040021from tempest import config
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +010022from tempest import exceptions
Andrea Frittoli (andreaf)db9672e2016-02-23 14:07:24 -050023from tempest.lib.services.compute.agents_client import AgentsClient
24from tempest.lib.services.compute.aggregates_client import AggregatesClient
25from tempest.lib.services.compute.availability_zone_client import \
26 AvailabilityZoneClient
27from tempest.lib.services.compute.baremetal_nodes_client import \
28 BaremetalNodesClient
29from tempest.lib.services.compute.certificates_client import \
30 CertificatesClient
31from tempest.lib.services.compute.extensions_client import \
32 ExtensionsClient
33from tempest.lib.services.compute.fixed_ips_client import FixedIPsClient
34from tempest.lib.services.compute.flavors_client import FlavorsClient
35from tempest.lib.services.compute.floating_ip_pools_client import \
36 FloatingIPPoolsClient
37from tempest.lib.services.compute.floating_ips_bulk_client import \
38 FloatingIPsBulkClient
39from tempest.lib.services.compute.floating_ips_client import \
40 FloatingIPsClient as ComputeFloatingIPsClient
41from tempest.lib.services.compute.hosts_client import HostsClient
42from tempest.lib.services.compute.hypervisor_client import \
43 HypervisorClient
44from tempest.lib.services.compute.images_client import ImagesClient \
45 as ComputeImagesClient
46from tempest.lib.services.compute.instance_usage_audit_log_client import \
47 InstanceUsagesAuditLogClient
48from tempest.lib.services.compute.interfaces_client import InterfacesClient
49from tempest.lib.services.compute.limits_client import LimitsClient
50from tempest.lib.services.compute.migrations_client import MigrationsClient
51from tempest.lib.services.compute.networks_client import NetworksClient \
52 as ComputeNetworksClient
53from tempest.lib.services.compute.quota_classes_client import \
54 QuotaClassesClient
55from tempest.lib.services.compute.quotas_client import QuotasClient
56from tempest.lib.services.compute.security_group_default_rules_client import \
57 SecurityGroupDefaultRulesClient
58from tempest.lib.services.compute.security_group_rules_client import \
59 SecurityGroupRulesClient as ComputeSecurityGroupRulesClient
60from tempest.lib.services.compute.security_groups_client import \
61 SecurityGroupsClient as ComputeSecurityGroupsClient
62from tempest.lib.services.compute.server_groups_client import \
63 ServerGroupsClient
64from tempest.lib.services.compute.servers_client import ServersClient
65from tempest.lib.services.compute.services_client import ServicesClient
66from tempest.lib.services.compute.snapshots_client import \
67 SnapshotsClient as ComputeSnapshotsClient
68from tempest.lib.services.compute.tenant_networks_client import \
69 TenantNetworksClient
70from tempest.lib.services.compute.tenant_usages_client import \
71 TenantUsagesClient
72from tempest.lib.services.compute.versions_client import VersionsClient
73from tempest.lib.services.compute.volumes_client import \
74 VolumesClient as ComputeVolumesClient
75from tempest.lib.services.identity.v2.token_client import TokenClient
76from tempest.lib.services.identity.v3.token_client import V3TokenClient
77from tempest.lib.services.network.agents_client import AgentsClient \
78 as NetworkAgentsClient
79from tempest.lib.services.network.extensions_client import \
80 ExtensionsClient as NetworkExtensionsClient
81from tempest.lib.services.network.floating_ips_client import FloatingIPsClient
82from tempest.lib.services.network.metering_label_rules_client import \
83 MeteringLabelRulesClient
84from tempest.lib.services.network.metering_labels_client import \
85 MeteringLabelsClient
86from tempest.lib.services.network.networks_client import NetworksClient
87from tempest.lib.services.network.ports_client import PortsClient
88from tempest.lib.services.network.quotas_client import QuotasClient \
89 as NetworkQuotasClient
Ken'ichi Ohmichid598d2f2016-03-25 15:57:08 -070090from tempest.lib.services.network.security_group_rules_client import \
91 SecurityGroupRulesClient
Andrea Frittoli (andreaf)db9672e2016-02-23 14:07:24 -050092from tempest.lib.services.network.security_groups_client import \
93 SecurityGroupsClient
94from tempest.lib.services.network.subnetpools_client import SubnetpoolsClient
95from tempest.lib.services.network.subnets_client import SubnetsClient
Andrea Frittolif9cde7e2014-02-18 09:57:04 +000096from tempest import manager
Ken'ichi Ohmichi884d1062015-01-23 03:24:41 +000097from tempest.services.baremetal.v1.json.baremetal_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000098 BaremetalClient
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000099from tempest.services.compute.json.keypairs_client import KeyPairsClient
Ken'ichi Ohmichidc5fe442015-02-13 04:00:47 +0000100from tempest.services.data_processing.v1_1.data_processing_client import \
101 DataProcessingClient
Nikhil Manchandadd6886f2014-03-03 01:58:45 -0800102from tempest.services.database.json.flavors_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000103 DatabaseFlavorsClient
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000104from tempest.services.database.json.limits_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000105 DatabaseLimitsClient
Peter Stachowski320f9c72014-04-21 16:13:23 -0400106from tempest.services.database.json.versions_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000107 DatabaseVersionsClient
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600108from tempest.services.identity.v2.json.endpoints_client import EndpointsClient
109from tempest.services.identity.v2.json.identity_client import IdentityClient
110from tempest.services.identity.v2.json.roles_client import RolesClient
Daniel Mellado72f24ec2015-12-21 10:26:42 +0000111from tempest.services.identity.v2.json.services_client import \
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600112 ServicesClient as IdentityServicesClient
113from tempest.services.identity.v2.json.tenants_client import TenantsClient
114from tempest.services.identity.v2.json.users_client import UsersClient
nayna-patel914b4712013-07-16 08:29:05 +0000115from tempest.services.identity.v3.json.credentials_client import \
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600116 CredentialsClient
Daniel Mellado91a26b62016-02-11 11:13:04 +0000117from tempest.services.identity.v3.json.domains_client import DomainsClient
Sean Dague2416cf32013-04-10 08:29:07 -0400118from tempest.services.identity.v3.json.endpoints_client import \
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600119 EndPointsClient as EndPointsV3Client
120from tempest.services.identity.v3.json.groups_client import GroupsClient
Ghanshyam5b9b17e2016-02-23 01:56:22 +0900121from tempest.services.identity.v3.json.identity_client import \
122 IdentityClient as IdentityV3Client
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600123from tempest.services.identity.v3.json.policies_client import PoliciesClient
Yaroslav Lobankov47a93ab2016-02-07 16:32:49 -0600124from tempest.services.identity.v3.json.projects_client import ProjectsClient
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600125from tempest.services.identity.v3.json.regions_client import RegionsClient
Arx Cruz24bcb882016-02-10 15:20:16 +0100126from tempest.services.identity.v3.json.roles_client import \
127 RolesClient as RolesV3Client
Yaroslav Lobankov69d90562015-12-18 12:06:40 +0300128from tempest.services.identity.v3.json.services_client import \
129 ServicesClient as IdentityServicesV3Client
Daniel Mellado76405392016-02-11 12:47:12 +0000130from tempest.services.identity.v3.json.trusts_client import TrustsClient
Ghanshyam5b9b17e2016-02-23 01:56:22 +0900131from tempest.services.identity.v3.json.users_clients import \
132 UsersClient as UsersV3Client
Ken'ichi Ohmichi69dcf442015-11-30 11:48:01 +0000133from tempest.services.image.v1.json.images_client import ImagesClient
134from tempest.services.image.v2.json.images_client import ImagesClientV2
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000135from tempest.services.network.json.network_client import NetworkClient
Ken'ichi Ohmichie35f4722015-12-22 04:57:11 +0000136from tempest.services.network.json.routers_client import RoutersClient
dwalleck5d734432012-10-04 01:11:47 -0500137from tempest.services.object_storage.account_client import AccountClient
Attila Fazekas6968dd52013-02-15 17:05:53 +0100138from tempest.services.object_storage.container_client import ContainerClient
139from tempest.services.object_storage.object_client import ObjectClient
Steve Bakerc60e4e32013-05-06 15:22:41 +1200140from tempest.services.orchestration.json.orchestration_client import \
141 OrchestrationClient
liu-sheng67b730e2015-07-16 15:19:33 +0800142from tempest.services.telemetry.json.alarming_client import AlarmingClient
Nikolay Pliashechnikovb053aab2013-11-05 06:06:44 -0800143from tempest.services.telemetry.json.telemetry_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000144 TelemetryClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300145from tempest.services.volume.v1.json.admin.hosts_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300146 HostsClient as VolumeHostsClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300147from tempest.services.volume.v1.json.admin.quotas_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300148 QuotasClient as VolumeQuotasClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300149from tempest.services.volume.v1.json.admin.services_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300150 ServicesClient as VolumeServicesClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300151from tempest.services.volume.v1.json.admin.types_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300152 TypesClient as VolumeTypesClient
Yaroslav Lobankovdb4a2e12015-11-28 20:04:54 +0300153from tempest.services.volume.v1.json.availability_zone_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300154 AvailabilityZoneClient as VolumeAvailabilityZoneClient
Yaroslav Lobankovdb4a2e12015-11-28 20:04:54 +0300155from tempest.services.volume.v1.json.backups_client import BackupsClient
156from tempest.services.volume.v1.json.extensions_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300157 ExtensionsClient as VolumeExtensionsClient
Yaroslav Lobankovdb4a2e12015-11-28 20:04:54 +0300158from tempest.services.volume.v1.json.qos_client import QosSpecsClient
159from tempest.services.volume.v1.json.snapshots_client import SnapshotsClient
160from tempest.services.volume.v1.json.volumes_client import VolumesClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300161from tempest.services.volume.v2.json.admin.hosts_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300162 HostsClient as VolumeHostsV2Client
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300163from tempest.services.volume.v2.json.admin.quotas_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300164 QuotasClient as VolumeQuotasV2Client
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300165from tempest.services.volume.v2.json.admin.services_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300166 ServicesClient as VolumeServicesV2Client
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300167from tempest.services.volume.v2.json.admin.types_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300168 TypesClient as VolumeTypesV2Client
Zhi Kun Liu53395522014-07-18 16:05:52 +0800169from tempest.services.volume.v2.json.availability_zone_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300170 AvailabilityZoneClient as VolumeAvailabilityZoneV2Client
171from tempest.services.volume.v2.json.backups_client import \
172 BackupsClient as BackupsV2Client
Zhi Kun Liu53395522014-07-18 16:05:52 +0800173from tempest.services.volume.v2.json.extensions_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300174 ExtensionsClient as VolumeExtensionsV2Client
175from tempest.services.volume.v2.json.qos_client import \
176 QosSpecsClient as QosSpecsV2Client
Zhi Kun Liu38641c62014-07-10 20:12:48 +0800177from tempest.services.volume.v2.json.snapshots_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300178 SnapshotsClient as SnapshotsV2Client
179from tempest.services.volume.v2.json.volumes_client import \
180 VolumesClient as VolumesV2Client
Vincent Hou6b8a7b72012-08-25 01:24:33 +0800181
Sean Dague86bd8422013-12-20 09:56:44 -0500182CONF = config.CONF
Jay Pipes3f981df2012-03-27 18:59:44 -0400183LOG = logging.getLogger(__name__)
184
Vincent Hou6b8a7b72012-08-25 01:24:33 +0800185
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000186class Manager(manager.Manager):
Ken'ichi Ohmichi2e2ee192015-11-19 09:48:27 +0000187 """Top level manager for OpenStack tempest clients"""
Jay Pipes3f981df2012-03-27 18:59:44 -0400188
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +0000189 default_params = {
190 'disable_ssl_certificate_validation':
191 CONF.identity.disable_ssl_certificate_validation,
192 'ca_certs': CONF.identity.ca_certificates_file,
193 'trace_requests': CONF.debug.trace_requests
194 }
195
Ken'ichi Ohmichi737a6032015-01-21 07:04:42 +0000196 # NOTE: Tempest uses timeout values of compute API if project specific
197 # timeout values don't exist.
198 default_params_with_timeout_values = {
199 'build_interval': CONF.compute.build_interval,
200 'build_timeout': CONF.compute.build_timeout
201 }
202 default_params_with_timeout_values.update(default_params)
203
Ghanshyam05049dd2016-02-12 17:44:48 +0900204 def __init__(self, credentials, service=None):
ghanshyam4e2be342015-11-27 18:07:46 +0900205 """Initialization of Manager class.
Brant Knudsonc7ca3342013-03-28 21:08:50 -0500206
ghanshyam4e2be342015-11-27 18:07:46 +0900207 Setup all services clients and make them available for tests cases.
208 :param credentials: type Credentials or TestResources
209 :param service: Service name
ghanshyam4e2be342015-11-27 18:07:46 +0900210 """
211 super(Manager, self).__init__(credentials=credentials)
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000212 self._set_compute_clients()
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000213 self._set_database_clients()
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000214 self._set_identity_clients()
215 self._set_volume_clients()
Ken'ichi Ohmichic95eb852015-01-22 01:57:57 +0000216 self._set_object_storage_clients()
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000217
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000218 self.baremetal_client = BaremetalClient(
Ken'ichi Ohmichi1f88ece2015-01-23 03:33:11 +0000219 self.auth_provider,
220 CONF.baremetal.catalog_type,
221 CONF.identity.region,
222 endpoint_type=CONF.baremetal.endpoint_type,
223 **self.default_params_with_timeout_values)
Ken'ichi Ohmichi71860062015-12-15 08:20:13 +0000224 self.network_agents_client = NetworkAgentsClient(
225 self.auth_provider,
226 CONF.network.catalog_type,
227 CONF.network.region or CONF.identity.region,
228 endpoint_type=CONF.network.endpoint_type,
229 build_interval=CONF.network.build_interval,
230 build_timeout=CONF.network.build_timeout,
231 **self.default_params)
Ken'ichi Ohmichi52bb8122016-01-26 01:43:06 +0000232 self.network_extensions_client = NetworkExtensionsClient(
233 self.auth_provider,
234 CONF.network.catalog_type,
235 CONF.network.region or CONF.identity.region,
236 endpoint_type=CONF.network.endpoint_type,
237 build_interval=CONF.network.build_interval,
238 build_timeout=CONF.network.build_timeout,
239 **self.default_params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000240 self.network_client = NetworkClient(
Ken'ichi Ohmichia182e862015-01-21 01:16:37 +0000241 self.auth_provider,
242 CONF.network.catalog_type,
243 CONF.network.region or CONF.identity.region,
244 endpoint_type=CONF.network.endpoint_type,
245 build_interval=CONF.network.build_interval,
246 build_timeout=CONF.network.build_timeout,
247 **self.default_params)
John Warren94d8faf2015-09-15 12:22:24 -0400248 self.networks_client = NetworksClient(
249 self.auth_provider,
250 CONF.network.catalog_type,
251 CONF.network.region or CONF.identity.region,
252 endpoint_type=CONF.network.endpoint_type,
253 build_interval=CONF.network.build_interval,
254 build_timeout=CONF.network.build_timeout,
255 **self.default_params)
Ken'ichi Ohmichif3f8aba2015-12-15 08:11:00 +0000256 self.subnetpools_client = SubnetpoolsClient(
257 self.auth_provider,
258 CONF.network.catalog_type,
259 CONF.network.region or CONF.identity.region,
260 endpoint_type=CONF.network.endpoint_type,
261 build_interval=CONF.network.build_interval,
262 build_timeout=CONF.network.build_timeout,
263 **self.default_params)
John Warren3961acd2015-10-02 14:38:53 -0400264 self.subnets_client = SubnetsClient(
265 self.auth_provider,
266 CONF.network.catalog_type,
267 CONF.network.region or CONF.identity.region,
268 endpoint_type=CONF.network.endpoint_type,
269 build_interval=CONF.network.build_interval,
270 build_timeout=CONF.network.build_timeout,
271 **self.default_params)
John Warren49c0fe52015-10-22 12:35:54 -0400272 self.ports_client = PortsClient(
273 self.auth_provider,
274 CONF.network.catalog_type,
275 CONF.network.region or CONF.identity.region,
276 endpoint_type=CONF.network.endpoint_type,
277 build_interval=CONF.network.build_interval,
278 build_timeout=CONF.network.build_timeout,
279 **self.default_params)
Ken'ichi Ohmichi756d8ff2015-12-15 09:47:54 +0000280 self.network_quotas_client = NetworkQuotasClient(
281 self.auth_provider,
282 CONF.network.catalog_type,
283 CONF.network.region or CONF.identity.region,
284 endpoint_type=CONF.network.endpoint_type,
285 build_interval=CONF.network.build_interval,
286 build_timeout=CONF.network.build_timeout,
287 **self.default_params)
John Warrenfbf2a892015-11-17 12:36:14 -0500288 self.floating_ips_client = FloatingIPsClient(
289 self.auth_provider,
290 CONF.network.catalog_type,
291 CONF.network.region or CONF.identity.region,
292 endpoint_type=CONF.network.endpoint_type,
293 build_interval=CONF.network.build_interval,
294 build_timeout=CONF.network.build_timeout,
295 **self.default_params)
John Warren6d0083a2015-11-30 18:12:30 -0500296 self.metering_labels_client = MeteringLabelsClient(
297 self.auth_provider,
298 CONF.network.catalog_type,
299 CONF.network.region or CONF.identity.region,
300 endpoint_type=CONF.network.endpoint_type,
301 build_interval=CONF.network.build_interval,
302 build_timeout=CONF.network.build_timeout,
303 **self.default_params)
John Warrendd20b3e2015-12-03 13:11:28 -0500304 self.metering_label_rules_client = MeteringLabelRulesClient(
305 self.auth_provider,
306 CONF.network.catalog_type,
307 CONF.network.region or CONF.identity.region,
308 endpoint_type=CONF.network.endpoint_type,
309 build_interval=CONF.network.build_interval,
310 build_timeout=CONF.network.build_timeout,
311 **self.default_params)
Ken'ichi Ohmichie35f4722015-12-22 04:57:11 +0000312 self.routers_client = RoutersClient(
313 self.auth_provider,
314 CONF.network.catalog_type,
315 CONF.network.region or CONF.identity.region,
316 endpoint_type=CONF.network.endpoint_type,
317 build_interval=CONF.network.build_interval,
318 build_timeout=CONF.network.build_timeout,
319 **self.default_params)
John Warren456d9ae2016-01-12 15:36:33 -0500320 self.security_group_rules_client = SecurityGroupRulesClient(
321 self.auth_provider,
322 CONF.network.catalog_type,
323 CONF.network.region or CONF.identity.region,
324 endpoint_type=CONF.network.endpoint_type,
325 build_interval=CONF.network.build_interval,
326 build_timeout=CONF.network.build_timeout,
327 **self.default_params)
John Warrenf9606e92015-12-10 12:12:42 -0500328 self.security_groups_client = SecurityGroupsClient(
329 self.auth_provider,
330 CONF.network.catalog_type,
331 CONF.network.region or CONF.identity.region,
332 endpoint_type=CONF.network.endpoint_type,
333 build_interval=CONF.network.build_interval,
334 build_timeout=CONF.network.build_timeout,
335 **self.default_params)
Sean Daguef3c75912014-11-24 11:45:11 -0500336 if CONF.service_available.ceilometer:
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000337 self.telemetry_client = TelemetryClient(
Ken'ichi Ohmichid5dba1c2015-01-23 02:23:22 +0000338 self.auth_provider,
339 CONF.telemetry.catalog_type,
340 CONF.identity.region,
341 endpoint_type=CONF.telemetry.endpoint_type,
342 **self.default_params_with_timeout_values)
liu-sheng67b730e2015-07-16 15:19:33 +0800343 if CONF.service_available.aodh:
344 self.alarming_client = AlarmingClient(
345 self.auth_provider,
346 CONF.alarming.catalog_type,
347 CONF.identity.region,
348 endpoint_type=CONF.alarming.endpoint_type,
349 **self.default_params_with_timeout_values)
Sean Dague86bd8422013-12-20 09:56:44 -0500350 if CONF.service_available.glance:
Ken'ichi Ohmichi69dcf442015-11-30 11:48:01 +0000351 self.image_client = ImagesClient(
Masayuki Igawabc7e1892015-03-03 11:46:48 +0900352 self.auth_provider,
353 CONF.image.catalog_type,
354 CONF.image.region or CONF.identity.region,
355 endpoint_type=CONF.image.endpoint_type,
356 build_interval=CONF.image.build_interval,
357 build_timeout=CONF.image.build_timeout,
358 **self.default_params)
Ken'ichi Ohmichi69dcf442015-11-30 11:48:01 +0000359 self.image_client_v2 = ImagesClientV2(
Masayuki Igawabc7e1892015-03-03 11:46:48 +0900360 self.auth_provider,
361 CONF.image.catalog_type,
362 CONF.image.region or CONF.identity.region,
363 endpoint_type=CONF.image.endpoint_type,
364 build_interval=CONF.image.build_interval,
365 build_timeout=CONF.image.build_timeout,
366 **self.default_params)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000367 self.orchestration_client = OrchestrationClient(
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +0000368 self.auth_provider,
369 CONF.orchestration.catalog_type,
370 CONF.orchestration.region or CONF.identity.region,
371 endpoint_type=CONF.orchestration.endpoint_type,
372 build_interval=CONF.orchestration.build_interval,
373 build_timeout=CONF.orchestration.build_timeout,
374 **self.default_params)
Ken'ichi Ohmichi4e83b5e2015-02-13 04:07:34 +0000375 self.data_processing_client = DataProcessingClient(
376 self.auth_provider,
377 CONF.data_processing.catalog_type,
378 CONF.identity.region,
379 endpoint_type=CONF.data_processing.endpoint_type,
380 **self.default_params_with_timeout_values)
Ken'ichi Ohmichib38eb002015-01-23 02:35:01 +0000381 self.negative_client = negative_rest_client.NegativeRestClient(
David Kranz1e33e372015-03-20 09:42:56 -0400382 self.auth_provider, service, **self.default_params)
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +0000383
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000384 def _set_compute_clients(self):
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000385 params = {
386 'service': CONF.compute.catalog_type,
387 'region': CONF.compute.region or CONF.identity.region,
388 'endpoint_type': CONF.compute.endpoint_type,
389 'build_interval': CONF.compute.build_interval,
390 'build_timeout': CONF.compute.build_timeout
391 }
392 params.update(self.default_params)
393
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000394 self.agents_client = AgentsClient(self.auth_provider, **params)
John Warren9487a182015-09-14 18:12:56 -0400395 self.compute_networks_client = ComputeNetworksClient(
396 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000397 self.migrations_client = MigrationsClient(self.auth_provider,
398 **params)
Ken'ichi Ohmichi65225ef2014-11-19 01:06:25 +0000399 self.security_group_default_rules_client = (
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000400 SecurityGroupDefaultRulesClient(self.auth_provider, **params))
401 self.certificates_client = CertificatesClient(self.auth_provider,
402 **params)
403 self.servers_client = ServersClient(
Masayuki Igawa8f9c0c82015-03-03 09:38:08 +0900404 self.auth_provider,
405 enable_instance_password=CONF.compute_feature_enabled
406 .enable_instance_password,
407 **params)
Ken'ichi Ohmichi7ca54b82015-07-07 01:10:26 +0000408 self.server_groups_client = ServerGroupsClient(
409 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000410 self.limits_client = LimitsClient(self.auth_provider, **params)
Ghanshyamae76c122015-12-22 13:41:35 +0900411 self.compute_images_client = ComputeImagesClient(self.auth_provider,
412 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000413 self.keypairs_client = KeyPairsClient(self.auth_provider, **params)
414 self.quotas_client = QuotasClient(self.auth_provider, **params)
415 self.quota_classes_client = QuotaClassesClient(self.auth_provider,
416 **params)
417 self.flavors_client = FlavorsClient(self.auth_provider, **params)
418 self.extensions_client = ExtensionsClient(self.auth_provider,
419 **params)
Ken'ichi Ohmichif5767702015-07-29 23:39:10 +0000420 self.floating_ip_pools_client = FloatingIPPoolsClient(
Ken'ichi Ohmichi03af1c52015-07-13 00:28:05 +0000421 self.auth_provider, **params)
Ken'ichi Ohmichif5767702015-07-29 23:39:10 +0000422 self.floating_ips_bulk_client = FloatingIPsBulkClient(
Ken'ichi Ohmichi2b26e752015-07-13 00:44:36 +0000423 self.auth_provider, **params)
John Warrene74890a2015-11-11 15:18:01 -0500424 self.compute_floating_ips_client = ComputeFloatingIPsClient(
425 self.auth_provider, **params)
John Warren5cdbf422016-01-05 12:42:43 -0500426 self.compute_security_group_rules_client = \
427 ComputeSecurityGroupRulesClient(self.auth_provider, **params)
John Warrenf2345512015-12-10 13:39:30 -0500428 self.compute_security_groups_client = ComputeSecurityGroupsClient(
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000429 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000430 self.interfaces_client = InterfacesClient(self.auth_provider,
431 **params)
432 self.fixed_ips_client = FixedIPsClient(self.auth_provider,
433 **params)
434 self.availability_zone_client = AvailabilityZoneClient(
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000435 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000436 self.aggregates_client = AggregatesClient(self.auth_provider,
437 **params)
438 self.services_client = ServicesClient(self.auth_provider, **params)
439 self.tenant_usages_client = TenantUsagesClient(self.auth_provider,
440 **params)
441 self.hosts_client = HostsClient(self.auth_provider, **params)
442 self.hypervisor_client = HypervisorClient(self.auth_provider,
443 **params)
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000444 self.instance_usages_audit_log_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000445 InstanceUsagesAuditLogClient(self.auth_provider, **params)
Ken'ichi Ohmichic3dfdb22015-01-22 04:39:58 +0000446 self.tenant_networks_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000447 TenantNetworksClient(self.auth_provider, **params)
448 self.baremetal_nodes_client = BaremetalNodesClient(
YuikoTakadaac0879a2015-01-22 02:40:03 +0000449 self.auth_provider, **params)
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000450
451 # NOTE: The following client needs special timeout values because
452 # the API is a proxy for the other component.
453 params_volume = copy.deepcopy(params)
454 params_volume.update({
455 'build_interval': CONF.volume.build_interval,
456 'build_timeout': CONF.volume.build_timeout
457 })
Ken'ichi Ohmichiea3f26a2015-09-29 00:18:39 +0000458 self.volumes_extensions_client = ComputeVolumesClient(
Ken'ichi Ohmichic4921782015-08-05 08:14:42 +0000459 self.auth_provider, **params_volume)
Ken'ichi Ohmichi2b6012b2015-09-03 01:56:19 +0000460 self.compute_versions_client = VersionsClient(self.auth_provider,
461 **params_volume)
Ken'ichi Ohmichib7e27302015-09-29 00:11:20 +0000462 self.snapshots_extensions_client = ComputeSnapshotsClient(
Gaozexub9c9d6e2015-09-10 17:08:04 +0800463 self.auth_provider, **params_volume)
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000464
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000465 def _set_database_clients(self):
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000466 self.database_flavors_client = DatabaseFlavorsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000467 self.auth_provider,
468 CONF.database.catalog_type,
469 CONF.identity.region,
470 **self.default_params_with_timeout_values)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000471 self.database_limits_client = DatabaseLimitsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000472 self.auth_provider,
473 CONF.database.catalog_type,
474 CONF.identity.region,
475 **self.default_params_with_timeout_values)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000476 self.database_versions_client = DatabaseVersionsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000477 self.auth_provider,
478 CONF.database.catalog_type,
479 CONF.identity.region,
480 **self.default_params_with_timeout_values)
481
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000482 def _set_identity_clients(self):
ghanshyamd26b5cd2015-02-09 14:48:58 +0900483 params = {
484 'service': CONF.identity.catalog_type,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300485 'region': CONF.identity.region
ghanshyamd26b5cd2015-02-09 14:48:58 +0900486 }
487 params.update(self.default_params_with_timeout_values)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300488
489 # Clients below use the admin endpoint type of Keystone API v2
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300490 params_v2_admin = params.copy()
491 params_v2_admin['endpoint_type'] = CONF.identity.v2_admin_endpoint_type
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600492 self.endpoints_client = EndpointsClient(self.auth_provider,
493 **params_v2_admin)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000494 self.identity_client = IdentityClient(self.auth_provider,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300495 **params_v2_admin)
Daniel Melladob04da902015-11-20 17:43:12 +0100496 self.tenants_client = TenantsClient(self.auth_provider,
497 **params_v2_admin)
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600498 self.roles_client = RolesClient(self.auth_provider, **params_v2_admin)
499 self.users_client = UsersClient(self.auth_provider, **params_v2_admin)
500 self.identity_services_client = IdentityServicesClient(
501 self.auth_provider, **params_v2_admin)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300502
503 # Clients below use the public endpoint type of Keystone API v2
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300504 params_v2_public = params.copy()
505 params_v2_public['endpoint_type'] = (
506 CONF.identity.v2_public_endpoint_type)
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300507 self.identity_public_client = IdentityClient(self.auth_provider,
508 **params_v2_public)
Daniel Melladob04da902015-11-20 17:43:12 +0100509 self.tenants_public_client = TenantsClient(self.auth_provider,
510 **params_v2_public)
Daniel Mellado82c83a52015-12-09 15:16:49 +0000511 self.users_public_client = UsersClient(self.auth_provider,
512 **params_v2_public)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300513
514 # Clients below use the endpoint type of Keystone API v3
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300515 params_v3 = params.copy()
516 params_v3['endpoint_type'] = CONF.identity.v3_endpoint_type
Daniel Mellado91a26b62016-02-11 11:13:04 +0000517 self.domains_client = DomainsClient(self.auth_provider,
518 **params_v3)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000519 self.identity_v3_client = IdentityV3Client(self.auth_provider,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300520 **params_v3)
Daniel Mellado76405392016-02-11 12:47:12 +0000521 self.trusts_client = TrustsClient(self.auth_provider, **params_v3)
Daniel Mellado7aea5342016-02-09 09:10:12 +0000522 self.users_v3_client = UsersV3Client(self.auth_provider, **params_v3)
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600523 self.endpoints_v3_client = EndPointsV3Client(self.auth_provider,
524 **params_v3)
Arx Cruz24bcb882016-02-10 15:20:16 +0100525 self.roles_v3_client = RolesV3Client(self.auth_provider, **params_v3)
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600526 self.identity_services_v3_client = IdentityServicesV3Client(
Yaroslav Lobankov69d90562015-12-18 12:06:40 +0300527 self.auth_provider, **params_v3)
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600528 self.policies_client = PoliciesClient(self.auth_provider, **params_v3)
Yaroslav Lobankov47a93ab2016-02-07 16:32:49 -0600529 self.projects_client = ProjectsClient(self.auth_provider, **params_v3)
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600530 self.regions_client = RegionsClient(self.auth_provider, **params_v3)
531 self.credentials_client = CredentialsClient(self.auth_provider,
532 **params_v3)
533 self.groups_client = GroupsClient(self.auth_provider, **params_v3)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300534
Andrea Frittoli90012352015-02-25 21:58:02 +0000535 # Token clients do not use the catalog. They only need default_params.
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100536 # They read auth_url, so they should only be set if the corresponding
537 # API version is marked as enabled
538 if CONF.identity_feature_enabled.api_v2:
539 if CONF.identity.uri:
Ken'ichi Ohmichi5f80ce32015-09-10 23:51:14 +0000540 self.token_client = TokenClient(
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100541 CONF.identity.uri, **self.default_params)
542 else:
543 msg = 'Identity v2 API enabled, but no identity.uri set'
544 raise exceptions.InvalidConfiguration(msg)
Ken'ichi Ohmichi41951b02014-11-19 01:57:43 +0000545 if CONF.identity_feature_enabled.api_v3:
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100546 if CONF.identity.uri_v3:
Ken'ichi Ohmichi5f80ce32015-09-10 23:51:14 +0000547 self.token_v3_client = V3TokenClient(
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100548 CONF.identity.uri_v3, **self.default_params)
549 else:
550 msg = 'Identity v3 API enabled, but no identity.uri_v3 set'
551 raise exceptions.InvalidConfiguration(msg)
Ken'ichi Ohmichi41951b02014-11-19 01:57:43 +0000552
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000553 def _set_volume_clients(self):
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000554 params = {
555 'service': CONF.volume.catalog_type,
556 'region': CONF.volume.region or CONF.identity.region,
557 'endpoint_type': CONF.volume.endpoint_type,
558 'build_interval': CONF.volume.build_interval,
559 'build_timeout': CONF.volume.build_timeout
560 }
561 params.update(self.default_params)
562
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000563 self.volume_qos_client = QosSpecsClient(self.auth_provider,
564 **params)
565 self.volume_qos_v2_client = QosSpecsV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000566 self.auth_provider, **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300567 self.volume_services_client = VolumeServicesClient(
568 self.auth_provider, **params)
569 self.volume_services_v2_client = VolumeServicesV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000570 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000571 self.backups_client = BackupsClient(self.auth_provider, **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300572 self.backups_v2_client = BackupsV2Client(self.auth_provider,
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000573 **params)
574 self.snapshots_client = SnapshotsClient(self.auth_provider,
575 **params)
576 self.snapshots_v2_client = SnapshotsV2Client(self.auth_provider,
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000577 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000578 self.volumes_client = VolumesClient(
Ken'ichi Ohmichi234da802015-02-13 04:48:06 +0000579 self.auth_provider, default_volume_size=CONF.volume.volume_size,
580 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000581 self.volumes_v2_client = VolumesV2Client(
Ken'ichi Ohmichi234da802015-02-13 04:48:06 +0000582 self.auth_provider, default_volume_size=CONF.volume.volume_size,
583 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000584 self.volume_types_client = VolumeTypesClient(self.auth_provider,
585 **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300586 self.volume_types_v2_client = VolumeTypesV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000587 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000588 self.volume_hosts_client = VolumeHostsClient(self.auth_provider,
589 **params)
590 self.volume_hosts_v2_client = VolumeHostsV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000591 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000592 self.volume_quotas_client = VolumeQuotasClient(self.auth_provider,
593 **params)
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000594 self.volume_quotas_v2_client = VolumeQuotasV2Client(self.auth_provider,
595 **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300596 self.volumes_extension_client = VolumeExtensionsClient(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000597 self.auth_provider, **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300598 self.volumes_v2_extension_client = VolumeExtensionsV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000599 self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000600 self.volume_availability_zone_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000601 VolumeAvailabilityZoneClient(self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000602 self.volume_v2_availability_zone_client = \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300603 VolumeAvailabilityZoneV2Client(self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000604
Ken'ichi Ohmichic95eb852015-01-22 01:57:57 +0000605 def _set_object_storage_clients(self):
Ken'ichi Ohmichi564b2ad2015-01-22 02:08:59 +0000606 params = {
607 'service': CONF.object_storage.catalog_type,
608 'region': CONF.object_storage.region or CONF.identity.region,
609 'endpoint_type': CONF.object_storage.endpoint_type
610 }
611 params.update(self.default_params_with_timeout_values)
612
613 self.account_client = AccountClient(self.auth_provider, **params)
614 self.container_client = ContainerClient(self.auth_provider, **params)
615 self.object_client = ObjectClient(self.auth_provider, **params)