ZhiQiang Fan | 39f9722 | 2013-09-20 04:49:44 +0800 | [diff] [blame] | 1 | # Copyright 2012 OpenStack Foundation |
Jay Pipes | 3f981df | 2012-03-27 18:59:44 -0400 | [diff] [blame] | 2 | # 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 Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 16 | import keystoneclient.exceptions |
| 17 | import keystoneclient.v2_0.client |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 18 | |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 19 | from tempest import auth |
Matthew Treinish | 5c660ab | 2014-05-18 21:14:36 -0400 | [diff] [blame] | 20 | from tempest.common import rest_client |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 21 | from tempest import config |
Daryl Walleck | 587385b | 2012-03-03 13:00:26 -0600 | [diff] [blame] | 22 | from tempest import exceptions |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 23 | from tempest import manager |
Matthew Treinish | f4a9b0f | 2013-07-26 16:58:26 -0400 | [diff] [blame] | 24 | from tempest.openstack.common import log as logging |
Roman Prykhodchenko | 62b1ed1 | 2013-10-16 21:51:47 +0300 | [diff] [blame] | 25 | from tempest.services.baremetal.v1.client_json import BaremetalClientJSON |
Attila Fazekas | 1aed620 | 2013-02-11 14:47:45 +0100 | [diff] [blame] | 26 | from tempest.services import botoclients |
Yuiko Takada | 420f2eb | 2014-04-02 19:53:38 +0900 | [diff] [blame] | 27 | from tempest.services.compute.json.agents_client import \ |
| 28 | AgentsClientJSON |
Mitsuhiko Yamazaki | 74f0707 | 2013-04-02 11:52:31 +0900 | [diff] [blame] | 29 | from tempest.services.compute.json.aggregates_client import \ |
| 30 | AggregatesClientJSON |
Leo Toyoda | a527891 | 2013-04-16 15:40:12 +0900 | [diff] [blame] | 31 | from tempest.services.compute.json.availability_zone_client import \ |
| 32 | AvailabilityZoneClientJSON |
ivan-zhu | d57f3cf | 2013-11-06 16:59:52 +0800 | [diff] [blame] | 33 | from tempest.services.compute.json.certificates_client import \ |
| 34 | CertificatesClientJSON |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 35 | from tempest.services.compute.json.extensions_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 36 | ExtensionsClientJSON |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 37 | from tempest.services.compute.json.fixed_ips_client import FixedIPsClientJSON |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 38 | from tempest.services.compute.json.flavors_client import FlavorsClientJSON |
| 39 | from tempest.services.compute.json.floating_ips_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 40 | FloatingIPsClientJSON |
Attila Fazekas | 8e99b99 | 2013-02-24 09:53:23 +0100 | [diff] [blame] | 41 | from tempest.services.compute.json.hosts_client import HostsClientJSON |
Tony Yang | 3d5f163 | 2013-06-06 14:17:57 +0800 | [diff] [blame] | 42 | from tempest.services.compute.json.hypervisor_client import \ |
| 43 | HypervisorClientJSON |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 44 | from tempest.services.compute.json.images_client import ImagesClientJSON |
ivan-zhu | ef7a1bd | 2013-10-22 17:56:46 +0800 | [diff] [blame] | 45 | from tempest.services.compute.json.instance_usage_audit_log_client import \ |
| 46 | InstanceUsagesAuditLogClientJSON |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 47 | from tempest.services.compute.json.interfaces_client import \ |
| 48 | InterfacesClientJSON |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 49 | from tempest.services.compute.json.keypairs_client import KeyPairsClientJSON |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 50 | from tempest.services.compute.json.limits_client import LimitsClientJSON |
Ken'ichi Ohmichi | 2fdc182 | 2014-03-18 09:10:57 +0900 | [diff] [blame] | 51 | from tempest.services.compute.json.migrations_client import \ |
| 52 | MigrationsClientJSON |
Matt Riedemann | 848805f | 2014-06-16 13:23:51 -0700 | [diff] [blame] | 53 | from tempest.services.compute.json.quotas_client import QuotaClassesClientJSON |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 54 | from tempest.services.compute.json.quotas_client import QuotasClientJSON |
Ghanshyam | 9d9201d | 2014-04-16 19:28:09 +0900 | [diff] [blame^] | 55 | from tempest.services.compute.json.security_group_default_rules_client import \ |
| 56 | SecurityGroupDefaultRulesClientJSON |
Matthew Treinish | a83a16e | 2012-12-07 13:44:02 -0500 | [diff] [blame] | 57 | from tempest.services.compute.json.security_groups_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 58 | SecurityGroupsClientJSON |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 59 | from tempest.services.compute.json.servers_client import ServersClientJSON |
Leo Toyoda | 3ae31e1 | 2013-04-19 11:19:57 +0900 | [diff] [blame] | 60 | from tempest.services.compute.json.services_client import ServicesClientJSON |
Leo Toyoda | d80b6a0 | 2013-05-08 12:15:13 +0900 | [diff] [blame] | 61 | from tempest.services.compute.json.tenant_usages_client import \ |
| 62 | TenantUsagesClientJSON |
Matthew Treinish | a83a16e | 2012-12-07 13:44:02 -0500 | [diff] [blame] | 63 | from tempest.services.compute.json.volumes_extensions_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 64 | VolumesExtensionsClientJSON |
YuikoTakada | 8a2ec11 | 2014-02-18 21:13:51 +0000 | [diff] [blame] | 65 | from tempest.services.compute.v3.json.agents_client import AgentsV3ClientJSON |
ivan-zhu | 00fe64f | 2013-08-20 19:35:51 +0800 | [diff] [blame] | 66 | from tempest.services.compute.v3.json.aggregates_client import \ |
| 67 | AggregatesV3ClientJSON |
ivan-zhu | ac7b380 | 2013-08-21 16:03:53 +0800 | [diff] [blame] | 68 | from tempest.services.compute.v3.json.availability_zone_client import \ |
| 69 | AvailabilityZoneV3ClientJSON |
ivan-zhu | 0e06292 | 2013-12-17 16:14:12 +0800 | [diff] [blame] | 70 | from tempest.services.compute.v3.json.certificates_client import \ |
| 71 | CertificatesV3ClientJSON |
ivan-zhu | 31d9848 | 2013-08-22 10:51:48 +0800 | [diff] [blame] | 72 | from tempest.services.compute.v3.json.extensions_client import \ |
| 73 | ExtensionsV3ClientJSON |
ivan-zhu | b25900a | 2013-12-13 16:28:45 +0800 | [diff] [blame] | 74 | from tempest.services.compute.v3.json.flavors_client import FlavorsV3ClientJSON |
ivan-zhu | 00fe64f | 2013-08-20 19:35:51 +0800 | [diff] [blame] | 75 | from tempest.services.compute.v3.json.hosts_client import HostsV3ClientJSON |
ivan-zhu | 6f5f9e9 | 2013-08-21 22:16:37 +0800 | [diff] [blame] | 76 | from tempest.services.compute.v3.json.hypervisor_client import \ |
| 77 | HypervisorV3ClientJSON |
ivan-zhu | 91feab9 | 2013-08-15 18:25:33 +0800 | [diff] [blame] | 78 | from tempest.services.compute.v3.json.interfaces_client import \ |
| 79 | InterfacesV3ClientJSON |
ivan-zhu | 7e7e6a3 | 2013-11-20 16:07:29 +0800 | [diff] [blame] | 80 | from tempest.services.compute.v3.json.keypairs_client import \ |
| 81 | KeyPairsV3ClientJSON |
Ken'ichi Ohmichi | 8f088c1 | 2014-03-28 15:16:11 +0900 | [diff] [blame] | 82 | from tempest.services.compute.v3.json.migration_client import \ |
| 83 | MigrationsV3ClientJSON |
ivan-zhu | b6d69ee | 2013-12-17 14:16:31 +0800 | [diff] [blame] | 84 | from tempest.services.compute.v3.json.quotas_client import \ |
| 85 | QuotasV3ClientJSON |
ivan-zhu | 8f992be | 2013-07-31 14:56:58 +0800 | [diff] [blame] | 86 | from tempest.services.compute.v3.json.servers_client import \ |
| 87 | ServersV3ClientJSON |
ivan-zhu | 5c86ae6 | 2013-08-20 21:09:01 +0800 | [diff] [blame] | 88 | from tempest.services.compute.v3.json.services_client import \ |
| 89 | ServicesV3ClientJSON |
Ken'ichi Ohmichi | 3d6b6fa | 2014-01-08 04:42:16 +0900 | [diff] [blame] | 90 | from tempest.services.compute.v3.json.version_client import \ |
| 91 | VersionV3ClientJSON |
Mitsuhiko Yamazaki | ae8fc53 | 2013-04-22 11:17:35 +0900 | [diff] [blame] | 92 | from tempest.services.compute.xml.aggregates_client import AggregatesClientXML |
Leo Toyoda | a527891 | 2013-04-16 15:40:12 +0900 | [diff] [blame] | 93 | from tempest.services.compute.xml.availability_zone_client import \ |
| 94 | AvailabilityZoneClientXML |
ivan-zhu | d57f3cf | 2013-11-06 16:59:52 +0800 | [diff] [blame] | 95 | from tempest.services.compute.xml.certificates_client import \ |
| 96 | CertificatesClientXML |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 97 | from tempest.services.compute.xml.extensions_client import ExtensionsClientXML |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 98 | from tempest.services.compute.xml.fixed_ips_client import FixedIPsClientXML |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 99 | from tempest.services.compute.xml.flavors_client import FlavorsClientXML |
| 100 | from tempest.services.compute.xml.floating_ips_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 101 | FloatingIPsClientXML |
Ken'ichi Ohmichi | a1aa44c | 2013-12-06 20:48:24 +0900 | [diff] [blame] | 102 | from tempest.services.compute.xml.hosts_client import HostsClientXML |
Tony Yang | 3d5f163 | 2013-06-06 14:17:57 +0800 | [diff] [blame] | 103 | from tempest.services.compute.xml.hypervisor_client import HypervisorClientXML |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 104 | from tempest.services.compute.xml.images_client import ImagesClientXML |
ivan-zhu | ef7a1bd | 2013-10-22 17:56:46 +0800 | [diff] [blame] | 105 | from tempest.services.compute.xml.instance_usage_audit_log_client import \ |
| 106 | InstanceUsagesAuditLogClientXML |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 107 | from tempest.services.compute.xml.interfaces_client import \ |
| 108 | InterfacesClientXML |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 109 | from tempest.services.compute.xml.keypairs_client import KeyPairsClientXML |
| 110 | from tempest.services.compute.xml.limits_client import LimitsClientXML |
Matt Riedemann | 848805f | 2014-06-16 13:23:51 -0700 | [diff] [blame] | 111 | from tempest.services.compute.xml.quotas_client import QuotaClassesClientXML |
rajalakshmi-ganesan | 1982c3c | 2013-01-10 14:56:45 +0530 | [diff] [blame] | 112 | from tempest.services.compute.xml.quotas_client import QuotasClientXML |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 113 | from tempest.services.compute.xml.security_groups_client \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 114 | import SecurityGroupsClientXML |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 115 | from tempest.services.compute.xml.servers_client import ServersClientXML |
Leo Toyoda | 3ae31e1 | 2013-04-19 11:19:57 +0900 | [diff] [blame] | 116 | from tempest.services.compute.xml.services_client import ServicesClientXML |
Leo Toyoda | d80b6a0 | 2013-05-08 12:15:13 +0900 | [diff] [blame] | 117 | from tempest.services.compute.xml.tenant_usages_client import \ |
| 118 | TenantUsagesClientXML |
Matthew Treinish | a83a16e | 2012-12-07 13:44:02 -0500 | [diff] [blame] | 119 | from tempest.services.compute.xml.volumes_extensions_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 120 | VolumesExtensionsClientXML |
Sergey Lukjanov | 3bc60e9 | 2013-12-10 16:40:50 +0400 | [diff] [blame] | 121 | from tempest.services.data_processing.v1_1.client import DataProcessingClient |
Nikhil Manchanda | dd6886f | 2014-03-03 01:58:45 -0800 | [diff] [blame] | 122 | from tempest.services.database.json.flavors_client import \ |
| 123 | DatabaseFlavorsClientJSON |
Peter Stachowski | 320f9c7 | 2014-04-21 16:13:23 -0400 | [diff] [blame] | 124 | from tempest.services.database.json.versions_client import \ |
| 125 | DatabaseVersionsClientJSON |
Attila Fazekas | 407b6db | 2013-01-19 12:48:36 +0100 | [diff] [blame] | 126 | from tempest.services.identity.json.identity_client import IdentityClientJSON |
| 127 | from tempest.services.identity.json.identity_client import TokenClientJSON |
nayna-patel | 914b471 | 2013-07-16 08:29:05 +0000 | [diff] [blame] | 128 | from tempest.services.identity.v3.json.credentials_client import \ |
| 129 | CredentialsClientJSON |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 130 | from tempest.services.identity.v3.json.endpoints_client import \ |
| 131 | EndPointClientJSON |
rajalakshmi-ganesan | 7312bb5 | 2013-01-29 20:03:42 +0530 | [diff] [blame] | 132 | from tempest.services.identity.v3.json.identity_client import \ |
| 133 | IdentityV3ClientJSON |
nayna-patel | b35f723 | 2013-06-28 07:08:44 +0000 | [diff] [blame] | 134 | from tempest.services.identity.v3.json.identity_client import V3TokenClientJSON |
harika-vakadi | 40e1011 | 2013-02-08 14:38:09 +0530 | [diff] [blame] | 135 | from tempest.services.identity.v3.json.policy_client import PolicyClientJSON |
ravikumar-venkatesan | 3052e94 | 2014-05-12 18:25:17 +0000 | [diff] [blame] | 136 | from tempest.services.identity.v3.json.region_client import RegionClientJSON |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 137 | from tempest.services.identity.v3.json.service_client import \ |
| 138 | ServiceClientJSON |
nayna-patel | 914b471 | 2013-07-16 08:29:05 +0000 | [diff] [blame] | 139 | from tempest.services.identity.v3.xml.credentials_client import \ |
| 140 | CredentialsClientXML |
rajalakshmi-ganesan | ab42672 | 2013-02-08 15:49:15 +0530 | [diff] [blame] | 141 | from tempest.services.identity.v3.xml.endpoints_client import EndPointClientXML |
rajalakshmi-ganesan | 7312bb5 | 2013-01-29 20:03:42 +0530 | [diff] [blame] | 142 | from tempest.services.identity.v3.xml.identity_client import \ |
| 143 | IdentityV3ClientXML |
nayna-patel | b35f723 | 2013-06-28 07:08:44 +0000 | [diff] [blame] | 144 | from tempest.services.identity.v3.xml.identity_client import V3TokenClientXML |
harika-vakadi | 40e1011 | 2013-02-08 14:38:09 +0530 | [diff] [blame] | 145 | from tempest.services.identity.v3.xml.policy_client import PolicyClientXML |
ravikumar-venkatesan | 3052e94 | 2014-05-12 18:25:17 +0000 | [diff] [blame] | 146 | from tempest.services.identity.v3.xml.region_client import RegionClientXML |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 147 | from tempest.services.identity.v3.xml.service_client import \ |
| 148 | ServiceClientXML |
Attila Fazekas | 407b6db | 2013-01-19 12:48:36 +0100 | [diff] [blame] | 149 | from tempest.services.identity.xml.identity_client import IdentityClientXML |
| 150 | from tempest.services.identity.xml.identity_client import TokenClientXML |
Matthew Treinish | 6d59c99 | 2013-03-01 16:20:04 -0500 | [diff] [blame] | 151 | from tempest.services.image.v1.json.image_client import ImageClientJSON |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 152 | from tempest.services.image.v2.json.image_client import ImageClientV2JSON |
raiesmh08 | 6769832 | 2013-08-20 13:09:01 +0530 | [diff] [blame] | 153 | from tempest.services.network.json.network_client import NetworkClientJSON |
| 154 | from tempest.services.network.xml.network_client import NetworkClientXML |
dwalleck | 5d73443 | 2012-10-04 01:11:47 -0500 | [diff] [blame] | 155 | from tempest.services.object_storage.account_client import AccountClient |
harika-vakadi | 2daed0a | 2013-01-01 20:51:39 +0530 | [diff] [blame] | 156 | from tempest.services.object_storage.account_client import \ |
| 157 | AccountClientCustomizedHeader |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 158 | from tempest.services.object_storage.container_client import ContainerClient |
| 159 | from tempest.services.object_storage.object_client import ObjectClient |
| 160 | from tempest.services.object_storage.object_client import \ |
| 161 | ObjectClientCustomizedHeader |
Steve Baker | c60e4e3 | 2013-05-06 15:22:41 +1200 | [diff] [blame] | 162 | from tempest.services.orchestration.json.orchestration_client import \ |
| 163 | OrchestrationClient |
Malini Kamalambal | 6e7b3b8 | 2014-02-06 06:49:04 -0500 | [diff] [blame] | 164 | from tempest.services.queuing.json.queuing_client import QueuingClientJSON |
Nikolay Pliashechnikov | b053aab | 2013-11-05 06:06:44 -0800 | [diff] [blame] | 165 | from tempest.services.telemetry.json.telemetry_client import \ |
| 166 | TelemetryClientJSON |
| 167 | from tempest.services.telemetry.xml.telemetry_client import \ |
| 168 | TelemetryClientXML |
Nayna Patel | 4a5024c | 2013-11-18 07:08:23 +0000 | [diff] [blame] | 169 | from tempest.services.volume.json.admin.volume_hosts_client import \ |
| 170 | VolumeHostsClientJSON |
Sylvain Baubeau | fdd3459 | 2014-02-20 18:40:10 +0100 | [diff] [blame] | 171 | from tempest.services.volume.json.admin.volume_quotas_client import \ |
| 172 | VolumeQuotasClientJSON |
Abhijeet.Jain | 0056b07 | 2014-04-15 09:32:29 +0530 | [diff] [blame] | 173 | from tempest.services.volume.json.admin.volume_services_client import \ |
| 174 | VolumesServicesClientJSON |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 175 | from tempest.services.volume.json.admin.volume_types_client import \ |
| 176 | VolumeTypesClientJSON |
Abhijeet.Jain | 6109bb8 | 2014-05-01 10:29:15 +0530 | [diff] [blame] | 177 | from tempest.services.volume.json.availability_zone_client import \ |
| 178 | VolumeAvailabilityZoneClientJSON |
Giulio Fidente | 74b08ad | 2014-01-18 04:02:51 +0100 | [diff] [blame] | 179 | from tempest.services.volume.json.backups_client import BackupsClientJSON |
Matthew Treinish | 2324e6b | 2013-10-21 20:25:17 +0000 | [diff] [blame] | 180 | from tempest.services.volume.json.extensions_client import \ |
| 181 | ExtensionsClientJSON as VolumeExtensionClientJSON |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 182 | from tempest.services.volume.json.snapshots_client import SnapshotsClientJSON |
| 183 | from tempest.services.volume.json.volumes_client import VolumesClientJSON |
Zhi Kun Liu | 8cc3c84 | 2014-01-07 10:44:34 +0800 | [diff] [blame] | 184 | from tempest.services.volume.v2.json.volumes_client import VolumesV2ClientJSON |
| 185 | from tempest.services.volume.v2.xml.volumes_client import VolumesV2ClientXML |
Nayna Patel | 4a5024c | 2013-11-18 07:08:23 +0000 | [diff] [blame] | 186 | from tempest.services.volume.xml.admin.volume_hosts_client import \ |
| 187 | VolumeHostsClientXML |
Sylvain Baubeau | fdd3459 | 2014-02-20 18:40:10 +0100 | [diff] [blame] | 188 | from tempest.services.volume.xml.admin.volume_quotas_client import \ |
| 189 | VolumeQuotasClientXML |
Abhijeet.Jain | 0056b07 | 2014-04-15 09:32:29 +0530 | [diff] [blame] | 190 | from tempest.services.volume.xml.admin.volume_services_client import \ |
| 191 | VolumesServicesClientXML |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 192 | from tempest.services.volume.xml.admin.volume_types_client import \ |
| 193 | VolumeTypesClientXML |
Abhijeet.Jain | 6109bb8 | 2014-05-01 10:29:15 +0530 | [diff] [blame] | 194 | from tempest.services.volume.xml.availability_zone_client import \ |
| 195 | VolumeAvailabilityZoneClientXML |
Giulio Fidente | 74b08ad | 2014-01-18 04:02:51 +0100 | [diff] [blame] | 196 | from tempest.services.volume.xml.backups_client import BackupsClientXML |
Matthew Treinish | 2324e6b | 2013-10-21 20:25:17 +0000 | [diff] [blame] | 197 | from tempest.services.volume.xml.extensions_client import \ |
| 198 | ExtensionsClientXML as VolumeExtensionClientXML |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 199 | from tempest.services.volume.xml.snapshots_client import SnapshotsClientXML |
| 200 | from tempest.services.volume.xml.volumes_client import VolumesClientXML |
Vincent Hou | 6b8a7b7 | 2012-08-25 01:24:33 +0800 | [diff] [blame] | 201 | |
Sean Dague | 86bd842 | 2013-12-20 09:56:44 -0500 | [diff] [blame] | 202 | CONF = config.CONF |
Jay Pipes | 3f981df | 2012-03-27 18:59:44 -0400 | [diff] [blame] | 203 | LOG = logging.getLogger(__name__) |
| 204 | |
Vincent Hou | 6b8a7b7 | 2012-08-25 01:24:33 +0800 | [diff] [blame] | 205 | |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 206 | class Manager(manager.Manager): |
Daryl Walleck | 1465d61 | 2011-11-02 02:22:15 -0500 | [diff] [blame] | 207 | |
Jay Pipes | 3f981df | 2012-03-27 18:59:44 -0400 | [diff] [blame] | 208 | """ |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 209 | Top level manager for OpenStack tempest clients |
Jay Pipes | 3f981df | 2012-03-27 18:59:44 -0400 | [diff] [blame] | 210 | """ |
| 211 | |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 212 | def __init__(self, credentials=None, interface='json', service=None): |
| 213 | # Set interface and client type first |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 214 | self.interface = interface |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 215 | self.client_type = 'tempest' |
| 216 | # super cares for credentials validation |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 217 | super(Manager, self).__init__(credentials=credentials) |
Brant Knudson | c7ca334 | 2013-03-28 21:08:50 -0500 | [diff] [blame] | 218 | |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 219 | if self.interface == 'xml': |
| 220 | self.certificates_client = CertificatesClientXML( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 221 | self.auth_provider) |
| 222 | self.servers_client = ServersClientXML(self.auth_provider) |
| 223 | self.limits_client = LimitsClientXML(self.auth_provider) |
| 224 | self.images_client = ImagesClientXML(self.auth_provider) |
| 225 | self.keypairs_client = KeyPairsClientXML(self.auth_provider) |
| 226 | self.quotas_client = QuotasClientXML(self.auth_provider) |
Matt Riedemann | 848805f | 2014-06-16 13:23:51 -0700 | [diff] [blame] | 227 | self.quota_classes_client = QuotaClassesClientXML( |
| 228 | self.auth_provider) |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 229 | self.flavors_client = FlavorsClientXML(self.auth_provider) |
| 230 | self.extensions_client = ExtensionsClientXML(self.auth_provider) |
Attila Fazekas | 7e678de | 2013-07-13 14:13:28 +0200 | [diff] [blame] | 231 | self.volumes_extensions_client = VolumesExtensionsClientXML( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 232 | self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 233 | self.floating_ips_client = FloatingIPsClientXML( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 234 | self.auth_provider) |
| 235 | self.backups_client = BackupsClientXML(self.auth_provider) |
| 236 | self.snapshots_client = SnapshotsClientXML(self.auth_provider) |
| 237 | self.volumes_client = VolumesClientXML(self.auth_provider) |
| 238 | self.volumes_v2_client = VolumesV2ClientXML(self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 239 | self.volume_types_client = VolumeTypesClientXML( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 240 | self.auth_provider) |
| 241 | self.identity_client = IdentityClientXML(self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 242 | self.identity_v3_client = IdentityV3ClientXML( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 243 | self.auth_provider) |
Attila Fazekas | 7e678de | 2013-07-13 14:13:28 +0200 | [diff] [blame] | 244 | self.security_groups_client = SecurityGroupsClientXML( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 245 | self.auth_provider) |
| 246 | self.interfaces_client = InterfacesClientXML(self.auth_provider) |
| 247 | self.endpoints_client = EndPointClientXML(self.auth_provider) |
| 248 | self.fixed_ips_client = FixedIPsClientXML(self.auth_provider) |
Attila Fazekas | 7e678de | 2013-07-13 14:13:28 +0200 | [diff] [blame] | 249 | self.availability_zone_client = AvailabilityZoneClientXML( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 250 | self.auth_provider) |
| 251 | self.service_client = ServiceClientXML(self.auth_provider) |
Abhijeet.Jain | 0056b07 | 2014-04-15 09:32:29 +0530 | [diff] [blame] | 252 | self.volume_services_client = VolumesServicesClientXML( |
| 253 | self.auth_provider) |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 254 | self.aggregates_client = AggregatesClientXML(self.auth_provider) |
| 255 | self.services_client = ServicesClientXML(self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 256 | self.tenant_usages_client = TenantUsagesClientXML( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 257 | self.auth_provider) |
| 258 | self.policy_client = PolicyClientXML(self.auth_provider) |
ravikumar-venkatesan | 3052e94 | 2014-05-12 18:25:17 +0000 | [diff] [blame] | 259 | self.region_client = RegionClientXML(self.auth_provider) |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 260 | self.hosts_client = HostsClientXML(self.auth_provider) |
| 261 | self.hypervisor_client = HypervisorClientXML(self.auth_provider) |
| 262 | self.network_client = NetworkClientXML(self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 263 | self.credentials_client = CredentialsClientXML( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 264 | self.auth_provider) |
ivan-zhu | ef7a1bd | 2013-10-22 17:56:46 +0800 | [diff] [blame] | 265 | self.instance_usages_audit_log_client = \ |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 266 | InstanceUsagesAuditLogClientXML(self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 267 | self.volume_hosts_client = VolumeHostsClientXML( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 268 | self.auth_provider) |
Sylvain Baubeau | fdd3459 | 2014-02-20 18:40:10 +0100 | [diff] [blame] | 269 | self.volume_quotas_client = VolumeQuotasClientXML( |
| 270 | self.auth_provider) |
Matthew Treinish | 2324e6b | 2013-10-21 20:25:17 +0000 | [diff] [blame] | 271 | self.volumes_extension_client = VolumeExtensionClientXML( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 272 | self.auth_provider) |
Nikolay Pliashechnikov | b053aab | 2013-11-05 06:06:44 -0800 | [diff] [blame] | 273 | if CONF.service_available.ceilometer: |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 274 | self.telemetry_client = TelemetryClientXML( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 275 | self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 276 | self.token_client = TokenClientXML() |
| 277 | self.token_v3_client = V3TokenClientXML() |
Abhijeet.Jain | 6109bb8 | 2014-05-01 10:29:15 +0530 | [diff] [blame] | 278 | self.volume_availability_zone_client = \ |
| 279 | VolumeAvailabilityZoneClientXML(self.auth_provider) |
Brant Knudson | c7ca334 | 2013-03-28 21:08:50 -0500 | [diff] [blame] | 280 | |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 281 | elif self.interface == 'json': |
| 282 | self.certificates_client = CertificatesClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 283 | self.auth_provider) |
ivan-zhu | 0e06292 | 2013-12-17 16:14:12 +0800 | [diff] [blame] | 284 | self.certificates_v3_client = CertificatesV3ClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 285 | self.auth_provider) |
| 286 | self.baremetal_client = BaremetalClientJSON(self.auth_provider) |
| 287 | self.servers_client = ServersClientJSON(self.auth_provider) |
| 288 | self.servers_v3_client = ServersV3ClientJSON(self.auth_provider) |
| 289 | self.limits_client = LimitsClientJSON(self.auth_provider) |
| 290 | self.images_client = ImagesClientJSON(self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 291 | self.keypairs_v3_client = KeyPairsV3ClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 292 | self.auth_provider) |
| 293 | self.keypairs_client = KeyPairsClientJSON(self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 294 | self.keypairs_v3_client = KeyPairsV3ClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 295 | self.auth_provider) |
| 296 | self.quotas_client = QuotasClientJSON(self.auth_provider) |
Matt Riedemann | 848805f | 2014-06-16 13:23:51 -0700 | [diff] [blame] | 297 | self.quota_classes_client = QuotaClassesClientJSON( |
| 298 | self.auth_provider) |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 299 | self.quotas_v3_client = QuotasV3ClientJSON(self.auth_provider) |
| 300 | self.flavors_client = FlavorsClientJSON(self.auth_provider) |
| 301 | self.flavors_v3_client = FlavorsV3ClientJSON(self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 302 | self.extensions_v3_client = ExtensionsV3ClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 303 | self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 304 | self.extensions_client = ExtensionsClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 305 | self.auth_provider) |
Attila Fazekas | 7e678de | 2013-07-13 14:13:28 +0200 | [diff] [blame] | 306 | self.volumes_extensions_client = VolumesExtensionsClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 307 | self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 308 | self.floating_ips_client = FloatingIPsClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 309 | self.auth_provider) |
| 310 | self.backups_client = BackupsClientJSON(self.auth_provider) |
| 311 | self.snapshots_client = SnapshotsClientJSON(self.auth_provider) |
| 312 | self.volumes_client = VolumesClientJSON(self.auth_provider) |
| 313 | self.volumes_v2_client = VolumesV2ClientJSON(self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 314 | self.volume_types_client = VolumeTypesClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 315 | self.auth_provider) |
| 316 | self.identity_client = IdentityClientJSON(self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 317 | self.identity_v3_client = IdentityV3ClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 318 | self.auth_provider) |
Attila Fazekas | 7e678de | 2013-07-13 14:13:28 +0200 | [diff] [blame] | 319 | self.security_groups_client = SecurityGroupsClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 320 | self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 321 | self.interfaces_v3_client = InterfacesV3ClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 322 | self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 323 | self.interfaces_client = InterfacesClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 324 | self.auth_provider) |
| 325 | self.endpoints_client = EndPointClientJSON(self.auth_provider) |
| 326 | self.fixed_ips_client = FixedIPsClientJSON(self.auth_provider) |
ivan-zhu | ac7b380 | 2013-08-21 16:03:53 +0800 | [diff] [blame] | 327 | self.availability_zone_v3_client = AvailabilityZoneV3ClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 328 | self.auth_provider) |
Attila Fazekas | 7e678de | 2013-07-13 14:13:28 +0200 | [diff] [blame] | 329 | self.availability_zone_client = AvailabilityZoneClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 330 | self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 331 | self.services_v3_client = ServicesV3ClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 332 | self.auth_provider) |
| 333 | self.service_client = ServiceClientJSON(self.auth_provider) |
Abhijeet.Jain | 0056b07 | 2014-04-15 09:32:29 +0530 | [diff] [blame] | 334 | self.volume_services_client = VolumesServicesClientJSON( |
| 335 | self.auth_provider) |
YuikoTakada | 8a2ec11 | 2014-02-18 21:13:51 +0000 | [diff] [blame] | 336 | self.agents_v3_client = AgentsV3ClientJSON(self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 337 | self.aggregates_v3_client = AggregatesV3ClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 338 | self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 339 | self.aggregates_client = AggregatesClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 340 | self.auth_provider) |
| 341 | self.services_client = ServicesClientJSON(self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 342 | self.tenant_usages_client = TenantUsagesClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 343 | self.auth_provider) |
| 344 | self.version_v3_client = VersionV3ClientJSON(self.auth_provider) |
Ken'ichi Ohmichi | 8f088c1 | 2014-03-28 15:16:11 +0900 | [diff] [blame] | 345 | self.migrations_v3_client = MigrationsV3ClientJSON( |
| 346 | self.auth_provider) |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 347 | self.policy_client = PolicyClientJSON(self.auth_provider) |
ravikumar-venkatesan | 3052e94 | 2014-05-12 18:25:17 +0000 | [diff] [blame] | 348 | self.region_client = RegionClientJSON(self.auth_provider) |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 349 | self.hosts_client = HostsClientJSON(self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 350 | self.hypervisor_v3_client = HypervisorV3ClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 351 | self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 352 | self.hypervisor_client = HypervisorClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 353 | self.auth_provider) |
| 354 | self.network_client = NetworkClientJSON(self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 355 | self.credentials_client = CredentialsClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 356 | self.auth_provider) |
ivan-zhu | ef7a1bd | 2013-10-22 17:56:46 +0800 | [diff] [blame] | 357 | self.instance_usages_audit_log_client = \ |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 358 | InstanceUsagesAuditLogClientJSON(self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 359 | self.volume_hosts_client = VolumeHostsClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 360 | self.auth_provider) |
Sylvain Baubeau | fdd3459 | 2014-02-20 18:40:10 +0100 | [diff] [blame] | 361 | self.volume_quotas_client = VolumeQuotasClientJSON( |
| 362 | self.auth_provider) |
Matthew Treinish | 2324e6b | 2013-10-21 20:25:17 +0000 | [diff] [blame] | 363 | self.volumes_extension_client = VolumeExtensionClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 364 | self.auth_provider) |
| 365 | self.hosts_v3_client = HostsV3ClientJSON(self.auth_provider) |
Nikhil Manchanda | dd6886f | 2014-03-03 01:58:45 -0800 | [diff] [blame] | 366 | self.database_flavors_client = DatabaseFlavorsClientJSON( |
| 367 | self.auth_provider) |
Peter Stachowski | 320f9c7 | 2014-04-21 16:13:23 -0400 | [diff] [blame] | 368 | self.database_versions_client = DatabaseVersionsClientJSON( |
| 369 | self.auth_provider) |
Malini Kamalambal | 6e7b3b8 | 2014-02-06 06:49:04 -0500 | [diff] [blame] | 370 | self.queuing_client = QueuingClientJSON(self.auth_provider) |
Nikolay Pliashechnikov | b053aab | 2013-11-05 06:06:44 -0800 | [diff] [blame] | 371 | if CONF.service_available.ceilometer: |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 372 | self.telemetry_client = TelemetryClientJSON( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 373 | self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 374 | self.token_client = TokenClientJSON() |
| 375 | self.token_v3_client = V3TokenClientJSON() |
Matthew Treinish | 5c660ab | 2014-05-18 21:14:36 -0400 | [diff] [blame] | 376 | self.negative_client = rest_client.NegativeRestClient( |
| 377 | self.auth_provider) |
Marc Koderer | 24eb89c | 2014-01-31 11:23:33 +0100 | [diff] [blame] | 378 | self.negative_client.service = service |
Abhijeet.Jain | 6109bb8 | 2014-05-01 10:29:15 +0530 | [diff] [blame] | 379 | self.volume_availability_zone_client = \ |
| 380 | VolumeAvailabilityZoneClientJSON(self.auth_provider) |
Attila Fazekas | 7e678de | 2013-07-13 14:13:28 +0200 | [diff] [blame] | 381 | |
Attila Fazekas | 7e678de | 2013-07-13 14:13:28 +0200 | [diff] [blame] | 382 | else: |
Dan Smith | cf8fab6 | 2012-08-14 08:03:48 -0700 | [diff] [blame] | 383 | msg = "Unsupported interface type `%s'" % interface |
| 384 | raise exceptions.InvalidConfiguration(msg) |
Attila Fazekas | 7e678de | 2013-07-13 14:13:28 +0200 | [diff] [blame] | 385 | |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 386 | # TODO(andreaf) EC2 client still do their auth, v2 only |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 387 | ec2_client_args = (self.credentials.username, |
| 388 | self.credentials.password, |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 389 | CONF.identity.uri, |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 390 | self.credentials.tenant_name) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 391 | |
Attila Fazekas | 7e678de | 2013-07-13 14:13:28 +0200 | [diff] [blame] | 392 | # common clients |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 393 | self.account_client = AccountClient(self.auth_provider) |
Yuiko Takada | 420f2eb | 2014-04-02 19:53:38 +0900 | [diff] [blame] | 394 | self.agents_client = AgentsClientJSON(self.auth_provider) |
Sean Dague | 86bd842 | 2013-12-20 09:56:44 -0500 | [diff] [blame] | 395 | if CONF.service_available.glance: |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 396 | self.image_client = ImageClientJSON(self.auth_provider) |
| 397 | self.image_client_v2 = ImageClientV2JSON(self.auth_provider) |
| 398 | self.container_client = ContainerClient(self.auth_provider) |
| 399 | self.object_client = ObjectClient(self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 400 | self.orchestration_client = OrchestrationClient( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 401 | self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 402 | self.ec2api_client = botoclients.APIClientEC2(*ec2_client_args) |
| 403 | self.s3_client = botoclients.ObjectClientS3(*ec2_client_args) |
| 404 | self.custom_object_client = ObjectClientCustomizedHeader( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 405 | self.auth_provider) |
harika-vakadi | 2daed0a | 2013-01-01 20:51:39 +0530 | [diff] [blame] | 406 | self.custom_account_client = \ |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 407 | AccountClientCustomizedHeader(self.auth_provider) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 408 | self.data_processing_client = DataProcessingClient( |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 409 | self.auth_provider) |
Ken'ichi Ohmichi | 2fdc182 | 2014-03-18 09:10:57 +0900 | [diff] [blame] | 410 | self.migrations_client = MigrationsClientJSON(self.auth_provider) |
Ghanshyam | 9d9201d | 2014-04-16 19:28:09 +0900 | [diff] [blame^] | 411 | self.security_group_default_rules_client = ( |
| 412 | SecurityGroupDefaultRulesClientJSON(self.auth_provider)) |
Jay Pipes | 5067728 | 2012-01-06 15:39:20 -0500 | [diff] [blame] | 413 | |
| 414 | |
Jay Pipes | ff10d55 | 2012-04-06 14:18:50 -0400 | [diff] [blame] | 415 | class AltManager(Manager): |
| 416 | |
| 417 | """ |
| 418 | Manager object that uses the alt_XXX credentials for its |
| 419 | managed client objects |
| 420 | """ |
| 421 | |
Marc Koderer | 24eb89c | 2014-01-31 11:23:33 +0100 | [diff] [blame] | 422 | def __init__(self, interface='json', service=None): |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 423 | super(AltManager, self).__init__( |
| 424 | credentials=auth.get_default_credentials('alt_user'), |
| 425 | interface=interface, |
| 426 | service=service) |
Jay Pipes | ff10d55 | 2012-04-06 14:18:50 -0400 | [diff] [blame] | 427 | |
| 428 | |
| 429 | class AdminManager(Manager): |
| 430 | |
| 431 | """ |
Attila Fazekas | cadcb1f | 2013-01-21 23:10:53 +0100 | [diff] [blame] | 432 | Manager object that uses the admin credentials for its |
Jay Pipes | ff10d55 | 2012-04-06 14:18:50 -0400 | [diff] [blame] | 433 | managed client objects |
| 434 | """ |
| 435 | |
Marc Koderer | 24eb89c | 2014-01-31 11:23:33 +0100 | [diff] [blame] | 436 | def __init__(self, interface='json', service=None): |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 437 | super(AdminManager, self).__init__( |
| 438 | credentials=auth.get_default_credentials('identity_admin'), |
| 439 | interface=interface, |
| 440 | service=service) |
Jay Pipes | ff10d55 | 2012-04-06 14:18:50 -0400 | [diff] [blame] | 441 | |
| 442 | |
Attila Fazekas | cadcb1f | 2013-01-21 23:10:53 +0100 | [diff] [blame] | 443 | class ComputeAdminManager(Manager): |
| 444 | |
| 445 | """ |
| 446 | Manager object that uses the compute_admin credentials for its |
| 447 | managed client objects |
| 448 | """ |
| 449 | |
Marc Koderer | 24eb89c | 2014-01-31 11:23:33 +0100 | [diff] [blame] | 450 | def __init__(self, interface='json', service=None): |
Attila Fazekas | cadcb1f | 2013-01-21 23:10:53 +0100 | [diff] [blame] | 451 | base = super(ComputeAdminManager, self) |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 452 | base.__init__( |
| 453 | credentials=auth.get_default_credentials('compute_admin'), |
| 454 | interface=interface, |
| 455 | service=service) |
Steve Baker | c60e4e3 | 2013-05-06 15:22:41 +1200 | [diff] [blame] | 456 | |
| 457 | |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 458 | class OfficialClientManager(manager.Manager): |
| 459 | """ |
| 460 | Manager that provides access to the official python clients for |
| 461 | calling various OpenStack APIs. |
| 462 | """ |
| 463 | |
| 464 | NOVACLIENT_VERSION = '2' |
| 465 | CINDERCLIENT_VERSION = '1' |
| 466 | HEATCLIENT_VERSION = '1' |
Adam Gandelman | 4a48a60 | 2014-03-20 18:23:18 -0700 | [diff] [blame] | 467 | IRONICCLIENT_VERSION = '1' |
Sergey Lukjanov | 7409e2e | 2014-03-27 12:55:50 +0400 | [diff] [blame] | 468 | SAHARACLIENT_VERSION = '1.1' |
Artur Svechnikov | c3bf925 | 2014-05-05 16:37:37 +0400 | [diff] [blame] | 469 | CEILOMETERCLIENT_VERSION = '2' |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 470 | |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 471 | def __init__(self, credentials): |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 472 | # FIXME(andreaf) Auth provider for client_type 'official' is |
| 473 | # not implemented yet, setting to 'tempest' for now. |
| 474 | self.client_type = 'tempest' |
| 475 | self.interface = None |
| 476 | # super cares for credentials validation |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 477 | super(OfficialClientManager, self).__init__(credentials=credentials) |
Adam Gandelman | 4a48a60 | 2014-03-20 18:23:18 -0700 | [diff] [blame] | 478 | self.baremetal_client = self._get_baremetal_client() |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 479 | self.compute_client = self._get_compute_client(credentials) |
| 480 | self.identity_client = self._get_identity_client(credentials) |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 481 | self.image_client = self._get_image_client() |
| 482 | self.network_client = self._get_network_client() |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 483 | self.volume_client = self._get_volume_client(credentials) |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 484 | self.object_storage_client = self._get_object_storage_client( |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 485 | credentials) |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 486 | self.orchestration_client = self._get_orchestration_client( |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 487 | credentials) |
Sergey Lukjanov | 7409e2e | 2014-03-27 12:55:50 +0400 | [diff] [blame] | 488 | self.data_processing_client = self._get_data_processing_client( |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 489 | credentials) |
Artur Svechnikov | c3bf925 | 2014-05-05 16:37:37 +0400 | [diff] [blame] | 490 | self.ceilometer_client = self._get_ceilometer_client( |
| 491 | credentials) |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 492 | |
Adam Gandelman | 4a48a60 | 2014-03-20 18:23:18 -0700 | [diff] [blame] | 493 | def _get_roles(self): |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 494 | admin_credentials = auth.get_default_credentials('identity_admin') |
| 495 | keystone_admin = self._get_identity_client(admin_credentials) |
Adam Gandelman | 4a48a60 | 2014-03-20 18:23:18 -0700 | [diff] [blame] | 496 | |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 497 | username = self.credentials.username |
| 498 | tenant_name = self.credentials.tenant_name |
Adam Gandelman | 4a48a60 | 2014-03-20 18:23:18 -0700 | [diff] [blame] | 499 | user_id = keystone_admin.users.find(name=username).id |
| 500 | tenant_id = keystone_admin.tenants.find(name=tenant_name).id |
| 501 | |
| 502 | roles = keystone_admin.roles.roles_for_user( |
| 503 | user=user_id, tenant=tenant_id) |
| 504 | |
| 505 | return [r.name for r in roles] |
| 506 | |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 507 | def _get_compute_client(self, credentials): |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 508 | # Novaclient will not execute operations for anyone but the |
| 509 | # identified user, so a new client needs to be created for |
| 510 | # each user that operations need to be performed for. |
Zhi Kun Liu | faa6b5f | 2014-04-14 01:38:16 -0500 | [diff] [blame] | 511 | if not CONF.service_available.nova: |
| 512 | return None |
| 513 | import novaclient.client |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 514 | |
| 515 | auth_url = CONF.identity.uri |
| 516 | dscv = CONF.identity.disable_ssl_certificate_validation |
| 517 | region = CONF.identity.region |
| 518 | |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 519 | client_args = (credentials.username, credentials.password, |
| 520 | credentials.tenant_name, auth_url) |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 521 | |
| 522 | # Create our default Nova client to use in testing |
| 523 | service_type = CONF.compute.catalog_type |
| 524 | endpoint_type = CONF.compute.endpoint_type |
| 525 | return novaclient.client.Client(self.NOVACLIENT_VERSION, |
| 526 | *client_args, |
| 527 | service_type=service_type, |
| 528 | endpoint_type=endpoint_type, |
| 529 | region_name=region, |
| 530 | no_cache=True, |
| 531 | insecure=dscv, |
| 532 | http_log_debug=True) |
| 533 | |
| 534 | def _get_image_client(self): |
Zhi Kun Liu | faa6b5f | 2014-04-14 01:38:16 -0500 | [diff] [blame] | 535 | if not CONF.service_available.glance: |
| 536 | return None |
| 537 | import glanceclient |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 538 | token = self.identity_client.auth_token |
| 539 | region = CONF.identity.region |
| 540 | endpoint_type = CONF.image.endpoint_type |
| 541 | endpoint = self.identity_client.service_catalog.url_for( |
| 542 | attr='region', filter_value=region, |
| 543 | service_type=CONF.image.catalog_type, endpoint_type=endpoint_type) |
| 544 | dscv = CONF.identity.disable_ssl_certificate_validation |
| 545 | return glanceclient.Client('1', endpoint=endpoint, token=token, |
| 546 | insecure=dscv) |
| 547 | |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 548 | def _get_volume_client(self, credentials): |
Zhi Kun Liu | faa6b5f | 2014-04-14 01:38:16 -0500 | [diff] [blame] | 549 | if not CONF.service_available.cinder: |
| 550 | return None |
| 551 | import cinderclient.client |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 552 | auth_url = CONF.identity.uri |
| 553 | region = CONF.identity.region |
| 554 | endpoint_type = CONF.volume.endpoint_type |
Rob Crittenden | 1aba5d0 | 2014-03-25 23:27:09 -0400 | [diff] [blame] | 555 | dscv = CONF.identity.disable_ssl_certificate_validation |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 556 | return cinderclient.client.Client(self.CINDERCLIENT_VERSION, |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 557 | credentials.username, |
| 558 | credentials.password, |
| 559 | credentials.tenant_name, |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 560 | auth_url, |
| 561 | region_name=region, |
| 562 | endpoint_type=endpoint_type, |
Rob Crittenden | 1aba5d0 | 2014-03-25 23:27:09 -0400 | [diff] [blame] | 563 | insecure=dscv, |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 564 | http_log_debug=True) |
| 565 | |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 566 | def _get_object_storage_client(self, credentials): |
Zhi Kun Liu | faa6b5f | 2014-04-14 01:38:16 -0500 | [diff] [blame] | 567 | if not CONF.service_available.swift: |
| 568 | return None |
| 569 | import swiftclient |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 570 | auth_url = CONF.identity.uri |
| 571 | # add current tenant to swift operator role group. |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 572 | admin_credentials = auth.get_default_credentials('identity_admin') |
| 573 | keystone_admin = self._get_identity_client(admin_credentials) |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 574 | |
| 575 | # enable test user to operate swift by adding operator role to him. |
| 576 | roles = keystone_admin.roles.list() |
| 577 | operator_role = CONF.object_storage.operator_role |
| 578 | member_role = [role for role in roles if role.name == operator_role][0] |
| 579 | # NOTE(maurosr): This is surrounded in the try-except block cause |
| 580 | # neutron tests doesn't have tenant isolation. |
| 581 | try: |
| 582 | keystone_admin.roles.add_user_role(self.identity_client.user_id, |
| 583 | member_role.id, |
| 584 | self.identity_client.tenant_id) |
| 585 | except keystoneclient.exceptions.Conflict: |
| 586 | pass |
| 587 | |
| 588 | endpoint_type = CONF.object_storage.endpoint_type |
| 589 | os_options = {'endpoint_type': endpoint_type} |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 590 | return swiftclient.Connection(auth_url, credentials.username, |
| 591 | credentials.password, |
| 592 | tenant_name=credentials.tenant_name, |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 593 | auth_version='2', |
| 594 | os_options=os_options) |
| 595 | |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 596 | def _get_orchestration_client(self, credentials): |
Zhi Kun Liu | faa6b5f | 2014-04-14 01:38:16 -0500 | [diff] [blame] | 597 | if not CONF.service_available.heat: |
| 598 | return None |
| 599 | import heatclient.client |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 600 | |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 601 | keystone = self._get_identity_client(credentials) |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 602 | region = CONF.identity.region |
| 603 | endpoint_type = CONF.orchestration.endpoint_type |
| 604 | token = keystone.auth_token |
| 605 | service_type = CONF.orchestration.catalog_type |
| 606 | try: |
| 607 | endpoint = keystone.service_catalog.url_for( |
| 608 | attr='region', |
| 609 | filter_value=region, |
| 610 | service_type=service_type, |
| 611 | endpoint_type=endpoint_type) |
| 612 | except keystoneclient.exceptions.EndpointNotFound: |
| 613 | return None |
| 614 | else: |
| 615 | return heatclient.client.Client(self.HEATCLIENT_VERSION, |
| 616 | endpoint, |
| 617 | token=token, |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 618 | username=credentials.username, |
| 619 | password=credentials.password) |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 620 | |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 621 | def _get_identity_client(self, credentials): |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 622 | # This identity client is not intended to check the security |
| 623 | # of the identity service, so use admin credentials by default. |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 624 | |
| 625 | auth_url = CONF.identity.uri |
| 626 | dscv = CONF.identity.disable_ssl_certificate_validation |
| 627 | |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 628 | return keystoneclient.v2_0.client.Client( |
| 629 | username=credentials.username, |
| 630 | password=credentials.password, |
| 631 | tenant_name=credentials.tenant_name, |
| 632 | auth_url=auth_url, |
| 633 | insecure=dscv) |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 634 | |
Adam Gandelman | 4a48a60 | 2014-03-20 18:23:18 -0700 | [diff] [blame] | 635 | def _get_baremetal_client(self): |
| 636 | # ironic client is currently intended to by used by admin users |
Zhi Kun Liu | faa6b5f | 2014-04-14 01:38:16 -0500 | [diff] [blame] | 637 | if not CONF.service_available.ironic: |
| 638 | return None |
| 639 | import ironicclient.client |
Adam Gandelman | 4a48a60 | 2014-03-20 18:23:18 -0700 | [diff] [blame] | 640 | roles = self._get_roles() |
| 641 | if CONF.identity.admin_role not in roles: |
| 642 | return None |
| 643 | |
| 644 | auth_url = CONF.identity.uri |
| 645 | api_version = self.IRONICCLIENT_VERSION |
| 646 | insecure = CONF.identity.disable_ssl_certificate_validation |
| 647 | service_type = CONF.baremetal.catalog_type |
| 648 | endpoint_type = CONF.baremetal.endpoint_type |
| 649 | creds = { |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 650 | 'os_username': self.credentials.username, |
| 651 | 'os_password': self.credentials.password, |
| 652 | 'os_tenant_name': self.credentials.tenant_name |
Adam Gandelman | 4a48a60 | 2014-03-20 18:23:18 -0700 | [diff] [blame] | 653 | } |
| 654 | |
| 655 | try: |
| 656 | return ironicclient.client.get_client( |
| 657 | api_version=api_version, |
| 658 | os_auth_url=auth_url, |
| 659 | insecure=insecure, |
| 660 | os_service_type=service_type, |
| 661 | os_endpoint_type=endpoint_type, |
| 662 | **creds) |
| 663 | except keystoneclient.exceptions.EndpointNotFound: |
| 664 | return None |
| 665 | |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 666 | def _get_network_client(self): |
| 667 | # The intended configuration is for the network client to have |
| 668 | # admin privileges and indicate for whom resources are being |
| 669 | # created via a 'tenant_id' parameter. This will often be |
| 670 | # preferable to authenticating as a specific user because |
| 671 | # working with certain resources (public routers and networks) |
| 672 | # often requires admin privileges anyway. |
Zhi Kun Liu | faa6b5f | 2014-04-14 01:38:16 -0500 | [diff] [blame] | 673 | if not CONF.service_available.neutron: |
| 674 | return None |
| 675 | import neutronclient.v2_0.client |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 676 | |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 677 | credentials = auth.get_default_credentials('identity_admin') |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 678 | |
| 679 | auth_url = CONF.identity.uri |
| 680 | dscv = CONF.identity.disable_ssl_certificate_validation |
| 681 | endpoint_type = CONF.network.endpoint_type |
| 682 | |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 683 | return neutronclient.v2_0.client.Client( |
| 684 | username=credentials.username, |
| 685 | password=credentials.password, |
| 686 | tenant_name=credentials.tenant_name, |
| 687 | endpoint_type=endpoint_type, |
| 688 | auth_url=auth_url, |
| 689 | insecure=dscv) |
Sergey Lukjanov | 7409e2e | 2014-03-27 12:55:50 +0400 | [diff] [blame] | 690 | |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 691 | def _get_data_processing_client(self, credentials): |
Sergey Lukjanov | 7409e2e | 2014-03-27 12:55:50 +0400 | [diff] [blame] | 692 | if not CONF.service_available.sahara: |
| 693 | # Sahara isn't available |
| 694 | return None |
| 695 | |
| 696 | import saharaclient.client |
| 697 | |
Sergey Lukjanov | 7409e2e | 2014-03-27 12:55:50 +0400 | [diff] [blame] | 698 | endpoint_type = CONF.data_processing.endpoint_type |
| 699 | catalog_type = CONF.data_processing.catalog_type |
| 700 | auth_url = CONF.identity.uri |
| 701 | |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 702 | client = saharaclient.client.Client( |
| 703 | self.SAHARACLIENT_VERSION, |
| 704 | credentials.username, |
| 705 | credentials.password, |
| 706 | project_name=credentials.tenant_name, |
| 707 | endpoint_type=endpoint_type, |
| 708 | service_type=catalog_type, |
| 709 | auth_url=auth_url) |
Sergey Lukjanov | 7409e2e | 2014-03-27 12:55:50 +0400 | [diff] [blame] | 710 | |
| 711 | return client |
Artur Svechnikov | c3bf925 | 2014-05-05 16:37:37 +0400 | [diff] [blame] | 712 | |
| 713 | def _get_ceilometer_client(self, credentials): |
| 714 | if not CONF.service_available.ceilometer: |
| 715 | return None |
| 716 | |
| 717 | import ceilometerclient.client |
| 718 | |
| 719 | keystone = self._get_identity_client(credentials) |
| 720 | region = CONF.identity.region |
| 721 | |
| 722 | endpoint_type = CONF.telemetry.endpoint_type |
| 723 | service_type = CONF.telemetry.catalog_type |
| 724 | auth_url = CONF.identity.uri |
| 725 | |
| 726 | try: |
| 727 | keystone.service_catalog.url_for( |
| 728 | attr='region', |
| 729 | filter_value=region, |
| 730 | service_type=service_type, |
| 731 | endpoint_type=endpoint_type) |
| 732 | except keystoneclient.exceptions.EndpointNotFound: |
| 733 | return None |
| 734 | else: |
| 735 | return ceilometerclient.client.get_client( |
| 736 | self.CEILOMETERCLIENT_VERSION, |
| 737 | os_username=credentials.username, |
| 738 | os_password=credentials.password, |
| 739 | os_tenant_name=credentials.tenant_name, |
| 740 | os_auth_url=auth_url, |
| 741 | os_service_type=service_type, |
| 742 | os_endpoint_type=endpoint_type) |