Jay Pipes | 3f981df | 2012-03-27 18:59:44 -0400 | [diff] [blame] | 1 | # vim: tabstop=4 shiftwidth=4 softtabstop=4 |
| 2 | |
| 3 | # Copyright 2012 OpenStack, LLC |
| 4 | # All Rights Reserved. |
| 5 | # |
| 6 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 7 | # not use this file except in compliance with the License. You may obtain |
| 8 | # a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 14 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 15 | # License for the specific language governing permissions and limitations |
| 16 | # under the License. |
| 17 | |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 18 | from tempest import config |
Daryl Walleck | 587385b | 2012-03-03 13:00:26 -0600 | [diff] [blame] | 19 | from tempest import exceptions |
Matthew Treinish | f4a9b0f | 2013-07-26 16:58:26 -0400 | [diff] [blame] | 20 | from tempest.openstack.common import log as logging |
Attila Fazekas | 1aed620 | 2013-02-11 14:47:45 +0100 | [diff] [blame] | 21 | from tempest.services import botoclients |
Mitsuhiko Yamazaki | 74f0707 | 2013-04-02 11:52:31 +0900 | [diff] [blame] | 22 | from tempest.services.compute.json.aggregates_client import \ |
| 23 | AggregatesClientJSON |
Leo Toyoda | a527891 | 2013-04-16 15:40:12 +0900 | [diff] [blame] | 24 | from tempest.services.compute.json.availability_zone_client import \ |
| 25 | AvailabilityZoneClientJSON |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 26 | from tempest.services.compute.json.extensions_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 27 | ExtensionsClientJSON |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 28 | from tempest.services.compute.json.fixed_ips_client import FixedIPsClientJSON |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 29 | from tempest.services.compute.json.flavors_client import FlavorsClientJSON |
| 30 | from tempest.services.compute.json.floating_ips_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 31 | FloatingIPsClientJSON |
Attila Fazekas | 8e99b99 | 2013-02-24 09:53:23 +0100 | [diff] [blame] | 32 | from tempest.services.compute.json.hosts_client import HostsClientJSON |
Tony Yang | 3d5f163 | 2013-06-06 14:17:57 +0800 | [diff] [blame] | 33 | from tempest.services.compute.json.hypervisor_client import \ |
| 34 | HypervisorClientJSON |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 35 | from tempest.services.compute.json.images_client import ImagesClientJSON |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 36 | from tempest.services.compute.json.interfaces_client import \ |
| 37 | InterfacesClientJSON |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 38 | from tempest.services.compute.json.keypairs_client import KeyPairsClientJSON |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 39 | from tempest.services.compute.json.limits_client import LimitsClientJSON |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 40 | from tempest.services.compute.json.quotas_client import QuotasClientJSON |
Matthew Treinish | a83a16e | 2012-12-07 13:44:02 -0500 | [diff] [blame] | 41 | from tempest.services.compute.json.security_groups_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 42 | SecurityGroupsClientJSON |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 43 | from tempest.services.compute.json.servers_client import ServersClientJSON |
Leo Toyoda | 3ae31e1 | 2013-04-19 11:19:57 +0900 | [diff] [blame] | 44 | from tempest.services.compute.json.services_client import ServicesClientJSON |
Leo Toyoda | d80b6a0 | 2013-05-08 12:15:13 +0900 | [diff] [blame] | 45 | from tempest.services.compute.json.tenant_usages_client import \ |
| 46 | TenantUsagesClientJSON |
Matthew Treinish | a83a16e | 2012-12-07 13:44:02 -0500 | [diff] [blame] | 47 | from tempest.services.compute.json.volumes_extensions_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 48 | VolumesExtensionsClientJSON |
Mitsuhiko Yamazaki | ae8fc53 | 2013-04-22 11:17:35 +0900 | [diff] [blame] | 49 | from tempest.services.compute.xml.aggregates_client import AggregatesClientXML |
Leo Toyoda | a527891 | 2013-04-16 15:40:12 +0900 | [diff] [blame] | 50 | from tempest.services.compute.xml.availability_zone_client import \ |
| 51 | AvailabilityZoneClientXML |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 52 | from tempest.services.compute.xml.extensions_client import ExtensionsClientXML |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 53 | from tempest.services.compute.xml.fixed_ips_client import FixedIPsClientXML |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 54 | from tempest.services.compute.xml.flavors_client import FlavorsClientXML |
| 55 | from tempest.services.compute.xml.floating_ips_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 56 | FloatingIPsClientXML |
Tony Yang | 3d5f163 | 2013-06-06 14:17:57 +0800 | [diff] [blame] | 57 | from tempest.services.compute.xml.hypervisor_client import HypervisorClientXML |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 58 | from tempest.services.compute.xml.images_client import ImagesClientXML |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 59 | from tempest.services.compute.xml.interfaces_client import \ |
| 60 | InterfacesClientXML |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 61 | from tempest.services.compute.xml.keypairs_client import KeyPairsClientXML |
| 62 | from tempest.services.compute.xml.limits_client import LimitsClientXML |
rajalakshmi-ganesan | 1982c3c | 2013-01-10 14:56:45 +0530 | [diff] [blame] | 63 | from tempest.services.compute.xml.quotas_client import QuotasClientXML |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 64 | from tempest.services.compute.xml.security_groups_client \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 65 | import SecurityGroupsClientXML |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 66 | from tempest.services.compute.xml.servers_client import ServersClientXML |
Leo Toyoda | 3ae31e1 | 2013-04-19 11:19:57 +0900 | [diff] [blame] | 67 | from tempest.services.compute.xml.services_client import ServicesClientXML |
Leo Toyoda | d80b6a0 | 2013-05-08 12:15:13 +0900 | [diff] [blame] | 68 | from tempest.services.compute.xml.tenant_usages_client import \ |
| 69 | TenantUsagesClientXML |
Matthew Treinish | a83a16e | 2012-12-07 13:44:02 -0500 | [diff] [blame] | 70 | from tempest.services.compute.xml.volumes_extensions_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 71 | VolumesExtensionsClientXML |
Attila Fazekas | 407b6db | 2013-01-19 12:48:36 +0100 | [diff] [blame] | 72 | from tempest.services.identity.json.identity_client import IdentityClientJSON |
| 73 | from tempest.services.identity.json.identity_client import TokenClientJSON |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 74 | from tempest.services.identity.v3.json.endpoints_client import \ |
| 75 | EndPointClientJSON |
rajalakshmi-ganesan | 7312bb5 | 2013-01-29 20:03:42 +0530 | [diff] [blame] | 76 | from tempest.services.identity.v3.json.identity_client import \ |
| 77 | IdentityV3ClientJSON |
nayna-patel | b35f723 | 2013-06-28 07:08:44 +0000 | [diff] [blame] | 78 | from tempest.services.identity.v3.json.identity_client import V3TokenClientJSON |
harika-vakadi | 40e1011 | 2013-02-08 14:38:09 +0530 | [diff] [blame] | 79 | from tempest.services.identity.v3.json.policy_client import PolicyClientJSON |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 80 | from tempest.services.identity.v3.json.service_client import \ |
| 81 | ServiceClientJSON |
rajalakshmi-ganesan | ab42672 | 2013-02-08 15:49:15 +0530 | [diff] [blame] | 82 | from tempest.services.identity.v3.xml.endpoints_client import EndPointClientXML |
rajalakshmi-ganesan | 7312bb5 | 2013-01-29 20:03:42 +0530 | [diff] [blame] | 83 | from tempest.services.identity.v3.xml.identity_client import \ |
| 84 | IdentityV3ClientXML |
nayna-patel | b35f723 | 2013-06-28 07:08:44 +0000 | [diff] [blame] | 85 | from tempest.services.identity.v3.xml.identity_client import V3TokenClientXML |
harika-vakadi | 40e1011 | 2013-02-08 14:38:09 +0530 | [diff] [blame] | 86 | from tempest.services.identity.v3.xml.policy_client import PolicyClientXML |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 87 | from tempest.services.identity.v3.xml.service_client import \ |
| 88 | ServiceClientXML |
Attila Fazekas | 407b6db | 2013-01-19 12:48:36 +0100 | [diff] [blame] | 89 | from tempest.services.identity.xml.identity_client import IdentityClientXML |
| 90 | from tempest.services.identity.xml.identity_client import TokenClientXML |
Matthew Treinish | 6d59c99 | 2013-03-01 16:20:04 -0500 | [diff] [blame] | 91 | from tempest.services.image.v1.json.image_client import ImageClientJSON |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 92 | from tempest.services.image.v2.json.image_client import ImageClientV2JSON |
raiesmh08 | 6769832 | 2013-08-20 13:09:01 +0530 | [diff] [blame] | 93 | from tempest.services.network.json.network_client import NetworkClientJSON |
| 94 | from tempest.services.network.xml.network_client import NetworkClientXML |
dwalleck | 5d73443 | 2012-10-04 01:11:47 -0500 | [diff] [blame] | 95 | from tempest.services.object_storage.account_client import AccountClient |
harika-vakadi | 2daed0a | 2013-01-01 20:51:39 +0530 | [diff] [blame] | 96 | from tempest.services.object_storage.account_client import \ |
| 97 | AccountClientCustomizedHeader |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 98 | from tempest.services.object_storage.container_client import ContainerClient |
| 99 | from tempest.services.object_storage.object_client import ObjectClient |
| 100 | from tempest.services.object_storage.object_client import \ |
| 101 | ObjectClientCustomizedHeader |
Steve Baker | c60e4e3 | 2013-05-06 15:22:41 +1200 | [diff] [blame] | 102 | from tempest.services.orchestration.json.orchestration_client import \ |
| 103 | OrchestrationClient |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 104 | from tempest.services.volume.json.admin.volume_types_client import \ |
| 105 | VolumeTypesClientJSON |
| 106 | from tempest.services.volume.json.snapshots_client import SnapshotsClientJSON |
| 107 | from tempest.services.volume.json.volumes_client import VolumesClientJSON |
| 108 | from tempest.services.volume.xml.admin.volume_types_client import \ |
| 109 | VolumeTypesClientXML |
| 110 | from tempest.services.volume.xml.snapshots_client import SnapshotsClientXML |
| 111 | from tempest.services.volume.xml.volumes_client import VolumesClientXML |
Vincent Hou | 6b8a7b7 | 2012-08-25 01:24:33 +0800 | [diff] [blame] | 112 | |
Jay Pipes | 3f981df | 2012-03-27 18:59:44 -0400 | [diff] [blame] | 113 | LOG = logging.getLogger(__name__) |
| 114 | |
Mauro S. M. Rodrigues | 6e37324 | 2012-08-27 18:59:19 -0400 | [diff] [blame] | 115 | IMAGES_CLIENTS = { |
| 116 | "json": ImagesClientJSON, |
| 117 | "xml": ImagesClientXML, |
| 118 | } |
| 119 | |
raiesmh08 | 6769832 | 2013-08-20 13:09:01 +0530 | [diff] [blame] | 120 | NETWORKS_CLIENTS = { |
| 121 | "json": NetworkClientJSON, |
| 122 | "xml": NetworkClientXML, |
| 123 | } |
| 124 | |
Mauro S. M. Rodrigues | a636f53 | 2012-08-21 11:07:53 -0400 | [diff] [blame] | 125 | KEYPAIRS_CLIENTS = { |
| 126 | "json": KeyPairsClientJSON, |
| 127 | "xml": KeyPairsClientXML, |
| 128 | } |
| 129 | |
rajalakshmi-ganesan | 1982c3c | 2013-01-10 14:56:45 +0530 | [diff] [blame] | 130 | QUOTAS_CLIENTS = { |
| 131 | "json": QuotasClientJSON, |
| 132 | "xml": QuotasClientXML, |
| 133 | } |
| 134 | |
Dan Smith | cf8fab6 | 2012-08-14 08:03:48 -0700 | [diff] [blame] | 135 | SERVERS_CLIENTS = { |
| 136 | "json": ServersClientJSON, |
| 137 | "xml": ServersClientXML, |
| 138 | } |
| 139 | |
Matthew Treinish | 3363446 | 2012-08-16 16:51:23 -0400 | [diff] [blame] | 140 | LIMITS_CLIENTS = { |
| 141 | "json": LimitsClientJSON, |
| 142 | "xml": LimitsClientXML, |
| 143 | } |
| 144 | |
Tiago Mello | eda03b5 | 2012-08-22 23:47:29 -0300 | [diff] [blame] | 145 | FLAVORS_CLIENTS = { |
| 146 | "json": FlavorsClientJSON, |
| 147 | "xml": FlavorsClientXML |
| 148 | } |
| 149 | |
Tiago Mello | 89126c3 | 2012-08-27 11:14:03 -0300 | [diff] [blame] | 150 | EXTENSIONS_CLIENTS = { |
| 151 | "json": ExtensionsClientJSON, |
| 152 | "xml": ExtensionsClientXML |
| 153 | } |
| 154 | |
Matthew Treinish | 4e08690 | 2012-08-17 17:52:22 -0400 | [diff] [blame] | 155 | VOLUMES_EXTENSIONS_CLIENTS = { |
| 156 | "json": VolumesExtensionsClientJSON, |
| 157 | "xml": VolumesExtensionsClientXML, |
| 158 | } |
| 159 | |
Vincent Hou | 22f03c7 | 2012-08-24 17:55:13 +0800 | [diff] [blame] | 160 | FLOAT_CLIENTS = { |
| 161 | "json": FloatingIPsClientJSON, |
| 162 | "xml": FloatingIPsClientXML, |
| 163 | } |
| 164 | |
Attila Fazekas | 36b1fcf | 2013-01-31 16:41:04 +0100 | [diff] [blame] | 165 | SNAPSHOTS_CLIENTS = { |
| 166 | "json": SnapshotsClientJSON, |
| 167 | "xml": SnapshotsClientXML, |
| 168 | } |
| 169 | |
Matthew Treinish | 9854d5b | 2012-09-20 10:22:13 -0400 | [diff] [blame] | 170 | VOLUMES_CLIENTS = { |
| 171 | "json": VolumesClientJSON, |
| 172 | "xml": VolumesClientXML, |
| 173 | } |
| 174 | |
Attila Fazekas | 3dcdae1 | 2013-02-14 12:50:04 +0100 | [diff] [blame] | 175 | VOLUME_TYPES_CLIENTS = { |
| 176 | "json": VolumeTypesClientJSON, |
| 177 | "xml": VolumeTypesClientXML, |
| 178 | } |
| 179 | |
Attila Fazekas | 407b6db | 2013-01-19 12:48:36 +0100 | [diff] [blame] | 180 | IDENTITY_CLIENT = { |
| 181 | "json": IdentityClientJSON, |
| 182 | "xml": IdentityClientXML, |
Vincent Hou | 6b8a7b7 | 2012-08-25 01:24:33 +0800 | [diff] [blame] | 183 | } |
| 184 | |
rajalakshmi-ganesan | 7312bb5 | 2013-01-29 20:03:42 +0530 | [diff] [blame] | 185 | IDENTITY_V3_CLIENT = { |
| 186 | "json": IdentityV3ClientJSON, |
| 187 | "xml": IdentityV3ClientXML, |
| 188 | } |
| 189 | |
Vincent Hou | 6b8a7b7 | 2012-08-25 01:24:33 +0800 | [diff] [blame] | 190 | TOKEN_CLIENT = { |
| 191 | "json": TokenClientJSON, |
| 192 | "xml": TokenClientXML, |
| 193 | } |
| 194 | |
Vincent Hou | ead03dc | 2012-08-24 21:35:11 +0800 | [diff] [blame] | 195 | SECURITY_GROUPS_CLIENT = { |
| 196 | "json": SecurityGroupsClientJSON, |
| 197 | "xml": SecurityGroupsClientXML, |
| 198 | } |
| 199 | |
Dan Smith | 8ad1c47 | 2013-02-26 13:03:16 -0500 | [diff] [blame] | 200 | INTERFACES_CLIENT = { |
| 201 | "json": InterfacesClientJSON, |
| 202 | "xml": InterfacesClientXML, |
| 203 | } |
| 204 | |
rajalakshmi-ganesan | ab42672 | 2013-02-08 15:49:15 +0530 | [diff] [blame] | 205 | ENDPOINT_CLIENT = { |
| 206 | "json": EndPointClientJSON, |
| 207 | "xml": EndPointClientXML, |
| 208 | } |
| 209 | |
Mauro S. M. Rodrigues | f516640 | 2013-04-01 10:25:26 -0400 | [diff] [blame] | 210 | FIXED_IPS_CLIENT = { |
| 211 | "json": FixedIPsClientJSON, |
| 212 | "xml": FixedIPsClientXML |
| 213 | } |
| 214 | |
Leo Toyoda | a527891 | 2013-04-16 15:40:12 +0900 | [diff] [blame] | 215 | AVAILABILITY_ZONE_CLIENT = { |
| 216 | "json": AvailabilityZoneClientJSON, |
| 217 | "xml": AvailabilityZoneClientXML, |
| 218 | } |
| 219 | |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 220 | SERVICE_CLIENT = { |
| 221 | "json": ServiceClientJSON, |
| 222 | "xml": ServiceClientXML, |
| 223 | } |
| 224 | |
Mitsuhiko Yamazaki | ae8fc53 | 2013-04-22 11:17:35 +0900 | [diff] [blame] | 225 | AGGREGATES_CLIENT = { |
| 226 | "json": AggregatesClientJSON, |
| 227 | "xml": AggregatesClientXML, |
| 228 | } |
| 229 | |
Leo Toyoda | 3ae31e1 | 2013-04-19 11:19:57 +0900 | [diff] [blame] | 230 | SERVICES_CLIENT = { |
| 231 | "json": ServicesClientJSON, |
| 232 | "xml": ServicesClientXML, |
| 233 | } |
| 234 | |
Leo Toyoda | d80b6a0 | 2013-05-08 12:15:13 +0900 | [diff] [blame] | 235 | TENANT_USAGES_CLIENT = { |
| 236 | "json": TenantUsagesClientJSON, |
| 237 | "xml": TenantUsagesClientXML, |
| 238 | } |
| 239 | |
harika-vakadi | 40e1011 | 2013-02-08 14:38:09 +0530 | [diff] [blame] | 240 | POLICY_CLIENT = { |
| 241 | "json": PolicyClientJSON, |
| 242 | "xml": PolicyClientXML, |
| 243 | } |
| 244 | |
Tony Yang | 3d5f163 | 2013-06-06 14:17:57 +0800 | [diff] [blame] | 245 | HYPERVISOR_CLIENT = { |
| 246 | "json": HypervisorClientJSON, |
| 247 | "xml": HypervisorClientXML, |
| 248 | } |
| 249 | |
nayna-patel | b35f723 | 2013-06-28 07:08:44 +0000 | [diff] [blame] | 250 | V3_TOKEN_CLIENT = { |
| 251 | "json": V3TokenClientJSON, |
| 252 | "xml": V3TokenClientXML, |
| 253 | } |
| 254 | |
Vincent Hou | 6b8a7b7 | 2012-08-25 01:24:33 +0800 | [diff] [blame] | 255 | |
Daryl Walleck | 1465d61 | 2011-11-02 02:22:15 -0500 | [diff] [blame] | 256 | class Manager(object): |
| 257 | |
Jay Pipes | 3f981df | 2012-03-27 18:59:44 -0400 | [diff] [blame] | 258 | """ |
| 259 | Top level manager for OpenStack Compute clients |
| 260 | """ |
| 261 | |
James E. Blair | e6d8ee1 | 2013-01-18 21:33:45 +0000 | [diff] [blame] | 262 | def __init__(self, username=None, password=None, tenant_name=None, |
| 263 | interface='json'): |
Jay Pipes | ff10d55 | 2012-04-06 14:18:50 -0400 | [diff] [blame] | 264 | """ |
| 265 | We allow overriding of the credentials used within the various |
| 266 | client classes managed by the Manager object. Left as None, the |
| 267 | standard username/password/tenant_name is used. |
| 268 | |
| 269 | :param username: Override of the username |
| 270 | :param password: Override of the password |
| 271 | :param tenant_name: Override of the tenant name |
| 272 | """ |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 273 | self.config = config.TempestConfig() |
Rohit Karajgi | e1b050d | 2011-12-02 16:13:18 -0800 | [diff] [blame] | 274 | |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 275 | # If no creds are provided, we fall back on the defaults |
| 276 | # in the config file for the Compute API. |
Attila Fazekas | cadcb1f | 2013-01-21 23:10:53 +0100 | [diff] [blame] | 277 | self.username = username or self.config.identity.username |
| 278 | self.password = password or self.config.identity.password |
| 279 | self.tenant_name = tenant_name or self.config.identity.tenant_name |
Daryl Walleck | ced8eb8 | 2012-03-19 13:52:37 -0500 | [diff] [blame] | 280 | |
Rohit Karajgi | dd47d7e | 2012-07-31 04:11:01 -0700 | [diff] [blame] | 281 | if None in (self.username, self.password, self.tenant_name): |
Jay Pipes | 3f981df | 2012-03-27 18:59:44 -0400 | [diff] [blame] | 282 | msg = ("Missing required credentials. " |
Sean Dague | 43cd905 | 2013-07-19 12:20:04 -0400 | [diff] [blame] | 283 | "username: %(u)s, password: %(p)s, " |
| 284 | "tenant_name: %(t)s" % |
| 285 | {'u': username, 'p': password, 't': tenant_name}) |
Jay Pipes | 3f981df | 2012-03-27 18:59:44 -0400 | [diff] [blame] | 286 | raise exceptions.InvalidConfiguration(msg) |
| 287 | |
Jay Pipes | 7c88eb2 | 2013-01-16 21:32:43 -0500 | [diff] [blame] | 288 | self.auth_url = self.config.identity.uri |
Brant Knudson | c7ca334 | 2013-03-28 21:08:50 -0500 | [diff] [blame] | 289 | self.auth_url_v3 = self.config.identity.uri_v3 |
Daryl Walleck | 587385b | 2012-03-03 13:00:26 -0600 | [diff] [blame] | 290 | |
Li Ma | 216550f | 2013-06-12 11:26:08 -0700 | [diff] [blame] | 291 | client_args = (self.config, self.username, self.password, |
| 292 | self.auth_url, self.tenant_name) |
Brant Knudson | c7ca334 | 2013-03-28 21:08:50 -0500 | [diff] [blame] | 293 | |
Li Ma | 216550f | 2013-06-12 11:26:08 -0700 | [diff] [blame] | 294 | if self.auth_url_v3: |
| 295 | auth_version = 'v3' |
| 296 | client_args_v3_auth = (self.config, self.username, |
| 297 | self.password, self.auth_url_v3, |
| 298 | self.tenant_name, auth_version) |
Daryl Walleck | 1465d61 | 2011-11-02 02:22:15 -0500 | [diff] [blame] | 299 | else: |
Brant Knudson | c7ca334 | 2013-03-28 21:08:50 -0500 | [diff] [blame] | 300 | client_args_v3_auth = None |
| 301 | |
Dan Smith | cf8fab6 | 2012-08-14 08:03:48 -0700 | [diff] [blame] | 302 | try: |
| 303 | self.servers_client = SERVERS_CLIENTS[interface](*client_args) |
raiesmh08 | 6769832 | 2013-08-20 13:09:01 +0530 | [diff] [blame] | 304 | self.network_client = NETWORKS_CLIENTS[interface](*client_args) |
Matthew Treinish | 3363446 | 2012-08-16 16:51:23 -0400 | [diff] [blame] | 305 | self.limits_client = LIMITS_CLIENTS[interface](*client_args) |
Frederic Lepied | cf1868b | 2013-07-28 18:07:15 -0400 | [diff] [blame] | 306 | if self.config.service_available.glance: |
| 307 | self.images_client = IMAGES_CLIENTS[interface](*client_args) |
Mauro S. M. Rodrigues | a636f53 | 2012-08-21 11:07:53 -0400 | [diff] [blame] | 308 | self.keypairs_client = KEYPAIRS_CLIENTS[interface](*client_args) |
rajalakshmi-ganesan | 1982c3c | 2013-01-10 14:56:45 +0530 | [diff] [blame] | 309 | self.quotas_client = QUOTAS_CLIENTS[interface](*client_args) |
Tiago Mello | eda03b5 | 2012-08-22 23:47:29 -0300 | [diff] [blame] | 310 | self.flavors_client = FLAVORS_CLIENTS[interface](*client_args) |
Zhongyue Luo | e0884a3 | 2012-09-25 17:24:17 +0800 | [diff] [blame] | 311 | ext_cli = EXTENSIONS_CLIENTS[interface](*client_args) |
| 312 | self.extensions_client = ext_cli |
| 313 | vol_ext_cli = VOLUMES_EXTENSIONS_CLIENTS[interface](*client_args) |
| 314 | self.volumes_extensions_client = vol_ext_cli |
Vincent Hou | 22f03c7 | 2012-08-24 17:55:13 +0800 | [diff] [blame] | 315 | self.floating_ips_client = FLOAT_CLIENTS[interface](*client_args) |
Attila Fazekas | 36b1fcf | 2013-01-31 16:41:04 +0100 | [diff] [blame] | 316 | self.snapshots_client = SNAPSHOTS_CLIENTS[interface](*client_args) |
Matthew Treinish | 9854d5b | 2012-09-20 10:22:13 -0400 | [diff] [blame] | 317 | self.volumes_client = VOLUMES_CLIENTS[interface](*client_args) |
Attila Fazekas | 3dcdae1 | 2013-02-14 12:50:04 +0100 | [diff] [blame] | 318 | self.volume_types_client = \ |
| 319 | VOLUME_TYPES_CLIENTS[interface](*client_args) |
Attila Fazekas | 407b6db | 2013-01-19 12:48:36 +0100 | [diff] [blame] | 320 | self.identity_client = IDENTITY_CLIENT[interface](*client_args) |
rajalakshmi-ganesan | 7312bb5 | 2013-01-29 20:03:42 +0530 | [diff] [blame] | 321 | self.identity_v3_client = \ |
| 322 | IDENTITY_V3_CLIENT[interface](*client_args) |
Vincent Hou | 6b8a7b7 | 2012-08-25 01:24:33 +0800 | [diff] [blame] | 323 | self.token_client = TOKEN_CLIENT[interface](self.config) |
Vincent Hou | ead03dc | 2012-08-24 21:35:11 +0800 | [diff] [blame] | 324 | self.security_groups_client = \ |
| 325 | SECURITY_GROUPS_CLIENT[interface](*client_args) |
Dan Smith | 8ad1c47 | 2013-02-26 13:03:16 -0500 | [diff] [blame] | 326 | self.interfaces_client = INTERFACES_CLIENT[interface](*client_args) |
rajalakshmi-ganesan | ab42672 | 2013-02-08 15:49:15 +0530 | [diff] [blame] | 327 | self.endpoints_client = ENDPOINT_CLIENT[interface](*client_args) |
Mauro S. M. Rodrigues | f516640 | 2013-04-01 10:25:26 -0400 | [diff] [blame] | 328 | self.fixed_ips_client = FIXED_IPS_CLIENT[interface](*client_args) |
Leo Toyoda | a527891 | 2013-04-16 15:40:12 +0900 | [diff] [blame] | 329 | self.availability_zone_client = \ |
| 330 | AVAILABILITY_ZONE_CLIENT[interface](*client_args) |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 331 | self.service_client = SERVICE_CLIENT[interface](*client_args) |
Mitsuhiko Yamazaki | ae8fc53 | 2013-04-22 11:17:35 +0900 | [diff] [blame] | 332 | self.aggregates_client = AGGREGATES_CLIENT[interface](*client_args) |
Leo Toyoda | 3ae31e1 | 2013-04-19 11:19:57 +0900 | [diff] [blame] | 333 | self.services_client = SERVICES_CLIENT[interface](*client_args) |
Leo Toyoda | d80b6a0 | 2013-05-08 12:15:13 +0900 | [diff] [blame] | 334 | self.tenant_usages_client = \ |
| 335 | TENANT_USAGES_CLIENT[interface](*client_args) |
harika-vakadi | 40e1011 | 2013-02-08 14:38:09 +0530 | [diff] [blame] | 336 | self.policy_client = POLICY_CLIENT[interface](*client_args) |
Tony Yang | 3d5f163 | 2013-06-06 14:17:57 +0800 | [diff] [blame] | 337 | self.hypervisor_client = HYPERVISOR_CLIENT[interface](*client_args) |
nayna-patel | b35f723 | 2013-06-28 07:08:44 +0000 | [diff] [blame] | 338 | self.token_v3_client = V3_TOKEN_CLIENT[interface](*client_args) |
Brant Knudson | c7ca334 | 2013-03-28 21:08:50 -0500 | [diff] [blame] | 339 | |
| 340 | if client_args_v3_auth: |
| 341 | self.servers_client_v3_auth = SERVERS_CLIENTS[interface]( |
| 342 | *client_args_v3_auth) |
| 343 | else: |
| 344 | self.servers_client_v3_auth = None |
| 345 | |
Dan Smith | cf8fab6 | 2012-08-14 08:03:48 -0700 | [diff] [blame] | 346 | except KeyError: |
| 347 | msg = "Unsupported interface type `%s'" % interface |
| 348 | raise exceptions.InvalidConfiguration(msg) |
Attila Fazekas | 8e99b99 | 2013-02-24 09:53:23 +0100 | [diff] [blame] | 349 | self.hosts_client = HostsClientJSON(*client_args) |
dwalleck | 5d73443 | 2012-10-04 01:11:47 -0500 | [diff] [blame] | 350 | self.account_client = AccountClient(*client_args) |
Frederic Lepied | cf1868b | 2013-07-28 18:07:15 -0400 | [diff] [blame] | 351 | if self.config.service_available.glance: |
| 352 | self.image_client = ImageClientJSON(*client_args) |
| 353 | self.image_client_v2 = ImageClientV2JSON(*client_args) |
dwalleck | 5d73443 | 2012-10-04 01:11:47 -0500 | [diff] [blame] | 354 | self.container_client = ContainerClient(*client_args) |
| 355 | self.object_client = ObjectClient(*client_args) |
Steve Baker | c60e4e3 | 2013-05-06 15:22:41 +1200 | [diff] [blame] | 356 | self.orchestration_client = OrchestrationClient(*client_args) |
Attila Fazekas | 1aed620 | 2013-02-11 14:47:45 +0100 | [diff] [blame] | 357 | self.ec2api_client = botoclients.APIClientEC2(*client_args) |
| 358 | self.s3_client = botoclients.ObjectClientS3(*client_args) |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 359 | self.custom_object_client = ObjectClientCustomizedHeader(*client_args) |
harika-vakadi | 2daed0a | 2013-01-01 20:51:39 +0530 | [diff] [blame] | 360 | self.custom_account_client = \ |
| 361 | AccountClientCustomizedHeader(*client_args) |
Jay Pipes | 5067728 | 2012-01-06 15:39:20 -0500 | [diff] [blame] | 362 | |
| 363 | |
Jay Pipes | ff10d55 | 2012-04-06 14:18:50 -0400 | [diff] [blame] | 364 | class AltManager(Manager): |
| 365 | |
| 366 | """ |
| 367 | Manager object that uses the alt_XXX credentials for its |
| 368 | managed client objects |
| 369 | """ |
| 370 | |
| 371 | def __init__(self): |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 372 | conf = config.TempestConfig() |
Attila Fazekas | cadcb1f | 2013-01-21 23:10:53 +0100 | [diff] [blame] | 373 | super(AltManager, self).__init__(conf.identity.alt_username, |
| 374 | conf.identity.alt_password, |
| 375 | conf.identity.alt_tenant_name) |
Jay Pipes | ff10d55 | 2012-04-06 14:18:50 -0400 | [diff] [blame] | 376 | |
| 377 | |
| 378 | class AdminManager(Manager): |
| 379 | |
| 380 | """ |
Attila Fazekas | cadcb1f | 2013-01-21 23:10:53 +0100 | [diff] [blame] | 381 | Manager object that uses the admin credentials for its |
Jay Pipes | ff10d55 | 2012-04-06 14:18:50 -0400 | [diff] [blame] | 382 | managed client objects |
| 383 | """ |
| 384 | |
James E. Blair | e6d8ee1 | 2013-01-18 21:33:45 +0000 | [diff] [blame] | 385 | def __init__(self, interface='json'): |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 386 | conf = config.TempestConfig() |
Attila Fazekas | cadcb1f | 2013-01-21 23:10:53 +0100 | [diff] [blame] | 387 | super(AdminManager, self).__init__(conf.identity.admin_username, |
| 388 | conf.identity.admin_password, |
| 389 | conf.identity.admin_tenant_name, |
James E. Blair | e6d8ee1 | 2013-01-18 21:33:45 +0000 | [diff] [blame] | 390 | interface=interface) |
Jay Pipes | ff10d55 | 2012-04-06 14:18:50 -0400 | [diff] [blame] | 391 | |
| 392 | |
Attila Fazekas | cadcb1f | 2013-01-21 23:10:53 +0100 | [diff] [blame] | 393 | class ComputeAdminManager(Manager): |
| 394 | |
| 395 | """ |
| 396 | Manager object that uses the compute_admin credentials for its |
| 397 | managed client objects |
| 398 | """ |
| 399 | |
| 400 | def __init__(self, interface='json'): |
| 401 | conf = config.TempestConfig() |
| 402 | base = super(ComputeAdminManager, self) |
| 403 | base.__init__(conf.compute_admin.username, |
| 404 | conf.compute_admin.password, |
| 405 | conf.compute_admin.tenant_name, |
| 406 | interface=interface) |
Steve Baker | c60e4e3 | 2013-05-06 15:22:41 +1200 | [diff] [blame] | 407 | |
| 408 | |
| 409 | class OrchestrationManager(Manager): |
| 410 | """ |
| 411 | Manager object that uses the admin credentials for its |
| 412 | so that heat templates can create users |
| 413 | """ |
| 414 | def __init__(self, interface='json'): |
| 415 | conf = config.TempestConfig() |
| 416 | base = super(OrchestrationManager, self) |
| 417 | base.__init__(conf.identity.admin_username, |
| 418 | conf.identity.admin_password, |
Steve Baker | fd86f3c | 2013-06-28 12:51:20 +1200 | [diff] [blame] | 419 | conf.identity.tenant_name, |
Steve Baker | c60e4e3 | 2013-05-06 15:22:41 +1200 | [diff] [blame] | 420 | interface=interface) |