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 | |
| 18 | import logging |
| 19 | |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 20 | from tempest import config |
Daryl Walleck | 587385b | 2012-03-03 13:00:26 -0600 | [diff] [blame] | 21 | from tempest import exceptions |
Attila Fazekas | 1aed620 | 2013-02-11 14:47:45 +0100 | [diff] [blame] | 22 | from tempest.services import botoclients |
Mitsuhiko Yamazaki | 74f0707 | 2013-04-02 11:52:31 +0900 | [diff] [blame] | 23 | from tempest.services.compute.json.aggregates_client import \ |
| 24 | AggregatesClientJSON |
Leo Toyoda | a527891 | 2013-04-16 15:40:12 +0900 | [diff] [blame] | 25 | from tempest.services.compute.json.availability_zone_client import \ |
| 26 | AvailabilityZoneClientJSON |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 27 | from tempest.services.compute.json.extensions_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 28 | ExtensionsClientJSON |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 29 | from tempest.services.compute.json.fixed_ips_client import FixedIPsClientJSON |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 30 | from tempest.services.compute.json.flavors_client import FlavorsClientJSON |
| 31 | from tempest.services.compute.json.floating_ips_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 32 | FloatingIPsClientJSON |
Attila Fazekas | 8e99b99 | 2013-02-24 09:53:23 +0100 | [diff] [blame] | 33 | from tempest.services.compute.json.hosts_client import HostsClientJSON |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 34 | from tempest.services.compute.json.images_client import ImagesClientJSON |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 35 | from tempest.services.compute.json.interfaces_client import \ |
| 36 | InterfacesClientJSON |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 37 | from tempest.services.compute.json.keypairs_client import KeyPairsClientJSON |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 38 | from tempest.services.compute.json.limits_client import LimitsClientJSON |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 39 | from tempest.services.compute.json.quotas_client import QuotasClientJSON |
Matthew Treinish | a83a16e | 2012-12-07 13:44:02 -0500 | [diff] [blame] | 40 | from tempest.services.compute.json.security_groups_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 41 | SecurityGroupsClientJSON |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 42 | from tempest.services.compute.json.servers_client import ServersClientJSON |
Matthew Treinish | a83a16e | 2012-12-07 13:44:02 -0500 | [diff] [blame] | 43 | from tempest.services.compute.json.volumes_extensions_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 44 | VolumesExtensionsClientJSON |
Mitsuhiko Yamazaki | ae8fc53 | 2013-04-22 11:17:35 +0900 | [diff] [blame^] | 45 | from tempest.services.compute.xml.aggregates_client import AggregatesClientXML |
Leo Toyoda | a527891 | 2013-04-16 15:40:12 +0900 | [diff] [blame] | 46 | from tempest.services.compute.xml.availability_zone_client import \ |
| 47 | AvailabilityZoneClientXML |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 48 | from tempest.services.compute.xml.extensions_client import ExtensionsClientXML |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 49 | from tempest.services.compute.xml.fixed_ips_client import FixedIPsClientXML |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 50 | from tempest.services.compute.xml.flavors_client import FlavorsClientXML |
| 51 | from tempest.services.compute.xml.floating_ips_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 52 | FloatingIPsClientXML |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 53 | from tempest.services.compute.xml.images_client import ImagesClientXML |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 54 | from tempest.services.compute.xml.interfaces_client import \ |
| 55 | InterfacesClientXML |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 56 | from tempest.services.compute.xml.keypairs_client import KeyPairsClientXML |
| 57 | from tempest.services.compute.xml.limits_client import LimitsClientXML |
rajalakshmi-ganesan | 1982c3c | 2013-01-10 14:56:45 +0530 | [diff] [blame] | 58 | from tempest.services.compute.xml.quotas_client import QuotasClientXML |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 59 | from tempest.services.compute.xml.security_groups_client \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 60 | import SecurityGroupsClientXML |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 61 | from tempest.services.compute.xml.servers_client import ServersClientXML |
Matthew Treinish | a83a16e | 2012-12-07 13:44:02 -0500 | [diff] [blame] | 62 | from tempest.services.compute.xml.volumes_extensions_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 63 | VolumesExtensionsClientXML |
Attila Fazekas | 407b6db | 2013-01-19 12:48:36 +0100 | [diff] [blame] | 64 | from tempest.services.identity.json.identity_client import IdentityClientJSON |
| 65 | from tempest.services.identity.json.identity_client import TokenClientJSON |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 66 | from tempest.services.identity.v3.json.endpoints_client import \ |
| 67 | EndPointClientJSON |
rajalakshmi-ganesan | 7312bb5 | 2013-01-29 20:03:42 +0530 | [diff] [blame] | 68 | from tempest.services.identity.v3.json.identity_client import \ |
| 69 | IdentityV3ClientJSON |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 70 | from tempest.services.identity.v3.json.service_client import \ |
| 71 | ServiceClientJSON |
rajalakshmi-ganesan | ab42672 | 2013-02-08 15:49:15 +0530 | [diff] [blame] | 72 | from tempest.services.identity.v3.xml.endpoints_client import EndPointClientXML |
rajalakshmi-ganesan | 7312bb5 | 2013-01-29 20:03:42 +0530 | [diff] [blame] | 73 | from tempest.services.identity.v3.xml.identity_client import \ |
| 74 | IdentityV3ClientXML |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 75 | from tempest.services.identity.v3.xml.service_client import \ |
| 76 | ServiceClientXML |
Attila Fazekas | 407b6db | 2013-01-19 12:48:36 +0100 | [diff] [blame] | 77 | from tempest.services.identity.xml.identity_client import IdentityClientXML |
| 78 | from tempest.services.identity.xml.identity_client import TokenClientXML |
Matthew Treinish | 6d59c99 | 2013-03-01 16:20:04 -0500 | [diff] [blame] | 79 | from tempest.services.image.v1.json.image_client import ImageClientJSON |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 80 | from tempest.services.image.v2.json.image_client import ImageClientV2JSON |
Matthew Treinish | a83a16e | 2012-12-07 13:44:02 -0500 | [diff] [blame] | 81 | from tempest.services.network.json.network_client import NetworkClient |
dwalleck | 5d73443 | 2012-10-04 01:11:47 -0500 | [diff] [blame] | 82 | from tempest.services.object_storage.account_client import AccountClient |
harika-vakadi | 2daed0a | 2013-01-01 20:51:39 +0530 | [diff] [blame] | 83 | from tempest.services.object_storage.account_client import \ |
| 84 | AccountClientCustomizedHeader |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 85 | from tempest.services.object_storage.container_client import ContainerClient |
| 86 | from tempest.services.object_storage.object_client import ObjectClient |
| 87 | from tempest.services.object_storage.object_client import \ |
| 88 | ObjectClientCustomizedHeader |
| 89 | from tempest.services.volume.json.admin.volume_types_client import \ |
| 90 | VolumeTypesClientJSON |
| 91 | from tempest.services.volume.json.snapshots_client import SnapshotsClientJSON |
| 92 | from tempest.services.volume.json.volumes_client import VolumesClientJSON |
| 93 | from tempest.services.volume.xml.admin.volume_types_client import \ |
| 94 | VolumeTypesClientXML |
| 95 | from tempest.services.volume.xml.snapshots_client import SnapshotsClientXML |
| 96 | from tempest.services.volume.xml.volumes_client import VolumesClientXML |
Vincent Hou | 6b8a7b7 | 2012-08-25 01:24:33 +0800 | [diff] [blame] | 97 | |
Jay Pipes | 3f981df | 2012-03-27 18:59:44 -0400 | [diff] [blame] | 98 | LOG = logging.getLogger(__name__) |
| 99 | |
Mauro S. M. Rodrigues | 6e37324 | 2012-08-27 18:59:19 -0400 | [diff] [blame] | 100 | IMAGES_CLIENTS = { |
| 101 | "json": ImagesClientJSON, |
| 102 | "xml": ImagesClientXML, |
| 103 | } |
| 104 | |
Mauro S. M. Rodrigues | a636f53 | 2012-08-21 11:07:53 -0400 | [diff] [blame] | 105 | KEYPAIRS_CLIENTS = { |
| 106 | "json": KeyPairsClientJSON, |
| 107 | "xml": KeyPairsClientXML, |
| 108 | } |
| 109 | |
rajalakshmi-ganesan | 1982c3c | 2013-01-10 14:56:45 +0530 | [diff] [blame] | 110 | QUOTAS_CLIENTS = { |
| 111 | "json": QuotasClientJSON, |
| 112 | "xml": QuotasClientXML, |
| 113 | } |
| 114 | |
Dan Smith | cf8fab6 | 2012-08-14 08:03:48 -0700 | [diff] [blame] | 115 | SERVERS_CLIENTS = { |
| 116 | "json": ServersClientJSON, |
| 117 | "xml": ServersClientXML, |
| 118 | } |
| 119 | |
Matthew Treinish | 3363446 | 2012-08-16 16:51:23 -0400 | [diff] [blame] | 120 | LIMITS_CLIENTS = { |
| 121 | "json": LimitsClientJSON, |
| 122 | "xml": LimitsClientXML, |
| 123 | } |
| 124 | |
Tiago Mello | eda03b5 | 2012-08-22 23:47:29 -0300 | [diff] [blame] | 125 | FLAVORS_CLIENTS = { |
| 126 | "json": FlavorsClientJSON, |
| 127 | "xml": FlavorsClientXML |
| 128 | } |
| 129 | |
Tiago Mello | 89126c3 | 2012-08-27 11:14:03 -0300 | [diff] [blame] | 130 | EXTENSIONS_CLIENTS = { |
| 131 | "json": ExtensionsClientJSON, |
| 132 | "xml": ExtensionsClientXML |
| 133 | } |
| 134 | |
Matthew Treinish | 4e08690 | 2012-08-17 17:52:22 -0400 | [diff] [blame] | 135 | VOLUMES_EXTENSIONS_CLIENTS = { |
| 136 | "json": VolumesExtensionsClientJSON, |
| 137 | "xml": VolumesExtensionsClientXML, |
| 138 | } |
| 139 | |
Vincent Hou | 22f03c7 | 2012-08-24 17:55:13 +0800 | [diff] [blame] | 140 | FLOAT_CLIENTS = { |
| 141 | "json": FloatingIPsClientJSON, |
| 142 | "xml": FloatingIPsClientXML, |
| 143 | } |
| 144 | |
Attila Fazekas | 36b1fcf | 2013-01-31 16:41:04 +0100 | [diff] [blame] | 145 | SNAPSHOTS_CLIENTS = { |
| 146 | "json": SnapshotsClientJSON, |
| 147 | "xml": SnapshotsClientXML, |
| 148 | } |
| 149 | |
Matthew Treinish | 9854d5b | 2012-09-20 10:22:13 -0400 | [diff] [blame] | 150 | VOLUMES_CLIENTS = { |
| 151 | "json": VolumesClientJSON, |
| 152 | "xml": VolumesClientXML, |
| 153 | } |
| 154 | |
Attila Fazekas | 3dcdae1 | 2013-02-14 12:50:04 +0100 | [diff] [blame] | 155 | VOLUME_TYPES_CLIENTS = { |
| 156 | "json": VolumeTypesClientJSON, |
| 157 | "xml": VolumeTypesClientXML, |
| 158 | } |
| 159 | |
Attila Fazekas | 407b6db | 2013-01-19 12:48:36 +0100 | [diff] [blame] | 160 | IDENTITY_CLIENT = { |
| 161 | "json": IdentityClientJSON, |
| 162 | "xml": IdentityClientXML, |
Vincent Hou | 6b8a7b7 | 2012-08-25 01:24:33 +0800 | [diff] [blame] | 163 | } |
| 164 | |
rajalakshmi-ganesan | 7312bb5 | 2013-01-29 20:03:42 +0530 | [diff] [blame] | 165 | IDENTITY_V3_CLIENT = { |
| 166 | "json": IdentityV3ClientJSON, |
| 167 | "xml": IdentityV3ClientXML, |
| 168 | } |
| 169 | |
Vincent Hou | 6b8a7b7 | 2012-08-25 01:24:33 +0800 | [diff] [blame] | 170 | TOKEN_CLIENT = { |
| 171 | "json": TokenClientJSON, |
| 172 | "xml": TokenClientXML, |
| 173 | } |
| 174 | |
Vincent Hou | ead03dc | 2012-08-24 21:35:11 +0800 | [diff] [blame] | 175 | SECURITY_GROUPS_CLIENT = { |
| 176 | "json": SecurityGroupsClientJSON, |
| 177 | "xml": SecurityGroupsClientXML, |
| 178 | } |
| 179 | |
Dan Smith | 8ad1c47 | 2013-02-26 13:03:16 -0500 | [diff] [blame] | 180 | INTERFACES_CLIENT = { |
| 181 | "json": InterfacesClientJSON, |
| 182 | "xml": InterfacesClientXML, |
| 183 | } |
| 184 | |
rajalakshmi-ganesan | ab42672 | 2013-02-08 15:49:15 +0530 | [diff] [blame] | 185 | ENDPOINT_CLIENT = { |
| 186 | "json": EndPointClientJSON, |
| 187 | "xml": EndPointClientXML, |
| 188 | } |
| 189 | |
Mauro S. M. Rodrigues | f516640 | 2013-04-01 10:25:26 -0400 | [diff] [blame] | 190 | FIXED_IPS_CLIENT = { |
| 191 | "json": FixedIPsClientJSON, |
| 192 | "xml": FixedIPsClientXML |
| 193 | } |
| 194 | |
Leo Toyoda | a527891 | 2013-04-16 15:40:12 +0900 | [diff] [blame] | 195 | AVAILABILITY_ZONE_CLIENT = { |
| 196 | "json": AvailabilityZoneClientJSON, |
| 197 | "xml": AvailabilityZoneClientXML, |
| 198 | } |
| 199 | |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 200 | SERVICE_CLIENT = { |
| 201 | "json": ServiceClientJSON, |
| 202 | "xml": ServiceClientXML, |
| 203 | } |
| 204 | |
Mitsuhiko Yamazaki | ae8fc53 | 2013-04-22 11:17:35 +0900 | [diff] [blame^] | 205 | AGGREGATES_CLIENT = { |
| 206 | "json": AggregatesClientJSON, |
| 207 | "xml": AggregatesClientXML, |
| 208 | } |
| 209 | |
Vincent Hou | 6b8a7b7 | 2012-08-25 01:24:33 +0800 | [diff] [blame] | 210 | |
Daryl Walleck | 1465d61 | 2011-11-02 02:22:15 -0500 | [diff] [blame] | 211 | class Manager(object): |
| 212 | |
Jay Pipes | 3f981df | 2012-03-27 18:59:44 -0400 | [diff] [blame] | 213 | """ |
| 214 | Top level manager for OpenStack Compute clients |
| 215 | """ |
| 216 | |
James E. Blair | e6d8ee1 | 2013-01-18 21:33:45 +0000 | [diff] [blame] | 217 | def __init__(self, username=None, password=None, tenant_name=None, |
| 218 | interface='json'): |
Jay Pipes | ff10d55 | 2012-04-06 14:18:50 -0400 | [diff] [blame] | 219 | """ |
| 220 | We allow overriding of the credentials used within the various |
| 221 | client classes managed by the Manager object. Left as None, the |
| 222 | standard username/password/tenant_name is used. |
| 223 | |
| 224 | :param username: Override of the username |
| 225 | :param password: Override of the password |
| 226 | :param tenant_name: Override of the tenant name |
| 227 | """ |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 228 | self.config = config.TempestConfig() |
Rohit Karajgi | e1b050d | 2011-12-02 16:13:18 -0800 | [diff] [blame] | 229 | |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 230 | # If no creds are provided, we fall back on the defaults |
| 231 | # in the config file for the Compute API. |
Attila Fazekas | cadcb1f | 2013-01-21 23:10:53 +0100 | [diff] [blame] | 232 | self.username = username or self.config.identity.username |
| 233 | self.password = password or self.config.identity.password |
| 234 | self.tenant_name = tenant_name or self.config.identity.tenant_name |
Daryl Walleck | ced8eb8 | 2012-03-19 13:52:37 -0500 | [diff] [blame] | 235 | |
Rohit Karajgi | dd47d7e | 2012-07-31 04:11:01 -0700 | [diff] [blame] | 236 | if None in (self.username, self.password, self.tenant_name): |
Jay Pipes | 3f981df | 2012-03-27 18:59:44 -0400 | [diff] [blame] | 237 | msg = ("Missing required credentials. " |
| 238 | "username: %(username)s, password: %(password)s, " |
| 239 | "tenant_name: %(tenant_name)s") % locals() |
| 240 | raise exceptions.InvalidConfiguration(msg) |
| 241 | |
Jay Pipes | 7c88eb2 | 2013-01-16 21:32:43 -0500 | [diff] [blame] | 242 | self.auth_url = self.config.identity.uri |
Daryl Walleck | 587385b | 2012-03-03 13:00:26 -0600 | [diff] [blame] | 243 | |
| 244 | if self.config.identity.strategy == 'keystone': |
Rohit Karajgi | dd47d7e | 2012-07-31 04:11:01 -0700 | [diff] [blame] | 245 | client_args = (self.config, self.username, self.password, |
| 246 | self.auth_url, self.tenant_name) |
Daryl Walleck | 1465d61 | 2011-11-02 02:22:15 -0500 | [diff] [blame] | 247 | else: |
Rohit Karajgi | dd47d7e | 2012-07-31 04:11:01 -0700 | [diff] [blame] | 248 | client_args = (self.config, self.username, self.password, |
| 249 | self.auth_url) |
Daryl Walleck | 587385b | 2012-03-03 13:00:26 -0600 | [diff] [blame] | 250 | |
Dan Smith | cf8fab6 | 2012-08-14 08:03:48 -0700 | [diff] [blame] | 251 | try: |
| 252 | self.servers_client = SERVERS_CLIENTS[interface](*client_args) |
Matthew Treinish | 3363446 | 2012-08-16 16:51:23 -0400 | [diff] [blame] | 253 | self.limits_client = LIMITS_CLIENTS[interface](*client_args) |
Mauro S. M. Rodrigues | 6e37324 | 2012-08-27 18:59:19 -0400 | [diff] [blame] | 254 | self.images_client = IMAGES_CLIENTS[interface](*client_args) |
Mauro S. M. Rodrigues | a636f53 | 2012-08-21 11:07:53 -0400 | [diff] [blame] | 255 | self.keypairs_client = KEYPAIRS_CLIENTS[interface](*client_args) |
rajalakshmi-ganesan | 1982c3c | 2013-01-10 14:56:45 +0530 | [diff] [blame] | 256 | self.quotas_client = QUOTAS_CLIENTS[interface](*client_args) |
Tiago Mello | eda03b5 | 2012-08-22 23:47:29 -0300 | [diff] [blame] | 257 | self.flavors_client = FLAVORS_CLIENTS[interface](*client_args) |
Zhongyue Luo | e0884a3 | 2012-09-25 17:24:17 +0800 | [diff] [blame] | 258 | ext_cli = EXTENSIONS_CLIENTS[interface](*client_args) |
| 259 | self.extensions_client = ext_cli |
| 260 | vol_ext_cli = VOLUMES_EXTENSIONS_CLIENTS[interface](*client_args) |
| 261 | self.volumes_extensions_client = vol_ext_cli |
Vincent Hou | 22f03c7 | 2012-08-24 17:55:13 +0800 | [diff] [blame] | 262 | self.floating_ips_client = FLOAT_CLIENTS[interface](*client_args) |
Attila Fazekas | 36b1fcf | 2013-01-31 16:41:04 +0100 | [diff] [blame] | 263 | self.snapshots_client = SNAPSHOTS_CLIENTS[interface](*client_args) |
Matthew Treinish | 9854d5b | 2012-09-20 10:22:13 -0400 | [diff] [blame] | 264 | self.volumes_client = VOLUMES_CLIENTS[interface](*client_args) |
Attila Fazekas | 3dcdae1 | 2013-02-14 12:50:04 +0100 | [diff] [blame] | 265 | self.volume_types_client = \ |
| 266 | VOLUME_TYPES_CLIENTS[interface](*client_args) |
Attila Fazekas | 407b6db | 2013-01-19 12:48:36 +0100 | [diff] [blame] | 267 | self.identity_client = IDENTITY_CLIENT[interface](*client_args) |
rajalakshmi-ganesan | 7312bb5 | 2013-01-29 20:03:42 +0530 | [diff] [blame] | 268 | self.identity_v3_client = \ |
| 269 | IDENTITY_V3_CLIENT[interface](*client_args) |
Vincent Hou | 6b8a7b7 | 2012-08-25 01:24:33 +0800 | [diff] [blame] | 270 | self.token_client = TOKEN_CLIENT[interface](self.config) |
Vincent Hou | ead03dc | 2012-08-24 21:35:11 +0800 | [diff] [blame] | 271 | self.security_groups_client = \ |
| 272 | SECURITY_GROUPS_CLIENT[interface](*client_args) |
Dan Smith | 8ad1c47 | 2013-02-26 13:03:16 -0500 | [diff] [blame] | 273 | self.interfaces_client = INTERFACES_CLIENT[interface](*client_args) |
rajalakshmi-ganesan | ab42672 | 2013-02-08 15:49:15 +0530 | [diff] [blame] | 274 | self.endpoints_client = ENDPOINT_CLIENT[interface](*client_args) |
Mauro S. M. Rodrigues | f516640 | 2013-04-01 10:25:26 -0400 | [diff] [blame] | 275 | self.fixed_ips_client = FIXED_IPS_CLIENT[interface](*client_args) |
Leo Toyoda | a527891 | 2013-04-16 15:40:12 +0900 | [diff] [blame] | 276 | self.availability_zone_client = \ |
| 277 | AVAILABILITY_ZONE_CLIENT[interface](*client_args) |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 278 | self.service_client = SERVICE_CLIENT[interface](*client_args) |
Mitsuhiko Yamazaki | ae8fc53 | 2013-04-22 11:17:35 +0900 | [diff] [blame^] | 279 | self.aggregates_client = AGGREGATES_CLIENT[interface](*client_args) |
Dan Smith | cf8fab6 | 2012-08-14 08:03:48 -0700 | [diff] [blame] | 280 | except KeyError: |
| 281 | msg = "Unsupported interface type `%s'" % interface |
| 282 | raise exceptions.InvalidConfiguration(msg) |
Unmesh Gurjar | 4498683 | 2012-05-08 19:57:10 +0530 | [diff] [blame] | 283 | self.network_client = NetworkClient(*client_args) |
Attila Fazekas | 8e99b99 | 2013-02-24 09:53:23 +0100 | [diff] [blame] | 284 | self.hosts_client = HostsClientJSON(*client_args) |
dwalleck | 5d73443 | 2012-10-04 01:11:47 -0500 | [diff] [blame] | 285 | self.account_client = AccountClient(*client_args) |
Matthew Treinish | 72ea442 | 2013-02-07 14:42:49 -0500 | [diff] [blame] | 286 | self.image_client = ImageClientJSON(*client_args) |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 287 | self.image_client_v2 = ImageClientV2JSON(*client_args) |
dwalleck | 5d73443 | 2012-10-04 01:11:47 -0500 | [diff] [blame] | 288 | self.container_client = ContainerClient(*client_args) |
| 289 | self.object_client = ObjectClient(*client_args) |
Attila Fazekas | 1aed620 | 2013-02-11 14:47:45 +0100 | [diff] [blame] | 290 | self.ec2api_client = botoclients.APIClientEC2(*client_args) |
| 291 | self.s3_client = botoclients.ObjectClientS3(*client_args) |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 292 | self.custom_object_client = ObjectClientCustomizedHeader(*client_args) |
harika-vakadi | 2daed0a | 2013-01-01 20:51:39 +0530 | [diff] [blame] | 293 | self.custom_account_client = \ |
| 294 | AccountClientCustomizedHeader(*client_args) |
Jay Pipes | 5067728 | 2012-01-06 15:39:20 -0500 | [diff] [blame] | 295 | |
| 296 | |
Jay Pipes | ff10d55 | 2012-04-06 14:18:50 -0400 | [diff] [blame] | 297 | class AltManager(Manager): |
| 298 | |
| 299 | """ |
| 300 | Manager object that uses the alt_XXX credentials for its |
| 301 | managed client objects |
| 302 | """ |
| 303 | |
| 304 | def __init__(self): |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 305 | conf = config.TempestConfig() |
Attila Fazekas | cadcb1f | 2013-01-21 23:10:53 +0100 | [diff] [blame] | 306 | super(AltManager, self).__init__(conf.identity.alt_username, |
| 307 | conf.identity.alt_password, |
| 308 | conf.identity.alt_tenant_name) |
Jay Pipes | ff10d55 | 2012-04-06 14:18:50 -0400 | [diff] [blame] | 309 | |
| 310 | |
| 311 | class AdminManager(Manager): |
| 312 | |
| 313 | """ |
Attila Fazekas | cadcb1f | 2013-01-21 23:10:53 +0100 | [diff] [blame] | 314 | Manager object that uses the admin credentials for its |
Jay Pipes | ff10d55 | 2012-04-06 14:18:50 -0400 | [diff] [blame] | 315 | managed client objects |
| 316 | """ |
| 317 | |
James E. Blair | e6d8ee1 | 2013-01-18 21:33:45 +0000 | [diff] [blame] | 318 | def __init__(self, interface='json'): |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 319 | conf = config.TempestConfig() |
Attila Fazekas | cadcb1f | 2013-01-21 23:10:53 +0100 | [diff] [blame] | 320 | super(AdminManager, self).__init__(conf.identity.admin_username, |
| 321 | conf.identity.admin_password, |
| 322 | conf.identity.admin_tenant_name, |
James E. Blair | e6d8ee1 | 2013-01-18 21:33:45 +0000 | [diff] [blame] | 323 | interface=interface) |
Jay Pipes | ff10d55 | 2012-04-06 14:18:50 -0400 | [diff] [blame] | 324 | |
| 325 | |
Attila Fazekas | cadcb1f | 2013-01-21 23:10:53 +0100 | [diff] [blame] | 326 | class ComputeAdminManager(Manager): |
| 327 | |
| 328 | """ |
| 329 | Manager object that uses the compute_admin credentials for its |
| 330 | managed client objects |
| 331 | """ |
| 332 | |
| 333 | def __init__(self, interface='json'): |
| 334 | conf = config.TempestConfig() |
| 335 | base = super(ComputeAdminManager, self) |
| 336 | base.__init__(conf.compute_admin.username, |
| 337 | conf.compute_admin.password, |
| 338 | conf.compute_admin.tenant_name, |
| 339 | interface=interface) |