blob: 54218d6528cd277cde35b66f57b0f353e289fd99 [file] [log] [blame]
ZhiQiang Fan39f97222013-09-20 04:49:44 +08001# Copyright 2012 OpenStack Foundation
Jay Pipes3f981df2012-03-27 18:59:44 -04002# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +000016import copy
17
Doug Hellmann583ce2c2015-03-11 14:55:46 +000018from oslo_log import log as logging
Ken'ichi Ohmichi8e7a4f82015-09-16 21:26:19 +090019from tempest_lib.services.compute.agents_client import AgentsClient
ghanshyamd1dac392015-10-13 15:30:24 +090020from tempest_lib.services.compute.aggregates_client import AggregatesClient
ghanshyam384dc792015-10-13 16:03:13 +090021from tempest_lib.services.compute.availability_zone_client import \
22 AvailabilityZoneClient
ghanshyam9fab7cc2015-10-13 16:12:23 +090023from tempest_lib.services.compute.baremetal_nodes_client import \
24 BaremetalNodesClient
ghanshyam4328a962015-10-13 16:18:09 +090025from tempest_lib.services.compute.certificates_client import \
26 CertificatesClient
ghanshyam0805a9e2015-10-13 16:24:44 +090027from tempest_lib.services.compute.extensions_client import \
28 ExtensionsClient
ghanshyam969281e2015-10-14 14:17:57 +090029from tempest_lib.services.compute.fixed_ips_client import FixedIPsClient
ghanshyam2f6f5f12015-10-14 14:27:36 +090030from tempest_lib.services.compute.flavors_client import FlavorsClient
ghanshyambf9e6002015-10-14 14:32:30 +090031from tempest_lib.services.compute.floating_ip_pools_client import \
32 FloatingIPPoolsClient
ghanshyam1a286ab2015-10-14 14:37:07 +090033from tempest_lib.services.compute.floating_ips_bulk_client import \
34 FloatingIPsBulkClient
Ghanshyam9d53dc22015-12-21 11:48:12 +090035from tempest_lib.services.compute.floating_ips_client import \
36 FloatingIPsClient as ComputeFloatingIPsClient
ghanshyamc898a282015-10-14 14:44:06 +090037from tempest_lib.services.compute.hosts_client import HostsClient
ghanshyam7dd1b492015-10-14 14:47:25 +090038from tempest_lib.services.compute.hypervisor_client import \
39 HypervisorClient
Ken'ichi Ohmichi69dcf442015-11-30 11:48:01 +000040from tempest_lib.services.compute.images_client import ImagesClient \
41 as ComputeImagesClient
ghanshyame6ee3e42015-11-20 18:20:57 +090042from tempest_lib.services.compute.instance_usage_audit_log_client import \
43 InstanceUsagesAuditLogClient
Ken'ichi Ohmichic3f22ce2015-12-03 05:21:37 +000044from tempest_lib.services.compute.interfaces_client import InterfacesClient
ghanshyam54e55cc2015-11-20 18:26:15 +090045from tempest_lib.services.compute.limits_client import LimitsClient
ghanshyameb6e2212015-11-20 18:30:46 +090046from tempest_lib.services.compute.migrations_client import MigrationsClient
ghanshyam6ca351a2015-11-20 18:35:30 +090047from tempest_lib.services.compute.networks_client import NetworksClient \
48 as ComputeNetworksClient
ghanshyam1a6acef2015-11-24 13:37:33 +090049from tempest_lib.services.compute.quota_classes_client import \
50 QuotaClassesClient
ghanshyam2f0b2f92015-11-24 13:45:10 +090051from tempest_lib.services.compute.quotas_client import QuotasClient
ghanshyama478b512015-11-24 13:52:31 +090052from tempest_lib.services.compute.security_group_default_rules_client import \
53 SecurityGroupDefaultRulesClient
Ghanshyam3d067522015-12-21 12:13:49 +090054from tempest_lib.services.compute.security_group_rules_client import \
55 SecurityGroupRulesClient
ghanshyam94ef6492015-11-25 16:43:26 +090056from tempest_lib.services.compute.security_groups_client import \
John Warrenf2345512015-12-10 13:39:30 -050057 SecurityGroupsClient as ComputeSecurityGroupsClient
Ghanshyam47d5f402015-12-21 12:59:04 +090058from tempest_lib.services.compute.server_groups_client import \
59 ServerGroupsClient
Ghanshyam4cc30d92015-12-21 14:17:59 +090060from tempest_lib.services.compute.servers_client import ServersClient
ghanshyamef23f222015-11-25 16:50:09 +090061from tempest_lib.services.compute.services_client import ServicesClient
ghanshyamef4ca252015-11-25 16:55:55 +090062from tempest_lib.services.compute.snapshots_client import \
63 SnapshotsClient as ComputeSnapshotsClient
ghanshyam06acc8e2015-11-25 17:06:52 +090064from tempest_lib.services.compute.tenant_networks_client import \
65 TenantNetworksClient
ghanshyama1f71702015-11-25 17:11:59 +090066from tempest_lib.services.compute.tenant_usages_client import \
67 TenantUsagesClient
ghanshyam30753462015-11-25 17:58:07 +090068from tempest_lib.services.compute.versions_client import VersionsClient
ghanshyam692d7c92015-11-25 21:16:52 +090069from tempest_lib.services.compute.volumes_client import \
70 VolumesClient as ComputeVolumesClient
Ken'ichi Ohmichi5f80ce32015-09-10 23:51:14 +000071from tempest_lib.services.identity.v2.token_client import TokenClient
72from tempest_lib.services.identity.v3.token_client import V3TokenClient
Doug Hellmann583ce2c2015-03-11 14:55:46 +000073
Ken'ichi Ohmichi42662682015-01-05 05:00:04 +000074from tempest.common import negative_rest_client
Jay Pipesf38eaac2012-06-21 13:37:35 -040075from tempest import config
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +010076from tempest import exceptions
Andrea Frittolif9cde7e2014-02-18 09:57:04 +000077from tempest import manager
Ken'ichi Ohmichi884d1062015-01-23 03:24:41 +000078from tempest.services.baremetal.v1.json.baremetal_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000079 BaremetalClient
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000080from tempest.services.compute.json.keypairs_client import KeyPairsClient
Ken'ichi Ohmichidc5fe442015-02-13 04:00:47 +000081from tempest.services.data_processing.v1_1.data_processing_client import \
82 DataProcessingClient
Nikhil Manchandadd6886f2014-03-03 01:58:45 -080083from tempest.services.database.json.flavors_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000084 DatabaseFlavorsClient
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +000085from tempest.services.database.json.limits_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000086 DatabaseLimitsClient
Peter Stachowski320f9c72014-04-21 16:13:23 -040087from tempest.services.database.json.versions_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000088 DatabaseVersionsClient
Jamie Lennoxc429e6a2015-02-24 10:42:42 +110089from tempest.services.identity.v2.json.identity_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000090 IdentityClient
Daniel Mellado6b16b922015-12-07 12:43:08 +000091from tempest.services.identity.v2.json.roles_client import \
92 RolesClient
Daniel Melladob04da902015-11-20 17:43:12 +010093from tempest.services.identity.v2.json.tenants_client import \
94 TenantsClient
nayna-patel914b4712013-07-16 08:29:05 +000095from tempest.services.identity.v3.json.credentials_client import \
Yaroslav Lobankov425ea1e2015-11-20 12:28:39 +030096 CredentialsClient as CredentialsV3Client
Sean Dague2416cf32013-04-10 08:29:07 -040097from tempest.services.identity.v3.json.endpoints_client import \
Yaroslav Lobankov425ea1e2015-11-20 12:28:39 +030098 EndPointClient as EndPointV3Client
99from tempest.services.identity.v3.json.groups_client import \
100 GroupsClient as GroupsV3Client
101from tempest.services.identity.v3.json.identity_client import IdentityV3Client
Yaroslav Lobankoved4d15c2015-12-18 11:30:10 +0300102from tempest.services.identity.v3.json.policies_client import \
103 PoliciesClient as PoliciesV3Client
Yaroslav Lobankov757d1a22015-12-18 11:43:02 +0300104from tempest.services.identity.v3.json.regions_client import \
105 RegionsClient as RegionsV3Client
Yaroslav Lobankov69d90562015-12-18 12:06:40 +0300106from tempest.services.identity.v3.json.services_client import \
107 ServicesClient as IdentityServicesV3Client
Ken'ichi Ohmichi69dcf442015-11-30 11:48:01 +0000108from tempest.services.image.v1.json.images_client import ImagesClient
109from tempest.services.image.v2.json.images_client import ImagesClientV2
Victoria Martínez de la Cruz1173b6e2014-09-22 18:32:13 -0300110from tempest.services.messaging.json.messaging_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000111 MessagingClient
Ken'ichi Ohmichi71860062015-12-15 08:20:13 +0000112from tempest.services.network.json.agents_client import AgentsClient \
113 as NetworkAgentsClient
John Warrenfbf2a892015-11-17 12:36:14 -0500114from tempest.services.network.json.floating_ips_client import FloatingIPsClient
John Warrendd20b3e2015-12-03 13:11:28 -0500115from tempest.services.network.json.metering_label_rules_client import \
116 MeteringLabelRulesClient
John Warren6d0083a2015-11-30 18:12:30 -0500117from tempest.services.network.json.metering_labels_client import \
118 MeteringLabelsClient
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000119from tempest.services.network.json.network_client import NetworkClient
John Warren94d8faf2015-09-15 12:22:24 -0400120from tempest.services.network.json.networks_client import NetworksClient
John Warren49c0fe52015-10-22 12:35:54 -0400121from tempest.services.network.json.ports_client import PortsClient
Ken'ichi Ohmichi756d8ff2015-12-15 09:47:54 +0000122from tempest.services.network.json.quotas_client import QuotasClient \
123 as NetworkQuotasClient
John Warrenf9606e92015-12-10 12:12:42 -0500124from tempest.services.network.json.security_groups_client import \
125 SecurityGroupsClient
Ken'ichi Ohmichif3f8aba2015-12-15 08:11:00 +0000126from tempest.services.network.json.subnetpools_client import SubnetpoolsClient
John Warren3961acd2015-10-02 14:38:53 -0400127from tempest.services.network.json.subnets_client import SubnetsClient
dwalleck5d734432012-10-04 01:11:47 -0500128from tempest.services.object_storage.account_client import AccountClient
Attila Fazekas6968dd52013-02-15 17:05:53 +0100129from tempest.services.object_storage.container_client import ContainerClient
130from tempest.services.object_storage.object_client import ObjectClient
Steve Bakerc60e4e32013-05-06 15:22:41 +1200131from tempest.services.orchestration.json.orchestration_client import \
132 OrchestrationClient
liu-sheng67b730e2015-07-16 15:19:33 +0800133from tempest.services.telemetry.json.alarming_client import AlarmingClient
Nikolay Pliashechnikovb053aab2013-11-05 06:06:44 -0800134from tempest.services.telemetry.json.telemetry_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000135 TelemetryClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300136from tempest.services.volume.v1.json.admin.hosts_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300137 HostsClient as VolumeHostsClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300138from tempest.services.volume.v1.json.admin.quotas_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300139 QuotasClient as VolumeQuotasClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300140from tempest.services.volume.v1.json.admin.services_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300141 ServicesClient as VolumeServicesClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300142from tempest.services.volume.v1.json.admin.types_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300143 TypesClient as VolumeTypesClient
Yaroslav Lobankovdb4a2e12015-11-28 20:04:54 +0300144from tempest.services.volume.v1.json.availability_zone_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300145 AvailabilityZoneClient as VolumeAvailabilityZoneClient
Yaroslav Lobankovdb4a2e12015-11-28 20:04:54 +0300146from tempest.services.volume.v1.json.backups_client import BackupsClient
147from tempest.services.volume.v1.json.extensions_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300148 ExtensionsClient as VolumeExtensionsClient
Yaroslav Lobankovdb4a2e12015-11-28 20:04:54 +0300149from tempest.services.volume.v1.json.qos_client import QosSpecsClient
150from tempest.services.volume.v1.json.snapshots_client import SnapshotsClient
151from tempest.services.volume.v1.json.volumes_client import VolumesClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300152from tempest.services.volume.v2.json.admin.hosts_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300153 HostsClient as VolumeHostsV2Client
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300154from tempest.services.volume.v2.json.admin.quotas_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300155 QuotasClient as VolumeQuotasV2Client
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300156from tempest.services.volume.v2.json.admin.services_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300157 ServicesClient as VolumeServicesV2Client
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300158from tempest.services.volume.v2.json.admin.types_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300159 TypesClient as VolumeTypesV2Client
Zhi Kun Liu53395522014-07-18 16:05:52 +0800160from tempest.services.volume.v2.json.availability_zone_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300161 AvailabilityZoneClient as VolumeAvailabilityZoneV2Client
162from tempest.services.volume.v2.json.backups_client import \
163 BackupsClient as BackupsV2Client
Zhi Kun Liu53395522014-07-18 16:05:52 +0800164from tempest.services.volume.v2.json.extensions_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300165 ExtensionsClient as VolumeExtensionsV2Client
166from tempest.services.volume.v2.json.qos_client import \
167 QosSpecsClient as QosSpecsV2Client
Zhi Kun Liu38641c62014-07-10 20:12:48 +0800168from tempest.services.volume.v2.json.snapshots_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300169 SnapshotsClient as SnapshotsV2Client
170from tempest.services.volume.v2.json.volumes_client import \
171 VolumesClient as VolumesV2Client
Vincent Hou6b8a7b72012-08-25 01:24:33 +0800172
Sean Dague86bd8422013-12-20 09:56:44 -0500173CONF = config.CONF
Jay Pipes3f981df2012-03-27 18:59:44 -0400174LOG = logging.getLogger(__name__)
175
Vincent Hou6b8a7b72012-08-25 01:24:33 +0800176
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000177class Manager(manager.Manager):
Ken'ichi Ohmichi2e2ee192015-11-19 09:48:27 +0000178 """Top level manager for OpenStack tempest clients"""
Jay Pipes3f981df2012-03-27 18:59:44 -0400179
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +0000180 default_params = {
181 'disable_ssl_certificate_validation':
182 CONF.identity.disable_ssl_certificate_validation,
183 'ca_certs': CONF.identity.ca_certificates_file,
184 'trace_requests': CONF.debug.trace_requests
185 }
186
Ken'ichi Ohmichi737a6032015-01-21 07:04:42 +0000187 # NOTE: Tempest uses timeout values of compute API if project specific
188 # timeout values don't exist.
189 default_params_with_timeout_values = {
190 'build_interval': CONF.compute.build_interval,
191 'build_timeout': CONF.compute.build_timeout
192 }
193 default_params_with_timeout_values.update(default_params)
194
Andrea Frittoli (andreaf)290b3e12015-10-08 10:25:02 +0100195 def __init__(self, credentials, service=None):
Andrea Frittoli422fbdf2014-03-20 10:05:18 +0000196 super(Manager, self).__init__(credentials=credentials)
Brant Knudsonc7ca3342013-03-28 21:08:50 -0500197
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000198 self._set_compute_clients()
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000199 self._set_database_clients()
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000200 self._set_identity_clients()
201 self._set_volume_clients()
Ken'ichi Ohmichic95eb852015-01-22 01:57:57 +0000202 self._set_object_storage_clients()
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000203
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000204 self.baremetal_client = BaremetalClient(
Ken'ichi Ohmichi1f88ece2015-01-23 03:33:11 +0000205 self.auth_provider,
206 CONF.baremetal.catalog_type,
207 CONF.identity.region,
208 endpoint_type=CONF.baremetal.endpoint_type,
209 **self.default_params_with_timeout_values)
Ken'ichi Ohmichi71860062015-12-15 08:20:13 +0000210 self.network_agents_client = NetworkAgentsClient(
211 self.auth_provider,
212 CONF.network.catalog_type,
213 CONF.network.region or CONF.identity.region,
214 endpoint_type=CONF.network.endpoint_type,
215 build_interval=CONF.network.build_interval,
216 build_timeout=CONF.network.build_timeout,
217 **self.default_params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000218 self.network_client = NetworkClient(
Ken'ichi Ohmichia182e862015-01-21 01:16:37 +0000219 self.auth_provider,
220 CONF.network.catalog_type,
221 CONF.network.region or CONF.identity.region,
222 endpoint_type=CONF.network.endpoint_type,
223 build_interval=CONF.network.build_interval,
224 build_timeout=CONF.network.build_timeout,
225 **self.default_params)
John Warren94d8faf2015-09-15 12:22:24 -0400226 self.networks_client = NetworksClient(
227 self.auth_provider,
228 CONF.network.catalog_type,
229 CONF.network.region or CONF.identity.region,
230 endpoint_type=CONF.network.endpoint_type,
231 build_interval=CONF.network.build_interval,
232 build_timeout=CONF.network.build_timeout,
233 **self.default_params)
Ken'ichi Ohmichif3f8aba2015-12-15 08:11:00 +0000234 self.subnetpools_client = SubnetpoolsClient(
235 self.auth_provider,
236 CONF.network.catalog_type,
237 CONF.network.region or CONF.identity.region,
238 endpoint_type=CONF.network.endpoint_type,
239 build_interval=CONF.network.build_interval,
240 build_timeout=CONF.network.build_timeout,
241 **self.default_params)
John Warren3961acd2015-10-02 14:38:53 -0400242 self.subnets_client = SubnetsClient(
243 self.auth_provider,
244 CONF.network.catalog_type,
245 CONF.network.region or CONF.identity.region,
246 endpoint_type=CONF.network.endpoint_type,
247 build_interval=CONF.network.build_interval,
248 build_timeout=CONF.network.build_timeout,
249 **self.default_params)
John Warren49c0fe52015-10-22 12:35:54 -0400250 self.ports_client = PortsClient(
251 self.auth_provider,
252 CONF.network.catalog_type,
253 CONF.network.region or CONF.identity.region,
254 endpoint_type=CONF.network.endpoint_type,
255 build_interval=CONF.network.build_interval,
256 build_timeout=CONF.network.build_timeout,
257 **self.default_params)
Ken'ichi Ohmichi756d8ff2015-12-15 09:47:54 +0000258 self.network_quotas_client = NetworkQuotasClient(
259 self.auth_provider,
260 CONF.network.catalog_type,
261 CONF.network.region or CONF.identity.region,
262 endpoint_type=CONF.network.endpoint_type,
263 build_interval=CONF.network.build_interval,
264 build_timeout=CONF.network.build_timeout,
265 **self.default_params)
John Warrenfbf2a892015-11-17 12:36:14 -0500266 self.floating_ips_client = FloatingIPsClient(
267 self.auth_provider,
268 CONF.network.catalog_type,
269 CONF.network.region or CONF.identity.region,
270 endpoint_type=CONF.network.endpoint_type,
271 build_interval=CONF.network.build_interval,
272 build_timeout=CONF.network.build_timeout,
273 **self.default_params)
John Warren6d0083a2015-11-30 18:12:30 -0500274 self.metering_labels_client = MeteringLabelsClient(
275 self.auth_provider,
276 CONF.network.catalog_type,
277 CONF.network.region or CONF.identity.region,
278 endpoint_type=CONF.network.endpoint_type,
279 build_interval=CONF.network.build_interval,
280 build_timeout=CONF.network.build_timeout,
281 **self.default_params)
John Warrendd20b3e2015-12-03 13:11:28 -0500282 self.metering_label_rules_client = MeteringLabelRulesClient(
283 self.auth_provider,
284 CONF.network.catalog_type,
285 CONF.network.region or CONF.identity.region,
286 endpoint_type=CONF.network.endpoint_type,
287 build_interval=CONF.network.build_interval,
288 build_timeout=CONF.network.build_timeout,
289 **self.default_params)
John Warrenf9606e92015-12-10 12:12:42 -0500290 self.security_groups_client = SecurityGroupsClient(
291 self.auth_provider,
292 CONF.network.catalog_type,
293 CONF.network.region or CONF.identity.region,
294 endpoint_type=CONF.network.endpoint_type,
295 build_interval=CONF.network.build_interval,
296 build_timeout=CONF.network.build_timeout,
297 **self.default_params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000298 self.messaging_client = MessagingClient(
Ken'ichi Ohmichi2183a652015-01-22 05:00:20 +0000299 self.auth_provider,
300 CONF.messaging.catalog_type,
301 CONF.identity.region,
302 **self.default_params_with_timeout_values)
Sean Daguef3c75912014-11-24 11:45:11 -0500303 if CONF.service_available.ceilometer:
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000304 self.telemetry_client = TelemetryClient(
Ken'ichi Ohmichid5dba1c2015-01-23 02:23:22 +0000305 self.auth_provider,
306 CONF.telemetry.catalog_type,
307 CONF.identity.region,
308 endpoint_type=CONF.telemetry.endpoint_type,
309 **self.default_params_with_timeout_values)
liu-sheng67b730e2015-07-16 15:19:33 +0800310 if CONF.service_available.aodh:
311 self.alarming_client = AlarmingClient(
312 self.auth_provider,
313 CONF.alarming.catalog_type,
314 CONF.identity.region,
315 endpoint_type=CONF.alarming.endpoint_type,
316 **self.default_params_with_timeout_values)
Sean Dague86bd8422013-12-20 09:56:44 -0500317 if CONF.service_available.glance:
Ken'ichi Ohmichi69dcf442015-11-30 11:48:01 +0000318 self.image_client = ImagesClient(
Masayuki Igawabc7e1892015-03-03 11:46:48 +0900319 self.auth_provider,
320 CONF.image.catalog_type,
321 CONF.image.region or CONF.identity.region,
322 endpoint_type=CONF.image.endpoint_type,
323 build_interval=CONF.image.build_interval,
324 build_timeout=CONF.image.build_timeout,
325 **self.default_params)
Ken'ichi Ohmichi69dcf442015-11-30 11:48:01 +0000326 self.image_client_v2 = ImagesClientV2(
Masayuki Igawabc7e1892015-03-03 11:46:48 +0900327 self.auth_provider,
328 CONF.image.catalog_type,
329 CONF.image.region or CONF.identity.region,
330 endpoint_type=CONF.image.endpoint_type,
331 build_interval=CONF.image.build_interval,
332 build_timeout=CONF.image.build_timeout,
333 **self.default_params)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000334 self.orchestration_client = OrchestrationClient(
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +0000335 self.auth_provider,
336 CONF.orchestration.catalog_type,
337 CONF.orchestration.region or CONF.identity.region,
338 endpoint_type=CONF.orchestration.endpoint_type,
339 build_interval=CONF.orchestration.build_interval,
340 build_timeout=CONF.orchestration.build_timeout,
341 **self.default_params)
Ken'ichi Ohmichi4e83b5e2015-02-13 04:07:34 +0000342 self.data_processing_client = DataProcessingClient(
343 self.auth_provider,
344 CONF.data_processing.catalog_type,
345 CONF.identity.region,
346 endpoint_type=CONF.data_processing.endpoint_type,
347 **self.default_params_with_timeout_values)
Ken'ichi Ohmichib38eb002015-01-23 02:35:01 +0000348 self.negative_client = negative_rest_client.NegativeRestClient(
David Kranz1e33e372015-03-20 09:42:56 -0400349 self.auth_provider, service, **self.default_params)
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +0000350
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000351 def _set_compute_clients(self):
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000352 params = {
353 'service': CONF.compute.catalog_type,
354 'region': CONF.compute.region or CONF.identity.region,
355 'endpoint_type': CONF.compute.endpoint_type,
356 'build_interval': CONF.compute.build_interval,
357 'build_timeout': CONF.compute.build_timeout
358 }
359 params.update(self.default_params)
360
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000361 self.agents_client = AgentsClient(self.auth_provider, **params)
John Warren9487a182015-09-14 18:12:56 -0400362 self.compute_networks_client = ComputeNetworksClient(
363 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000364 self.migrations_client = MigrationsClient(self.auth_provider,
365 **params)
Ken'ichi Ohmichi65225ef2014-11-19 01:06:25 +0000366 self.security_group_default_rules_client = (
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000367 SecurityGroupDefaultRulesClient(self.auth_provider, **params))
368 self.certificates_client = CertificatesClient(self.auth_provider,
369 **params)
370 self.servers_client = ServersClient(
Masayuki Igawa8f9c0c82015-03-03 09:38:08 +0900371 self.auth_provider,
372 enable_instance_password=CONF.compute_feature_enabled
373 .enable_instance_password,
374 **params)
Ken'ichi Ohmichi7ca54b82015-07-07 01:10:26 +0000375 self.server_groups_client = ServerGroupsClient(
376 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000377 self.limits_client = LimitsClient(self.auth_provider, **params)
Ken'ichi Ohmichi69dcf442015-11-30 11:48:01 +0000378 self.images_client = ComputeImagesClient(self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000379 self.keypairs_client = KeyPairsClient(self.auth_provider, **params)
380 self.quotas_client = QuotasClient(self.auth_provider, **params)
381 self.quota_classes_client = QuotaClassesClient(self.auth_provider,
382 **params)
383 self.flavors_client = FlavorsClient(self.auth_provider, **params)
384 self.extensions_client = ExtensionsClient(self.auth_provider,
385 **params)
Ken'ichi Ohmichif5767702015-07-29 23:39:10 +0000386 self.floating_ip_pools_client = FloatingIPPoolsClient(
Ken'ichi Ohmichi03af1c52015-07-13 00:28:05 +0000387 self.auth_provider, **params)
Ken'ichi Ohmichif5767702015-07-29 23:39:10 +0000388 self.floating_ips_bulk_client = FloatingIPsBulkClient(
Ken'ichi Ohmichi2b26e752015-07-13 00:44:36 +0000389 self.auth_provider, **params)
John Warrene74890a2015-11-11 15:18:01 -0500390 self.compute_floating_ips_client = ComputeFloatingIPsClient(
391 self.auth_provider, **params)
Ken'ichi Ohmichi685cd172015-07-13 01:29:57 +0000392 self.security_group_rules_client = SecurityGroupRulesClient(
393 self.auth_provider, **params)
John Warrenf2345512015-12-10 13:39:30 -0500394 self.compute_security_groups_client = ComputeSecurityGroupsClient(
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000395 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000396 self.interfaces_client = InterfacesClient(self.auth_provider,
397 **params)
398 self.fixed_ips_client = FixedIPsClient(self.auth_provider,
399 **params)
400 self.availability_zone_client = AvailabilityZoneClient(
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000401 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000402 self.aggregates_client = AggregatesClient(self.auth_provider,
403 **params)
404 self.services_client = ServicesClient(self.auth_provider, **params)
405 self.tenant_usages_client = TenantUsagesClient(self.auth_provider,
406 **params)
407 self.hosts_client = HostsClient(self.auth_provider, **params)
408 self.hypervisor_client = HypervisorClient(self.auth_provider,
409 **params)
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000410 self.instance_usages_audit_log_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000411 InstanceUsagesAuditLogClient(self.auth_provider, **params)
Ken'ichi Ohmichic3dfdb22015-01-22 04:39:58 +0000412 self.tenant_networks_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000413 TenantNetworksClient(self.auth_provider, **params)
414 self.baremetal_nodes_client = BaremetalNodesClient(
YuikoTakadaac0879a2015-01-22 02:40:03 +0000415 self.auth_provider, **params)
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000416
417 # NOTE: The following client needs special timeout values because
418 # the API is a proxy for the other component.
419 params_volume = copy.deepcopy(params)
420 params_volume.update({
421 'build_interval': CONF.volume.build_interval,
422 'build_timeout': CONF.volume.build_timeout
423 })
Ken'ichi Ohmichiea3f26a2015-09-29 00:18:39 +0000424 self.volumes_extensions_client = ComputeVolumesClient(
Ken'ichi Ohmichic4921782015-08-05 08:14:42 +0000425 self.auth_provider, **params_volume)
Ken'ichi Ohmichi2b6012b2015-09-03 01:56:19 +0000426 self.compute_versions_client = VersionsClient(self.auth_provider,
427 **params_volume)
Ken'ichi Ohmichib7e27302015-09-29 00:11:20 +0000428 self.snapshots_extensions_client = ComputeSnapshotsClient(
Gaozexub9c9d6e2015-09-10 17:08:04 +0800429 self.auth_provider, **params_volume)
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000430
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000431 def _set_database_clients(self):
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000432 self.database_flavors_client = DatabaseFlavorsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000433 self.auth_provider,
434 CONF.database.catalog_type,
435 CONF.identity.region,
436 **self.default_params_with_timeout_values)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000437 self.database_limits_client = DatabaseLimitsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000438 self.auth_provider,
439 CONF.database.catalog_type,
440 CONF.identity.region,
441 **self.default_params_with_timeout_values)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000442 self.database_versions_client = DatabaseVersionsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000443 self.auth_provider,
444 CONF.database.catalog_type,
445 CONF.identity.region,
446 **self.default_params_with_timeout_values)
447
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000448 def _set_identity_clients(self):
ghanshyamd26b5cd2015-02-09 14:48:58 +0900449 params = {
450 'service': CONF.identity.catalog_type,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300451 'region': CONF.identity.region
ghanshyamd26b5cd2015-02-09 14:48:58 +0900452 }
453 params.update(self.default_params_with_timeout_values)
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300454 params_v2_admin = params.copy()
455 params_v2_admin['endpoint_type'] = CONF.identity.v2_admin_endpoint_type
456 # Client uses admin endpoint type of Keystone API v2
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000457 self.identity_client = IdentityClient(self.auth_provider,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300458 **params_v2_admin)
Daniel Melladob04da902015-11-20 17:43:12 +0100459 self.tenants_client = TenantsClient(self.auth_provider,
460 **params_v2_admin)
Daniel Mellado6b16b922015-12-07 12:43:08 +0000461 self.roles_client = RolesClient(self.auth_provider,
462 **params_v2_admin)
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300463 params_v2_public = params.copy()
464 params_v2_public['endpoint_type'] = (
465 CONF.identity.v2_public_endpoint_type)
466 # Client uses public endpoint type of Keystone API v2
467 self.identity_public_client = IdentityClient(self.auth_provider,
468 **params_v2_public)
Daniel Melladob04da902015-11-20 17:43:12 +0100469 self.tenants_public_client = TenantsClient(self.auth_provider,
470 **params_v2_public)
Daniel Mellado6b16b922015-12-07 12:43:08 +0000471 self.roles_public_client = RolesClient(self.auth_provider,
472 **params_v2_public)
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300473 params_v3 = params.copy()
474 params_v3['endpoint_type'] = CONF.identity.v3_endpoint_type
Yaroslav Lobankov425ea1e2015-11-20 12:28:39 +0300475 # Clients below use the endpoint type of Keystone API v3
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000476 self.identity_v3_client = IdentityV3Client(self.auth_provider,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300477 **params_v3)
Yaroslav Lobankov425ea1e2015-11-20 12:28:39 +0300478 self.endpoints_client = EndPointV3Client(self.auth_provider,
479 **params_v3)
Yaroslav Lobankov69d90562015-12-18 12:06:40 +0300480 self.identity_services_client = IdentityServicesV3Client(
481 self.auth_provider, **params_v3)
Yaroslav Lobankoved4d15c2015-12-18 11:30:10 +0300482 self.policies_client = PoliciesV3Client(self.auth_provider,
483 **params_v3)
Yaroslav Lobankov757d1a22015-12-18 11:43:02 +0300484 self.regions_client = RegionsV3Client(self.auth_provider, **params_v3)
Yaroslav Lobankov425ea1e2015-11-20 12:28:39 +0300485 self.credentials_client = CredentialsV3Client(self.auth_provider,
486 **params_v3)
487 self.groups_client = GroupsV3Client(self.auth_provider, **params_v3)
Andrea Frittoli90012352015-02-25 21:58:02 +0000488 # Token clients do not use the catalog. They only need default_params.
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100489 # They read auth_url, so they should only be set if the corresponding
490 # API version is marked as enabled
491 if CONF.identity_feature_enabled.api_v2:
492 if CONF.identity.uri:
Ken'ichi Ohmichi5f80ce32015-09-10 23:51:14 +0000493 self.token_client = TokenClient(
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100494 CONF.identity.uri, **self.default_params)
495 else:
496 msg = 'Identity v2 API enabled, but no identity.uri set'
497 raise exceptions.InvalidConfiguration(msg)
Ken'ichi Ohmichi41951b02014-11-19 01:57:43 +0000498 if CONF.identity_feature_enabled.api_v3:
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100499 if CONF.identity.uri_v3:
Ken'ichi Ohmichi5f80ce32015-09-10 23:51:14 +0000500 self.token_v3_client = V3TokenClient(
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100501 CONF.identity.uri_v3, **self.default_params)
502 else:
503 msg = 'Identity v3 API enabled, but no identity.uri_v3 set'
504 raise exceptions.InvalidConfiguration(msg)
Ken'ichi Ohmichi41951b02014-11-19 01:57:43 +0000505
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000506 def _set_volume_clients(self):
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000507 params = {
508 'service': CONF.volume.catalog_type,
509 'region': CONF.volume.region or CONF.identity.region,
510 'endpoint_type': CONF.volume.endpoint_type,
511 'build_interval': CONF.volume.build_interval,
512 'build_timeout': CONF.volume.build_timeout
513 }
514 params.update(self.default_params)
515
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000516 self.volume_qos_client = QosSpecsClient(self.auth_provider,
517 **params)
518 self.volume_qos_v2_client = QosSpecsV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000519 self.auth_provider, **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300520 self.volume_services_client = VolumeServicesClient(
521 self.auth_provider, **params)
522 self.volume_services_v2_client = VolumeServicesV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000523 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000524 self.backups_client = BackupsClient(self.auth_provider, **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300525 self.backups_v2_client = BackupsV2Client(self.auth_provider,
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000526 **params)
527 self.snapshots_client = SnapshotsClient(self.auth_provider,
528 **params)
529 self.snapshots_v2_client = SnapshotsV2Client(self.auth_provider,
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000530 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000531 self.volumes_client = VolumesClient(
Ken'ichi Ohmichi234da802015-02-13 04:48:06 +0000532 self.auth_provider, default_volume_size=CONF.volume.volume_size,
533 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000534 self.volumes_v2_client = VolumesV2Client(
Ken'ichi Ohmichi234da802015-02-13 04:48:06 +0000535 self.auth_provider, default_volume_size=CONF.volume.volume_size,
536 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000537 self.volume_types_client = VolumeTypesClient(self.auth_provider,
538 **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300539 self.volume_types_v2_client = VolumeTypesV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000540 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000541 self.volume_hosts_client = VolumeHostsClient(self.auth_provider,
542 **params)
543 self.volume_hosts_v2_client = VolumeHostsV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000544 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000545 self.volume_quotas_client = VolumeQuotasClient(self.auth_provider,
546 **params)
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000547 self.volume_quotas_v2_client = VolumeQuotasV2Client(self.auth_provider,
548 **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300549 self.volumes_extension_client = VolumeExtensionsClient(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000550 self.auth_provider, **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300551 self.volumes_v2_extension_client = VolumeExtensionsV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000552 self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000553 self.volume_availability_zone_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000554 VolumeAvailabilityZoneClient(self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000555 self.volume_v2_availability_zone_client = \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300556 VolumeAvailabilityZoneV2Client(self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000557
Ken'ichi Ohmichic95eb852015-01-22 01:57:57 +0000558 def _set_object_storage_clients(self):
Ken'ichi Ohmichi564b2ad2015-01-22 02:08:59 +0000559 params = {
560 'service': CONF.object_storage.catalog_type,
561 'region': CONF.object_storage.region or CONF.identity.region,
562 'endpoint_type': CONF.object_storage.endpoint_type
563 }
564 params.update(self.default_params_with_timeout_values)
565
566 self.account_client = AccountClient(self.auth_provider, **params)
567 self.container_client = ContainerClient(self.auth_provider, **params)
568 self.object_client = ObjectClient(self.auth_provider, **params)