blob: 646a2d9bfbcfb2acba3e5d05ea933daa7f0590d9 [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
Andrea Frittolif9cde7e2014-02-18 09:57:04 +000016import keystoneclient.exceptions
17import keystoneclient.v2_0.client
Andrea Frittolif9cde7e2014-02-18 09:57:04 +000018
Marc Koderer24eb89c2014-01-31 11:23:33 +010019from tempest.common.rest_client import NegativeRestClient
Jay Pipesf38eaac2012-06-21 13:37:35 -040020from tempest import config
Daryl Walleck587385b2012-03-03 13:00:26 -060021from tempest import exceptions
Andrea Frittolif9cde7e2014-02-18 09:57:04 +000022from tempest import manager
Matthew Treinishf4a9b0f2013-07-26 16:58:26 -040023from tempest.openstack.common import log as logging
Roman Prykhodchenko62b1ed12013-10-16 21:51:47 +030024from tempest.services.baremetal.v1.client_json import BaremetalClientJSON
Attila Fazekas1aed6202013-02-11 14:47:45 +010025from tempest.services import botoclients
Yuiko Takada420f2eb2014-04-02 19:53:38 +090026from tempest.services.compute.json.agents_client import \
27 AgentsClientJSON
Mitsuhiko Yamazaki74f07072013-04-02 11:52:31 +090028from tempest.services.compute.json.aggregates_client import \
29 AggregatesClientJSON
Leo Toyodaa5278912013-04-16 15:40:12 +090030from tempest.services.compute.json.availability_zone_client import \
31 AvailabilityZoneClientJSON
ivan-zhud57f3cf2013-11-06 16:59:52 +080032from tempest.services.compute.json.certificates_client import \
33 CertificatesClientJSON
dwallecke62b9f02012-10-10 23:34:42 -050034from tempest.services.compute.json.extensions_client import \
harika-vakadi1a9ad612012-12-14 19:12:08 +053035 ExtensionsClientJSON
Sean Dague2416cf32013-04-10 08:29:07 -040036from tempest.services.compute.json.fixed_ips_client import FixedIPsClientJSON
dwallecke62b9f02012-10-10 23:34:42 -050037from tempest.services.compute.json.flavors_client import FlavorsClientJSON
38from tempest.services.compute.json.floating_ips_client import \
harika-vakadi1a9ad612012-12-14 19:12:08 +053039 FloatingIPsClientJSON
Attila Fazekas8e99b992013-02-24 09:53:23 +010040from tempest.services.compute.json.hosts_client import HostsClientJSON
Tony Yang3d5f1632013-06-06 14:17:57 +080041from tempest.services.compute.json.hypervisor_client import \
42 HypervisorClientJSON
dwallecke62b9f02012-10-10 23:34:42 -050043from tempest.services.compute.json.images_client import ImagesClientJSON
ivan-zhuef7a1bd2013-10-22 17:56:46 +080044from tempest.services.compute.json.instance_usage_audit_log_client import \
45 InstanceUsagesAuditLogClientJSON
Sean Dague2416cf32013-04-10 08:29:07 -040046from tempest.services.compute.json.interfaces_client import \
47 InterfacesClientJSON
Attila Fazekas6968dd52013-02-15 17:05:53 +010048from tempest.services.compute.json.keypairs_client import KeyPairsClientJSON
dwallecke62b9f02012-10-10 23:34:42 -050049from tempest.services.compute.json.limits_client import LimitsClientJSON
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090050from tempest.services.compute.json.migrations_client import \
51 MigrationsClientJSON
Attila Fazekas6968dd52013-02-15 17:05:53 +010052from tempest.services.compute.json.quotas_client import QuotasClientJSON
Matthew Treinisha83a16e2012-12-07 13:44:02 -050053from tempest.services.compute.json.security_groups_client import \
harika-vakadi1a9ad612012-12-14 19:12:08 +053054 SecurityGroupsClientJSON
Attila Fazekas6968dd52013-02-15 17:05:53 +010055from tempest.services.compute.json.servers_client import ServersClientJSON
Leo Toyoda3ae31e12013-04-19 11:19:57 +090056from tempest.services.compute.json.services_client import ServicesClientJSON
Leo Toyodad80b6a02013-05-08 12:15:13 +090057from tempest.services.compute.json.tenant_usages_client import \
58 TenantUsagesClientJSON
Matthew Treinisha83a16e2012-12-07 13:44:02 -050059from tempest.services.compute.json.volumes_extensions_client import \
harika-vakadi1a9ad612012-12-14 19:12:08 +053060 VolumesExtensionsClientJSON
YuikoTakada8a2ec112014-02-18 21:13:51 +000061from tempest.services.compute.v3.json.agents_client import AgentsV3ClientJSON
ivan-zhu00fe64f2013-08-20 19:35:51 +080062from tempest.services.compute.v3.json.aggregates_client import \
63 AggregatesV3ClientJSON
ivan-zhuac7b3802013-08-21 16:03:53 +080064from tempest.services.compute.v3.json.availability_zone_client import \
65 AvailabilityZoneV3ClientJSON
ivan-zhu0e062922013-12-17 16:14:12 +080066from tempest.services.compute.v3.json.certificates_client import \
67 CertificatesV3ClientJSON
ivan-zhu31d98482013-08-22 10:51:48 +080068from tempest.services.compute.v3.json.extensions_client import \
69 ExtensionsV3ClientJSON
ivan-zhub25900a2013-12-13 16:28:45 +080070from tempest.services.compute.v3.json.flavors_client import FlavorsV3ClientJSON
ivan-zhu00fe64f2013-08-20 19:35:51 +080071from tempest.services.compute.v3.json.hosts_client import HostsV3ClientJSON
ivan-zhu6f5f9e92013-08-21 22:16:37 +080072from tempest.services.compute.v3.json.hypervisor_client import \
73 HypervisorV3ClientJSON
ivan-zhu91feab92013-08-15 18:25:33 +080074from tempest.services.compute.v3.json.interfaces_client import \
75 InterfacesV3ClientJSON
ivan-zhu7e7e6a32013-11-20 16:07:29 +080076from tempest.services.compute.v3.json.keypairs_client import \
77 KeyPairsV3ClientJSON
Ken'ichi Ohmichi8f088c12014-03-28 15:16:11 +090078from tempest.services.compute.v3.json.migration_client import \
79 MigrationsV3ClientJSON
ivan-zhub6d69ee2013-12-17 14:16:31 +080080from tempest.services.compute.v3.json.quotas_client import \
81 QuotasV3ClientJSON
ivan-zhu8f992be2013-07-31 14:56:58 +080082from tempest.services.compute.v3.json.servers_client import \
83 ServersV3ClientJSON
ivan-zhu5c86ae62013-08-20 21:09:01 +080084from tempest.services.compute.v3.json.services_client import \
85 ServicesV3ClientJSON
Ken'ichi Ohmichi3d6b6fa2014-01-08 04:42:16 +090086from tempest.services.compute.v3.json.version_client import \
87 VersionV3ClientJSON
Mitsuhiko Yamazakiae8fc532013-04-22 11:17:35 +090088from tempest.services.compute.xml.aggregates_client import AggregatesClientXML
Leo Toyodaa5278912013-04-16 15:40:12 +090089from tempest.services.compute.xml.availability_zone_client import \
90 AvailabilityZoneClientXML
ivan-zhud57f3cf2013-11-06 16:59:52 +080091from tempest.services.compute.xml.certificates_client import \
92 CertificatesClientXML
dwallecke62b9f02012-10-10 23:34:42 -050093from tempest.services.compute.xml.extensions_client import ExtensionsClientXML
Sean Dague2416cf32013-04-10 08:29:07 -040094from tempest.services.compute.xml.fixed_ips_client import FixedIPsClientXML
dwallecke62b9f02012-10-10 23:34:42 -050095from tempest.services.compute.xml.flavors_client import FlavorsClientXML
96from tempest.services.compute.xml.floating_ips_client import \
harika-vakadi1a9ad612012-12-14 19:12:08 +053097 FloatingIPsClientXML
Ken'ichi Ohmichia1aa44c2013-12-06 20:48:24 +090098from tempest.services.compute.xml.hosts_client import HostsClientXML
Tony Yang3d5f1632013-06-06 14:17:57 +080099from tempest.services.compute.xml.hypervisor_client import HypervisorClientXML
dwallecke62b9f02012-10-10 23:34:42 -0500100from tempest.services.compute.xml.images_client import ImagesClientXML
ivan-zhuef7a1bd2013-10-22 17:56:46 +0800101from tempest.services.compute.xml.instance_usage_audit_log_client import \
102 InstanceUsagesAuditLogClientXML
Sean Dague2416cf32013-04-10 08:29:07 -0400103from tempest.services.compute.xml.interfaces_client import \
104 InterfacesClientXML
dwallecke62b9f02012-10-10 23:34:42 -0500105from tempest.services.compute.xml.keypairs_client import KeyPairsClientXML
106from tempest.services.compute.xml.limits_client import LimitsClientXML
rajalakshmi-ganesan1982c3c2013-01-10 14:56:45 +0530107from tempest.services.compute.xml.quotas_client import QuotasClientXML
dwallecke62b9f02012-10-10 23:34:42 -0500108from tempest.services.compute.xml.security_groups_client \
harika-vakadi1a9ad612012-12-14 19:12:08 +0530109 import SecurityGroupsClientXML
dwallecke62b9f02012-10-10 23:34:42 -0500110from tempest.services.compute.xml.servers_client import ServersClientXML
Leo Toyoda3ae31e12013-04-19 11:19:57 +0900111from tempest.services.compute.xml.services_client import ServicesClientXML
Leo Toyodad80b6a02013-05-08 12:15:13 +0900112from tempest.services.compute.xml.tenant_usages_client import \
113 TenantUsagesClientXML
Matthew Treinisha83a16e2012-12-07 13:44:02 -0500114from tempest.services.compute.xml.volumes_extensions_client import \
harika-vakadi1a9ad612012-12-14 19:12:08 +0530115 VolumesExtensionsClientXML
Sergey Lukjanov3bc60e92013-12-10 16:40:50 +0400116from tempest.services.data_processing.v1_1.client import DataProcessingClient
Nikhil Manchandadd6886f2014-03-03 01:58:45 -0800117from tempest.services.database.json.flavors_client import \
118 DatabaseFlavorsClientJSON
Attila Fazekas407b6db2013-01-19 12:48:36 +0100119from tempest.services.identity.json.identity_client import IdentityClientJSON
120from tempest.services.identity.json.identity_client import TokenClientJSON
nayna-patel914b4712013-07-16 08:29:05 +0000121from tempest.services.identity.v3.json.credentials_client import \
122 CredentialsClientJSON
Sean Dague2416cf32013-04-10 08:29:07 -0400123from tempest.services.identity.v3.json.endpoints_client import \
124 EndPointClientJSON
rajalakshmi-ganesan7312bb52013-01-29 20:03:42 +0530125from tempest.services.identity.v3.json.identity_client import \
126 IdentityV3ClientJSON
nayna-patelb35f7232013-06-28 07:08:44 +0000127from tempest.services.identity.v3.json.identity_client import V3TokenClientJSON
harika-vakadi40e10112013-02-08 14:38:09 +0530128from tempest.services.identity.v3.json.policy_client import PolicyClientJSON
harika-vakadia92dd742013-02-19 20:41:22 +0530129from tempest.services.identity.v3.json.service_client import \
130 ServiceClientJSON
nayna-patel914b4712013-07-16 08:29:05 +0000131from tempest.services.identity.v3.xml.credentials_client import \
132 CredentialsClientXML
rajalakshmi-ganesanab426722013-02-08 15:49:15 +0530133from tempest.services.identity.v3.xml.endpoints_client import EndPointClientXML
rajalakshmi-ganesan7312bb52013-01-29 20:03:42 +0530134from tempest.services.identity.v3.xml.identity_client import \
135 IdentityV3ClientXML
nayna-patelb35f7232013-06-28 07:08:44 +0000136from tempest.services.identity.v3.xml.identity_client import V3TokenClientXML
harika-vakadi40e10112013-02-08 14:38:09 +0530137from tempest.services.identity.v3.xml.policy_client import PolicyClientXML
harika-vakadia92dd742013-02-19 20:41:22 +0530138from tempest.services.identity.v3.xml.service_client import \
139 ServiceClientXML
Attila Fazekas407b6db2013-01-19 12:48:36 +0100140from tempest.services.identity.xml.identity_client import IdentityClientXML
141from tempest.services.identity.xml.identity_client import TokenClientXML
Matthew Treinish6d59c992013-03-01 16:20:04 -0500142from tempest.services.image.v1.json.image_client import ImageClientJSON
Matthew Treinisha62347f2013-03-01 16:37:30 -0500143from tempest.services.image.v2.json.image_client import ImageClientV2JSON
raiesmh0867698322013-08-20 13:09:01 +0530144from tempest.services.network.json.network_client import NetworkClientJSON
145from tempest.services.network.xml.network_client import NetworkClientXML
dwalleck5d734432012-10-04 01:11:47 -0500146from tempest.services.object_storage.account_client import AccountClient
harika-vakadi2daed0a2013-01-01 20:51:39 +0530147from tempest.services.object_storage.account_client import \
148 AccountClientCustomizedHeader
Attila Fazekas6968dd52013-02-15 17:05:53 +0100149from tempest.services.object_storage.container_client import ContainerClient
150from tempest.services.object_storage.object_client import ObjectClient
151from tempest.services.object_storage.object_client import \
152 ObjectClientCustomizedHeader
Steve Bakerc60e4e32013-05-06 15:22:41 +1200153from tempest.services.orchestration.json.orchestration_client import \
154 OrchestrationClient
Malini Kamalambal6e7b3b82014-02-06 06:49:04 -0500155from tempest.services.queuing.json.queuing_client import QueuingClientJSON
Nikolay Pliashechnikovb053aab2013-11-05 06:06:44 -0800156from tempest.services.telemetry.json.telemetry_client import \
157 TelemetryClientJSON
158from tempest.services.telemetry.xml.telemetry_client import \
159 TelemetryClientXML
Nayna Patel4a5024c2013-11-18 07:08:23 +0000160from tempest.services.volume.json.admin.volume_hosts_client import \
161 VolumeHostsClientJSON
Sylvain Baubeaufdd34592014-02-20 18:40:10 +0100162from tempest.services.volume.json.admin.volume_quotas_client import \
163 VolumeQuotasClientJSON
Abhijeet.Jain0056b072014-04-15 09:32:29 +0530164from tempest.services.volume.json.admin.volume_services_client import \
165 VolumesServicesClientJSON
Attila Fazekas6968dd52013-02-15 17:05:53 +0100166from tempest.services.volume.json.admin.volume_types_client import \
167 VolumeTypesClientJSON
Giulio Fidente74b08ad2014-01-18 04:02:51 +0100168from tempest.services.volume.json.backups_client import BackupsClientJSON
Matthew Treinish2324e6b2013-10-21 20:25:17 +0000169from tempest.services.volume.json.extensions_client import \
170 ExtensionsClientJSON as VolumeExtensionClientJSON
Attila Fazekas6968dd52013-02-15 17:05:53 +0100171from tempest.services.volume.json.snapshots_client import SnapshotsClientJSON
172from tempest.services.volume.json.volumes_client import VolumesClientJSON
Zhi Kun Liu8cc3c842014-01-07 10:44:34 +0800173from tempest.services.volume.v2.json.volumes_client import VolumesV2ClientJSON
174from tempest.services.volume.v2.xml.volumes_client import VolumesV2ClientXML
Nayna Patel4a5024c2013-11-18 07:08:23 +0000175from tempest.services.volume.xml.admin.volume_hosts_client import \
176 VolumeHostsClientXML
Sylvain Baubeaufdd34592014-02-20 18:40:10 +0100177from tempest.services.volume.xml.admin.volume_quotas_client import \
178 VolumeQuotasClientXML
Abhijeet.Jain0056b072014-04-15 09:32:29 +0530179from tempest.services.volume.xml.admin.volume_services_client import \
180 VolumesServicesClientXML
Attila Fazekas6968dd52013-02-15 17:05:53 +0100181from tempest.services.volume.xml.admin.volume_types_client import \
182 VolumeTypesClientXML
Giulio Fidente74b08ad2014-01-18 04:02:51 +0100183from tempest.services.volume.xml.backups_client import BackupsClientXML
Matthew Treinish2324e6b2013-10-21 20:25:17 +0000184from tempest.services.volume.xml.extensions_client import \
185 ExtensionsClientXML as VolumeExtensionClientXML
Attila Fazekas6968dd52013-02-15 17:05:53 +0100186from tempest.services.volume.xml.snapshots_client import SnapshotsClientXML
187from tempest.services.volume.xml.volumes_client import VolumesClientXML
Vincent Hou6b8a7b72012-08-25 01:24:33 +0800188
Sean Dague86bd8422013-12-20 09:56:44 -0500189CONF = config.CONF
Jay Pipes3f981df2012-03-27 18:59:44 -0400190LOG = logging.getLogger(__name__)
191
Vincent Hou6b8a7b72012-08-25 01:24:33 +0800192
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000193class Manager(manager.Manager):
Daryl Walleck1465d612011-11-02 02:22:15 -0500194
Jay Pipes3f981df2012-03-27 18:59:44 -0400195 """
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000196 Top level manager for OpenStack tempest clients
Jay Pipes3f981df2012-03-27 18:59:44 -0400197 """
198
James E. Blaire6d8ee12013-01-18 21:33:45 +0000199 def __init__(self, username=None, password=None, tenant_name=None,
Marc Koderer24eb89c2014-01-31 11:23:33 +0100200 interface='json', service=None):
Jay Pipesff10d552012-04-06 14:18:50 -0400201 """
202 We allow overriding of the credentials used within the various
203 client classes managed by the Manager object. Left as None, the
204 standard username/password/tenant_name is used.
205
206 :param username: Override of the username
207 :param password: Override of the password
208 :param tenant_name: Override of the tenant name
209 """
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000210 self.interface = interface
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000211 self.client_type = 'tempest'
212 # super cares for credentials validation
213 super(Manager, self).__init__(
214 username=username, password=password, tenant_name=tenant_name)
Brant Knudsonc7ca3342013-03-28 21:08:50 -0500215
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000216 if self.interface == 'xml':
217 self.certificates_client = CertificatesClientXML(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000218 self.auth_provider)
219 self.servers_client = ServersClientXML(self.auth_provider)
220 self.limits_client = LimitsClientXML(self.auth_provider)
221 self.images_client = ImagesClientXML(self.auth_provider)
222 self.keypairs_client = KeyPairsClientXML(self.auth_provider)
223 self.quotas_client = QuotasClientXML(self.auth_provider)
224 self.flavors_client = FlavorsClientXML(self.auth_provider)
225 self.extensions_client = ExtensionsClientXML(self.auth_provider)
Attila Fazekas7e678de2013-07-13 14:13:28 +0200226 self.volumes_extensions_client = VolumesExtensionsClientXML(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000227 self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000228 self.floating_ips_client = FloatingIPsClientXML(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000229 self.auth_provider)
230 self.backups_client = BackupsClientXML(self.auth_provider)
231 self.snapshots_client = SnapshotsClientXML(self.auth_provider)
232 self.volumes_client = VolumesClientXML(self.auth_provider)
233 self.volumes_v2_client = VolumesV2ClientXML(self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000234 self.volume_types_client = VolumeTypesClientXML(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000235 self.auth_provider)
236 self.identity_client = IdentityClientXML(self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000237 self.identity_v3_client = IdentityV3ClientXML(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000238 self.auth_provider)
Attila Fazekas7e678de2013-07-13 14:13:28 +0200239 self.security_groups_client = SecurityGroupsClientXML(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000240 self.auth_provider)
241 self.interfaces_client = InterfacesClientXML(self.auth_provider)
242 self.endpoints_client = EndPointClientXML(self.auth_provider)
243 self.fixed_ips_client = FixedIPsClientXML(self.auth_provider)
Attila Fazekas7e678de2013-07-13 14:13:28 +0200244 self.availability_zone_client = AvailabilityZoneClientXML(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000245 self.auth_provider)
246 self.service_client = ServiceClientXML(self.auth_provider)
Abhijeet.Jain0056b072014-04-15 09:32:29 +0530247 self.volume_services_client = VolumesServicesClientXML(
248 self.auth_provider)
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000249 self.aggregates_client = AggregatesClientXML(self.auth_provider)
250 self.services_client = ServicesClientXML(self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000251 self.tenant_usages_client = TenantUsagesClientXML(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000252 self.auth_provider)
253 self.policy_client = PolicyClientXML(self.auth_provider)
254 self.hosts_client = HostsClientXML(self.auth_provider)
255 self.hypervisor_client = HypervisorClientXML(self.auth_provider)
256 self.network_client = NetworkClientXML(self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000257 self.credentials_client = CredentialsClientXML(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000258 self.auth_provider)
ivan-zhuef7a1bd2013-10-22 17:56:46 +0800259 self.instance_usages_audit_log_client = \
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000260 InstanceUsagesAuditLogClientXML(self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000261 self.volume_hosts_client = VolumeHostsClientXML(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000262 self.auth_provider)
Sylvain Baubeaufdd34592014-02-20 18:40:10 +0100263 self.volume_quotas_client = VolumeQuotasClientXML(
264 self.auth_provider)
Matthew Treinish2324e6b2013-10-21 20:25:17 +0000265 self.volumes_extension_client = VolumeExtensionClientXML(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000266 self.auth_provider)
Nikolay Pliashechnikovb053aab2013-11-05 06:06:44 -0800267 if CONF.service_available.ceilometer:
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000268 self.telemetry_client = TelemetryClientXML(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000269 self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000270 self.token_client = TokenClientXML()
271 self.token_v3_client = V3TokenClientXML()
Brant Knudsonc7ca3342013-03-28 21:08:50 -0500272
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000273 elif self.interface == 'json':
274 self.certificates_client = CertificatesClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000275 self.auth_provider)
ivan-zhu0e062922013-12-17 16:14:12 +0800276 self.certificates_v3_client = CertificatesV3ClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000277 self.auth_provider)
278 self.baremetal_client = BaremetalClientJSON(self.auth_provider)
279 self.servers_client = ServersClientJSON(self.auth_provider)
280 self.servers_v3_client = ServersV3ClientJSON(self.auth_provider)
281 self.limits_client = LimitsClientJSON(self.auth_provider)
282 self.images_client = ImagesClientJSON(self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000283 self.keypairs_v3_client = KeyPairsV3ClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000284 self.auth_provider)
285 self.keypairs_client = KeyPairsClientJSON(self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000286 self.keypairs_v3_client = KeyPairsV3ClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000287 self.auth_provider)
288 self.quotas_client = QuotasClientJSON(self.auth_provider)
289 self.quotas_v3_client = QuotasV3ClientJSON(self.auth_provider)
290 self.flavors_client = FlavorsClientJSON(self.auth_provider)
291 self.flavors_v3_client = FlavorsV3ClientJSON(self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000292 self.extensions_v3_client = ExtensionsV3ClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000293 self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000294 self.extensions_client = ExtensionsClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000295 self.auth_provider)
Attila Fazekas7e678de2013-07-13 14:13:28 +0200296 self.volumes_extensions_client = VolumesExtensionsClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000297 self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000298 self.floating_ips_client = FloatingIPsClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000299 self.auth_provider)
300 self.backups_client = BackupsClientJSON(self.auth_provider)
301 self.snapshots_client = SnapshotsClientJSON(self.auth_provider)
302 self.volumes_client = VolumesClientJSON(self.auth_provider)
303 self.volumes_v2_client = VolumesV2ClientJSON(self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000304 self.volume_types_client = VolumeTypesClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000305 self.auth_provider)
306 self.identity_client = IdentityClientJSON(self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000307 self.identity_v3_client = IdentityV3ClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000308 self.auth_provider)
Attila Fazekas7e678de2013-07-13 14:13:28 +0200309 self.security_groups_client = SecurityGroupsClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000310 self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000311 self.interfaces_v3_client = InterfacesV3ClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000312 self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000313 self.interfaces_client = InterfacesClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000314 self.auth_provider)
315 self.endpoints_client = EndPointClientJSON(self.auth_provider)
316 self.fixed_ips_client = FixedIPsClientJSON(self.auth_provider)
ivan-zhuac7b3802013-08-21 16:03:53 +0800317 self.availability_zone_v3_client = AvailabilityZoneV3ClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000318 self.auth_provider)
Attila Fazekas7e678de2013-07-13 14:13:28 +0200319 self.availability_zone_client = AvailabilityZoneClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000320 self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000321 self.services_v3_client = ServicesV3ClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000322 self.auth_provider)
323 self.service_client = ServiceClientJSON(self.auth_provider)
Abhijeet.Jain0056b072014-04-15 09:32:29 +0530324 self.volume_services_client = VolumesServicesClientJSON(
325 self.auth_provider)
YuikoTakada8a2ec112014-02-18 21:13:51 +0000326 self.agents_v3_client = AgentsV3ClientJSON(self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000327 self.aggregates_v3_client = AggregatesV3ClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000328 self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000329 self.aggregates_client = AggregatesClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000330 self.auth_provider)
331 self.services_client = ServicesClientJSON(self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000332 self.tenant_usages_client = TenantUsagesClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000333 self.auth_provider)
334 self.version_v3_client = VersionV3ClientJSON(self.auth_provider)
Ken'ichi Ohmichi8f088c12014-03-28 15:16:11 +0900335 self.migrations_v3_client = MigrationsV3ClientJSON(
336 self.auth_provider)
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000337 self.policy_client = PolicyClientJSON(self.auth_provider)
338 self.hosts_client = HostsClientJSON(self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000339 self.hypervisor_v3_client = HypervisorV3ClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000340 self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000341 self.hypervisor_client = HypervisorClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000342 self.auth_provider)
343 self.network_client = NetworkClientJSON(self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000344 self.credentials_client = CredentialsClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000345 self.auth_provider)
ivan-zhuef7a1bd2013-10-22 17:56:46 +0800346 self.instance_usages_audit_log_client = \
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000347 InstanceUsagesAuditLogClientJSON(self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000348 self.volume_hosts_client = VolumeHostsClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000349 self.auth_provider)
Sylvain Baubeaufdd34592014-02-20 18:40:10 +0100350 self.volume_quotas_client = VolumeQuotasClientJSON(
351 self.auth_provider)
Matthew Treinish2324e6b2013-10-21 20:25:17 +0000352 self.volumes_extension_client = VolumeExtensionClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000353 self.auth_provider)
354 self.hosts_v3_client = HostsV3ClientJSON(self.auth_provider)
Nikhil Manchandadd6886f2014-03-03 01:58:45 -0800355 self.database_flavors_client = DatabaseFlavorsClientJSON(
356 self.auth_provider)
Malini Kamalambal6e7b3b82014-02-06 06:49:04 -0500357 self.queuing_client = QueuingClientJSON(self.auth_provider)
Nikolay Pliashechnikovb053aab2013-11-05 06:06:44 -0800358 if CONF.service_available.ceilometer:
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000359 self.telemetry_client = TelemetryClientJSON(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000360 self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000361 self.token_client = TokenClientJSON()
362 self.token_v3_client = V3TokenClientJSON()
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000363 self.negative_client = NegativeRestClient(self.auth_provider)
Marc Koderer24eb89c2014-01-31 11:23:33 +0100364 self.negative_client.service = service
Attila Fazekas7e678de2013-07-13 14:13:28 +0200365
Attila Fazekas7e678de2013-07-13 14:13:28 +0200366 else:
Dan Smithcf8fab62012-08-14 08:03:48 -0700367 msg = "Unsupported interface type `%s'" % interface
368 raise exceptions.InvalidConfiguration(msg)
Attila Fazekas7e678de2013-07-13 14:13:28 +0200369
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000370 # TODO(andreaf) EC2 client still do their auth, v2 only
371 ec2_client_args = (self.credentials.get('username'),
372 self.credentials.get('password'),
373 CONF.identity.uri,
374 self.credentials.get('tenant_name'))
375
Attila Fazekas7e678de2013-07-13 14:13:28 +0200376 # common clients
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000377 self.account_client = AccountClient(self.auth_provider)
Yuiko Takada420f2eb2014-04-02 19:53:38 +0900378 self.agents_client = AgentsClientJSON(self.auth_provider)
Sean Dague86bd8422013-12-20 09:56:44 -0500379 if CONF.service_available.glance:
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000380 self.image_client = ImageClientJSON(self.auth_provider)
381 self.image_client_v2 = ImageClientV2JSON(self.auth_provider)
382 self.container_client = ContainerClient(self.auth_provider)
383 self.object_client = ObjectClient(self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000384 self.orchestration_client = OrchestrationClient(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000385 self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000386 self.ec2api_client = botoclients.APIClientEC2(*ec2_client_args)
387 self.s3_client = botoclients.ObjectClientS3(*ec2_client_args)
388 self.custom_object_client = ObjectClientCustomizedHeader(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000389 self.auth_provider)
harika-vakadi2daed0a2013-01-01 20:51:39 +0530390 self.custom_account_client = \
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000391 AccountClientCustomizedHeader(self.auth_provider)
Andrea Frittoli8bbdb162014-01-06 11:06:13 +0000392 self.data_processing_client = DataProcessingClient(
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000393 self.auth_provider)
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +0900394 self.migrations_client = MigrationsClientJSON(self.auth_provider)
Jay Pipes50677282012-01-06 15:39:20 -0500395
396
Jay Pipesff10d552012-04-06 14:18:50 -0400397class AltManager(Manager):
398
399 """
400 Manager object that uses the alt_XXX credentials for its
401 managed client objects
402 """
403
Marc Koderer24eb89c2014-01-31 11:23:33 +0100404 def __init__(self, interface='json', service=None):
Sean Dague86bd8422013-12-20 09:56:44 -0500405 super(AltManager, self).__init__(CONF.identity.alt_username,
406 CONF.identity.alt_password,
407 CONF.identity.alt_tenant_name,
Marc Koderer24eb89c2014-01-31 11:23:33 +0100408 interface=interface,
409 service=service)
Jay Pipesff10d552012-04-06 14:18:50 -0400410
411
412class AdminManager(Manager):
413
414 """
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100415 Manager object that uses the admin credentials for its
Jay Pipesff10d552012-04-06 14:18:50 -0400416 managed client objects
417 """
418
Marc Koderer24eb89c2014-01-31 11:23:33 +0100419 def __init__(self, interface='json', service=None):
Sean Dague86bd8422013-12-20 09:56:44 -0500420 super(AdminManager, self).__init__(CONF.identity.admin_username,
421 CONF.identity.admin_password,
422 CONF.identity.admin_tenant_name,
Marc Koderer24eb89c2014-01-31 11:23:33 +0100423 interface=interface,
424 service=service)
Jay Pipesff10d552012-04-06 14:18:50 -0400425
426
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100427class ComputeAdminManager(Manager):
428
429 """
430 Manager object that uses the compute_admin credentials for its
431 managed client objects
432 """
433
Marc Koderer24eb89c2014-01-31 11:23:33 +0100434 def __init__(self, interface='json', service=None):
Attila Fazekascadcb1f2013-01-21 23:10:53 +0100435 base = super(ComputeAdminManager, self)
Sean Dague86bd8422013-12-20 09:56:44 -0500436 base.__init__(CONF.compute_admin.username,
437 CONF.compute_admin.password,
438 CONF.compute_admin.tenant_name,
Marc Koderer24eb89c2014-01-31 11:23:33 +0100439 interface=interface,
440 service=service)
Steve Bakerc60e4e32013-05-06 15:22:41 +1200441
442
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000443class OfficialClientManager(manager.Manager):
444 """
445 Manager that provides access to the official python clients for
446 calling various OpenStack APIs.
447 """
448
449 NOVACLIENT_VERSION = '2'
450 CINDERCLIENT_VERSION = '1'
451 HEATCLIENT_VERSION = '1'
Adam Gandelman4a48a602014-03-20 18:23:18 -0700452 IRONICCLIENT_VERSION = '1'
Sergey Lukjanov7409e2e2014-03-27 12:55:50 +0400453 SAHARACLIENT_VERSION = '1.1'
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000454
455 def __init__(self, username, password, tenant_name):
456 # FIXME(andreaf) Auth provider for client_type 'official' is
457 # not implemented yet, setting to 'tempest' for now.
458 self.client_type = 'tempest'
459 self.interface = None
460 # super cares for credentials validation
461 super(OfficialClientManager, self).__init__(
462 username=username, password=password, tenant_name=tenant_name)
Adam Gandelman4a48a602014-03-20 18:23:18 -0700463 self.baremetal_client = self._get_baremetal_client()
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000464 self.compute_client = self._get_compute_client(username,
465 password,
466 tenant_name)
467 self.identity_client = self._get_identity_client(username,
468 password,
469 tenant_name)
470 self.image_client = self._get_image_client()
471 self.network_client = self._get_network_client()
472 self.volume_client = self._get_volume_client(username,
473 password,
474 tenant_name)
475 self.object_storage_client = self._get_object_storage_client(
476 username,
477 password,
478 tenant_name)
479 self.orchestration_client = self._get_orchestration_client(
480 username,
481 password,
482 tenant_name)
Sergey Lukjanov7409e2e2014-03-27 12:55:50 +0400483 self.data_processing_client = self._get_data_processing_client(
484 username,
485 password,
486 tenant_name)
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000487
Adam Gandelman4a48a602014-03-20 18:23:18 -0700488 def _get_roles(self):
489 keystone_admin = self._get_identity_client(
490 CONF.identity.admin_username,
491 CONF.identity.admin_password,
492 CONF.identity.admin_tenant_name)
493
494 username = self.credentials['username']
495 tenant_name = self.credentials['tenant_name']
496 user_id = keystone_admin.users.find(name=username).id
497 tenant_id = keystone_admin.tenants.find(name=tenant_name).id
498
499 roles = keystone_admin.roles.roles_for_user(
500 user=user_id, tenant=tenant_id)
501
502 return [r.name for r in roles]
503
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000504 def _get_compute_client(self, username, password, tenant_name):
505 # Novaclient will not execute operations for anyone but the
506 # identified user, so a new client needs to be created for
507 # each user that operations need to be performed for.
Zhi Kun Liufaa6b5f2014-04-14 01:38:16 -0500508 if not CONF.service_available.nova:
509 return None
510 import novaclient.client
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000511 self._validate_credentials(username, password, tenant_name)
512
513 auth_url = CONF.identity.uri
514 dscv = CONF.identity.disable_ssl_certificate_validation
515 region = CONF.identity.region
516
517 client_args = (username, password, tenant_name, auth_url)
518
519 # Create our default Nova client to use in testing
520 service_type = CONF.compute.catalog_type
521 endpoint_type = CONF.compute.endpoint_type
522 return novaclient.client.Client(self.NOVACLIENT_VERSION,
523 *client_args,
524 service_type=service_type,
525 endpoint_type=endpoint_type,
526 region_name=region,
527 no_cache=True,
528 insecure=dscv,
529 http_log_debug=True)
530
531 def _get_image_client(self):
Zhi Kun Liufaa6b5f2014-04-14 01:38:16 -0500532 if not CONF.service_available.glance:
533 return None
534 import glanceclient
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000535 token = self.identity_client.auth_token
536 region = CONF.identity.region
537 endpoint_type = CONF.image.endpoint_type
538 endpoint = self.identity_client.service_catalog.url_for(
539 attr='region', filter_value=region,
540 service_type=CONF.image.catalog_type, endpoint_type=endpoint_type)
541 dscv = CONF.identity.disable_ssl_certificate_validation
542 return glanceclient.Client('1', endpoint=endpoint, token=token,
543 insecure=dscv)
544
545 def _get_volume_client(self, username, password, tenant_name):
Zhi Kun Liufaa6b5f2014-04-14 01:38:16 -0500546 if not CONF.service_available.cinder:
547 return None
548 import cinderclient.client
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000549 auth_url = CONF.identity.uri
550 region = CONF.identity.region
551 endpoint_type = CONF.volume.endpoint_type
Rob Crittenden1aba5d02014-03-25 23:27:09 -0400552 dscv = CONF.identity.disable_ssl_certificate_validation
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000553 return cinderclient.client.Client(self.CINDERCLIENT_VERSION,
554 username,
555 password,
556 tenant_name,
557 auth_url,
558 region_name=region,
559 endpoint_type=endpoint_type,
Rob Crittenden1aba5d02014-03-25 23:27:09 -0400560 insecure=dscv,
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000561 http_log_debug=True)
562
563 def _get_object_storage_client(self, username, password, tenant_name):
Zhi Kun Liufaa6b5f2014-04-14 01:38:16 -0500564 if not CONF.service_available.swift:
565 return None
566 import swiftclient
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000567 auth_url = CONF.identity.uri
568 # add current tenant to swift operator role group.
569 keystone_admin = self._get_identity_client(
570 CONF.identity.admin_username,
571 CONF.identity.admin_password,
572 CONF.identity.admin_tenant_name)
573
574 # enable test user to operate swift by adding operator role to him.
575 roles = keystone_admin.roles.list()
576 operator_role = CONF.object_storage.operator_role
577 member_role = [role for role in roles if role.name == operator_role][0]
578 # NOTE(maurosr): This is surrounded in the try-except block cause
579 # neutron tests doesn't have tenant isolation.
580 try:
581 keystone_admin.roles.add_user_role(self.identity_client.user_id,
582 member_role.id,
583 self.identity_client.tenant_id)
584 except keystoneclient.exceptions.Conflict:
585 pass
586
587 endpoint_type = CONF.object_storage.endpoint_type
588 os_options = {'endpoint_type': endpoint_type}
589 return swiftclient.Connection(auth_url, username, password,
590 tenant_name=tenant_name,
591 auth_version='2',
592 os_options=os_options)
593
594 def _get_orchestration_client(self, username=None, password=None,
595 tenant_name=None):
Zhi Kun Liufaa6b5f2014-04-14 01:38:16 -0500596 if not CONF.service_available.heat:
597 return None
598 import heatclient.client
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000599 if not username:
600 username = CONF.identity.admin_username
601 if not password:
602 password = CONF.identity.admin_password
603 if not tenant_name:
604 tenant_name = CONF.identity.tenant_name
605
606 self._validate_credentials(username, password, tenant_name)
607
608 keystone = self._get_identity_client(username, password, tenant_name)
609 region = CONF.identity.region
610 endpoint_type = CONF.orchestration.endpoint_type
611 token = keystone.auth_token
612 service_type = CONF.orchestration.catalog_type
613 try:
614 endpoint = keystone.service_catalog.url_for(
615 attr='region',
616 filter_value=region,
617 service_type=service_type,
618 endpoint_type=endpoint_type)
619 except keystoneclient.exceptions.EndpointNotFound:
620 return None
621 else:
622 return heatclient.client.Client(self.HEATCLIENT_VERSION,
623 endpoint,
624 token=token,
625 username=username,
626 password=password)
627
628 def _get_identity_client(self, username, password, tenant_name):
629 # This identity client is not intended to check the security
630 # of the identity service, so use admin credentials by default.
631 self._validate_credentials(username, password, tenant_name)
632
633 auth_url = CONF.identity.uri
634 dscv = CONF.identity.disable_ssl_certificate_validation
635
636 return keystoneclient.v2_0.client.Client(username=username,
637 password=password,
638 tenant_name=tenant_name,
639 auth_url=auth_url,
640 insecure=dscv)
641
Adam Gandelman4a48a602014-03-20 18:23:18 -0700642 def _get_baremetal_client(self):
643 # ironic client is currently intended to by used by admin users
Zhi Kun Liufaa6b5f2014-04-14 01:38:16 -0500644 if not CONF.service_available.ironic:
645 return None
646 import ironicclient.client
Adam Gandelman4a48a602014-03-20 18:23:18 -0700647 roles = self._get_roles()
648 if CONF.identity.admin_role not in roles:
649 return None
650
651 auth_url = CONF.identity.uri
652 api_version = self.IRONICCLIENT_VERSION
653 insecure = CONF.identity.disable_ssl_certificate_validation
654 service_type = CONF.baremetal.catalog_type
655 endpoint_type = CONF.baremetal.endpoint_type
656 creds = {
657 'os_username': self.credentials['username'],
658 'os_password': self.credentials['password'],
659 'os_tenant_name': self.credentials['tenant_name']
660 }
661
662 try:
663 return ironicclient.client.get_client(
664 api_version=api_version,
665 os_auth_url=auth_url,
666 insecure=insecure,
667 os_service_type=service_type,
668 os_endpoint_type=endpoint_type,
669 **creds)
670 except keystoneclient.exceptions.EndpointNotFound:
671 return None
672
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000673 def _get_network_client(self):
674 # The intended configuration is for the network client to have
675 # admin privileges and indicate for whom resources are being
676 # created via a 'tenant_id' parameter. This will often be
677 # preferable to authenticating as a specific user because
678 # working with certain resources (public routers and networks)
679 # often requires admin privileges anyway.
Zhi Kun Liufaa6b5f2014-04-14 01:38:16 -0500680 if not CONF.service_available.neutron:
681 return None
682 import neutronclient.v2_0.client
Andrea Frittolif9cde7e2014-02-18 09:57:04 +0000683 username = CONF.identity.admin_username
684 password = CONF.identity.admin_password
685 tenant_name = CONF.identity.admin_tenant_name
686
687 self._validate_credentials(username, password, tenant_name)
688
689 auth_url = CONF.identity.uri
690 dscv = CONF.identity.disable_ssl_certificate_validation
691 endpoint_type = CONF.network.endpoint_type
692
693 return neutronclient.v2_0.client.Client(username=username,
694 password=password,
695 tenant_name=tenant_name,
696 endpoint_type=endpoint_type,
697 auth_url=auth_url,
698 insecure=dscv)
Sergey Lukjanov7409e2e2014-03-27 12:55:50 +0400699
700 def _get_data_processing_client(self, username, password, tenant_name):
701 if not CONF.service_available.sahara:
702 # Sahara isn't available
703 return None
704
705 import saharaclient.client
706
707 self._validate_credentials(username, password, tenant_name)
708
709 endpoint_type = CONF.data_processing.endpoint_type
710 catalog_type = CONF.data_processing.catalog_type
711 auth_url = CONF.identity.uri
712
713 client = saharaclient.client.Client(self.SAHARACLIENT_VERSION,
714 username, password,
715 project_name=tenant_name,
716 endpoint_type=endpoint_type,
717 service_type=catalog_type,
718 auth_url=auth_url)
719
720 return client