blob: f6ef0af2bbfc2c8f5ff917d8047ca19db42d7a21 [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
Ken'ichi Ohmichi04390ac2016-06-08 17:11:16 -070078from tempest.lib.services.image.v2.image_members_client import \
79 ImageMembersClient as ImageMembersClientV2
Ken'ichi Ohmichi41c51ae2016-06-07 13:16:07 -070080from tempest.lib.services.image.v2.namespaces_client import NamespacesClient
81from tempest.lib.services.image.v2.resource_types_client import \
82 ResourceTypesClient
83from tempest.lib.services.image.v2.schemas_client import SchemasClient
Andrea Frittoli (andreaf)db9672e2016-02-23 14:07:24 -050084from tempest.lib.services.network.agents_client import AgentsClient \
85 as NetworkAgentsClient
86from tempest.lib.services.network.extensions_client import \
87 ExtensionsClient as NetworkExtensionsClient
88from tempest.lib.services.network.floating_ips_client import FloatingIPsClient
89from tempest.lib.services.network.metering_label_rules_client import \
90 MeteringLabelRulesClient
91from tempest.lib.services.network.metering_labels_client import \
92 MeteringLabelsClient
93from tempest.lib.services.network.networks_client import NetworksClient
94from tempest.lib.services.network.ports_client import PortsClient
95from tempest.lib.services.network.quotas_client import QuotasClient \
96 as NetworkQuotasClient
Ken'ichi Ohmichi131799e2016-06-06 12:06:41 -070097from tempest.lib.services.network.routers_client import RoutersClient
Ken'ichi Ohmichid598d2f2016-03-25 15:57:08 -070098from tempest.lib.services.network.security_group_rules_client import \
99 SecurityGroupRulesClient
Andrea Frittoli (andreaf)db9672e2016-02-23 14:07:24 -0500100from tempest.lib.services.network.security_groups_client import \
101 SecurityGroupsClient
102from tempest.lib.services.network.subnetpools_client import SubnetpoolsClient
103from tempest.lib.services.network.subnets_client import SubnetsClient
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000104from tempest import manager
Ken'ichi Ohmichi884d1062015-01-23 03:24:41 +0000105from tempest.services.baremetal.v1.json.baremetal_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000106 BaremetalClient
Ken'ichi Ohmichidc5fe442015-02-13 04:00:47 +0000107from tempest.services.data_processing.v1_1.data_processing_client import \
108 DataProcessingClient
Nikhil Manchandadd6886f2014-03-03 01:58:45 -0800109from tempest.services.database.json.flavors_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000110 DatabaseFlavorsClient
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000111from tempest.services.database.json.limits_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000112 DatabaseLimitsClient
Peter Stachowski320f9c72014-04-21 16:13:23 -0400113from tempest.services.database.json.versions_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000114 DatabaseVersionsClient
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600115from tempest.services.identity.v2.json.endpoints_client import EndpointsClient
116from tempest.services.identity.v2.json.identity_client import IdentityClient
117from tempest.services.identity.v2.json.roles_client import RolesClient
Daniel Mellado72f24ec2015-12-21 10:26:42 +0000118from tempest.services.identity.v2.json.services_client import \
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600119 ServicesClient as IdentityServicesClient
120from tempest.services.identity.v2.json.tenants_client import TenantsClient
121from tempest.services.identity.v2.json.users_client import UsersClient
nayna-patel914b4712013-07-16 08:29:05 +0000122from tempest.services.identity.v3.json.credentials_client import \
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600123 CredentialsClient
Daniel Mellado91a26b62016-02-11 11:13:04 +0000124from tempest.services.identity.v3.json.domains_client import DomainsClient
Sean Dague2416cf32013-04-10 08:29:07 -0400125from tempest.services.identity.v3.json.endpoints_client import \
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600126 EndPointsClient as EndPointsV3Client
127from tempest.services.identity.v3.json.groups_client import GroupsClient
Ghanshyam5b9b17e2016-02-23 01:56:22 +0900128from tempest.services.identity.v3.json.identity_client import \
129 IdentityClient as IdentityV3Client
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600130from tempest.services.identity.v3.json.policies_client import PoliciesClient
Yaroslav Lobankov47a93ab2016-02-07 16:32:49 -0600131from tempest.services.identity.v3.json.projects_client import ProjectsClient
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600132from tempest.services.identity.v3.json.regions_client import RegionsClient
Arx Cruz24bcb882016-02-10 15:20:16 +0100133from tempest.services.identity.v3.json.roles_client import \
134 RolesClient as RolesV3Client
Yaroslav Lobankov69d90562015-12-18 12:06:40 +0300135from tempest.services.identity.v3.json.services_client import \
136 ServicesClient as IdentityServicesV3Client
Daniel Mellado76405392016-02-11 12:47:12 +0000137from tempest.services.identity.v3.json.trusts_client import TrustsClient
Ghanshyam5b9b17e2016-02-23 01:56:22 +0900138from tempest.services.identity.v3.json.users_clients import \
139 UsersClient as UsersV3Client
Ken'ichi Ohmichi5be64722016-06-08 15:15:15 -0700140from tempest.services.image.v1.json.image_members_client import \
141 ImageMembersClient
Ken'ichi Ohmichi69dcf442015-11-30 11:48:01 +0000142from tempest.services.image.v1.json.images_client import ImagesClient
Yaroslav Lobankov2fea4052016-04-19 15:05:57 +0300143from tempest.services.image.v2.json.images_client import \
144 ImagesClient as ImagesV2Client
dwalleck5d734432012-10-04 01:11:47 -0500145from tempest.services.object_storage.account_client import AccountClient
Attila Fazekas6968dd52013-02-15 17:05:53 +0100146from tempest.services.object_storage.container_client import ContainerClient
147from tempest.services.object_storage.object_client import ObjectClient
Steve Bakerc60e4e32013-05-06 15:22:41 +1200148from tempest.services.orchestration.json.orchestration_client import \
149 OrchestrationClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300150from tempest.services.volume.v1.json.admin.hosts_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300151 HostsClient as VolumeHostsClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300152from tempest.services.volume.v1.json.admin.quotas_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300153 QuotasClient as VolumeQuotasClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300154from tempest.services.volume.v1.json.admin.services_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300155 ServicesClient as VolumeServicesClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300156from tempest.services.volume.v1.json.admin.types_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300157 TypesClient as VolumeTypesClient
Yaroslav Lobankovdb4a2e12015-11-28 20:04:54 +0300158from tempest.services.volume.v1.json.availability_zone_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300159 AvailabilityZoneClient as VolumeAvailabilityZoneClient
Yaroslav Lobankovdb4a2e12015-11-28 20:04:54 +0300160from tempest.services.volume.v1.json.backups_client import BackupsClient
161from tempest.services.volume.v1.json.extensions_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300162 ExtensionsClient as VolumeExtensionsClient
Yaroslav Lobankovdb4a2e12015-11-28 20:04:54 +0300163from tempest.services.volume.v1.json.qos_client import QosSpecsClient
164from tempest.services.volume.v1.json.snapshots_client import SnapshotsClient
165from tempest.services.volume.v1.json.volumes_client import VolumesClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300166from tempest.services.volume.v2.json.admin.hosts_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300167 HostsClient as VolumeHostsV2Client
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300168from tempest.services.volume.v2.json.admin.quotas_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300169 QuotasClient as VolumeQuotasV2Client
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300170from tempest.services.volume.v2.json.admin.services_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300171 ServicesClient as VolumeServicesV2Client
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300172from tempest.services.volume.v2.json.admin.types_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300173 TypesClient as VolumeTypesV2Client
Zhi Kun Liu53395522014-07-18 16:05:52 +0800174from tempest.services.volume.v2.json.availability_zone_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300175 AvailabilityZoneClient as VolumeAvailabilityZoneV2Client
176from tempest.services.volume.v2.json.backups_client import \
177 BackupsClient as BackupsV2Client
Zhi Kun Liu53395522014-07-18 16:05:52 +0800178from tempest.services.volume.v2.json.extensions_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300179 ExtensionsClient as VolumeExtensionsV2Client
180from tempest.services.volume.v2.json.qos_client import \
181 QosSpecsClient as QosSpecsV2Client
Zhi Kun Liu38641c62014-07-10 20:12:48 +0800182from tempest.services.volume.v2.json.snapshots_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300183 SnapshotsClient as SnapshotsV2Client
184from tempest.services.volume.v2.json.volumes_client import \
185 VolumesClient as VolumesV2Client
Vincent Hou6b8a7b72012-08-25 01:24:33 +0800186
Sean Dague86bd8422013-12-20 09:56:44 -0500187CONF = config.CONF
Jay Pipes3f981df2012-03-27 18:59:44 -0400188LOG = logging.getLogger(__name__)
189
Vincent Hou6b8a7b72012-08-25 01:24:33 +0800190
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000191class Manager(manager.Manager):
Ken'ichi Ohmichi2e2ee192015-11-19 09:48:27 +0000192 """Top level manager for OpenStack tempest clients"""
Jay Pipes3f981df2012-03-27 18:59:44 -0400193
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +0000194 default_params = {
195 'disable_ssl_certificate_validation':
196 CONF.identity.disable_ssl_certificate_validation,
197 'ca_certs': CONF.identity.ca_certificates_file,
198 'trace_requests': CONF.debug.trace_requests
199 }
200
Ken'ichi Ohmichi737a6032015-01-21 07:04:42 +0000201 # NOTE: Tempest uses timeout values of compute API if project specific
202 # timeout values don't exist.
203 default_params_with_timeout_values = {
204 'build_interval': CONF.compute.build_interval,
205 'build_timeout': CONF.compute.build_timeout
206 }
207 default_params_with_timeout_values.update(default_params)
208
Andrea Frittoli (andreaf)3e82af72016-05-05 22:53:38 +0100209 def __init__(self, credentials, service=None, scope='project'):
ghanshyam4e2be342015-11-27 18:07:46 +0900210 """Initialization of Manager class.
Brant Knudsonc7ca3342013-03-28 21:08:50 -0500211
ghanshyam4e2be342015-11-27 18:07:46 +0900212 Setup all services clients and make them available for tests cases.
213 :param credentials: type Credentials or TestResources
214 :param service: Service name
Andrea Frittoli (andreaf)3e82af72016-05-05 22:53:38 +0100215 :param scope: default scope for tokens produced by the auth provider
ghanshyam4e2be342015-11-27 18:07:46 +0900216 """
Andrea Frittoli (andreaf)3e82af72016-05-05 22:53:38 +0100217 super(Manager, self).__init__(credentials=credentials, scope=scope)
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000218 self._set_compute_clients()
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000219 self._set_database_clients()
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000220 self._set_identity_clients()
221 self._set_volume_clients()
Ken'ichi Ohmichic95eb852015-01-22 01:57:57 +0000222 self._set_object_storage_clients()
Andrea Frittoli (andreaf)591e8542016-06-07 18:31:39 +0100223 self._set_image_clients()
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000224
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000225 self.baremetal_client = BaremetalClient(
Ken'ichi Ohmichi1f88ece2015-01-23 03:33:11 +0000226 self.auth_provider,
227 CONF.baremetal.catalog_type,
228 CONF.identity.region,
229 endpoint_type=CONF.baremetal.endpoint_type,
230 **self.default_params_with_timeout_values)
Ken'ichi Ohmichi71860062015-12-15 08:20:13 +0000231 self.network_agents_client = NetworkAgentsClient(
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)
Ken'ichi Ohmichi52bb8122016-01-26 01:43:06 +0000239 self.network_extensions_client = NetworkExtensionsClient(
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)
John Warren94d8faf2015-09-15 12:22:24 -0400247 self.networks_client = NetworksClient(
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)
Ken'ichi Ohmichif3f8aba2015-12-15 08:11:00 +0000255 self.subnetpools_client = SubnetpoolsClient(
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 Warren3961acd2015-10-02 14:38:53 -0400263 self.subnets_client = SubnetsClient(
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)
John Warren49c0fe52015-10-22 12:35:54 -0400271 self.ports_client = PortsClient(
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)
Ken'ichi Ohmichi756d8ff2015-12-15 09:47:54 +0000279 self.network_quotas_client = NetworkQuotasClient(
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 Warrenfbf2a892015-11-17 12:36:14 -0500287 self.floating_ips_client = FloatingIPsClient(
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 Warren6d0083a2015-11-30 18:12:30 -0500295 self.metering_labels_client = MeteringLabelsClient(
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)
John Warrendd20b3e2015-12-03 13:11:28 -0500303 self.metering_label_rules_client = MeteringLabelRulesClient(
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)
Ken'ichi Ohmichie35f4722015-12-22 04:57:11 +0000311 self.routers_client = RoutersClient(
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 Warren456d9ae2016-01-12 15:36:33 -0500319 self.security_group_rules_client = SecurityGroupRulesClient(
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)
John Warrenf9606e92015-12-10 12:12:42 -0500327 self.security_groups_client = SecurityGroupsClient(
328 self.auth_provider,
329 CONF.network.catalog_type,
330 CONF.network.region or CONF.identity.region,
331 endpoint_type=CONF.network.endpoint_type,
332 build_interval=CONF.network.build_interval,
333 build_timeout=CONF.network.build_timeout,
334 **self.default_params)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000335 self.orchestration_client = OrchestrationClient(
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +0000336 self.auth_provider,
337 CONF.orchestration.catalog_type,
338 CONF.orchestration.region or CONF.identity.region,
339 endpoint_type=CONF.orchestration.endpoint_type,
340 build_interval=CONF.orchestration.build_interval,
341 build_timeout=CONF.orchestration.build_timeout,
342 **self.default_params)
Ken'ichi Ohmichi4e83b5e2015-02-13 04:07:34 +0000343 self.data_processing_client = DataProcessingClient(
344 self.auth_provider,
345 CONF.data_processing.catalog_type,
346 CONF.identity.region,
347 endpoint_type=CONF.data_processing.endpoint_type,
348 **self.default_params_with_timeout_values)
Ken'ichi Ohmichib38eb002015-01-23 02:35:01 +0000349 self.negative_client = negative_rest_client.NegativeRestClient(
David Kranz1e33e372015-03-20 09:42:56 -0400350 self.auth_provider, service, **self.default_params)
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +0000351
Andrea Frittoli (andreaf)591e8542016-06-07 18:31:39 +0100352 def _set_image_clients(self):
353 params = {
354 'service': CONF.image.catalog_type,
355 'region': CONF.image.region or CONF.identity.region,
356 'endpoint_type': CONF.image.endpoint_type,
357 'build_interval': CONF.image.build_interval,
358 'build_timeout': CONF.image.build_timeout
359 }
360 params.update(self.default_params)
361
362 if CONF.service_available.glance:
363 self.image_client = ImagesClient(
364 self.auth_provider, **params)
365 self.image_member_client = ImageMembersClient(
366 self.auth_provider, **params)
367 self.image_client_v2 = ImagesV2Client(
368 self.auth_provider, **params)
369 self.image_member_client_v2 = ImageMembersClientV2(
370 self.auth_provider, **params)
371 self.namespaces_client = NamespacesClient(
372 self.auth_provider, **params)
373 self.resource_types_client = ResourceTypesClient(
374 self.auth_provider, **params)
375 self.schemas_client = SchemasClient(
376 self.auth_provider, **params)
377
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000378 def _set_compute_clients(self):
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000379 params = {
380 'service': CONF.compute.catalog_type,
381 'region': CONF.compute.region or CONF.identity.region,
382 'endpoint_type': CONF.compute.endpoint_type,
383 'build_interval': CONF.compute.build_interval,
384 'build_timeout': CONF.compute.build_timeout
385 }
386 params.update(self.default_params)
387
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000388 self.agents_client = AgentsClient(self.auth_provider, **params)
John Warren9487a182015-09-14 18:12:56 -0400389 self.compute_networks_client = ComputeNetworksClient(
390 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000391 self.migrations_client = MigrationsClient(self.auth_provider,
392 **params)
Ken'ichi Ohmichi65225ef2014-11-19 01:06:25 +0000393 self.security_group_default_rules_client = (
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000394 SecurityGroupDefaultRulesClient(self.auth_provider, **params))
395 self.certificates_client = CertificatesClient(self.auth_provider,
396 **params)
397 self.servers_client = ServersClient(
Masayuki Igawa8f9c0c82015-03-03 09:38:08 +0900398 self.auth_provider,
399 enable_instance_password=CONF.compute_feature_enabled
400 .enable_instance_password,
401 **params)
Ken'ichi Ohmichi7ca54b82015-07-07 01:10:26 +0000402 self.server_groups_client = ServerGroupsClient(
403 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000404 self.limits_client = LimitsClient(self.auth_provider, **params)
Ghanshyamae76c122015-12-22 13:41:35 +0900405 self.compute_images_client = ComputeImagesClient(self.auth_provider,
406 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000407 self.keypairs_client = KeyPairsClient(self.auth_provider, **params)
408 self.quotas_client = QuotasClient(self.auth_provider, **params)
409 self.quota_classes_client = QuotaClassesClient(self.auth_provider,
410 **params)
411 self.flavors_client = FlavorsClient(self.auth_provider, **params)
412 self.extensions_client = ExtensionsClient(self.auth_provider,
413 **params)
Ken'ichi Ohmichif5767702015-07-29 23:39:10 +0000414 self.floating_ip_pools_client = FloatingIPPoolsClient(
Ken'ichi Ohmichi03af1c52015-07-13 00:28:05 +0000415 self.auth_provider, **params)
Ken'ichi Ohmichif5767702015-07-29 23:39:10 +0000416 self.floating_ips_bulk_client = FloatingIPsBulkClient(
Ken'ichi Ohmichi2b26e752015-07-13 00:44:36 +0000417 self.auth_provider, **params)
John Warrene74890a2015-11-11 15:18:01 -0500418 self.compute_floating_ips_client = ComputeFloatingIPsClient(
419 self.auth_provider, **params)
John Warren5cdbf422016-01-05 12:42:43 -0500420 self.compute_security_group_rules_client = \
421 ComputeSecurityGroupRulesClient(self.auth_provider, **params)
John Warrenf2345512015-12-10 13:39:30 -0500422 self.compute_security_groups_client = ComputeSecurityGroupsClient(
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000423 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000424 self.interfaces_client = InterfacesClient(self.auth_provider,
425 **params)
426 self.fixed_ips_client = FixedIPsClient(self.auth_provider,
427 **params)
428 self.availability_zone_client = AvailabilityZoneClient(
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000429 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000430 self.aggregates_client = AggregatesClient(self.auth_provider,
431 **params)
432 self.services_client = ServicesClient(self.auth_provider, **params)
433 self.tenant_usages_client = TenantUsagesClient(self.auth_provider,
434 **params)
435 self.hosts_client = HostsClient(self.auth_provider, **params)
436 self.hypervisor_client = HypervisorClient(self.auth_provider,
437 **params)
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000438 self.instance_usages_audit_log_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000439 InstanceUsagesAuditLogClient(self.auth_provider, **params)
Ken'ichi Ohmichic3dfdb22015-01-22 04:39:58 +0000440 self.tenant_networks_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000441 TenantNetworksClient(self.auth_provider, **params)
442 self.baremetal_nodes_client = BaremetalNodesClient(
YuikoTakadaac0879a2015-01-22 02:40:03 +0000443 self.auth_provider, **params)
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000444
445 # NOTE: The following client needs special timeout values because
446 # the API is a proxy for the other component.
447 params_volume = copy.deepcopy(params)
448 params_volume.update({
449 'build_interval': CONF.volume.build_interval,
450 'build_timeout': CONF.volume.build_timeout
451 })
Ken'ichi Ohmichiea3f26a2015-09-29 00:18:39 +0000452 self.volumes_extensions_client = ComputeVolumesClient(
Ken'ichi Ohmichic4921782015-08-05 08:14:42 +0000453 self.auth_provider, **params_volume)
Ken'ichi Ohmichi2b6012b2015-09-03 01:56:19 +0000454 self.compute_versions_client = VersionsClient(self.auth_provider,
455 **params_volume)
Ken'ichi Ohmichib7e27302015-09-29 00:11:20 +0000456 self.snapshots_extensions_client = ComputeSnapshotsClient(
Gaozexub9c9d6e2015-09-10 17:08:04 +0800457 self.auth_provider, **params_volume)
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000458
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000459 def _set_database_clients(self):
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000460 self.database_flavors_client = DatabaseFlavorsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000461 self.auth_provider,
462 CONF.database.catalog_type,
463 CONF.identity.region,
464 **self.default_params_with_timeout_values)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000465 self.database_limits_client = DatabaseLimitsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000466 self.auth_provider,
467 CONF.database.catalog_type,
468 CONF.identity.region,
469 **self.default_params_with_timeout_values)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000470 self.database_versions_client = DatabaseVersionsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000471 self.auth_provider,
472 CONF.database.catalog_type,
473 CONF.identity.region,
474 **self.default_params_with_timeout_values)
475
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000476 def _set_identity_clients(self):
ghanshyamd26b5cd2015-02-09 14:48:58 +0900477 params = {
478 'service': CONF.identity.catalog_type,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300479 'region': CONF.identity.region
ghanshyamd26b5cd2015-02-09 14:48:58 +0900480 }
481 params.update(self.default_params_with_timeout_values)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300482
483 # Clients below use the admin endpoint type of Keystone API v2
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300484 params_v2_admin = params.copy()
485 params_v2_admin['endpoint_type'] = CONF.identity.v2_admin_endpoint_type
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600486 self.endpoints_client = EndpointsClient(self.auth_provider,
487 **params_v2_admin)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000488 self.identity_client = IdentityClient(self.auth_provider,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300489 **params_v2_admin)
Daniel Melladob04da902015-11-20 17:43:12 +0100490 self.tenants_client = TenantsClient(self.auth_provider,
491 **params_v2_admin)
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600492 self.roles_client = RolesClient(self.auth_provider, **params_v2_admin)
493 self.users_client = UsersClient(self.auth_provider, **params_v2_admin)
494 self.identity_services_client = IdentityServicesClient(
495 self.auth_provider, **params_v2_admin)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300496
497 # Clients below use the public endpoint type of Keystone API v2
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300498 params_v2_public = params.copy()
499 params_v2_public['endpoint_type'] = (
500 CONF.identity.v2_public_endpoint_type)
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300501 self.identity_public_client = IdentityClient(self.auth_provider,
502 **params_v2_public)
Daniel Melladob04da902015-11-20 17:43:12 +0100503 self.tenants_public_client = TenantsClient(self.auth_provider,
504 **params_v2_public)
Daniel Mellado82c83a52015-12-09 15:16:49 +0000505 self.users_public_client = UsersClient(self.auth_provider,
506 **params_v2_public)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300507
508 # Clients below use the endpoint type of Keystone API v3
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300509 params_v3 = params.copy()
510 params_v3['endpoint_type'] = CONF.identity.v3_endpoint_type
Daniel Mellado91a26b62016-02-11 11:13:04 +0000511 self.domains_client = DomainsClient(self.auth_provider,
512 **params_v3)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000513 self.identity_v3_client = IdentityV3Client(self.auth_provider,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300514 **params_v3)
Daniel Mellado76405392016-02-11 12:47:12 +0000515 self.trusts_client = TrustsClient(self.auth_provider, **params_v3)
Daniel Mellado7aea5342016-02-09 09:10:12 +0000516 self.users_v3_client = UsersV3Client(self.auth_provider, **params_v3)
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600517 self.endpoints_v3_client = EndPointsV3Client(self.auth_provider,
518 **params_v3)
Arx Cruz24bcb882016-02-10 15:20:16 +0100519 self.roles_v3_client = RolesV3Client(self.auth_provider, **params_v3)
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600520 self.identity_services_v3_client = IdentityServicesV3Client(
Yaroslav Lobankov69d90562015-12-18 12:06:40 +0300521 self.auth_provider, **params_v3)
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600522 self.policies_client = PoliciesClient(self.auth_provider, **params_v3)
Yaroslav Lobankov47a93ab2016-02-07 16:32:49 -0600523 self.projects_client = ProjectsClient(self.auth_provider, **params_v3)
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600524 self.regions_client = RegionsClient(self.auth_provider, **params_v3)
525 self.credentials_client = CredentialsClient(self.auth_provider,
526 **params_v3)
527 self.groups_client = GroupsClient(self.auth_provider, **params_v3)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300528
Andrea Frittoli90012352015-02-25 21:58:02 +0000529 # Token clients do not use the catalog. They only need default_params.
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100530 # They read auth_url, so they should only be set if the corresponding
531 # API version is marked as enabled
532 if CONF.identity_feature_enabled.api_v2:
533 if CONF.identity.uri:
Ken'ichi Ohmichi5f80ce32015-09-10 23:51:14 +0000534 self.token_client = TokenClient(
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100535 CONF.identity.uri, **self.default_params)
536 else:
537 msg = 'Identity v2 API enabled, but no identity.uri set'
538 raise exceptions.InvalidConfiguration(msg)
Ken'ichi Ohmichi41951b02014-11-19 01:57:43 +0000539 if CONF.identity_feature_enabled.api_v3:
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100540 if CONF.identity.uri_v3:
Ken'ichi Ohmichi5f80ce32015-09-10 23:51:14 +0000541 self.token_v3_client = V3TokenClient(
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100542 CONF.identity.uri_v3, **self.default_params)
543 else:
544 msg = 'Identity v3 API enabled, but no identity.uri_v3 set'
545 raise exceptions.InvalidConfiguration(msg)
Ken'ichi Ohmichi41951b02014-11-19 01:57:43 +0000546
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000547 def _set_volume_clients(self):
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000548 params = {
549 'service': CONF.volume.catalog_type,
550 'region': CONF.volume.region or CONF.identity.region,
551 'endpoint_type': CONF.volume.endpoint_type,
552 'build_interval': CONF.volume.build_interval,
553 'build_timeout': CONF.volume.build_timeout
554 }
555 params.update(self.default_params)
556
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000557 self.volume_qos_client = QosSpecsClient(self.auth_provider,
558 **params)
559 self.volume_qos_v2_client = QosSpecsV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000560 self.auth_provider, **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300561 self.volume_services_client = VolumeServicesClient(
562 self.auth_provider, **params)
563 self.volume_services_v2_client = VolumeServicesV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000564 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000565 self.backups_client = BackupsClient(self.auth_provider, **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300566 self.backups_v2_client = BackupsV2Client(self.auth_provider,
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000567 **params)
568 self.snapshots_client = SnapshotsClient(self.auth_provider,
569 **params)
570 self.snapshots_v2_client = SnapshotsV2Client(self.auth_provider,
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000571 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000572 self.volumes_client = VolumesClient(
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.volumes_v2_client = VolumesV2Client(
Ken'ichi Ohmichi234da802015-02-13 04:48:06 +0000576 self.auth_provider, default_volume_size=CONF.volume.volume_size,
577 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000578 self.volume_types_client = VolumeTypesClient(self.auth_provider,
579 **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300580 self.volume_types_v2_client = VolumeTypesV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000581 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000582 self.volume_hosts_client = VolumeHostsClient(self.auth_provider,
583 **params)
584 self.volume_hosts_v2_client = VolumeHostsV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000585 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000586 self.volume_quotas_client = VolumeQuotasClient(self.auth_provider,
587 **params)
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000588 self.volume_quotas_v2_client = VolumeQuotasV2Client(self.auth_provider,
589 **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300590 self.volumes_extension_client = VolumeExtensionsClient(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000591 self.auth_provider, **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300592 self.volumes_v2_extension_client = VolumeExtensionsV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000593 self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000594 self.volume_availability_zone_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000595 VolumeAvailabilityZoneClient(self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000596 self.volume_v2_availability_zone_client = \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300597 VolumeAvailabilityZoneV2Client(self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000598
Ken'ichi Ohmichic95eb852015-01-22 01:57:57 +0000599 def _set_object_storage_clients(self):
Ken'ichi Ohmichi564b2ad2015-01-22 02:08:59 +0000600 params = {
601 'service': CONF.object_storage.catalog_type,
602 'region': CONF.object_storage.region or CONF.identity.region,
603 'endpoint_type': CONF.object_storage.endpoint_type
604 }
605 params.update(self.default_params_with_timeout_values)
606
607 self.account_client = AccountClient(self.auth_provider, **params)
608 self.container_client = ContainerClient(self.auth_provider, **params)
609 self.object_client = ObjectClient(self.auth_provider, **params)