blob: b7bc4fab94701d82f83486904cf65f0a00e01200 [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)76a4b4e2016-06-14 23:28:16 +010023from tempest.lib.services import compute
Andrea Frittoli (andreaf)fa991be2016-06-17 11:46:14 +010024from tempest.lib.services import network
Andrea Frittolif9cde7e2014-02-18 09:57:04 +000025from tempest import manager
Andrea Frittoli (andreaf)c33486f2016-06-17 12:22:08 +010026from tempest.services import baremetal
27from tempest.services import data_processing
28from tempest.services import database
Andrea Frittoli (andreaf)6cb6b132016-06-17 11:39:10 +010029from tempest.services import identity
Andrea Frittoli (andreaf)26300f92016-06-17 12:14:00 +010030from tempest.services import image
Andrea Frittoli (andreaf)9a225432016-06-17 12:16:22 +010031from tempest.services import object_storage
Andrea Frittoli (andreaf)c33486f2016-06-17 12:22:08 +010032from tempest.services import orchestration
Andrea Frittoli (andreaf)14ecae12016-06-17 11:56:24 +010033from tempest.services import volume
Vincent Hou6b8a7b72012-08-25 01:24:33 +080034
Sean Dague86bd8422013-12-20 09:56:44 -050035CONF = config.CONF
Jay Pipes3f981df2012-03-27 18:59:44 -040036LOG = logging.getLogger(__name__)
37
Vincent Hou6b8a7b72012-08-25 01:24:33 +080038
Andrea Frittolif9cde7e2014-02-18 09:57:04 +000039class Manager(manager.Manager):
Ken'ichi Ohmichi2e2ee192015-11-19 09:48:27 +000040 """Top level manager for OpenStack tempest clients"""
Jay Pipes3f981df2012-03-27 18:59:44 -040041
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +000042 default_params = {
43 'disable_ssl_certificate_validation':
44 CONF.identity.disable_ssl_certificate_validation,
45 'ca_certs': CONF.identity.ca_certificates_file,
46 'trace_requests': CONF.debug.trace_requests
47 }
48
Ken'ichi Ohmichi737a6032015-01-21 07:04:42 +000049 # NOTE: Tempest uses timeout values of compute API if project specific
50 # timeout values don't exist.
51 default_params_with_timeout_values = {
52 'build_interval': CONF.compute.build_interval,
53 'build_timeout': CONF.compute.build_timeout
54 }
55 default_params_with_timeout_values.update(default_params)
56
Andrea Frittoli (andreaf)3e82af72016-05-05 22:53:38 +010057 def __init__(self, credentials, service=None, scope='project'):
ghanshyam4e2be342015-11-27 18:07:46 +090058 """Initialization of Manager class.
Brant Knudsonc7ca3342013-03-28 21:08:50 -050059
ghanshyam4e2be342015-11-27 18:07:46 +090060 Setup all services clients and make them available for tests cases.
61 :param credentials: type Credentials or TestResources
62 :param service: Service name
Andrea Frittoli (andreaf)3e82af72016-05-05 22:53:38 +010063 :param scope: default scope for tokens produced by the auth provider
ghanshyam4e2be342015-11-27 18:07:46 +090064 """
Andrea Frittoli (andreaf)3e82af72016-05-05 22:53:38 +010065 super(Manager, self).__init__(credentials=credentials, scope=scope)
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +000066 self._set_compute_clients()
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +000067 self._set_database_clients()
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +000068 self._set_identity_clients()
69 self._set_volume_clients()
Ken'ichi Ohmichic95eb852015-01-22 01:57:57 +000070 self._set_object_storage_clients()
Andrea Frittoli (andreaf)591e8542016-06-07 18:31:39 +010071 self._set_image_clients()
Andrea Frittoli (andreaf)11e1e882016-06-07 18:35:58 +010072 self._set_network_clients()
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +000073
Andrea Frittoli (andreaf)c33486f2016-06-17 12:22:08 +010074 self.baremetal_client = baremetal.BaremetalClient(
Ken'ichi Ohmichi1f88ece2015-01-23 03:33:11 +000075 self.auth_provider,
76 CONF.baremetal.catalog_type,
77 CONF.identity.region,
78 endpoint_type=CONF.baremetal.endpoint_type,
79 **self.default_params_with_timeout_values)
Andrea Frittoli (andreaf)c33486f2016-06-17 12:22:08 +010080 self.orchestration_client = orchestration.OrchestrationClient(
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +000081 self.auth_provider,
82 CONF.orchestration.catalog_type,
83 CONF.orchestration.region or CONF.identity.region,
84 endpoint_type=CONF.orchestration.endpoint_type,
85 build_interval=CONF.orchestration.build_interval,
86 build_timeout=CONF.orchestration.build_timeout,
87 **self.default_params)
Andrea Frittoli (andreaf)c33486f2016-06-17 12:22:08 +010088 self.data_processing_client = data_processing.DataProcessingClient(
Ken'ichi Ohmichi4e83b5e2015-02-13 04:07:34 +000089 self.auth_provider,
90 CONF.data_processing.catalog_type,
91 CONF.identity.region,
92 endpoint_type=CONF.data_processing.endpoint_type,
93 **self.default_params_with_timeout_values)
Ken'ichi Ohmichib38eb002015-01-23 02:35:01 +000094 self.negative_client = negative_rest_client.NegativeRestClient(
David Kranz1e33e372015-03-20 09:42:56 -040095 self.auth_provider, service, **self.default_params)
Ken'ichi Ohmichic2b11ce2015-01-16 07:17:29 +000096
Andrea Frittoli (andreaf)11e1e882016-06-07 18:35:58 +010097 def _set_network_clients(self):
98 params = {
99 'service': CONF.network.catalog_type,
100 'region': CONF.network.region or CONF.identity.region,
101 'endpoint_type': CONF.network.endpoint_type,
102 'build_interval': CONF.network.build_interval,
103 'build_timeout': CONF.network.build_timeout
104 }
105 params.update(self.default_params)
Andrea Frittoli (andreaf)fa991be2016-06-17 11:46:14 +0100106 self.network_agents_client = network.AgentsClient(
Andrea Frittoli (andreaf)11e1e882016-06-07 18:35:58 +0100107 self.auth_provider, **params)
Andrea Frittoli (andreaf)fa991be2016-06-17 11:46:14 +0100108 self.network_extensions_client = network.ExtensionsClient(
Andrea Frittoli (andreaf)11e1e882016-06-07 18:35:58 +0100109 self.auth_provider, **params)
Andrea Frittoli (andreaf)fa991be2016-06-17 11:46:14 +0100110 self.networks_client = network.NetworksClient(
Andrea Frittoli (andreaf)11e1e882016-06-07 18:35:58 +0100111 self.auth_provider, **params)
Andrea Frittoli (andreaf)fa991be2016-06-17 11:46:14 +0100112 self.subnetpools_client = network.SubnetpoolsClient(
Andrea Frittoli (andreaf)11e1e882016-06-07 18:35:58 +0100113 self.auth_provider, **params)
Andrea Frittoli (andreaf)fa991be2016-06-17 11:46:14 +0100114 self.subnets_client = network.SubnetsClient(
Andrea Frittoli (andreaf)11e1e882016-06-07 18:35:58 +0100115 self.auth_provider, **params)
Andrea Frittoli (andreaf)fa991be2016-06-17 11:46:14 +0100116 self.ports_client = network.PortsClient(
Andrea Frittoli (andreaf)11e1e882016-06-07 18:35:58 +0100117 self.auth_provider, **params)
Andrea Frittoli (andreaf)fa991be2016-06-17 11:46:14 +0100118 self.network_quotas_client = network.QuotasClient(
Andrea Frittoli (andreaf)11e1e882016-06-07 18:35:58 +0100119 self.auth_provider, **params)
Andrea Frittoli (andreaf)fa991be2016-06-17 11:46:14 +0100120 self.floating_ips_client = network.FloatingIPsClient(
Andrea Frittoli (andreaf)11e1e882016-06-07 18:35:58 +0100121 self.auth_provider, **params)
Andrea Frittoli (andreaf)fa991be2016-06-17 11:46:14 +0100122 self.metering_labels_client = network.MeteringLabelsClient(
Andrea Frittoli (andreaf)11e1e882016-06-07 18:35:58 +0100123 self.auth_provider, **params)
Andrea Frittoli (andreaf)fa991be2016-06-17 11:46:14 +0100124 self.metering_label_rules_client = network.MeteringLabelRulesClient(
Andrea Frittoli (andreaf)11e1e882016-06-07 18:35:58 +0100125 self.auth_provider, **params)
Andrea Frittoli (andreaf)fa991be2016-06-17 11:46:14 +0100126 self.routers_client = network.RoutersClient(
Andrea Frittoli (andreaf)11e1e882016-06-07 18:35:58 +0100127 self.auth_provider, **params)
Andrea Frittoli (andreaf)fa991be2016-06-17 11:46:14 +0100128 self.security_group_rules_client = network.SecurityGroupRulesClient(
Andrea Frittoli (andreaf)11e1e882016-06-07 18:35:58 +0100129 self.auth_provider, **params)
Andrea Frittoli (andreaf)fa991be2016-06-17 11:46:14 +0100130 self.security_groups_client = network.SecurityGroupsClient(
Andrea Frittoli (andreaf)11e1e882016-06-07 18:35:58 +0100131 self.auth_provider, **params)
Andrea Frittoli (andreaf)fa991be2016-06-17 11:46:14 +0100132 self.network_versions_client = network.NetworkVersionsClient(
Mark T. Voelkerabd4cbd2016-04-29 12:03:04 -0500133 self.auth_provider, **params)
Andrea Frittoli (andreaf)11e1e882016-06-07 18:35:58 +0100134
Andrea Frittoli (andreaf)591e8542016-06-07 18:31:39 +0100135 def _set_image_clients(self):
136 params = {
137 'service': CONF.image.catalog_type,
138 'region': CONF.image.region or CONF.identity.region,
139 'endpoint_type': CONF.image.endpoint_type,
140 'build_interval': CONF.image.build_interval,
141 'build_timeout': CONF.image.build_timeout
142 }
143 params.update(self.default_params)
144
145 if CONF.service_available.glance:
Andrea Frittoli (andreaf)26300f92016-06-17 12:14:00 +0100146 self.image_client = image.v1.ImagesClient(
Andrea Frittoli (andreaf)591e8542016-06-07 18:31:39 +0100147 self.auth_provider, **params)
Andrea Frittoli (andreaf)26300f92016-06-17 12:14:00 +0100148 self.image_member_client = image.v1.ImageMembersClient(
Andrea Frittoli (andreaf)591e8542016-06-07 18:31:39 +0100149 self.auth_provider, **params)
Andrea Frittoli (andreaf)26300f92016-06-17 12:14:00 +0100150 self.image_client_v2 = image.v2.ImagesClient(
Andrea Frittoli (andreaf)591e8542016-06-07 18:31:39 +0100151 self.auth_provider, **params)
Andrea Frittoli (andreaf)26300f92016-06-17 12:14:00 +0100152 self.image_member_client_v2 = image.v2.ImageMembersClient(
Andrea Frittoli (andreaf)591e8542016-06-07 18:31:39 +0100153 self.auth_provider, **params)
Andrea Frittoli (andreaf)26300f92016-06-17 12:14:00 +0100154 self.namespaces_client = image.v2.NamespacesClient(
Andrea Frittoli (andreaf)591e8542016-06-07 18:31:39 +0100155 self.auth_provider, **params)
Andrea Frittoli (andreaf)26300f92016-06-17 12:14:00 +0100156 self.resource_types_client = image.v2.ResourceTypesClient(
Andrea Frittoli (andreaf)591e8542016-06-07 18:31:39 +0100157 self.auth_provider, **params)
Andrea Frittoli (andreaf)26300f92016-06-17 12:14:00 +0100158 self.schemas_client = image.v2.SchemasClient(
Andrea Frittoli (andreaf)591e8542016-06-07 18:31:39 +0100159 self.auth_provider, **params)
160
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000161 def _set_compute_clients(self):
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000162 params = {
163 'service': CONF.compute.catalog_type,
164 'region': CONF.compute.region or CONF.identity.region,
165 'endpoint_type': CONF.compute.endpoint_type,
166 'build_interval': CONF.compute.build_interval,
167 'build_timeout': CONF.compute.build_timeout
168 }
169 params.update(self.default_params)
170
Andrea Frittoli (andreaf)76a4b4e2016-06-14 23:28:16 +0100171 self.agents_client = compute.AgentsClient(self.auth_provider, **params)
172 self.compute_networks_client = compute.NetworksClient(
John Warren9487a182015-09-14 18:12:56 -0400173 self.auth_provider, **params)
Andrea Frittoli (andreaf)76a4b4e2016-06-14 23:28:16 +0100174 self.migrations_client = compute.MigrationsClient(self.auth_provider,
175 **params)
Ken'ichi Ohmichi65225ef2014-11-19 01:06:25 +0000176 self.security_group_default_rules_client = (
Andrea Frittoli (andreaf)76a4b4e2016-06-14 23:28:16 +0100177 compute.SecurityGroupDefaultRulesClient(self.auth_provider,
178 **params))
179 self.certificates_client = compute.CertificatesClient(
180 self.auth_provider, **params)
181 self.servers_client = compute.ServersClient(
Masayuki Igawa8f9c0c82015-03-03 09:38:08 +0900182 self.auth_provider,
183 enable_instance_password=CONF.compute_feature_enabled
184 .enable_instance_password,
185 **params)
Andrea Frittoli (andreaf)76a4b4e2016-06-14 23:28:16 +0100186 self.server_groups_client = compute.ServerGroupsClient(
Ken'ichi Ohmichi7ca54b82015-07-07 01:10:26 +0000187 self.auth_provider, **params)
Andrea Frittoli (andreaf)76a4b4e2016-06-14 23:28:16 +0100188 self.limits_client = compute.LimitsClient(self.auth_provider, **params)
189 self.compute_images_client = compute.ImagesClient(self.auth_provider,
190 **params)
191 self.keypairs_client = compute.KeyPairsClient(self.auth_provider,
192 **params)
193 self.quotas_client = compute.QuotasClient(self.auth_provider, **params)
194 self.quota_classes_client = compute.QuotaClassesClient(
195 self.auth_provider, **params)
196 self.flavors_client = compute.FlavorsClient(self.auth_provider,
197 **params)
198 self.extensions_client = compute.ExtensionsClient(self.auth_provider,
199 **params)
200 self.floating_ip_pools_client = compute.FloatingIPPoolsClient(
201 self.auth_provider, **params)
202 self.floating_ips_bulk_client = compute.FloatingIPsBulkClient(
203 self.auth_provider, **params)
204 self.compute_floating_ips_client = compute.FloatingIPsClient(
205 self.auth_provider, **params)
206 self.compute_security_group_rules_client = (
207 compute.SecurityGroupRulesClient(self.auth_provider, **params))
208 self.compute_security_groups_client = compute.SecurityGroupsClient(
209 self.auth_provider, **params)
210 self.interfaces_client = compute.InterfacesClient(self.auth_provider,
211 **params)
212 self.fixed_ips_client = compute.FixedIPsClient(self.auth_provider,
Ken'ichi Ohmichia6287072015-07-02 02:43:15 +0000213 **params)
Andrea Frittoli (andreaf)76a4b4e2016-06-14 23:28:16 +0100214 self.availability_zone_client = compute.AvailabilityZoneClient(
Ken'ichi Ohmichi03af1c52015-07-13 00:28:05 +0000215 self.auth_provider, **params)
Andrea Frittoli (andreaf)76a4b4e2016-06-14 23:28:16 +0100216 self.aggregates_client = compute.AggregatesClient(self.auth_provider,
217 **params)
218 self.services_client = compute.ServicesClient(self.auth_provider,
219 **params)
220 self.tenant_usages_client = compute.TenantUsagesClient(
Ken'ichi Ohmichi2b26e752015-07-13 00:44:36 +0000221 self.auth_provider, **params)
Andrea Frittoli (andreaf)76a4b4e2016-06-14 23:28:16 +0100222 self.hosts_client = compute.HostsClient(self.auth_provider, **params)
223 self.hypervisor_client = compute.HypervisorClient(self.auth_provider,
224 **params)
225 self.instance_usages_audit_log_client = (
226 compute.InstanceUsagesAuditLogClient(self.auth_provider, **params))
227 self.tenant_networks_client = compute.TenantNetworksClient(
John Warrene74890a2015-11-11 15:18:01 -0500228 self.auth_provider, **params)
Andrea Frittoli (andreaf)76a4b4e2016-06-14 23:28:16 +0100229 self.baremetal_nodes_client = compute.BaremetalNodesClient(
YuikoTakadaac0879a2015-01-22 02:40:03 +0000230 self.auth_provider, **params)
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000231
232 # NOTE: The following client needs special timeout values because
233 # the API is a proxy for the other component.
234 params_volume = copy.deepcopy(params)
235 params_volume.update({
236 'build_interval': CONF.volume.build_interval,
237 'build_timeout': CONF.volume.build_timeout
238 })
Andrea Frittoli (andreaf)76a4b4e2016-06-14 23:28:16 +0100239 self.volumes_extensions_client = compute.VolumesClient(
Ken'ichi Ohmichic4921782015-08-05 08:14:42 +0000240 self.auth_provider, **params_volume)
Andrea Frittoli (andreaf)76a4b4e2016-06-14 23:28:16 +0100241 self.compute_versions_client = compute.VersionsClient(
242 self.auth_provider, **params_volume)
243 self.snapshots_extensions_client = compute.SnapshotsClient(
Gaozexub9c9d6e2015-09-10 17:08:04 +0800244 self.auth_provider, **params_volume)
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000245
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000246 def _set_database_clients(self):
Andrea Frittoli (andreaf)c33486f2016-06-17 12:22:08 +0100247 self.database_flavors_client = database.DatabaseFlavorsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000248 self.auth_provider,
249 CONF.database.catalog_type,
250 CONF.identity.region,
251 **self.default_params_with_timeout_values)
Andrea Frittoli (andreaf)c33486f2016-06-17 12:22:08 +0100252 self.database_limits_client = database.DatabaseLimitsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000253 self.auth_provider,
254 CONF.database.catalog_type,
255 CONF.identity.region,
256 **self.default_params_with_timeout_values)
Andrea Frittoli (andreaf)c33486f2016-06-17 12:22:08 +0100257 self.database_versions_client = database.DatabaseVersionsClient(
ravikumar-venkatesan9e81b442014-12-08 09:57:56 +0000258 self.auth_provider,
259 CONF.database.catalog_type,
260 CONF.identity.region,
261 **self.default_params_with_timeout_values)
262
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000263 def _set_identity_clients(self):
ghanshyamd26b5cd2015-02-09 14:48:58 +0900264 params = {
265 'service': CONF.identity.catalog_type,
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300266 'region': CONF.identity.region
ghanshyamd26b5cd2015-02-09 14:48:58 +0900267 }
268 params.update(self.default_params_with_timeout_values)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300269
270 # Clients below use the admin endpoint type of Keystone API v2
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300271 params_v2_admin = params.copy()
272 params_v2_admin['endpoint_type'] = CONF.identity.v2_admin_endpoint_type
Andrea Frittoli (andreaf)6cb6b132016-06-17 11:39:10 +0100273 self.endpoints_client = identity.v2.EndpointsClient(self.auth_provider,
274 **params_v2_admin)
275 self.identity_client = identity.v2.IdentityClient(self.auth_provider,
276 **params_v2_admin)
277 self.tenants_client = identity.v2.TenantsClient(self.auth_provider,
278 **params_v2_admin)
279 self.roles_client = identity.v2.RolesClient(self.auth_provider,
280 **params_v2_admin)
281 self.users_client = identity.v2.UsersClient(self.auth_provider,
282 **params_v2_admin)
283 self.identity_services_client = identity.v2.ServicesClient(
Yaroslav Lobankovf6906e12016-02-26 19:44:53 -0600284 self.auth_provider, **params_v2_admin)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300285
286 # Clients below use the public endpoint type of Keystone API v2
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300287 params_v2_public = params.copy()
288 params_v2_public['endpoint_type'] = (
289 CONF.identity.v2_public_endpoint_type)
Andrea Frittoli (andreaf)6cb6b132016-06-17 11:39:10 +0100290 self.identity_public_client = identity.v2.IdentityClient(
291 self.auth_provider, **params_v2_public)
292 self.tenants_public_client = identity.v2.TenantsClient(
293 self.auth_provider, **params_v2_public)
294 self.users_public_client = identity.v2.UsersClient(
295 self.auth_provider, **params_v2_public)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300296
297 # Clients below use the endpoint type of Keystone API v3
Jane Zadorozhnac7862132015-07-10 14:34:50 +0300298 params_v3 = params.copy()
299 params_v3['endpoint_type'] = CONF.identity.v3_endpoint_type
Andrea Frittoli (andreaf)6cb6b132016-06-17 11:39:10 +0100300 self.domains_client = identity.v3.DomainsClient(self.auth_provider,
301 **params_v3)
302 self.identity_v3_client = identity.v3.IdentityClient(
Yaroslav Lobankov69d90562015-12-18 12:06:40 +0300303 self.auth_provider, **params_v3)
Andrea Frittoli (andreaf)6cb6b132016-06-17 11:39:10 +0100304 self.trusts_client = identity.v3.TrustsClient(self.auth_provider,
305 **params_v3)
306 self.users_v3_client = identity.v3.UsersClient(self.auth_provider,
307 **params_v3)
308 self.endpoints_v3_client = identity.v3.EndPointsClient(
309 self.auth_provider, **params_v3)
310 self.roles_v3_client = identity.v3.RolesClient(self.auth_provider,
311 **params_v3)
312 self.identity_services_v3_client = identity.v3.ServicesClient(
313 self.auth_provider, **params_v3)
314 self.policies_client = identity.v3.PoliciesClient(self.auth_provider,
315 **params_v3)
316 self.projects_client = identity.v3.ProjectsClient(self.auth_provider,
317 **params_v3)
318 self.regions_client = identity.v3.RegionsClient(self.auth_provider,
319 **params_v3)
320 self.credentials_client = identity.v3.CredentialsClient(
321 self.auth_provider, **params_v3)
322 self.groups_client = identity.v3.GroupsClient(self.auth_provider,
323 **params_v3)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300324
Andrea Frittoli90012352015-02-25 21:58:02 +0000325 # Token clients do not use the catalog. They only need default_params.
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100326 # They read auth_url, so they should only be set if the corresponding
327 # API version is marked as enabled
328 if CONF.identity_feature_enabled.api_v2:
329 if CONF.identity.uri:
Andrea Frittoli (andreaf)6cb6b132016-06-17 11:39:10 +0100330 self.token_client = identity.v2.TokenClient(
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100331 CONF.identity.uri, **self.default_params)
332 else:
333 msg = 'Identity v2 API enabled, but no identity.uri set'
334 raise exceptions.InvalidConfiguration(msg)
Ken'ichi Ohmichi41951b02014-11-19 01:57:43 +0000335 if CONF.identity_feature_enabled.api_v3:
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100336 if CONF.identity.uri_v3:
Andrea Frittoli (andreaf)6cb6b132016-06-17 11:39:10 +0100337 self.token_v3_client = identity.v3.V3TokenClient(
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100338 CONF.identity.uri_v3, **self.default_params)
339 else:
340 msg = 'Identity v3 API enabled, but no identity.uri_v3 set'
341 raise exceptions.InvalidConfiguration(msg)
Ken'ichi Ohmichi41951b02014-11-19 01:57:43 +0000342
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000343 def _set_volume_clients(self):
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000344 params = {
345 'service': CONF.volume.catalog_type,
346 'region': CONF.volume.region or CONF.identity.region,
347 'endpoint_type': CONF.volume.endpoint_type,
348 'build_interval': CONF.volume.build_interval,
349 'build_timeout': CONF.volume.build_timeout
350 }
351 params.update(self.default_params)
352
Andrea Frittoli (andreaf)14ecae12016-06-17 11:56:24 +0100353 self.volume_qos_client = volume.v1.QosSpecsClient(self.auth_provider,
354 **params)
355 self.volume_qos_v2_client = volume.v2.QosSpecsClient(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000356 self.auth_provider, **params)
Andrea Frittoli (andreaf)14ecae12016-06-17 11:56:24 +0100357 self.volume_services_client = volume.v1.ServicesClient(
Yaroslav Lobankov4c237792015-12-02 18:43:48 +0300358 self.auth_provider, **params)
Andrea Frittoli (andreaf)14ecae12016-06-17 11:56:24 +0100359 self.volume_services_v2_client = volume.v2.ServicesClient(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000360 self.auth_provider, **params)
Andrea Frittoli (andreaf)14ecae12016-06-17 11:56:24 +0100361 self.backups_client = volume.v1.BackupsClient(self.auth_provider,
362 **params)
363 self.backups_v2_client = volume.v2.BackupsClient(self.auth_provider,
364 **params)
365 self.snapshots_client = volume.v1.SnapshotsClient(self.auth_provider,
366 **params)
367 self.snapshots_v2_client = volume.v2.SnapshotsClient(
368 self.auth_provider, **params)
369 self.volumes_client = volume.v1.VolumesClient(
Ken'ichi Ohmichi234da802015-02-13 04:48:06 +0000370 self.auth_provider, default_volume_size=CONF.volume.volume_size,
371 **params)
Andrea Frittoli (andreaf)14ecae12016-06-17 11:56:24 +0100372 self.volumes_v2_client = volume.v2.VolumesClient(
Ken'ichi Ohmichi234da802015-02-13 04:48:06 +0000373 self.auth_provider, default_volume_size=CONF.volume.volume_size,
374 **params)
Andrea Frittoli (andreaf)14ecae12016-06-17 11:56:24 +0100375 self.volume_messages_client = volume.v3.MessagesClient(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000376 self.auth_provider, **params)
Andrea Frittoli (andreaf)14ecae12016-06-17 11:56:24 +0100377 self.volume_types_client = volume.v1.TypesClient(self.auth_provider,
378 **params)
379 self.volume_types_v2_client = volume.v2.TypesClient(self.auth_provider,
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000380 **params)
Andrea Frittoli (andreaf)14ecae12016-06-17 11:56:24 +0100381 self.volume_hosts_client = volume.v1.HostsClient(self.auth_provider,
382 **params)
383 self.volume_hosts_v2_client = volume.v2.HostsClient(self.auth_provider,
384 **params)
385 self.volume_quotas_client = volume.v1.QuotasClient(self.auth_provider,
386 **params)
387 self.volume_quotas_v2_client = volume.v2.QuotasClient(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000388 self.auth_provider, **params)
Andrea Frittoli (andreaf)14ecae12016-06-17 11:56:24 +0100389 self.volumes_extension_client = volume.v1.ExtensionsClient(
390 self.auth_provider, **params)
391 self.volumes_v2_extension_client = volume.v2.ExtensionsClient(
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000392 self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000393 self.volume_availability_zone_client = \
Andrea Frittoli (andreaf)14ecae12016-06-17 11:56:24 +0100394 volume.v1.AvailabilityZoneClient(self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000395 self.volume_v2_availability_zone_client = \
Andrea Frittoli (andreaf)14ecae12016-06-17 11:56:24 +0100396 volume.v2.AvailabilityZoneClient(self.auth_provider, **params)
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000397
Ken'ichi Ohmichic95eb852015-01-22 01:57:57 +0000398 def _set_object_storage_clients(self):
Ken'ichi Ohmichi564b2ad2015-01-22 02:08:59 +0000399 params = {
400 'service': CONF.object_storage.catalog_type,
401 'region': CONF.object_storage.region or CONF.identity.region,
402 'endpoint_type': CONF.object_storage.endpoint_type
403 }
404 params.update(self.default_params_with_timeout_values)
405
Andrea Frittoli (andreaf)9a225432016-06-17 12:16:22 +0100406 self.account_client = object_storage.AccountClient(self.auth_provider,
407 **params)
408 self.container_client = object_storage.ContainerClient(
409 self.auth_provider, **params)
410 self.object_client = object_storage.ObjectClient(self.auth_provider,
411 **params)