blob: 955748b025c2f1ccd86f962c849ad8f622051918 [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
ghanshyamc898a282015-10-14 14:44:06 +090035from tempest_lib.services.compute.hosts_client import HostsClient
ghanshyam7dd1b492015-10-14 14:47:25 +090036from tempest_lib.services.compute.hypervisor_client import \
37 HypervisorClient
Ken'ichi Ohmichi69dcf442015-11-30 11:48:01 +000038from tempest_lib.services.compute.images_client import ImagesClient \
39 as ComputeImagesClient
ghanshyame6ee3e42015-11-20 18:20:57 +090040from tempest_lib.services.compute.instance_usage_audit_log_client import \
41 InstanceUsagesAuditLogClient
Ken'ichi Ohmichic3f22ce2015-12-03 05:21:37 +000042from tempest_lib.services.compute.interfaces_client import InterfacesClient
ghanshyam54e55cc2015-11-20 18:26:15 +090043from tempest_lib.services.compute.limits_client import LimitsClient
ghanshyameb6e2212015-11-20 18:30:46 +090044from tempest_lib.services.compute.migrations_client import MigrationsClient
ghanshyam6ca351a2015-11-20 18:35:30 +090045from tempest_lib.services.compute.networks_client import NetworksClient \
46 as ComputeNetworksClient
ghanshyam1a6acef2015-11-24 13:37:33 +090047from tempest_lib.services.compute.quota_classes_client import \
48 QuotaClassesClient
ghanshyam2f0b2f92015-11-24 13:45:10 +090049from tempest_lib.services.compute.quotas_client import QuotasClient
ghanshyama478b512015-11-24 13:52:31 +090050from tempest_lib.services.compute.security_group_default_rules_client import \
51 SecurityGroupDefaultRulesClient
ghanshyam94ef6492015-11-25 16:43:26 +090052from tempest_lib.services.compute.security_groups_client import \
John Warrenf2345512015-12-10 13:39:30 -050053 SecurityGroupsClient as ComputeSecurityGroupsClient
ghanshyamef23f222015-11-25 16:50:09 +090054from tempest_lib.services.compute.services_client import ServicesClient
ghanshyamef4ca252015-11-25 16:55:55 +090055from tempest_lib.services.compute.snapshots_client import \
56 SnapshotsClient as ComputeSnapshotsClient
ghanshyam06acc8e2015-11-25 17:06:52 +090057from tempest_lib.services.compute.tenant_networks_client import \
58 TenantNetworksClient
ghanshyama1f71702015-11-25 17:11:59 +090059from tempest_lib.services.compute.tenant_usages_client import \
60 TenantUsagesClient
ghanshyam30753462015-11-25 17:58:07 +090061from tempest_lib.services.compute.versions_client import VersionsClient
ghanshyam692d7c92015-11-25 21:16:52 +090062from tempest_lib.services.compute.volumes_client import \
63 VolumesClient as ComputeVolumesClient
Ken'ichi Ohmichi5f80ce32015-09-10 23:51:14 +000064from tempest_lib.services.identity.v2.token_client import TokenClient
65from tempest_lib.services.identity.v3.token_client import V3TokenClient
Doug Hellmann583ce2c2015-03-11 14:55:46 +000066
Ken'ichi Ohmichi42662682015-01-05 05:00:04 +000067from tempest.common import negative_rest_client
Jay Pipesf38eaac2012-06-21 13:37:35 -040068from tempest import config
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +010069from tempest import exceptions
Andrea Frittolif9cde7e2014-02-18 09:57:04 +000070from tempest import manager
Ken'ichi Ohmichi884d1062015-01-23 03:24:41 +000071from tempest.services.baremetal.v1.json.baremetal_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000072 BaremetalClient
Attila Fazekas1aed6202013-02-11 14:47:45 +010073from tempest.services import botoclients
dwallecke62b9f02012-10-10 23:34:42 -050074from tempest.services.compute.json.floating_ips_client import \
John Warrene74890a2015-11-11 15:18:01 -050075 FloatingIPsClient as ComputeFloatingIPsClient
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000076from tempest.services.compute.json.keypairs_client import KeyPairsClient
Ken'ichi Ohmichi685cd172015-07-13 01:29:57 +000077from tempest.services.compute.json.security_group_rules_client import \
78 SecurityGroupRulesClient
Ken'ichi Ohmichi7ca54b82015-07-07 01:10:26 +000079from tempest.services.compute.json.server_groups_client import \
80 ServerGroupsClient
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000081from tempest.services.compute.json.servers_client import ServersClient
Ken'ichi Ohmichidc5fe442015-02-13 04:00:47 +000082from tempest.services.data_processing.v1_1.data_processing_client import \
83 DataProcessingClient
Nikhil Manchandadd6886f2014-03-03 01:58:45 -080084from tempest.services.database.json.flavors_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000085 DatabaseFlavorsClient
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +000086from tempest.services.database.json.limits_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000087 DatabaseLimitsClient
Peter Stachowski320f9c72014-04-21 16:13:23 -040088from tempest.services.database.json.versions_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000089 DatabaseVersionsClient
Jamie Lennoxc429e6a2015-02-24 10:42:42 +110090from tempest.services.identity.v2.json.identity_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +000091 IdentityClient
nayna-patel914b4712013-07-16 08:29:05 +000092from tempest.services.identity.v3.json.credentials_client import \
Yaroslav Lobankov425ea1e2015-11-20 12:28:39 +030093 CredentialsClient as CredentialsV3Client
Sean Dague2416cf32013-04-10 08:29:07 -040094from tempest.services.identity.v3.json.endpoints_client import \
Yaroslav Lobankov425ea1e2015-11-20 12:28:39 +030095 EndPointClient as EndPointV3Client
96from tempest.services.identity.v3.json.groups_client import \
97 GroupsClient as GroupsV3Client
98from tempest.services.identity.v3.json.identity_client import IdentityV3Client
99from tempest.services.identity.v3.json.policy_client import \
100 PolicyClient as PolicyV3Client
101from tempest.services.identity.v3.json.region_client import \
102 RegionClient as RegionV3Client
harika-vakadia92dd742013-02-19 20:41:22 +0530103from tempest.services.identity.v3.json.service_client import \
Yaroslav Lobankov425ea1e2015-11-20 12:28:39 +0300104 ServiceClient as ServiceV3Client
Ken'ichi Ohmichi69dcf442015-11-30 11:48:01 +0000105from tempest.services.image.v1.json.images_client import ImagesClient
106from tempest.services.image.v2.json.images_client import ImagesClientV2
Victoria Martínez de la Cruz1173b6e2014-09-22 18:32:13 -0300107from tempest.services.messaging.json.messaging_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000108 MessagingClient
John Warrenfbf2a892015-11-17 12:36:14 -0500109from tempest.services.network.json.floating_ips_client import FloatingIPsClient
John Warrendd20b3e2015-12-03 13:11:28 -0500110from tempest.services.network.json.metering_label_rules_client import \
111 MeteringLabelRulesClient
John Warren6d0083a2015-11-30 18:12:30 -0500112from tempest.services.network.json.metering_labels_client import \
113 MeteringLabelsClient
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000114from tempest.services.network.json.network_client import NetworkClient
John Warren94d8faf2015-09-15 12:22:24 -0400115from tempest.services.network.json.networks_client import NetworksClient
John Warren49c0fe52015-10-22 12:35:54 -0400116from tempest.services.network.json.ports_client import PortsClient
John Warren3961acd2015-10-02 14:38:53 -0400117from tempest.services.network.json.subnets_client import SubnetsClient
dwalleck5d734432012-10-04 01:11:47 -0500118from tempest.services.object_storage.account_client import AccountClient
Attila Fazekas6968dd52013-02-15 17:05:53 +0100119from tempest.services.object_storage.container_client import ContainerClient
120from tempest.services.object_storage.object_client import ObjectClient
Steve Bakerc60e4e32013-05-06 15:22:41 +1200121from tempest.services.orchestration.json.orchestration_client import \
122 OrchestrationClient
liu-sheng67b730e2015-07-16 15:19:33 +0800123from tempest.services.telemetry.json.alarming_client import AlarmingClient
Nikolay Pliashechnikovb053aab2013-11-05 06:06:44 -0800124from tempest.services.telemetry.json.telemetry_client import \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000125 TelemetryClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300126from tempest.services.volume.v1.json.admin.hosts_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300127 HostsClient as VolumeHostsClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300128from tempest.services.volume.v1.json.admin.quotas_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300129 QuotasClient as VolumeQuotasClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300130from tempest.services.volume.v1.json.admin.services_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300131 ServicesClient as VolumeServicesClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300132from tempest.services.volume.v1.json.admin.types_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300133 TypesClient as VolumeTypesClient
Yaroslav Lobankovdb4a2e12015-11-28 20:04:54 +0300134from tempest.services.volume.v1.json.availability_zone_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300135 AvailabilityZoneClient as VolumeAvailabilityZoneClient
Yaroslav Lobankovdb4a2e12015-11-28 20:04:54 +0300136from tempest.services.volume.v1.json.backups_client import BackupsClient
137from tempest.services.volume.v1.json.extensions_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300138 ExtensionsClient as VolumeExtensionsClient
Yaroslav Lobankovdb4a2e12015-11-28 20:04:54 +0300139from tempest.services.volume.v1.json.qos_client import QosSpecsClient
140from tempest.services.volume.v1.json.snapshots_client import SnapshotsClient
141from tempest.services.volume.v1.json.volumes_client import VolumesClient
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300142from tempest.services.volume.v2.json.admin.hosts_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300143 HostsClient as VolumeHostsV2Client
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300144from tempest.services.volume.v2.json.admin.quotas_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300145 QuotasClient as VolumeQuotasV2Client
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300146from tempest.services.volume.v2.json.admin.services_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300147 ServicesClient as VolumeServicesV2Client
Yaroslav Lobankovaef02982015-12-02 17:42:32 +0300148from tempest.services.volume.v2.json.admin.types_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300149 TypesClient as VolumeTypesV2Client
Zhi Kun Liu53395522014-07-18 16:05:52 +0800150from tempest.services.volume.v2.json.availability_zone_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300151 AvailabilityZoneClient as VolumeAvailabilityZoneV2Client
152from tempest.services.volume.v2.json.backups_client import \
153 BackupsClient as BackupsV2Client
Zhi Kun Liu53395522014-07-18 16:05:52 +0800154from tempest.services.volume.v2.json.extensions_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300155 ExtensionsClient as VolumeExtensionsV2Client
156from tempest.services.volume.v2.json.qos_client import \
157 QosSpecsClient as QosSpecsV2Client
Zhi Kun Liu38641c62014-07-10 20:12:48 +0800158from tempest.services.volume.v2.json.snapshots_client import \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300159 SnapshotsClient as SnapshotsV2Client
160from tempest.services.volume.v2.json.volumes_client import \
161 VolumesClient as VolumesV2Client
Vincent Hou6b8a7b72012-08-25 01:24:33 +0800162
Sean Dague86bd8422013-12-20 09:56:44 -0500163CONF = config.CONF
Jay Pipes3f981df2012-03-27 18:59:44 -0400164LOG = logging.getLogger(__name__)
165
Vincent Hou6b8a7b72012-08-25 01:24:33 +0800166
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000167class Manager(manager.Manager):
Ken'ichi Ohmichi2e2ee192015-11-19 09:48:27 +0000168 """Top level manager for OpenStack tempest clients"""
Jay Pipes3f981df2012-03-27 18:59:44 -0400169
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +0000170 default_params = {
171 'disable_ssl_certificate_validation':
172 CONF.identity.disable_ssl_certificate_validation,
173 'ca_certs': CONF.identity.ca_certificates_file,
174 'trace_requests': CONF.debug.trace_requests
175 }
176
Ken'ichi Ohmichi737a6032015-01-21 07:04:42 +0000177 # NOTE: Tempest uses timeout values of compute API if project specific
178 # timeout values don't exist.
179 default_params_with_timeout_values = {
180 'build_interval': CONF.compute.build_interval,
181 'build_timeout': CONF.compute.build_timeout
182 }
183 default_params_with_timeout_values.update(default_params)
184
Andrea Frittoli (andreaf)290b3e12015-10-08 10:25:02 +0100185 def __init__(self, credentials, service=None):
Andrea Frittoli422fbdf2014-03-20 10:05:18 +0000186 super(Manager, self).__init__(credentials=credentials)
Brant Knudsonc7ca3342013-03-28 21:08:50 -0500187
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000188 self._set_compute_clients()
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000189 self._set_database_clients()
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000190 self._set_identity_clients()
191 self._set_volume_clients()
Ken'ichi Ohmichic95eb852015-01-22 01:57:57 +0000192 self._set_object_storage_clients()
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000193
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000194 self.baremetal_client = BaremetalClient(
Ken'ichi Ohmichi1f88ece2015-01-23 03:33:11 +0000195 self.auth_provider,
196 CONF.baremetal.catalog_type,
197 CONF.identity.region,
198 endpoint_type=CONF.baremetal.endpoint_type,
199 **self.default_params_with_timeout_values)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000200 self.network_client = NetworkClient(
Ken'ichi Ohmichia182e862015-01-21 01:16:37 +0000201 self.auth_provider,
202 CONF.network.catalog_type,
203 CONF.network.region or CONF.identity.region,
204 endpoint_type=CONF.network.endpoint_type,
205 build_interval=CONF.network.build_interval,
206 build_timeout=CONF.network.build_timeout,
207 **self.default_params)
John Warren94d8faf2015-09-15 12:22:24 -0400208 self.networks_client = NetworksClient(
209 self.auth_provider,
210 CONF.network.catalog_type,
211 CONF.network.region or CONF.identity.region,
212 endpoint_type=CONF.network.endpoint_type,
213 build_interval=CONF.network.build_interval,
214 build_timeout=CONF.network.build_timeout,
215 **self.default_params)
John Warren3961acd2015-10-02 14:38:53 -0400216 self.subnets_client = SubnetsClient(
217 self.auth_provider,
218 CONF.network.catalog_type,
219 CONF.network.region or CONF.identity.region,
220 endpoint_type=CONF.network.endpoint_type,
221 build_interval=CONF.network.build_interval,
222 build_timeout=CONF.network.build_timeout,
223 **self.default_params)
John Warren49c0fe52015-10-22 12:35:54 -0400224 self.ports_client = PortsClient(
225 self.auth_provider,
226 CONF.network.catalog_type,
227 CONF.network.region or CONF.identity.region,
228 endpoint_type=CONF.network.endpoint_type,
229 build_interval=CONF.network.build_interval,
230 build_timeout=CONF.network.build_timeout,
231 **self.default_params)
John Warrenfbf2a892015-11-17 12:36:14 -0500232 self.floating_ips_client = FloatingIPsClient(
233 self.auth_provider,
234 CONF.network.catalog_type,
235 CONF.network.region or CONF.identity.region,
236 endpoint_type=CONF.network.endpoint_type,
237 build_interval=CONF.network.build_interval,
238 build_timeout=CONF.network.build_timeout,
239 **self.default_params)
John Warren6d0083a2015-11-30 18:12:30 -0500240 self.metering_labels_client = MeteringLabelsClient(
241 self.auth_provider,
242 CONF.network.catalog_type,
243 CONF.network.region or CONF.identity.region,
244 endpoint_type=CONF.network.endpoint_type,
245 build_interval=CONF.network.build_interval,
246 build_timeout=CONF.network.build_timeout,
247 **self.default_params)
John Warrendd20b3e2015-12-03 13:11:28 -0500248 self.metering_label_rules_client = MeteringLabelRulesClient(
249 self.auth_provider,
250 CONF.network.catalog_type,
251 CONF.network.region or CONF.identity.region,
252 endpoint_type=CONF.network.endpoint_type,
253 build_interval=CONF.network.build_interval,
254 build_timeout=CONF.network.build_timeout,
255 **self.default_params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000256 self.messaging_client = MessagingClient(
Ken'ichi Ohmichi2183a652015-01-22 05:00:20 +0000257 self.auth_provider,
258 CONF.messaging.catalog_type,
259 CONF.identity.region,
260 **self.default_params_with_timeout_values)
Sean Daguef3c75912014-11-24 11:45:11 -0500261 if CONF.service_available.ceilometer:
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000262 self.telemetry_client = TelemetryClient(
Ken'ichi Ohmichid5dba1c2015-01-23 02:23:22 +0000263 self.auth_provider,
264 CONF.telemetry.catalog_type,
265 CONF.identity.region,
266 endpoint_type=CONF.telemetry.endpoint_type,
267 **self.default_params_with_timeout_values)
liu-sheng67b730e2015-07-16 15:19:33 +0800268 if CONF.service_available.aodh:
269 self.alarming_client = AlarmingClient(
270 self.auth_provider,
271 CONF.alarming.catalog_type,
272 CONF.identity.region,
273 endpoint_type=CONF.alarming.endpoint_type,
274 **self.default_params_with_timeout_values)
Sean Dague86bd8422013-12-20 09:56:44 -0500275 if CONF.service_available.glance:
Ken'ichi Ohmichi69dcf442015-11-30 11:48:01 +0000276 self.image_client = ImagesClient(
Masayuki Igawabc7e1892015-03-03 11:46:48 +0900277 self.auth_provider,
278 CONF.image.catalog_type,
279 CONF.image.region or CONF.identity.region,
280 endpoint_type=CONF.image.endpoint_type,
281 build_interval=CONF.image.build_interval,
282 build_timeout=CONF.image.build_timeout,
283 **self.default_params)
Ken'ichi Ohmichi69dcf442015-11-30 11:48:01 +0000284 self.image_client_v2 = ImagesClientV2(
Masayuki Igawabc7e1892015-03-03 11:46:48 +0900285 self.auth_provider,
286 CONF.image.catalog_type,
287 CONF.image.region or CONF.identity.region,
288 endpoint_type=CONF.image.endpoint_type,
289 build_interval=CONF.image.build_interval,
290 build_timeout=CONF.image.build_timeout,
291 **self.default_params)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000292 self.orchestration_client = OrchestrationClient(
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +0000293 self.auth_provider,
294 CONF.orchestration.catalog_type,
295 CONF.orchestration.region or CONF.identity.region,
296 endpoint_type=CONF.orchestration.endpoint_type,
297 build_interval=CONF.orchestration.build_interval,
298 build_timeout=CONF.orchestration.build_timeout,
299 **self.default_params)
Ken'ichi Ohmichi4e83b5e2015-02-13 04:07:34 +0000300 self.data_processing_client = DataProcessingClient(
301 self.auth_provider,
302 CONF.data_processing.catalog_type,
303 CONF.identity.region,
304 endpoint_type=CONF.data_processing.endpoint_type,
305 **self.default_params_with_timeout_values)
Ken'ichi Ohmichib38eb002015-01-23 02:35:01 +0000306 self.negative_client = negative_rest_client.NegativeRestClient(
David Kranz1e33e372015-03-20 09:42:56 -0400307 self.auth_provider, service, **self.default_params)
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +0000308
Andrea Frittoli32d74992015-03-06 17:01:07 +0000309 # Generating EC2 credentials in tempest is only supported
310 # with identity v2
311 if CONF.identity_feature_enabled.api_v2 and \
312 CONF.identity.auth_version == 'v2':
nayna-patel1dfbedb2015-08-04 11:07:56 +0000313 # EC2 and S3 clients, if used, will check configured AWS
314 # credentials and generate new ones if needed
Andrea Frittoli32d74992015-03-06 17:01:07 +0000315 self.ec2api_client = botoclients.APIClientEC2(self.identity_client)
316 self.s3_client = botoclients.ObjectClientS3(self.identity_client)
Jay Pipes50677282012-01-06 15:39:20 -0500317
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000318 def _set_compute_clients(self):
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000319 params = {
320 'service': CONF.compute.catalog_type,
321 'region': CONF.compute.region or CONF.identity.region,
322 'endpoint_type': CONF.compute.endpoint_type,
323 'build_interval': CONF.compute.build_interval,
324 'build_timeout': CONF.compute.build_timeout
325 }
326 params.update(self.default_params)
327
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000328 self.agents_client = AgentsClient(self.auth_provider, **params)
John Warren9487a182015-09-14 18:12:56 -0400329 self.compute_networks_client = ComputeNetworksClient(
330 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000331 self.migrations_client = MigrationsClient(self.auth_provider,
332 **params)
Ken'ichi Ohmichi65225ef2014-11-19 01:06:25 +0000333 self.security_group_default_rules_client = (
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000334 SecurityGroupDefaultRulesClient(self.auth_provider, **params))
335 self.certificates_client = CertificatesClient(self.auth_provider,
336 **params)
337 self.servers_client = ServersClient(
Masayuki Igawa8f9c0c82015-03-03 09:38:08 +0900338 self.auth_provider,
339 enable_instance_password=CONF.compute_feature_enabled
340 .enable_instance_password,
341 **params)
Ken'ichi Ohmichi7ca54b82015-07-07 01:10:26 +0000342 self.server_groups_client = ServerGroupsClient(
343 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000344 self.limits_client = LimitsClient(self.auth_provider, **params)
Ken'ichi Ohmichi69dcf442015-11-30 11:48:01 +0000345 self.images_client = ComputeImagesClient(self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000346 self.keypairs_client = KeyPairsClient(self.auth_provider, **params)
347 self.quotas_client = QuotasClient(self.auth_provider, **params)
348 self.quota_classes_client = QuotaClassesClient(self.auth_provider,
349 **params)
350 self.flavors_client = FlavorsClient(self.auth_provider, **params)
351 self.extensions_client = ExtensionsClient(self.auth_provider,
352 **params)
Ken'ichi Ohmichif5767702015-07-29 23:39:10 +0000353 self.floating_ip_pools_client = FloatingIPPoolsClient(
Ken'ichi Ohmichi03af1c52015-07-13 00:28:05 +0000354 self.auth_provider, **params)
Ken'ichi Ohmichif5767702015-07-29 23:39:10 +0000355 self.floating_ips_bulk_client = FloatingIPsBulkClient(
Ken'ichi Ohmichi2b26e752015-07-13 00:44:36 +0000356 self.auth_provider, **params)
John Warrene74890a2015-11-11 15:18:01 -0500357 self.compute_floating_ips_client = ComputeFloatingIPsClient(
358 self.auth_provider, **params)
Ken'ichi Ohmichi685cd172015-07-13 01:29:57 +0000359 self.security_group_rules_client = SecurityGroupRulesClient(
360 self.auth_provider, **params)
John Warrenf2345512015-12-10 13:39:30 -0500361 self.compute_security_groups_client = ComputeSecurityGroupsClient(
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000362 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000363 self.interfaces_client = InterfacesClient(self.auth_provider,
364 **params)
365 self.fixed_ips_client = FixedIPsClient(self.auth_provider,
366 **params)
367 self.availability_zone_client = AvailabilityZoneClient(
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000368 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000369 self.aggregates_client = AggregatesClient(self.auth_provider,
370 **params)
371 self.services_client = ServicesClient(self.auth_provider, **params)
372 self.tenant_usages_client = TenantUsagesClient(self.auth_provider,
373 **params)
374 self.hosts_client = HostsClient(self.auth_provider, **params)
375 self.hypervisor_client = HypervisorClient(self.auth_provider,
376 **params)
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000377 self.instance_usages_audit_log_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000378 InstanceUsagesAuditLogClient(self.auth_provider, **params)
Ken'ichi Ohmichic3dfdb22015-01-22 04:39:58 +0000379 self.tenant_networks_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000380 TenantNetworksClient(self.auth_provider, **params)
381 self.baremetal_nodes_client = BaremetalNodesClient(
YuikoTakadaac0879a2015-01-22 02:40:03 +0000382 self.auth_provider, **params)
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000383
384 # NOTE: The following client needs special timeout values because
385 # the API is a proxy for the other component.
386 params_volume = copy.deepcopy(params)
387 params_volume.update({
388 'build_interval': CONF.volume.build_interval,
389 'build_timeout': CONF.volume.build_timeout
390 })
Ken'ichi Ohmichiea3f26a2015-09-29 00:18:39 +0000391 self.volumes_extensions_client = ComputeVolumesClient(
Ken'ichi Ohmichic4921782015-08-05 08:14:42 +0000392 self.auth_provider, **params_volume)
Ken'ichi Ohmichi2b6012b2015-09-03 01:56:19 +0000393 self.compute_versions_client = VersionsClient(self.auth_provider,
394 **params_volume)
Ken'ichi Ohmichib7e27302015-09-29 00:11:20 +0000395 self.snapshots_extensions_client = ComputeSnapshotsClient(
Gaozexub9c9d6e2015-09-10 17:08:04 +0800396 self.auth_provider, **params_volume)
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000397
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000398 def _set_database_clients(self):
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000399 self.database_flavors_client = DatabaseFlavorsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000400 self.auth_provider,
401 CONF.database.catalog_type,
402 CONF.identity.region,
403 **self.default_params_with_timeout_values)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000404 self.database_limits_client = DatabaseLimitsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000405 self.auth_provider,
406 CONF.database.catalog_type,
407 CONF.identity.region,
408 **self.default_params_with_timeout_values)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000409 self.database_versions_client = DatabaseVersionsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000410 self.auth_provider,
411 CONF.database.catalog_type,
412 CONF.identity.region,
413 **self.default_params_with_timeout_values)
414
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000415 def _set_identity_clients(self):
ghanshyamd26b5cd2015-02-09 14:48:58 +0900416 params = {
417 'service': CONF.identity.catalog_type,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300418 'region': CONF.identity.region
ghanshyamd26b5cd2015-02-09 14:48:58 +0900419 }
420 params.update(self.default_params_with_timeout_values)
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300421 params_v2_admin = params.copy()
422 params_v2_admin['endpoint_type'] = CONF.identity.v2_admin_endpoint_type
423 # Client uses admin endpoint type of Keystone API v2
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000424 self.identity_client = IdentityClient(self.auth_provider,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300425 **params_v2_admin)
426 params_v2_public = params.copy()
427 params_v2_public['endpoint_type'] = (
428 CONF.identity.v2_public_endpoint_type)
429 # Client uses public endpoint type of Keystone API v2
430 self.identity_public_client = IdentityClient(self.auth_provider,
431 **params_v2_public)
432 params_v3 = params.copy()
433 params_v3['endpoint_type'] = CONF.identity.v3_endpoint_type
Yaroslav Lobankov425ea1e2015-11-20 12:28:39 +0300434 # Clients below use the endpoint type of Keystone API v3
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000435 self.identity_v3_client = IdentityV3Client(self.auth_provider,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300436 **params_v3)
Yaroslav Lobankov425ea1e2015-11-20 12:28:39 +0300437 self.endpoints_client = EndPointV3Client(self.auth_provider,
438 **params_v3)
439 self.service_client = ServiceV3Client(self.auth_provider, **params_v3)
440 self.policy_client = PolicyV3Client(self.auth_provider, **params_v3)
441 self.region_client = RegionV3Client(self.auth_provider, **params_v3)
442 self.credentials_client = CredentialsV3Client(self.auth_provider,
443 **params_v3)
444 self.groups_client = GroupsV3Client(self.auth_provider, **params_v3)
Andrea Frittoli90012352015-02-25 21:58:02 +0000445 # Token clients do not use the catalog. They only need default_params.
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100446 # They read auth_url, so they should only be set if the corresponding
447 # API version is marked as enabled
448 if CONF.identity_feature_enabled.api_v2:
449 if CONF.identity.uri:
Ken'ichi Ohmichi5f80ce32015-09-10 23:51:14 +0000450 self.token_client = TokenClient(
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100451 CONF.identity.uri, **self.default_params)
452 else:
453 msg = 'Identity v2 API enabled, but no identity.uri set'
454 raise exceptions.InvalidConfiguration(msg)
Ken'ichi Ohmichi41951b02014-11-19 01:57:43 +0000455 if CONF.identity_feature_enabled.api_v3:
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100456 if CONF.identity.uri_v3:
Ken'ichi Ohmichi5f80ce32015-09-10 23:51:14 +0000457 self.token_v3_client = V3TokenClient(
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100458 CONF.identity.uri_v3, **self.default_params)
459 else:
460 msg = 'Identity v3 API enabled, but no identity.uri_v3 set'
461 raise exceptions.InvalidConfiguration(msg)
Ken'ichi Ohmichi41951b02014-11-19 01:57:43 +0000462
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000463 def _set_volume_clients(self):
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000464 params = {
465 'service': CONF.volume.catalog_type,
466 'region': CONF.volume.region or CONF.identity.region,
467 'endpoint_type': CONF.volume.endpoint_type,
468 'build_interval': CONF.volume.build_interval,
469 'build_timeout': CONF.volume.build_timeout
470 }
471 params.update(self.default_params)
472
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000473 self.volume_qos_client = QosSpecsClient(self.auth_provider,
474 **params)
475 self.volume_qos_v2_client = QosSpecsV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000476 self.auth_provider, **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300477 self.volume_services_client = VolumeServicesClient(
478 self.auth_provider, **params)
479 self.volume_services_v2_client = VolumeServicesV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000480 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000481 self.backups_client = BackupsClient(self.auth_provider, **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300482 self.backups_v2_client = BackupsV2Client(self.auth_provider,
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000483 **params)
484 self.snapshots_client = SnapshotsClient(self.auth_provider,
485 **params)
486 self.snapshots_v2_client = SnapshotsV2Client(self.auth_provider,
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000487 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000488 self.volumes_client = VolumesClient(
Ken'ichi Ohmichi234da802015-02-13 04:48:06 +0000489 self.auth_provider, default_volume_size=CONF.volume.volume_size,
490 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000491 self.volumes_v2_client = VolumesV2Client(
Ken'ichi Ohmichi234da802015-02-13 04:48:06 +0000492 self.auth_provider, default_volume_size=CONF.volume.volume_size,
493 **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000494 self.volume_types_client = VolumeTypesClient(self.auth_provider,
495 **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300496 self.volume_types_v2_client = VolumeTypesV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000497 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000498 self.volume_hosts_client = VolumeHostsClient(self.auth_provider,
499 **params)
500 self.volume_hosts_v2_client = VolumeHostsV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000501 self.auth_provider, **params)
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000502 self.volume_quotas_client = VolumeQuotasClient(self.auth_provider,
503 **params)
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000504 self.volume_quotas_v2_client = VolumeQuotasV2Client(self.auth_provider,
505 **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300506 self.volumes_extension_client = VolumeExtensionsClient(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000507 self.auth_provider, **params)
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300508 self.volumes_v2_extension_client = VolumeExtensionsV2Client(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000509 self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000510 self.volume_availability_zone_client = \
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000511 VolumeAvailabilityZoneClient(self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000512 self.volume_v2_availability_zone_client = \
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300513 VolumeAvailabilityZoneV2Client(self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000514
Ken'ichi Ohmichic95eb852015-01-22 01:57:57 +0000515 def _set_object_storage_clients(self):
Ken'ichi Ohmichi564b2ad2015-01-22 02:08:59 +0000516 params = {
517 'service': CONF.object_storage.catalog_type,
518 'region': CONF.object_storage.region or CONF.identity.region,
519 'endpoint_type': CONF.object_storage.endpoint_type
520 }
521 params.update(self.default_params_with_timeout_values)
522
523 self.account_client = AccountClient(self.auth_provider, **params)
524 self.container_client = ContainerClient(self.auth_provider, **params)
525 self.object_client = ObjectClient(self.auth_provider, **params)