blob: 1aa34d0d54ab250baf0d80a9f20a182b15e5764e [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
Jay Pipesf38eaac2012-06-21 13:37:35 -040016from tempest import config
Andrea Frittoli (andreaf)23950142016-06-13 12:39:29 +010017from tempest.lib import auth
Andrea Frittoli (andreaf)de5fb0c2016-06-13 12:15:00 +010018from tempest.lib import exceptions as lib_exc
Andrea Frittoli (andreaf)e07579c2016-08-05 07:27:02 +010019from tempest.lib.services import clients
Vincent Hou6b8a7b72012-08-25 01:24:33 +080020
Sean Dague86bd8422013-12-20 09:56:44 -050021CONF = config.CONF
Jay Pipes3f981df2012-03-27 18:59:44 -040022
Vincent Hou6b8a7b72012-08-25 01:24:33 +080023
Andrea Frittoli (andreaf)e07579c2016-08-05 07:27:02 +010024class Manager(clients.ServiceClients):
Ken'ichi Ohmichi2e2ee192015-11-19 09:48:27 +000025 """Top level manager for OpenStack tempest clients"""
Jay Pipes3f981df2012-03-27 18:59:44 -040026
Jordan Pittiere4be9072017-01-04 19:17:35 +010027 def __init__(self, credentials, scope='project'):
ghanshyam4e2be342015-11-27 18:07:46 +090028 """Initialization of Manager class.
Brant Knudsonc7ca3342013-03-28 21:08:50 -050029
ghanshyam4e2be342015-11-27 18:07:46 +090030 Setup all services clients and make them available for tests cases.
31 :param credentials: type Credentials or TestResources
Andrea Frittoli (andreaf)3e82af72016-05-05 22:53:38 +010032 :param scope: default scope for tokens produced by the auth provider
ghanshyam4e2be342015-11-27 18:07:46 +090033 """
Andrea Frittoli (andreaf)23950142016-06-13 12:39:29 +010034 _, identity_uri = get_auth_provider_class(credentials)
35 super(Manager, self).__init__(
36 credentials=credentials, identity_uri=identity_uri, scope=scope,
Andrea Frittoli7ae56bb2017-05-24 10:56:46 +010037 region=CONF.identity.region)
Andrea Frittoli (andreaf)de5fb0c2016-06-13 12:15:00 +010038 # TODO(andreaf) When clients are initialised without the right
39 # parameters available, the calls below will trigger a KeyError.
40 # We should catch that and raise a better error.
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +000041 self._set_compute_clients()
42 self._set_identity_clients()
43 self._set_volume_clients()
Ken'ichi Ohmichic95eb852015-01-22 01:57:57 +000044 self._set_object_storage_clients()
Andrea Frittoli (andreaf)591e8542016-06-07 18:31:39 +010045 self._set_image_clients()
Andrea Frittoli (andreaf)11e1e882016-06-07 18:35:58 +010046 self._set_network_clients()
elajkat23e07472019-07-12 15:21:14 +020047 self._set_placement_clients()
Andrea Frittolif0820792017-08-16 13:02:20 +010048 # TODO(andreaf) This is maintained for backward compatibility
49 # with plugins, but it should removed eventually, since it was
50 # never a stable interface and it's not useful anyways
51 self.default_params = config.service_client_config()
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +000052
Andrea Frittoli (andreaf)11e1e882016-06-07 18:35:58 +010053 def _set_network_clients(self):
Andrea Frittoli (andreaf)127c1022016-07-05 23:19:50 +010054 self.network_agents_client = self.network.AgentsClient()
55 self.network_extensions_client = self.network.ExtensionsClient()
56 self.networks_client = self.network.NetworksClient()
57 self.subnetpools_client = self.network.SubnetpoolsClient()
58 self.subnets_client = self.network.SubnetsClient()
59 self.ports_client = self.network.PortsClient()
60 self.network_quotas_client = self.network.QuotasClient()
61 self.floating_ips_client = self.network.FloatingIPsClient()
Soniya Vyasc08dfd22021-09-14 16:57:42 +053062 self.floating_ips_port_forwarding_client =\
63 self.network.FloatingIpsPortForwardingClient()
Andrea Frittoli (andreaf)127c1022016-07-05 23:19:50 +010064 self.metering_labels_client = self.network.MeteringLabelsClient()
65 self.metering_label_rules_client = (
66 self.network.MeteringLabelRulesClient())
67 self.routers_client = self.network.RoutersClient()
68 self.security_group_rules_client = (
69 self.network.SecurityGroupRulesClient())
70 self.security_groups_client = self.network.SecurityGroupsClient()
71 self.network_versions_client = self.network.NetworkVersionsClient()
Jordan Pittiere5794632016-07-21 17:34:32 +020072 self.service_providers_client = self.network.ServiceProvidersClient()
Felipe Monteiro11779422017-05-18 06:10:26 +010073 self.tags_client = self.network.TagsClient()
Lajos Katonae8a5e5c2019-01-04 14:49:34 +010074 self.qos_client = self.network.QosClient()
75 self.qos_min_bw_client = self.network.QosMinimumBandwidthRulesClient()
bonguardo92ca2582021-10-25 05:38:20 -040076 self.qos_limit_bw_client = self.network.QosLimitBandwidthRulesClient()
Balazs Gibizerf294b0d2021-09-29 16:16:44 +020077 self.qos_min_pps_client = (
78 self.network.QosMinimumPacketRateRulesClient())
elajkat36e543b2019-07-12 13:08:58 +020079 self.segments_client = self.network.SegmentsClient()
elajkat0b14db22021-02-08 16:43:59 +010080 self.trunks_client = self.network.TrunksClient()
Soniya Vyas065715d2021-06-17 14:36:29 +053081 self.log_resource_client = self.network.LogResourceClient()
Soniya Vyas5a3de3e2021-07-09 12:30:36 +053082 self.loggable_resource_client = self.network.LoggableResourceClient()
Andrea Frittoli (andreaf)11e1e882016-06-07 18:35:58 +010083
Andrea Frittoli (andreaf)591e8542016-06-07 18:31:39 +010084 def _set_image_clients(self):
Andrea Frittoli (andreaf)591e8542016-06-07 18:31:39 +010085 if CONF.service_available.glance:
Andrea Frittoli (andreaf)e6a9b3f2016-06-30 16:24:32 +010086 self.image_client = self.image_v1.ImagesClient()
87 self.image_member_client = self.image_v1.ImageMembersClient()
88 self.image_client_v2 = self.image_v2.ImagesClient()
89 self.image_member_client_v2 = self.image_v2.ImageMembersClient()
Abhishek Kekane86df53b2022-01-11 08:07:58 +000090 self.image_cache_client = self.image_v2.ImageCacheClient()
Andrea Frittoli (andreaf)e6a9b3f2016-06-30 16:24:32 +010091 self.namespaces_client = self.image_v2.NamespacesClient()
92 self.resource_types_client = self.image_v2.ResourceTypesClient()
Li Wei37aff3c2016-10-20 19:50:02 +080093 self.namespace_objects_client = \
94 self.image_v2.NamespaceObjectsClient()
Andrea Frittoli (andreaf)e6a9b3f2016-06-30 16:24:32 +010095 self.schemas_client = self.image_v2.SchemasClient()
guo yunxian753e90a2016-11-17 20:12:22 +080096 self.namespace_properties_client = \
97 self.image_v2.NamespacePropertiesClient()
zhufl6cd38272019-01-10 10:40:02 +080098 self.namespace_tags_client = self.image_v2.NamespaceTagsClient()
99 self.image_versions_client = self.image_v2.VersionsClient()
Dan Smithd4bc9a82021-01-12 17:25:07 -0800100 # NOTE(danms): If no alternate endpoint is configured,
101 # this client will work the same as the base self.images_client.
102 # If your test needs to know if these are different, check the
103 # config option to see if the alternate_image_endpoint is set.
104 self.image_client_remote = self.image_v2.ImagesClient(
105 service=CONF.image.alternate_image_endpoint,
Dan Smith0ac97de2021-03-05 06:36:15 -0800106 endpoint_type=CONF.image.alternate_image_endpoint_type,
107 region=CONF.image.region)
Andrea Frittoli (andreaf)591e8542016-06-07 18:31:39 +0100108
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000109 def _set_compute_clients(self):
Andrea Frittoli (andreaf)142d8192016-07-05 23:19:05 +0100110 self.agents_client = self.compute.AgentsClient()
111 self.compute_networks_client = self.compute.NetworksClient()
112 self.migrations_client = self.compute.MigrationsClient()
Ken'ichi Ohmichi65225ef2014-11-19 01:06:25 +0000113 self.security_group_default_rules_client = (
Andrea Frittoli (andreaf)142d8192016-07-05 23:19:05 +0100114 self.compute.SecurityGroupDefaultRulesClient())
115 self.certificates_client = self.compute.CertificatesClient()
116 eip = CONF.compute_feature_enabled.enable_instance_password
117 self.servers_client = self.compute.ServersClient(
118 enable_instance_password=eip)
119 self.server_groups_client = self.compute.ServerGroupsClient()
120 self.limits_client = self.compute.LimitsClient()
Ade Lee6ded0702021-09-04 15:56:34 -0400121 self.keypairs_client = self.compute.KeyPairsClient(
122 ssh_key_type=CONF.validation.ssh_key_type)
Andrea Frittoli (andreaf)142d8192016-07-05 23:19:05 +0100123 self.quotas_client = self.compute.QuotasClient()
124 self.quota_classes_client = self.compute.QuotaClassesClient()
125 self.flavors_client = self.compute.FlavorsClient()
126 self.extensions_client = self.compute.ExtensionsClient()
127 self.floating_ip_pools_client = self.compute.FloatingIPPoolsClient()
128 self.floating_ips_bulk_client = self.compute.FloatingIPsBulkClient()
129 self.compute_floating_ips_client = self.compute.FloatingIPsClient()
Andrea Frittoli (andreaf)76a4b4e2016-06-14 23:28:16 +0100130 self.compute_security_group_rules_client = (
Andrea Frittoli (andreaf)142d8192016-07-05 23:19:05 +0100131 self.compute.SecurityGroupRulesClient())
132 self.compute_security_groups_client = (
133 self.compute.SecurityGroupsClient())
134 self.interfaces_client = self.compute.InterfacesClient()
135 self.fixed_ips_client = self.compute.FixedIPsClient()
136 self.availability_zone_client = self.compute.AvailabilityZoneClient()
137 self.aggregates_client = self.compute.AggregatesClient()
138 self.services_client = self.compute.ServicesClient()
139 self.tenant_usages_client = self.compute.TenantUsagesClient()
140 self.hosts_client = self.compute.HostsClient()
141 self.hypervisor_client = self.compute.HypervisorClient()
Andrea Frittoli (andreaf)76a4b4e2016-06-14 23:28:16 +0100142 self.instance_usages_audit_log_client = (
Andrea Frittoli (andreaf)142d8192016-07-05 23:19:05 +0100143 self.compute.InstanceUsagesAuditLogClient())
144 self.tenant_networks_client = self.compute.TenantNetworksClient()
Rao Adnan Khanac1aaf62017-04-27 08:01:18 -0500145 self.assisted_volume_snapshots_client = (
146 self.compute.AssistedVolumeSnapshotsClient())
Ghanshyam Mann81bd0e92022-11-17 21:16:58 -0600147 self.server_external_events_client = (
148 self.compute.ServerExternalEventsClient())
Ken'ichi Ohmichi4771cbc2015-01-19 23:45:23 +0000149
150 # NOTE: The following client needs special timeout values because
151 # the API is a proxy for the other component.
Andrea Frittoli20322572017-04-09 19:13:13 +0200152 params_volume = {
153 'build_interval': CONF.volume.build_interval,
154 'build_timeout': CONF.volume.build_timeout
155 }
Andrea Frittoli (andreaf)142d8192016-07-05 23:19:05 +0100156 self.volumes_extensions_client = self.compute.VolumesClient(
157 **params_volume)
158 self.compute_versions_client = self.compute.VersionsClient(
159 **params_volume)
160 self.snapshots_extensions_client = self.compute.SnapshotsClient(
161 **params_volume)
Mitya_Eremeev6caf3b32022-09-16 15:49:53 +0300162 self.compute_images_client = self.compute.ImagesClient(
163 build_timeout=CONF.image.build_timeout)
Ken'ichi Ohmichicd4a51e2014-11-13 07:25:33 +0000164
elajkat23e07472019-07-12 15:21:14 +0200165 def _set_placement_clients(self):
166 self.placement_client = self.placement.PlacementClient()
167 self.resource_providers_client = \
168 self.placement.ResourceProvidersClient()
169
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000170 def _set_identity_clients(self):
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300171 # Clients below use the admin endpoint type of Keystone API v2
ghanshyam68227d62016-12-22 16:17:42 +0900172 params_v2_admin = {
173 'endpoint_type': CONF.identity.v2_admin_endpoint_type}
174 self.endpoints_client = self.identity_v2.EndpointsClient(
175 **params_v2_admin)
176 self.identity_client = self.identity_v2.IdentityClient(
177 **params_v2_admin)
178 self.tenants_client = self.identity_v2.TenantsClient(
179 **params_v2_admin)
180 self.roles_client = self.identity_v2.RolesClient(**params_v2_admin)
181 self.users_client = self.identity_v2.UsersClient(**params_v2_admin)
182 self.identity_services_client = self.identity_v2.ServicesClient(
183 **params_v2_admin)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300184
185 # Clients below use the public endpoint type of Keystone API v2
ghanshyam68227d62016-12-22 16:17:42 +0900186 params_v2_public = {
187 'endpoint_type': CONF.identity.v2_public_endpoint_type}
188 self.identity_public_client = self.identity_v2.IdentityClient(
189 **params_v2_public)
190 self.tenants_public_client = self.identity_v2.TenantsClient(
191 **params_v2_public)
192 self.users_public_client = self.identity_v2.UsersClient(
193 **params_v2_public)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300194
Andrea Frittoli (andreaf)de5fb0c2016-06-13 12:15:00 +0100195 # Clients below use the endpoint type of Keystone API v3, which is set
196 # in endpoint_type
ghanshyam68227d62016-12-22 16:17:42 +0900197 params_v3 = {'endpoint_type': CONF.identity.v3_endpoint_type}
198 self.domains_client = self.identity_v3.DomainsClient(**params_v3)
199 self.identity_v3_client = self.identity_v3.IdentityClient(**params_v3)
200 self.trusts_client = self.identity_v3.TrustsClient(**params_v3)
201 self.users_v3_client = self.identity_v3.UsersClient(**params_v3)
202 self.endpoints_v3_client = self.identity_v3.EndPointsClient(
203 **params_v3)
204 self.roles_v3_client = self.identity_v3.RolesClient(**params_v3)
205 self.inherited_roles_client = self.identity_v3.InheritedRolesClient(
206 **params_v3)
207 self.role_assignments_client = self.identity_v3.RoleAssignmentsClient(
208 **params_v3)
209 self.identity_services_v3_client = self.identity_v3.ServicesClient(
210 **params_v3)
211 self.policies_client = self.identity_v3.PoliciesClient(**params_v3)
212 self.projects_client = self.identity_v3.ProjectsClient(**params_v3)
213 self.regions_client = self.identity_v3.RegionsClient(**params_v3)
214 self.credentials_client = self.identity_v3.CredentialsClient(
215 **params_v3)
216 self.groups_client = self.identity_v3.GroupsClient(**params_v3)
Ken'ichi Ohmichida26b162017-03-03 15:53:46 -0800217 self.identity_versions_v3_client = self.identity_v3.VersionsClient(
218 **params_v3)
Nicolas Helgeson8e2d4032017-02-14 09:36:37 -0800219 self.oauth_consumers_client = self.identity_v3.OAUTHConsumerClient(
220 **params_v3)
Hemanth Nakkinad9594f52017-04-19 11:14:40 +0530221 self.oauth_token_client = self.identity_v3.OAUTHTokenClient(
222 **params_v3)
Felipe Monteiro94d85772017-04-03 22:04:06 +0100223 self.domain_config_client = self.identity_v3.DomainConfigurationClient(
224 **params_v3)
Pradeep Kumar KS5d52d3a2017-03-18 11:41:15 +0530225 self.endpoint_filter_client = \
226 self.identity_v3.EndPointsFilterClient(**params_v3)
Chi Lod0ed8b02017-04-22 05:35:53 -0500227 self.endpoint_groups_client = self.identity_v3.EndPointGroupsClient(
228 **params_v3)
Megan Guineyd0295162017-05-23 23:57:53 -0700229 self.catalog_client = self.identity_v3.CatalogClient(**params_v3)
Felipe Monteiroa3b2d8e2018-03-15 04:47:52 +0000230 self.project_tags_client = self.identity_v3.ProjectTagsClient(
231 **params_v3)
Colleen Murphy0e52d4e2018-02-17 21:29:40 +0100232 self.application_credentials_client = \
233 self.identity_v3.ApplicationCredentialsClient(**params_v3)
Colleen Murphyd2cbd3a2019-12-17 16:31:14 -0800234 self.access_rules_client = \
235 self.identity_v3.AccessRulesClient(**params_v3)
Dan Smithef987c42021-04-27 11:48:27 -0700236 self.identity_limits_client = \
237 self.identity_v3.LimitsClient(**params_v3)
Yaroslav Lobankovcd97fea2016-01-13 19:59:52 +0300238
Andrea Frittoli90012352015-02-25 21:58:02 +0000239 # Token clients do not use the catalog. They only need default_params.
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100240 # They read auth_url, so they should only be set if the corresponding
241 # API version is marked as enabled
242 if CONF.identity_feature_enabled.api_v2:
243 if CONF.identity.uri:
Andrea Frittoli8b8db532016-12-22 11:21:47 +0000244 self.token_client = self.identity_v2.TokenClient(
245 auth_url=CONF.identity.uri)
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100246 else:
247 msg = 'Identity v2 API enabled, but no identity.uri set'
Matthew Treinish4217a702016-10-07 17:27:11 -0400248 raise lib_exc.InvalidConfiguration(msg)
Ken'ichi Ohmichi41951b02014-11-19 01:57:43 +0000249 if CONF.identity_feature_enabled.api_v3:
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100250 if CONF.identity.uri_v3:
Andrea Frittoli8b8db532016-12-22 11:21:47 +0000251 self.token_v3_client = self.identity_v3.V3TokenClient(
252 auth_url=CONF.identity.uri_v3)
Andrea Frittoli (andreaf)03e546f2015-05-13 12:44:47 +0100253 else:
254 msg = 'Identity v3 API enabled, but no identity.uri_v3 set'
Matthew Treinish4217a702016-10-07 17:27:11 -0400255 raise lib_exc.InvalidConfiguration(msg)
Ken'ichi Ohmichi41951b02014-11-19 01:57:43 +0000256
Ken'ichi Ohmichi80ec0b92015-01-16 06:43:10 +0000257 def _set_volume_clients(self):
Ken'ichi Ohmichif85e9bd2015-01-27 12:51:47 +0000258
Ghanshyam Mann449287d2019-12-12 16:36:57 +0000259 self.backups_client_latest = self.volume_v3.BackupsClient()
260 self.encryption_types_client_latest = \
261 self.volume_v3.EncryptionTypesClient()
262 self.snapshot_manage_client_latest = \
263 self.volume_v3.SnapshotManageClient()
264 self.snapshots_client_latest = self.volume_v3.SnapshotsClient()
265 self.volume_capabilities_client_latest = \
266 self.volume_v3.CapabilitiesClient()
267 self.volume_manage_client_latest = (
268 self.volume_v3.VolumeManageClient())
269 self.volume_qos_client_latest = self.volume_v3.QosSpecsClient()
270 self.volume_services_client_latest = (
271 self.volume_v3.ServicesClient())
272 self.volume_types_client_latest = self.volume_v3.TypesClient()
273 self.volume_hosts_client_latest = self.volume_v3.HostsClient()
274 self.volume_quotas_client_latest = self.volume_v3.QuotasClient()
275 self.volume_quota_classes_client_latest = \
276 self.volume_v3.QuotaClassesClient()
277 self.volume_scheduler_stats_client_latest = \
278 self.volume_v3.SchedulerStatsClient()
279 self.volume_transfers_client_latest = \
280 self.volume_v3.TransfersClient()
Brian Rosmaitacafd2d12021-05-06 18:01:05 -0400281 self.volume_transfers_mv355_client_latest = \
282 self.volume_v3.TransfersV355Client()
Ghanshyam Mann449287d2019-12-12 16:36:57 +0000283 self.volume_availability_zone_client_latest = \
284 self.volume_v3.AvailabilityZoneClient()
285 self.volume_limits_client_latest = self.volume_v3.LimitsClient()
286 self.volumes_client_latest = self.volume_v3.VolumesClient()
287 self.volumes_extension_client_latest = \
288 self.volume_v3.ExtensionsClient()
289 self.group_types_client_latest = self.volume_v3.GroupTypesClient()
290 self.groups_client_latest = self.volume_v3.GroupsClient()
291 self.group_snapshots_client_latest = \
292 self.volume_v3.GroupSnapshotsClient()
293 self.volume_messages_client_latest = (
294 self.volume_v3.MessagesClient())
295 self.volume_versions_client_latest = (
296 self.volume_v3.VersionsClient())
297 self.attachments_client_latest = (
298 self.volume_v3.AttachmentsClient())
ghanshyam6c682ff2018-08-06 09:54:45 +0000299
Ghanshyam Mann449287d2019-12-12 16:36:57 +0000300 # TODO(gmann): Below alias for service clients have been
301 # deprecated and will be removed in future. Start using the alias
302 # defined above with suffix _latest.
303 # ****************Deprecated alias start from here***************
304 self.backups_v2_client = self.volume_v3.BackupsClient()
305 self.encryption_types_v2_client = \
306 self.volume_v3.EncryptionTypesClient()
307 self.snapshot_manage_v2_client = \
308 self.volume_v3.SnapshotManageClient()
309 self.snapshots_v2_client = self.volume_v3.SnapshotsClient()
310 self.volume_capabilities_v2_client = \
311 self.volume_v3.CapabilitiesClient()
312 self.volume_manage_v2_client = self.volume_v3.VolumeManageClient()
313 self.volume_qos_v2_client = self.volume_v3.QosSpecsClient()
314 self.volume_services_v2_client = self.volume_v3.ServicesClient()
315 self.volume_types_v2_client = self.volume_v3.TypesClient()
316 self.volume_hosts_v2_client = self.volume_v3.HostsClient()
317 self.volume_quotas_v2_client = self.volume_v3.QuotasClient()
318 self.volume_quota_classes_v2_client = \
319 self.volume_v3.QuotaClassesClient()
320 self.volume_scheduler_stats_v2_client = \
321 self.volume_v3.SchedulerStatsClient()
322 self.volume_transfers_v2_client = self.volume_v3.TransfersClient()
323 self.volume_v2_availability_zone_client = \
324 self.volume_v3.AvailabilityZoneClient()
325 self.volume_v2_limits_client = self.volume_v3.LimitsClient()
326 self.volumes_v2_client = self.volume_v3.VolumesClient()
327 self.volumes_v2_extension_client = \
328 self.volume_v3.ExtensionsClient()
Sean McGinnisff5f0c12017-07-07 16:39:24 -0500329
Ghanshyam Mann449287d2019-12-12 16:36:57 +0000330 self.backups_v3_client = self.volume_v3.BackupsClient()
331 self.group_types_v3_client = self.volume_v3.GroupTypesClient()
332 self.groups_v3_client = self.volume_v3.GroupsClient()
333 self.group_snapshots_v3_client = \
334 self.volume_v3.GroupSnapshotsClient()
335 self.snapshots_v3_client = self.volume_v3.SnapshotsClient()
336 self.volume_v3_messages_client = self.volume_v3.MessagesClient()
337 self.volume_v3_versions_client = self.volume_v3.VersionsClient()
338 self.volumes_v3_client = self.volume_v3.VolumesClient()
339 # ****************Deprecated alias end here***********************
Ken'ichi Ohmichi532ae922014-11-19 01:37:15 +0000340
Ken'ichi Ohmichic95eb852015-01-22 01:57:57 +0000341 def _set_object_storage_clients(self):
Andrea Frittoli986407d2017-10-11 10:23:17 +0000342 self.account_client = self.object_storage.AccountClient()
343 self.bulk_client = self.object_storage.BulkMiddlewareClient()
344 self.capabilities_client = self.object_storage.CapabilitiesClient()
345 self.container_client = self.object_storage.ContainerClient()
346 self.object_client = self.object_storage.ObjectClient()
Andrea Frittoli (andreaf)23950142016-06-13 12:39:29 +0100347
348
349def get_auth_provider_class(credentials):
350 if isinstance(credentials, auth.KeystoneV3Credentials):
351 return auth.KeystoneV3AuthProvider, CONF.identity.uri_v3
352 else:
353 return auth.KeystoneV2AuthProvider, CONF.identity.uri
354
355
356def get_auth_provider(credentials, pre_auth=False, scope='project'):
Andrea Frittoli (andreaf)de5fb0c2016-06-13 12:15:00 +0100357 # kwargs for auth provider match the common ones used by service clients
358 default_params = config.service_client_config()
Andrea Frittoli (andreaf)23950142016-06-13 12:39:29 +0100359 if credentials is None:
guo yunxian654a9212016-11-02 17:26:42 +0800360 raise lib_exc.InvalidCredentials(
Andrea Frittoli (andreaf)23950142016-06-13 12:39:29 +0100361 'Credentials must be specified')
362 auth_provider_class, auth_url = get_auth_provider_class(
363 credentials)
364 _auth_provider = auth_provider_class(credentials, auth_url,
365 scope=scope,
366 **default_params)
367 if pre_auth:
368 _auth_provider.set_auth()
369 return _auth_provider