blob: 0eded8bb782a81d91fc76f2d8c73e2098ed39fa5 [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 Ohmichid598d2f2016-03-25 15:57:08 -070091from tempest.lib.services.network.security_group_rules_client import \
92 SecurityGroupRulesClient
Andrea Frittoli (andreaf)db9672e2016-02-23 14:07:24 -050093from tempest.lib.services.network.security_groups_client import \
94 SecurityGroupsClient
95from tempest.lib.services.network.subnetpools_client import SubnetpoolsClient
96from tempest.lib.services.network.subnets_client import SubnetsClient
Andrea Frittolif9cde7e2014-02-18 09:57:04 +000097from tempest import manager
Ken'ichi Ohmichi884d1062015-01-23 03:24:41 +000098from tempest.services.baremetal.v1.json.baremetal_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000099 BaremetalClient
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 Ohmichie35f4722015-12-22 04:57:11 +0000135from tempest.services.network.json.routers_client import RoutersClient
dwalleck5d734432012-10-04 01:11:47 -0500136from tempest.services.object_storage.account_client import AccountClient
Attila Fazekas6968dd52013-02-15 17:05:53 +0100137from tempest.services.object_storage.container_client import ContainerClient
138from tempest.services.object_storage.object_client import ObjectClient
Steve Bakerc60e4e32013-05-06 15:22:41 +1200139from tempest.services.orchestration.json.orchestration_client import \
140 OrchestrationClient
liu-sheng67b730e2015-07-16 15:19:33 +0800141from tempest.services.telemetry.json.alarming_client import AlarmingClient
Nikolay Pliashechnikovb053aab2013-11-05 06:06:44 -0800142from tempest.services.telemetry.json.telemetry_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000143 TelemetryClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300144from tempest.services.volume.v1.json.admin.hosts_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300145 HostsClient as VolumeHostsClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300146from tempest.services.volume.v1.json.admin.quotas_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300147 QuotasClient as VolumeQuotasClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300148from tempest.services.volume.v1.json.admin.services_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300149 ServicesClient as VolumeServicesClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300150from tempest.services.volume.v1.json.admin.types_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300151 TypesClient as VolumeTypesClient
Yaroslav Lobankovdb4a2e12015-11-28 20:04:54 +0300152from tempest.services.volume.v1.json.availability_zone_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300153 AvailabilityZoneClient as VolumeAvailabilityZoneClient
Yaroslav Lobankovdb4a2e12015-11-28 20:04:54 +0300154from tempest.services.volume.v1.json.backups_client import BackupsClient
155from tempest.services.volume.v1.json.extensions_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300156 ExtensionsClient as VolumeExtensionsClient
Yaroslav Lobankovdb4a2e12015-11-28 20:04:54 +0300157from tempest.services.volume.v1.json.qos_client import QosSpecsClient
158from tempest.services.volume.v1.json.snapshots_client import SnapshotsClient
159from tempest.services.volume.v1.json.volumes_client import VolumesClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300160from tempest.services.volume.v2.json.admin.hosts_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300161 HostsClient as VolumeHostsV2Client
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300162from tempest.services.volume.v2.json.admin.quotas_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300163 QuotasClient as VolumeQuotasV2Client
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300164from tempest.services.volume.v2.json.admin.services_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300165 ServicesClient as VolumeServicesV2Client
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300166from tempest.services.volume.v2.json.admin.types_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300167 TypesClient as VolumeTypesV2Client
Zhi Kun Liu53395522014-07-18 16:05:52 +0800168from tempest.services.volume.v2.json.availability_zone_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300169 AvailabilityZoneClient as VolumeAvailabilityZoneV2Client
170from tempest.services.volume.v2.json.backups_client import \
171 BackupsClient as BackupsV2Client
Zhi Kun Liu53395522014-07-18 16:05:52 +0800172from tempest.services.volume.v2.json.extensions_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300173 ExtensionsClient as VolumeExtensionsV2Client
174from tempest.services.volume.v2.json.qos_client import \
175 QosSpecsClient as QosSpecsV2Client
Zhi Kun Liu38641c62014-07-10 20:12:48 +0800176from tempest.services.volume.v2.json.snapshots_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300177 SnapshotsClient as SnapshotsV2Client
178from tempest.services.volume.v2.json.volumes_client import \
179 VolumesClient as VolumesV2Client
Vincent Hou6b8a7b72012-08-25 01:24:33 +0800180
Sean Dague86bd8422013-12-20 09:56:44 -0500181CONF = config.CONF
Jay Pipes3f981df2012-03-27 18:59:44 -0400182LOG = logging.getLogger(__name__)
183
Vincent Hou6b8a7b72012-08-25 01:24:33 +0800184
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000185class Manager(manager.Manager):
Ken'ichi Ohmichi2e2ee192015-11-19 09:48:27 +0000186 """Top level manager for OpenStack tempest clients"""
Jay Pipes3f981df2012-03-27 18:59:44 -0400187
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +0000188 default_params = {
189 'disable_ssl_certificate_validation':
190 CONF.identity.disable_ssl_certificate_validation,
191 'ca_certs': CONF.identity.ca_certificates_file,
192 'trace_requests': CONF.debug.trace_requests
193 }
194
Ken'ichi Ohmichi737a6032015-01-21 07:04:42 +0000195 # NOTE: Tempest uses timeout values of compute API if project specific
196 # timeout values don't exist.
197 default_params_with_timeout_values = {
198 'build_interval': CONF.compute.build_interval,
199 'build_timeout': CONF.compute.build_timeout
200 }
201 default_params_with_timeout_values.update(default_params)
202
Ghanshyam05049dd2016-02-12 17:44:48 +0900203 def __init__(self, credentials, service=None):
ghanshyam4e2be342015-11-27 18:07:46 +0900204 """Initialization of Manager class.
Brant Knudsonc7ca3342013-03-28 21:08:50 -0500205
ghanshyam4e2be342015-11-27 18:07:46 +0900206 Setup all services clients and make them available for tests cases.
207 :param credentials: type Credentials or TestResources
208 :param service: Service name
ghanshyam4e2be342015-11-27 18:07:46 +0900209 """
210 super(Manager, self).__init__(credentials=credentials)
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000211 self._set_compute_clients()
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000212 self._set_database_clients()
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000213 self._set_identity_clients()
214 self._set_volume_clients()
Ken'ichi Ohmichic95eb852015-01-22 01:57:57 +0000215 self._set_object_storage_clients()
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000216
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000217 self.baremetal_client = BaremetalClient(
Ken'ichi Ohmichi1f88ece2015-01-23 03:33:11 +0000218 self.auth_provider,
219 CONF.baremetal.catalog_type,
220 CONF.identity.region,
221 endpoint_type=CONF.baremetal.endpoint_type,
222 **self.default_params_with_timeout_values)
Ken'ichi Ohmichi71860062015-12-15 08:20:13 +0000223 self.network_agents_client = NetworkAgentsClient(
224 self.auth_provider,
225 CONF.network.catalog_type,
226 CONF.network.region or CONF.identity.region,
227 endpoint_type=CONF.network.endpoint_type,
228 build_interval=CONF.network.build_interval,
229 build_timeout=CONF.network.build_timeout,
230 **self.default_params)
Ken'ichi Ohmichi52bb8122016-01-26 01:43:06 +0000231 self.network_extensions_client = NetworkExtensionsClient(
232 self.auth_provider,
233 CONF.network.catalog_type,
234 CONF.network.region or CONF.identity.region,
235 endpoint_type=CONF.network.endpoint_type,
236 build_interval=CONF.network.build_interval,
237 build_timeout=CONF.network.build_timeout,
238 **self.default_params)
John Warren94d8faf2015-09-15 12:22:24 -0400239 self.networks_client = NetworksClient(
240 self.auth_provider,
241 CONF.network.catalog_type,
242 CONF.network.region or CONF.identity.region,
243 endpoint_type=CONF.network.endpoint_type,
244 build_interval=CONF.network.build_interval,
245 build_timeout=CONF.network.build_timeout,
246 **self.default_params)
Ken'ichi Ohmichif3f8aba2015-12-15 08:11:00 +0000247 self.subnetpools_client = SubnetpoolsClient(
248 self.auth_provider,
249 CONF.network.catalog_type,
250 CONF.network.region or CONF.identity.region,
251 endpoint_type=CONF.network.endpoint_type,
252 build_interval=CONF.network.build_interval,
253 build_timeout=CONF.network.build_timeout,
254 **self.default_params)
John Warren3961acd2015-10-02 14:38:53 -0400255 self.subnets_client = SubnetsClient(
256 self.auth_provider,
257 CONF.network.catalog_type,
258 CONF.network.region or CONF.identity.region,
259 endpoint_type=CONF.network.endpoint_type,
260 build_interval=CONF.network.build_interval,
261 build_timeout=CONF.network.build_timeout,
262 **self.default_params)
John Warren49c0fe52015-10-22 12:35:54 -0400263 self.ports_client = PortsClient(
264 self.auth_provider,
265 CONF.network.catalog_type,
266 CONF.network.region or CONF.identity.region,
267 endpoint_type=CONF.network.endpoint_type,
268 build_interval=CONF.network.build_interval,
269 build_timeout=CONF.network.build_timeout,
270 **self.default_params)
Ken'ichi Ohmichi756d8ff2015-12-15 09:47:54 +0000271 self.network_quotas_client = NetworkQuotasClient(
272 self.auth_provider,
273 CONF.network.catalog_type,
274 CONF.network.region or CONF.identity.region,
275 endpoint_type=CONF.network.endpoint_type,
276 build_interval=CONF.network.build_interval,
277 build_timeout=CONF.network.build_timeout,
278 **self.default_params)
John Warrenfbf2a892015-11-17 12:36:14 -0500279 self.floating_ips_client = FloatingIPsClient(
280 self.auth_provider,
281 CONF.network.catalog_type,
282 CONF.network.region or CONF.identity.region,
283 endpoint_type=CONF.network.endpoint_type,
284 build_interval=CONF.network.build_interval,
285 build_timeout=CONF.network.build_timeout,
286 **self.default_params)
John Warren6d0083a2015-11-30 18:12:30 -0500287 self.metering_labels_client = MeteringLabelsClient(
288 self.auth_provider,
289 CONF.network.catalog_type,
290 CONF.network.region or CONF.identity.region,
291 endpoint_type=CONF.network.endpoint_type,
292 build_interval=CONF.network.build_interval,
293 build_timeout=CONF.network.build_timeout,
294 **self.default_params)
John Warrendd20b3e2015-12-03 13:11:28 -0500295 self.metering_label_rules_client = MeteringLabelRulesClient(
296 self.auth_provider,
297 CONF.network.catalog_type,
298 CONF.network.region or CONF.identity.region,
299 endpoint_type=CONF.network.endpoint_type,
300 build_interval=CONF.network.build_interval,
301 build_timeout=CONF.network.build_timeout,
302 **self.default_params)
Ken'ichi Ohmichie35f4722015-12-22 04:57:11 +0000303 self.routers_client = RoutersClient(
304 self.auth_provider,
305 CONF.network.catalog_type,
306 CONF.network.region or CONF.identity.region,
307 endpoint_type=CONF.network.endpoint_type,
308 build_interval=CONF.network.build_interval,
309 build_timeout=CONF.network.build_timeout,
310 **self.default_params)
John Warren456d9ae2016-01-12 15:36:33 -0500311 self.security_group_rules_client = SecurityGroupRulesClient(
312 self.auth_provider,
313 CONF.network.catalog_type,
314 CONF.network.region or CONF.identity.region,
315 endpoint_type=CONF.network.endpoint_type,
316 build_interval=CONF.network.build_interval,
317 build_timeout=CONF.network.build_timeout,
318 **self.default_params)
John Warrenf9606e92015-12-10 12:12:42 -0500319 self.security_groups_client = SecurityGroupsClient(
320 self.auth_provider,
321 CONF.network.catalog_type,
322 CONF.network.region or CONF.identity.region,
323 endpoint_type=CONF.network.endpoint_type,
324 build_interval=CONF.network.build_interval,
325 build_timeout=CONF.network.build_timeout,
326 **self.default_params)
Sean Daguef3c75912014-11-24 11:45:11 -0500327 if CONF.service_available.ceilometer:
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000328 self.telemetry_client = TelemetryClient(
Ken'ichi Ohmichid5dba1c2015-01-23 02:23:22 +0000329 self.auth_provider,
330 CONF.telemetry.catalog_type,
331 CONF.identity.region,
332 endpoint_type=CONF.telemetry.endpoint_type,
333 **self.default_params_with_timeout_values)
liu-sheng67b730e2015-07-16 15:19:33 +0800334 if CONF.service_available.aodh:
335 self.alarming_client = AlarmingClient(
336 self.auth_provider,
337 CONF.alarming.catalog_type,
338 CONF.identity.region,
339 endpoint_type=CONF.alarming.endpoint_type,
340 **self.default_params_with_timeout_values)
Sean Dague86bd8422013-12-20 09:56:44 -0500341 if CONF.service_available.glance:
Ken'ichi Ohmichi69dcf442015-11-30 11:48:01 +0000342 self.image_client = ImagesClient(
Masayuki Igawabc7e1892015-03-03 11:46:48 +0900343 self.auth_provider,
344 CONF.image.catalog_type,
345 CONF.image.region or CONF.identity.region,
346 endpoint_type=CONF.image.endpoint_type,
347 build_interval=CONF.image.build_interval,
348 build_timeout=CONF.image.build_timeout,
349 **self.default_params)
Ken'ichi Ohmichi69dcf442015-11-30 11:48:01 +0000350 self.image_client_v2 = ImagesClientV2(
Masayuki Igawabc7e1892015-03-03 11:46:48 +0900351 self.auth_provider,
352 CONF.image.catalog_type,
353 CONF.image.region or CONF.identity.region,
354 endpoint_type=CONF.image.endpoint_type,
355 build_interval=CONF.image.build_interval,
356 build_timeout=CONF.image.build_timeout,
357 **self.default_params)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000358 self.orchestration_client = OrchestrationClient(
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +0000359 self.auth_provider,
360 CONF.orchestration.catalog_type,
361 CONF.orchestration.region or CONF.identity.region,
362 endpoint_type=CONF.orchestration.endpoint_type,
363 build_interval=CONF.orchestration.build_interval,
364 build_timeout=CONF.orchestration.build_timeout,
365 **self.default_params)
Ken'ichi Ohmichi4e83b5e2015-02-13 04:07:34 +0000366 self.data_processing_client = DataProcessingClient(
367 self.auth_provider,
368 CONF.data_processing.catalog_type,
369 CONF.identity.region,
370 endpoint_type=CONF.data_processing.endpoint_type,
371 **self.default_params_with_timeout_values)
Ken'ichi Ohmichib38eb002015-01-23 02:35:01 +0000372 self.negative_client = negative_rest_client.NegativeRestClient(
David Kranz1e33e372015-03-20 09:42:56 -0400373 self.auth_provider, service, **self.default_params)
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +0000374
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000375 def _set_compute_clients(self):
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000376 params = {
377 'service': CONF.compute.catalog_type,
378 'region': CONF.compute.region or CONF.identity.region,
379 'endpoint_type': CONF.compute.endpoint_type,
380 'build_interval': CONF.compute.build_interval,
381 'build_timeout': CONF.compute.build_timeout
382 }
383 params.update(self.default_params)
384
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000385 self.agents_client = AgentsClient(self.auth_provider, **params)
John Warren9487a182015-09-14 18:12:56 -0400386 self.compute_networks_client = ComputeNetworksClient(
387 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000388 self.migrations_client = MigrationsClient(self.auth_provider,
389 **params)
Ken'ichi Ohmichi65225ef2014-11-19 01:06:25 +0000390 self.security_group_default_rules_client = (
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000391 SecurityGroupDefaultRulesClient(self.auth_provider, **params))
392 self.certificates_client = CertificatesClient(self.auth_provider,
393 **params)
394 self.servers_client = ServersClient(
Masayuki Igawa8f9c0c82015-03-03 09:38:08 +0900395 self.auth_provider,
396 enable_instance_password=CONF.compute_feature_enabled
397 .enable_instance_password,
398 **params)
Ken'ichi Ohmichi7ca54b82015-07-07 01:10:26 +0000399 self.server_groups_client = ServerGroupsClient(
400 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000401 self.limits_client = LimitsClient(self.auth_provider, **params)
Ghanshyamae76c122015-12-22 13:41:35 +0900402 self.compute_images_client = ComputeImagesClient(self.auth_provider,
403 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000404 self.keypairs_client = KeyPairsClient(self.auth_provider, **params)
405 self.quotas_client = QuotasClient(self.auth_provider, **params)
406 self.quota_classes_client = QuotaClassesClient(self.auth_provider,
407 **params)
408 self.flavors_client = FlavorsClient(self.auth_provider, **params)
409 self.extensions_client = ExtensionsClient(self.auth_provider,
410 **params)
Ken'ichi Ohmichif5767702015-07-29 23:39:10 +0000411 self.floating_ip_pools_client = FloatingIPPoolsClient(
Ken'ichi Ohmichi03af1c52015-07-13 00:28:05 +0000412 self.auth_provider, **params)
Ken'ichi Ohmichif5767702015-07-29 23:39:10 +0000413 self.floating_ips_bulk_client = FloatingIPsBulkClient(
Ken'ichi Ohmichi2b26e752015-07-13 00:44:36 +0000414 self.auth_provider, **params)
John Warrene74890a2015-11-11 15:18:01 -0500415 self.compute_floating_ips_client = ComputeFloatingIPsClient(
416 self.auth_provider, **params)
John Warren5cdbf422016-01-05 12:42:43 -0500417 self.compute_security_group_rules_client = \
418 ComputeSecurityGroupRulesClient(self.auth_provider, **params)
John Warrenf2345512015-12-10 13:39:30 -0500419 self.compute_security_groups_client = ComputeSecurityGroupsClient(
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000420 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000421 self.interfaces_client = InterfacesClient(self.auth_provider,
422 **params)
423 self.fixed_ips_client = FixedIPsClient(self.auth_provider,
424 **params)
425 self.availability_zone_client = AvailabilityZoneClient(
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000426 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000427 self.aggregates_client = AggregatesClient(self.auth_provider,
428 **params)
429 self.services_client = ServicesClient(self.auth_provider, **params)
430 self.tenant_usages_client = TenantUsagesClient(self.auth_provider,
431 **params)
432 self.hosts_client = HostsClient(self.auth_provider, **params)
433 self.hypervisor_client = HypervisorClient(self.auth_provider,
434 **params)
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000435 self.instance_usages_audit_log_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000436 InstanceUsagesAuditLogClient(self.auth_provider, **params)
Ken'ichi Ohmichic3dfdb22015-01-22 04:39:58 +0000437 self.tenant_networks_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000438 TenantNetworksClient(self.auth_provider, **params)
439 self.baremetal_nodes_client = BaremetalNodesClient(
YuikoTakadaac0879a2015-01-22 02:40:03 +0000440 self.auth_provider, **params)
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000441
442 # NOTE: The following client needs special timeout values because
443 # the API is a proxy for the other component.
444 params_volume = copy.deepcopy(params)
445 params_volume.update({
446 'build_interval': CONF.volume.build_interval,
447 'build_timeout': CONF.volume.build_timeout
448 })
Ken'ichi Ohmichiea3f26a2015-09-29 00:18:39 +0000449 self.volumes_extensions_client = ComputeVolumesClient(
Ken'ichi Ohmichic4921782015-08-05 08:14:42 +0000450 self.auth_provider, **params_volume)
Ken'ichi Ohmichi2b6012b2015-09-03 01:56:19 +0000451 self.compute_versions_client = VersionsClient(self.auth_provider,
452 **params_volume)
Ken'ichi Ohmichib7e27302015-09-29 00:11:20 +0000453 self.snapshots_extensions_client = ComputeSnapshotsClient(
Gaozexub9c9d6e2015-09-10 17:08:04 +0800454 self.auth_provider, **params_volume)
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000455
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000456 def _set_database_clients(self):
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000457 self.database_flavors_client = DatabaseFlavorsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000458 self.auth_provider,
459 CONF.database.catalog_type,
460 CONF.identity.region,
461 **self.default_params_with_timeout_values)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000462 self.database_limits_client = DatabaseLimitsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000463 self.auth_provider,
464 CONF.database.catalog_type,
465 CONF.identity.region,
466 **self.default_params_with_timeout_values)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000467 self.database_versions_client = DatabaseVersionsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000468 self.auth_provider,
469 CONF.database.catalog_type,
470 CONF.identity.region,
471 **self.default_params_with_timeout_values)
472
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000473 def _set_identity_clients(self):
ghanshyamd26b5cd2015-02-09 14:48:58 +0900474 params = {
475 'service': CONF.identity.catalog_type,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300476 'region': CONF.identity.region
ghanshyamd26b5cd2015-02-09 14:48:58 +0900477 }
478 params.update(self.default_params_with_timeout_values)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300479
480 # Clients below use the admin endpoint type of Keystone API v2
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300481 params_v2_admin = params.copy()
482 params_v2_admin['endpoint_type'] = CONF.identity.v2_admin_endpoint_type
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600483 self.endpoints_client = EndpointsClient(self.auth_provider,
484 **params_v2_admin)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000485 self.identity_client = IdentityClient(self.auth_provider,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300486 **params_v2_admin)
Daniel Melladob04da902015-11-20 17:43:12 +0100487 self.tenants_client = TenantsClient(self.auth_provider,
488 **params_v2_admin)
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600489 self.roles_client = RolesClient(self.auth_provider, **params_v2_admin)
490 self.users_client = UsersClient(self.auth_provider, **params_v2_admin)
491 self.identity_services_client = IdentityServicesClient(
492 self.auth_provider, **params_v2_admin)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300493
494 # Clients below use the public endpoint type of Keystone API v2
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300495 params_v2_public = params.copy()
496 params_v2_public['endpoint_type'] = (
497 CONF.identity.v2_public_endpoint_type)
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300498 self.identity_public_client = IdentityClient(self.auth_provider,
499 **params_v2_public)
Daniel Melladob04da902015-11-20 17:43:12 +0100500 self.tenants_public_client = TenantsClient(self.auth_provider,
501 **params_v2_public)
Daniel Mellado82c83a52015-12-09 15:16:49 +0000502 self.users_public_client = UsersClient(self.auth_provider,
503 **params_v2_public)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300504
505 # Clients below use the endpoint type of Keystone API v3
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300506 params_v3 = params.copy()
507 params_v3['endpoint_type'] = CONF.identity.v3_endpoint_type
Daniel Mellado91a26b62016-02-11 11:13:04 +0000508 self.domains_client = DomainsClient(self.auth_provider,
509 **params_v3)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000510 self.identity_v3_client = IdentityV3Client(self.auth_provider,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300511 **params_v3)
Daniel Mellado76405392016-02-11 12:47:12 +0000512 self.trusts_client = TrustsClient(self.auth_provider, **params_v3)
Daniel Mellado7aea5342016-02-09 09:10:12 +0000513 self.users_v3_client = UsersV3Client(self.auth_provider, **params_v3)
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600514 self.endpoints_v3_client = EndPointsV3Client(self.auth_provider,
515 **params_v3)
Arx Cruz24bcb882016-02-10 15:20:16 +0100516 self.roles_v3_client = RolesV3Client(self.auth_provider, **params_v3)
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600517 self.identity_services_v3_client = IdentityServicesV3Client(
Yaroslav Lobankov69d90562015-12-18 12:06:40 +0300518 self.auth_provider, **params_v3)
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600519 self.policies_client = PoliciesClient(self.auth_provider, **params_v3)
Yaroslav Lobankov47a93ab2016-02-07 16:32:49 -0600520 self.projects_client = ProjectsClient(self.auth_provider, **params_v3)
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600521 self.regions_client = RegionsClient(self.auth_provider, **params_v3)
522 self.credentials_client = CredentialsClient(self.auth_provider,
523 **params_v3)
524 self.groups_client = GroupsClient(self.auth_provider, **params_v3)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300525
Andrea Frittoli90012352015-02-25 21:58:02 +0000526 # Token clients do not use the catalog. They only need default_params.
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100527 # They read auth_url, so they should only be set if the corresponding
528 # API version is marked as enabled
529 if CONF.identity_feature_enabled.api_v2:
530 if CONF.identity.uri:
Ken'ichi Ohmichi5f80ce32015-09-10 23:51:14 +0000531 self.token_client = TokenClient(
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100532 CONF.identity.uri, **self.default_params)
533 else:
534 msg = 'Identity v2 API enabled, but no identity.uri set'
535 raise exceptions.InvalidConfiguration(msg)
Ken'ichi Ohmichi41951b02014-11-19 01:57:43 +0000536 if CONF.identity_feature_enabled.api_v3:
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100537 if CONF.identity.uri_v3:
Ken'ichi Ohmichi5f80ce32015-09-10 23:51:14 +0000538 self.token_v3_client = V3TokenClient(
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100539 CONF.identity.uri_v3, **self.default_params)
540 else:
541 msg = 'Identity v3 API enabled, but no identity.uri_v3 set'
542 raise exceptions.InvalidConfiguration(msg)
Ken'ichi Ohmichi41951b02014-11-19 01:57:43 +0000543
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000544 def _set_volume_clients(self):
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000545 params = {
546 'service': CONF.volume.catalog_type,
547 'region': CONF.volume.region or CONF.identity.region,
548 'endpoint_type': CONF.volume.endpoint_type,
549 'build_interval': CONF.volume.build_interval,
550 'build_timeout': CONF.volume.build_timeout
551 }
552 params.update(self.default_params)
553
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000554 self.volume_qos_client = QosSpecsClient(self.auth_provider,
555 **params)
556 self.volume_qos_v2_client = QosSpecsV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000557 self.auth_provider, **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300558 self.volume_services_client = VolumeServicesClient(
559 self.auth_provider, **params)
560 self.volume_services_v2_client = VolumeServicesV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000561 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000562 self.backups_client = BackupsClient(self.auth_provider, **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300563 self.backups_v2_client = BackupsV2Client(self.auth_provider,
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000564 **params)
565 self.snapshots_client = SnapshotsClient(self.auth_provider,
566 **params)
567 self.snapshots_v2_client = SnapshotsV2Client(self.auth_provider,
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000568 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000569 self.volumes_client = VolumesClient(
Ken'ichi Ohmichi234da802015-02-13 04:48:06 +0000570 self.auth_provider, default_volume_size=CONF.volume.volume_size,
571 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000572 self.volumes_v2_client = VolumesV2Client(
Ken'ichi Ohmichi234da802015-02-13 04:48:06 +0000573 self.auth_provider, default_volume_size=CONF.volume.volume_size,
574 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000575 self.volume_types_client = VolumeTypesClient(self.auth_provider,
576 **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300577 self.volume_types_v2_client = VolumeTypesV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000578 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000579 self.volume_hosts_client = VolumeHostsClient(self.auth_provider,
580 **params)
581 self.volume_hosts_v2_client = VolumeHostsV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000582 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000583 self.volume_quotas_client = VolumeQuotasClient(self.auth_provider,
584 **params)
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000585 self.volume_quotas_v2_client = VolumeQuotasV2Client(self.auth_provider,
586 **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300587 self.volumes_extension_client = VolumeExtensionsClient(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000588 self.auth_provider, **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300589 self.volumes_v2_extension_client = VolumeExtensionsV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000590 self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000591 self.volume_availability_zone_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000592 VolumeAvailabilityZoneClient(self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000593 self.volume_v2_availability_zone_client = \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300594 VolumeAvailabilityZoneV2Client(self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000595
Ken'ichi Ohmichic95eb852015-01-22 01:57:57 +0000596 def _set_object_storage_clients(self):
Ken'ichi Ohmichi564b2ad2015-01-22 02:08:59 +0000597 params = {
598 'service': CONF.object_storage.catalog_type,
599 'region': CONF.object_storage.region or CONF.identity.region,
600 'endpoint_type': CONF.object_storage.endpoint_type
601 }
602 params.update(self.default_params_with_timeout_values)
603
604 self.account_client = AccountClient(self.auth_provider, **params)
605 self.container_client = ContainerClient(self.auth_provider, **params)
606 self.object_client = ObjectClient(self.auth_provider, **params)