blob: 7fa4e5bbeae64b4bce910b2488d8c9d7b7c11249 [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
ghanshyam3e758ee2016-04-07 09:29:02 +090049from tempest.lib.services.compute.keypairs_client import KeyPairsClient
Andrea Frittoli (andreaf)db9672e2016-02-23 14:07:24 -050050from tempest.lib.services.compute.limits_client import LimitsClient
51from tempest.lib.services.compute.migrations_client import MigrationsClient
52from tempest.lib.services.compute.networks_client import NetworksClient \
53 as ComputeNetworksClient
54from tempest.lib.services.compute.quota_classes_client import \
55 QuotaClassesClient
56from tempest.lib.services.compute.quotas_client import QuotasClient
57from tempest.lib.services.compute.security_group_default_rules_client import \
58 SecurityGroupDefaultRulesClient
59from tempest.lib.services.compute.security_group_rules_client import \
60 SecurityGroupRulesClient as ComputeSecurityGroupRulesClient
61from tempest.lib.services.compute.security_groups_client import \
62 SecurityGroupsClient as ComputeSecurityGroupsClient
63from tempest.lib.services.compute.server_groups_client import \
64 ServerGroupsClient
65from tempest.lib.services.compute.servers_client import ServersClient
66from tempest.lib.services.compute.services_client import ServicesClient
67from tempest.lib.services.compute.snapshots_client import \
68 SnapshotsClient as ComputeSnapshotsClient
69from tempest.lib.services.compute.tenant_networks_client import \
70 TenantNetworksClient
71from tempest.lib.services.compute.tenant_usages_client import \
72 TenantUsagesClient
73from tempest.lib.services.compute.versions_client import VersionsClient
74from tempest.lib.services.compute.volumes_client import \
75 VolumesClient as ComputeVolumesClient
76from tempest.lib.services.identity.v2.token_client import TokenClient
77from tempest.lib.services.identity.v3.token_client import V3TokenClient
78from tempest.lib.services.network.agents_client import AgentsClient \
79 as NetworkAgentsClient
80from tempest.lib.services.network.extensions_client import \
81 ExtensionsClient as NetworkExtensionsClient
82from tempest.lib.services.network.floating_ips_client import FloatingIPsClient
83from tempest.lib.services.network.metering_label_rules_client import \
84 MeteringLabelRulesClient
85from tempest.lib.services.network.metering_labels_client import \
86 MeteringLabelsClient
87from tempest.lib.services.network.networks_client import NetworksClient
88from tempest.lib.services.network.ports_client import PortsClient
89from tempest.lib.services.network.quotas_client import QuotasClient \
90 as NetworkQuotasClient
Ken'ichi Ohmichi131799e2016-06-06 12:06:41 -070091from tempest.lib.services.network.routers_client import RoutersClient
Ken'ichi Ohmichid598d2f2016-03-25 15:57:08 -070092from tempest.lib.services.network.security_group_rules_client import \
93 SecurityGroupRulesClient
Andrea Frittoli (andreaf)db9672e2016-02-23 14:07:24 -050094from tempest.lib.services.network.security_groups_client import \
95 SecurityGroupsClient
96from tempest.lib.services.network.subnetpools_client import SubnetpoolsClient
97from tempest.lib.services.network.subnets_client import SubnetsClient
Andrea Frittolif9cde7e2014-02-18 09:57:04 +000098from tempest import manager
Ken'ichi Ohmichi884d1062015-01-23 03:24:41 +000099from tempest.services.baremetal.v1.json.baremetal_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000100 BaremetalClient
Ken'ichi Ohmichidc5fe442015-02-13 04:00:47 +0000101from tempest.services.data_processing.v1_1.data_processing_client import \
102 DataProcessingClient
Nikhil Manchandadd6886f2014-03-03 01:58:45 -0800103from tempest.services.database.json.flavors_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000104 DatabaseFlavorsClient
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000105from tempest.services.database.json.limits_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000106 DatabaseLimitsClient
Peter Stachowski320f9c72014-04-21 16:13:23 -0400107from tempest.services.database.json.versions_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000108 DatabaseVersionsClient
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600109from tempest.services.identity.v2.json.endpoints_client import EndpointsClient
110from tempest.services.identity.v2.json.identity_client import IdentityClient
111from tempest.services.identity.v2.json.roles_client import RolesClient
Daniel Mellado72f24ec2015-12-21 10:26:42 +0000112from tempest.services.identity.v2.json.services_client import \
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600113 ServicesClient as IdentityServicesClient
114from tempest.services.identity.v2.json.tenants_client import TenantsClient
115from tempest.services.identity.v2.json.users_client import UsersClient
nayna-patel914b4712013-07-16 08:29:05 +0000116from tempest.services.identity.v3.json.credentials_client import \
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600117 CredentialsClient
Daniel Mellado91a26b62016-02-11 11:13:04 +0000118from tempest.services.identity.v3.json.domains_client import DomainsClient
Sean Dague2416cf32013-04-10 08:29:07 -0400119from tempest.services.identity.v3.json.endpoints_client import \
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600120 EndPointsClient as EndPointsV3Client
121from tempest.services.identity.v3.json.groups_client import GroupsClient
Ghanshyam5b9b17e2016-02-23 01:56:22 +0900122from tempest.services.identity.v3.json.identity_client import \
123 IdentityClient as IdentityV3Client
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600124from tempest.services.identity.v3.json.policies_client import PoliciesClient
Yaroslav Lobankov47a93ab2016-02-07 16:32:49 -0600125from tempest.services.identity.v3.json.projects_client import ProjectsClient
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600126from tempest.services.identity.v3.json.regions_client import RegionsClient
Arx Cruz24bcb882016-02-10 15:20:16 +0100127from tempest.services.identity.v3.json.roles_client import \
128 RolesClient as RolesV3Client
Yaroslav Lobankov69d90562015-12-18 12:06:40 +0300129from tempest.services.identity.v3.json.services_client import \
130 ServicesClient as IdentityServicesV3Client
Daniel Mellado76405392016-02-11 12:47:12 +0000131from tempest.services.identity.v3.json.trusts_client import TrustsClient
Ghanshyam5b9b17e2016-02-23 01:56:22 +0900132from tempest.services.identity.v3.json.users_clients import \
133 UsersClient as UsersV3Client
Ken'ichi Ohmichi69dcf442015-11-30 11:48:01 +0000134from tempest.services.image.v1.json.images_client import ImagesClient
ghanshyame21b63e2016-06-07 16:53:04 +0900135from tempest.services.image.v1.json.members_client import MembersClient
Yaroslav Lobankov2fea4052016-04-19 15:05:57 +0300136from tempest.services.image.v2.json.images_client import \
137 ImagesClient as ImagesV2Client
ghanshyam71db8f52016-06-07 17:02:38 +0900138from tempest.services.image.v2.json.members_client import MembersClient \
139 as MembersClientV2
dwalleck5d734432012-10-04 01:11:47 -0500140from tempest.services.object_storage.account_client import AccountClient
Attila Fazekas6968dd52013-02-15 17:05:53 +0100141from tempest.services.object_storage.container_client import ContainerClient
142from tempest.services.object_storage.object_client import ObjectClient
Steve Bakerc60e4e32013-05-06 15:22:41 +1200143from tempest.services.orchestration.json.orchestration_client import \
144 OrchestrationClient
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
Andrea Frittoli (andreaf)3e82af72016-05-05 22:53:38 +0100204 def __init__(self, credentials, service=None, scope='project'):
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
Andrea Frittoli (andreaf)3e82af72016-05-05 22:53:38 +0100210 :param scope: default scope for tokens produced by the auth provider
ghanshyam4e2be342015-11-27 18:07:46 +0900211 """
Andrea Frittoli (andreaf)3e82af72016-05-05 22:53:38 +0100212 super(Manager, self).__init__(credentials=credentials, scope=scope)
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000213 self._set_compute_clients()
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000214 self._set_database_clients()
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000215 self._set_identity_clients()
216 self._set_volume_clients()
Ken'ichi Ohmichic95eb852015-01-22 01:57:57 +0000217 self._set_object_storage_clients()
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000218
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000219 self.baremetal_client = BaremetalClient(
Ken'ichi Ohmichi1f88ece2015-01-23 03:33:11 +0000220 self.auth_provider,
221 CONF.baremetal.catalog_type,
222 CONF.identity.region,
223 endpoint_type=CONF.baremetal.endpoint_type,
224 **self.default_params_with_timeout_values)
Ken'ichi Ohmichi71860062015-12-15 08:20:13 +0000225 self.network_agents_client = NetworkAgentsClient(
226 self.auth_provider,
227 CONF.network.catalog_type,
228 CONF.network.region or CONF.identity.region,
229 endpoint_type=CONF.network.endpoint_type,
230 build_interval=CONF.network.build_interval,
231 build_timeout=CONF.network.build_timeout,
232 **self.default_params)
Ken'ichi Ohmichi52bb8122016-01-26 01:43:06 +0000233 self.network_extensions_client = NetworkExtensionsClient(
234 self.auth_provider,
235 CONF.network.catalog_type,
236 CONF.network.region or CONF.identity.region,
237 endpoint_type=CONF.network.endpoint_type,
238 build_interval=CONF.network.build_interval,
239 build_timeout=CONF.network.build_timeout,
240 **self.default_params)
John Warren94d8faf2015-09-15 12:22:24 -0400241 self.networks_client = NetworksClient(
242 self.auth_provider,
243 CONF.network.catalog_type,
244 CONF.network.region or CONF.identity.region,
245 endpoint_type=CONF.network.endpoint_type,
246 build_interval=CONF.network.build_interval,
247 build_timeout=CONF.network.build_timeout,
248 **self.default_params)
Ken'ichi Ohmichif3f8aba2015-12-15 08:11:00 +0000249 self.subnetpools_client = SubnetpoolsClient(
250 self.auth_provider,
251 CONF.network.catalog_type,
252 CONF.network.region or CONF.identity.region,
253 endpoint_type=CONF.network.endpoint_type,
254 build_interval=CONF.network.build_interval,
255 build_timeout=CONF.network.build_timeout,
256 **self.default_params)
John Warren3961acd2015-10-02 14:38:53 -0400257 self.subnets_client = SubnetsClient(
258 self.auth_provider,
259 CONF.network.catalog_type,
260 CONF.network.region or CONF.identity.region,
261 endpoint_type=CONF.network.endpoint_type,
262 build_interval=CONF.network.build_interval,
263 build_timeout=CONF.network.build_timeout,
264 **self.default_params)
John Warren49c0fe52015-10-22 12:35:54 -0400265 self.ports_client = PortsClient(
266 self.auth_provider,
267 CONF.network.catalog_type,
268 CONF.network.region or CONF.identity.region,
269 endpoint_type=CONF.network.endpoint_type,
270 build_interval=CONF.network.build_interval,
271 build_timeout=CONF.network.build_timeout,
272 **self.default_params)
Ken'ichi Ohmichi756d8ff2015-12-15 09:47:54 +0000273 self.network_quotas_client = NetworkQuotasClient(
274 self.auth_provider,
275 CONF.network.catalog_type,
276 CONF.network.region or CONF.identity.region,
277 endpoint_type=CONF.network.endpoint_type,
278 build_interval=CONF.network.build_interval,
279 build_timeout=CONF.network.build_timeout,
280 **self.default_params)
John Warrenfbf2a892015-11-17 12:36:14 -0500281 self.floating_ips_client = FloatingIPsClient(
282 self.auth_provider,
283 CONF.network.catalog_type,
284 CONF.network.region or CONF.identity.region,
285 endpoint_type=CONF.network.endpoint_type,
286 build_interval=CONF.network.build_interval,
287 build_timeout=CONF.network.build_timeout,
288 **self.default_params)
John Warren6d0083a2015-11-30 18:12:30 -0500289 self.metering_labels_client = MeteringLabelsClient(
290 self.auth_provider,
291 CONF.network.catalog_type,
292 CONF.network.region or CONF.identity.region,
293 endpoint_type=CONF.network.endpoint_type,
294 build_interval=CONF.network.build_interval,
295 build_timeout=CONF.network.build_timeout,
296 **self.default_params)
John Warrendd20b3e2015-12-03 13:11:28 -0500297 self.metering_label_rules_client = MeteringLabelRulesClient(
298 self.auth_provider,
299 CONF.network.catalog_type,
300 CONF.network.region or CONF.identity.region,
301 endpoint_type=CONF.network.endpoint_type,
302 build_interval=CONF.network.build_interval,
303 build_timeout=CONF.network.build_timeout,
304 **self.default_params)
Ken'ichi Ohmichie35f4722015-12-22 04:57:11 +0000305 self.routers_client = RoutersClient(
306 self.auth_provider,
307 CONF.network.catalog_type,
308 CONF.network.region or CONF.identity.region,
309 endpoint_type=CONF.network.endpoint_type,
310 build_interval=CONF.network.build_interval,
311 build_timeout=CONF.network.build_timeout,
312 **self.default_params)
John Warren456d9ae2016-01-12 15:36:33 -0500313 self.security_group_rules_client = SecurityGroupRulesClient(
314 self.auth_provider,
315 CONF.network.catalog_type,
316 CONF.network.region or CONF.identity.region,
317 endpoint_type=CONF.network.endpoint_type,
318 build_interval=CONF.network.build_interval,
319 build_timeout=CONF.network.build_timeout,
320 **self.default_params)
John Warrenf9606e92015-12-10 12:12:42 -0500321 self.security_groups_client = SecurityGroupsClient(
322 self.auth_provider,
323 CONF.network.catalog_type,
324 CONF.network.region or CONF.identity.region,
325 endpoint_type=CONF.network.endpoint_type,
326 build_interval=CONF.network.build_interval,
327 build_timeout=CONF.network.build_timeout,
328 **self.default_params)
Sean Dague86bd8422013-12-20 09:56:44 -0500329 if CONF.service_available.glance:
Ken'ichi Ohmichi69dcf442015-11-30 11:48:01 +0000330 self.image_client = ImagesClient(
Masayuki Igawabc7e1892015-03-03 11:46:48 +0900331 self.auth_provider,
332 CONF.image.catalog_type,
333 CONF.image.region or CONF.identity.region,
334 endpoint_type=CONF.image.endpoint_type,
335 build_interval=CONF.image.build_interval,
336 build_timeout=CONF.image.build_timeout,
337 **self.default_params)
ghanshyame21b63e2016-06-07 16:53:04 +0900338 self.image_member_client = MembersClient(
339 self.auth_provider,
340 CONF.image.catalog_type,
341 CONF.image.region or CONF.identity.region,
342 endpoint_type=CONF.image.endpoint_type,
343 build_interval=CONF.image.build_interval,
344 build_timeout=CONF.image.build_timeout,
345 **self.default_params)
Yaroslav Lobankov2fea4052016-04-19 15:05:57 +0300346 self.image_client_v2 = ImagesV2Client(
Masayuki Igawabc7e1892015-03-03 11:46:48 +0900347 self.auth_provider,
348 CONF.image.catalog_type,
349 CONF.image.region or CONF.identity.region,
350 endpoint_type=CONF.image.endpoint_type,
351 build_interval=CONF.image.build_interval,
352 build_timeout=CONF.image.build_timeout,
353 **self.default_params)
ghanshyam71db8f52016-06-07 17:02:38 +0900354 self.image_member_client_v2 = MembersClientV2(
355 self.auth_provider,
356 CONF.image.catalog_type,
357 CONF.image.region or CONF.identity.region,
358 endpoint_type=CONF.image.endpoint_type,
359 build_interval=CONF.image.build_interval,
360 build_timeout=CONF.image.build_timeout,
361 **self.default_params)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000362 self.orchestration_client = OrchestrationClient(
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +0000363 self.auth_provider,
364 CONF.orchestration.catalog_type,
365 CONF.orchestration.region or CONF.identity.region,
366 endpoint_type=CONF.orchestration.endpoint_type,
367 build_interval=CONF.orchestration.build_interval,
368 build_timeout=CONF.orchestration.build_timeout,
369 **self.default_params)
Ken'ichi Ohmichi4e83b5e2015-02-13 04:07:34 +0000370 self.data_processing_client = DataProcessingClient(
371 self.auth_provider,
372 CONF.data_processing.catalog_type,
373 CONF.identity.region,
374 endpoint_type=CONF.data_processing.endpoint_type,
375 **self.default_params_with_timeout_values)
Ken'ichi Ohmichib38eb002015-01-23 02:35:01 +0000376 self.negative_client = negative_rest_client.NegativeRestClient(
David Kranz1e33e372015-03-20 09:42:56 -0400377 self.auth_provider, service, **self.default_params)
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +0000378
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000379 def _set_compute_clients(self):
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000380 params = {
381 'service': CONF.compute.catalog_type,
382 'region': CONF.compute.region or CONF.identity.region,
383 'endpoint_type': CONF.compute.endpoint_type,
384 'build_interval': CONF.compute.build_interval,
385 'build_timeout': CONF.compute.build_timeout
386 }
387 params.update(self.default_params)
388
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000389 self.agents_client = AgentsClient(self.auth_provider, **params)
John Warren9487a182015-09-14 18:12:56 -0400390 self.compute_networks_client = ComputeNetworksClient(
391 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000392 self.migrations_client = MigrationsClient(self.auth_provider,
393 **params)
Ken'ichi Ohmichi65225ef2014-11-19 01:06:25 +0000394 self.security_group_default_rules_client = (
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000395 SecurityGroupDefaultRulesClient(self.auth_provider, **params))
396 self.certificates_client = CertificatesClient(self.auth_provider,
397 **params)
398 self.servers_client = ServersClient(
Masayuki Igawa8f9c0c82015-03-03 09:38:08 +0900399 self.auth_provider,
400 enable_instance_password=CONF.compute_feature_enabled
401 .enable_instance_password,
402 **params)
Ken'ichi Ohmichi7ca54b82015-07-07 01:10:26 +0000403 self.server_groups_client = ServerGroupsClient(
404 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000405 self.limits_client = LimitsClient(self.auth_provider, **params)
Ghanshyamae76c122015-12-22 13:41:35 +0900406 self.compute_images_client = ComputeImagesClient(self.auth_provider,
407 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000408 self.keypairs_client = KeyPairsClient(self.auth_provider, **params)
409 self.quotas_client = QuotasClient(self.auth_provider, **params)
410 self.quota_classes_client = QuotaClassesClient(self.auth_provider,
411 **params)
412 self.flavors_client = FlavorsClient(self.auth_provider, **params)
413 self.extensions_client = ExtensionsClient(self.auth_provider,
414 **params)
Ken'ichi Ohmichif5767702015-07-29 23:39:10 +0000415 self.floating_ip_pools_client = FloatingIPPoolsClient(
Ken'ichi Ohmichi03af1c52015-07-13 00:28:05 +0000416 self.auth_provider, **params)
Ken'ichi Ohmichif5767702015-07-29 23:39:10 +0000417 self.floating_ips_bulk_client = FloatingIPsBulkClient(
Ken'ichi Ohmichi2b26e752015-07-13 00:44:36 +0000418 self.auth_provider, **params)
John Warrene74890a2015-11-11 15:18:01 -0500419 self.compute_floating_ips_client = ComputeFloatingIPsClient(
420 self.auth_provider, **params)
John Warren5cdbf422016-01-05 12:42:43 -0500421 self.compute_security_group_rules_client = \
422 ComputeSecurityGroupRulesClient(self.auth_provider, **params)
John Warrenf2345512015-12-10 13:39:30 -0500423 self.compute_security_groups_client = ComputeSecurityGroupsClient(
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000424 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000425 self.interfaces_client = InterfacesClient(self.auth_provider,
426 **params)
427 self.fixed_ips_client = FixedIPsClient(self.auth_provider,
428 **params)
429 self.availability_zone_client = AvailabilityZoneClient(
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000430 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000431 self.aggregates_client = AggregatesClient(self.auth_provider,
432 **params)
433 self.services_client = ServicesClient(self.auth_provider, **params)
434 self.tenant_usages_client = TenantUsagesClient(self.auth_provider,
435 **params)
436 self.hosts_client = HostsClient(self.auth_provider, **params)
437 self.hypervisor_client = HypervisorClient(self.auth_provider,
438 **params)
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000439 self.instance_usages_audit_log_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000440 InstanceUsagesAuditLogClient(self.auth_provider, **params)
Ken'ichi Ohmichic3dfdb22015-01-22 04:39:58 +0000441 self.tenant_networks_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000442 TenantNetworksClient(self.auth_provider, **params)
443 self.baremetal_nodes_client = BaremetalNodesClient(
YuikoTakadaac0879a2015-01-22 02:40:03 +0000444 self.auth_provider, **params)
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000445
446 # NOTE: The following client needs special timeout values because
447 # the API is a proxy for the other component.
448 params_volume = copy.deepcopy(params)
449 params_volume.update({
450 'build_interval': CONF.volume.build_interval,
451 'build_timeout': CONF.volume.build_timeout
452 })
Ken'ichi Ohmichiea3f26a2015-09-29 00:18:39 +0000453 self.volumes_extensions_client = ComputeVolumesClient(
Ken'ichi Ohmichic4921782015-08-05 08:14:42 +0000454 self.auth_provider, **params_volume)
Ken'ichi Ohmichi2b6012b2015-09-03 01:56:19 +0000455 self.compute_versions_client = VersionsClient(self.auth_provider,
456 **params_volume)
Ken'ichi Ohmichib7e27302015-09-29 00:11:20 +0000457 self.snapshots_extensions_client = ComputeSnapshotsClient(
Gaozexub9c9d6e2015-09-10 17:08:04 +0800458 self.auth_provider, **params_volume)
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000459
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000460 def _set_database_clients(self):
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000461 self.database_flavors_client = DatabaseFlavorsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000462 self.auth_provider,
463 CONF.database.catalog_type,
464 CONF.identity.region,
465 **self.default_params_with_timeout_values)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000466 self.database_limits_client = DatabaseLimitsClient(
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_versions_client = DatabaseVersionsClient(
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)
476
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000477 def _set_identity_clients(self):
ghanshyamd26b5cd2015-02-09 14:48:58 +0900478 params = {
479 'service': CONF.identity.catalog_type,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300480 'region': CONF.identity.region
ghanshyamd26b5cd2015-02-09 14:48:58 +0900481 }
482 params.update(self.default_params_with_timeout_values)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300483
484 # Clients below use the admin endpoint type of Keystone API v2
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300485 params_v2_admin = params.copy()
486 params_v2_admin['endpoint_type'] = CONF.identity.v2_admin_endpoint_type
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600487 self.endpoints_client = EndpointsClient(self.auth_provider,
488 **params_v2_admin)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000489 self.identity_client = IdentityClient(self.auth_provider,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300490 **params_v2_admin)
Daniel Melladob04da902015-11-20 17:43:12 +0100491 self.tenants_client = TenantsClient(self.auth_provider,
492 **params_v2_admin)
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600493 self.roles_client = RolesClient(self.auth_provider, **params_v2_admin)
494 self.users_client = UsersClient(self.auth_provider, **params_v2_admin)
495 self.identity_services_client = IdentityServicesClient(
496 self.auth_provider, **params_v2_admin)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300497
498 # Clients below use the public endpoint type of Keystone API v2
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300499 params_v2_public = params.copy()
500 params_v2_public['endpoint_type'] = (
501 CONF.identity.v2_public_endpoint_type)
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300502 self.identity_public_client = IdentityClient(self.auth_provider,
503 **params_v2_public)
Daniel Melladob04da902015-11-20 17:43:12 +0100504 self.tenants_public_client = TenantsClient(self.auth_provider,
505 **params_v2_public)
Daniel Mellado82c83a52015-12-09 15:16:49 +0000506 self.users_public_client = UsersClient(self.auth_provider,
507 **params_v2_public)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300508
509 # Clients below use the endpoint type of Keystone API v3
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300510 params_v3 = params.copy()
511 params_v3['endpoint_type'] = CONF.identity.v3_endpoint_type
Daniel Mellado91a26b62016-02-11 11:13:04 +0000512 self.domains_client = DomainsClient(self.auth_provider,
513 **params_v3)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000514 self.identity_v3_client = IdentityV3Client(self.auth_provider,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300515 **params_v3)
Daniel Mellado76405392016-02-11 12:47:12 +0000516 self.trusts_client = TrustsClient(self.auth_provider, **params_v3)
Daniel Mellado7aea5342016-02-09 09:10:12 +0000517 self.users_v3_client = UsersV3Client(self.auth_provider, **params_v3)
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600518 self.endpoints_v3_client = EndPointsV3Client(self.auth_provider,
519 **params_v3)
Arx Cruz24bcb882016-02-10 15:20:16 +0100520 self.roles_v3_client = RolesV3Client(self.auth_provider, **params_v3)
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600521 self.identity_services_v3_client = IdentityServicesV3Client(
Yaroslav Lobankov69d90562015-12-18 12:06:40 +0300522 self.auth_provider, **params_v3)
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600523 self.policies_client = PoliciesClient(self.auth_provider, **params_v3)
Yaroslav Lobankov47a93ab2016-02-07 16:32:49 -0600524 self.projects_client = ProjectsClient(self.auth_provider, **params_v3)
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600525 self.regions_client = RegionsClient(self.auth_provider, **params_v3)
526 self.credentials_client = CredentialsClient(self.auth_provider,
527 **params_v3)
528 self.groups_client = GroupsClient(self.auth_provider, **params_v3)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300529
Andrea Frittoli90012352015-02-25 21:58:02 +0000530 # Token clients do not use the catalog. They only need default_params.
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100531 # They read auth_url, so they should only be set if the corresponding
532 # API version is marked as enabled
533 if CONF.identity_feature_enabled.api_v2:
534 if CONF.identity.uri:
Ken'ichi Ohmichi5f80ce32015-09-10 23:51:14 +0000535 self.token_client = TokenClient(
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100536 CONF.identity.uri, **self.default_params)
537 else:
538 msg = 'Identity v2 API enabled, but no identity.uri set'
539 raise exceptions.InvalidConfiguration(msg)
Ken'ichi Ohmichi41951b02014-11-19 01:57:43 +0000540 if CONF.identity_feature_enabled.api_v3:
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100541 if CONF.identity.uri_v3:
Ken'ichi Ohmichi5f80ce32015-09-10 23:51:14 +0000542 self.token_v3_client = V3TokenClient(
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100543 CONF.identity.uri_v3, **self.default_params)
544 else:
545 msg = 'Identity v3 API enabled, but no identity.uri_v3 set'
546 raise exceptions.InvalidConfiguration(msg)
Ken'ichi Ohmichi41951b02014-11-19 01:57:43 +0000547
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000548 def _set_volume_clients(self):
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000549 params = {
550 'service': CONF.volume.catalog_type,
551 'region': CONF.volume.region or CONF.identity.region,
552 'endpoint_type': CONF.volume.endpoint_type,
553 'build_interval': CONF.volume.build_interval,
554 'build_timeout': CONF.volume.build_timeout
555 }
556 params.update(self.default_params)
557
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000558 self.volume_qos_client = QosSpecsClient(self.auth_provider,
559 **params)
560 self.volume_qos_v2_client = QosSpecsV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000561 self.auth_provider, **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300562 self.volume_services_client = VolumeServicesClient(
563 self.auth_provider, **params)
564 self.volume_services_v2_client = VolumeServicesV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000565 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000566 self.backups_client = BackupsClient(self.auth_provider, **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300567 self.backups_v2_client = BackupsV2Client(self.auth_provider,
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000568 **params)
569 self.snapshots_client = SnapshotsClient(self.auth_provider,
570 **params)
571 self.snapshots_v2_client = SnapshotsV2Client(self.auth_provider,
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000572 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000573 self.volumes_client = VolumesClient(
Ken'ichi Ohmichi234da802015-02-13 04:48:06 +0000574 self.auth_provider, default_volume_size=CONF.volume.volume_size,
575 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000576 self.volumes_v2_client = VolumesV2Client(
Ken'ichi Ohmichi234da802015-02-13 04:48:06 +0000577 self.auth_provider, default_volume_size=CONF.volume.volume_size,
578 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000579 self.volume_types_client = VolumeTypesClient(self.auth_provider,
580 **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300581 self.volume_types_v2_client = VolumeTypesV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000582 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000583 self.volume_hosts_client = VolumeHostsClient(self.auth_provider,
584 **params)
585 self.volume_hosts_v2_client = VolumeHostsV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000586 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000587 self.volume_quotas_client = VolumeQuotasClient(self.auth_provider,
588 **params)
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000589 self.volume_quotas_v2_client = VolumeQuotasV2Client(self.auth_provider,
590 **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300591 self.volumes_extension_client = VolumeExtensionsClient(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000592 self.auth_provider, **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300593 self.volumes_v2_extension_client = VolumeExtensionsV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000594 self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000595 self.volume_availability_zone_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000596 VolumeAvailabilityZoneClient(self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000597 self.volume_v2_availability_zone_client = \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300598 VolumeAvailabilityZoneV2Client(self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000599
Ken'ichi Ohmichic95eb852015-01-22 01:57:57 +0000600 def _set_object_storage_clients(self):
Ken'ichi Ohmichi564b2ad2015-01-22 02:08:59 +0000601 params = {
602 'service': CONF.object_storage.catalog_type,
603 'region': CONF.object_storage.region or CONF.identity.region,
604 'endpoint_type': CONF.object_storage.endpoint_type
605 }
606 params.update(self.default_params_with_timeout_values)
607
608 self.account_client = AccountClient(self.auth_provider, **params)
609 self.container_client = ContainerClient(self.auth_provider, **params)
610 self.object_client = ObjectClient(self.auth_provider, **params)