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 | |
Ken'ichi Ohmichi | 4771cbc | 2015-01-19 23:45:23 +0000 | [diff] [blame] | 16 | import copy |
| 17 | |
Doug Hellmann | 583ce2c | 2015-03-11 14:55:46 +0000 | [diff] [blame] | 18 | from oslo_log import log as logging |
andreaf | b8a5228 | 2015-03-19 22:21:54 +0000 | [diff] [blame] | 19 | from tempest_lib.services.identity.v2.token_client import TokenClientJSON |
| 20 | from tempest_lib.services.identity.v3.token_client import V3TokenClientJSON |
Doug Hellmann | 583ce2c | 2015-03-11 14:55:46 +0000 | [diff] [blame] | 21 | |
Andrea Frittoli | 9efbe95 | 2015-01-29 12:43:09 +0000 | [diff] [blame] | 22 | from tempest.common import cred_provider |
Ken'ichi Ohmichi | 4266268 | 2015-01-05 05:00:04 +0000 | [diff] [blame] | 23 | from tempest.common import negative_rest_client |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 24 | from tempest import config |
Andrea Frittoli (andreaf) | 03e546f | 2015-05-13 12:44:47 +0100 | [diff] [blame] | 25 | from tempest import exceptions |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 26 | from tempest import manager |
Ken'ichi Ohmichi | 884d106 | 2015-01-23 03:24:41 +0000 | [diff] [blame] | 27 | from tempest.services.baremetal.v1.json.baremetal_client import \ |
| 28 | BaremetalClientJSON |
Attila Fazekas | 1aed620 | 2013-02-11 14:47:45 +0100 | [diff] [blame] | 29 | from tempest.services import botoclients |
Yuiko Takada | 420f2eb | 2014-04-02 19:53:38 +0900 | [diff] [blame] | 30 | from tempest.services.compute.json.agents_client import \ |
| 31 | AgentsClientJSON |
Mitsuhiko Yamazaki | 74f0707 | 2013-04-02 11:52:31 +0900 | [diff] [blame] | 32 | from tempest.services.compute.json.aggregates_client import \ |
| 33 | AggregatesClientJSON |
Leo Toyoda | a527891 | 2013-04-16 15:40:12 +0900 | [diff] [blame] | 34 | from tempest.services.compute.json.availability_zone_client import \ |
| 35 | AvailabilityZoneClientJSON |
YuikoTakada | ac0879a | 2015-01-22 02:40:03 +0000 | [diff] [blame] | 36 | from tempest.services.compute.json.baremetal_nodes_client import \ |
| 37 | BaremetalNodesClientJSON |
ivan-zhu | d57f3cf | 2013-11-06 16:59:52 +0800 | [diff] [blame] | 38 | from tempest.services.compute.json.certificates_client import \ |
| 39 | CertificatesClientJSON |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 40 | from tempest.services.compute.json.extensions_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 41 | ExtensionsClientJSON |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 42 | from tempest.services.compute.json.fixed_ips_client import FixedIPsClientJSON |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 43 | from tempest.services.compute.json.flavors_client import FlavorsClientJSON |
| 44 | from tempest.services.compute.json.floating_ips_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 45 | FloatingIPsClientJSON |
Attila Fazekas | 8e99b99 | 2013-02-24 09:53:23 +0100 | [diff] [blame] | 46 | from tempest.services.compute.json.hosts_client import HostsClientJSON |
Tony Yang | 3d5f163 | 2013-06-06 14:17:57 +0800 | [diff] [blame] | 47 | from tempest.services.compute.json.hypervisor_client import \ |
| 48 | HypervisorClientJSON |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 49 | from tempest.services.compute.json.images_client import ImagesClientJSON |
ivan-zhu | ef7a1bd | 2013-10-22 17:56:46 +0800 | [diff] [blame] | 50 | from tempest.services.compute.json.instance_usage_audit_log_client import \ |
| 51 | InstanceUsagesAuditLogClientJSON |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 52 | from tempest.services.compute.json.interfaces_client import \ |
| 53 | InterfacesClientJSON |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 54 | from tempest.services.compute.json.keypairs_client import KeyPairsClientJSON |
dwalleck | e62b9f0 | 2012-10-10 23:34:42 -0500 | [diff] [blame] | 55 | from tempest.services.compute.json.limits_client import LimitsClientJSON |
Ken'ichi Ohmichi | 2fdc182 | 2014-03-18 09:10:57 +0900 | [diff] [blame] | 56 | from tempest.services.compute.json.migrations_client import \ |
| 57 | MigrationsClientJSON |
Andrea Frittoli | e258cd7 | 2014-07-17 04:47:26 +0100 | [diff] [blame] | 58 | from tempest.services.compute.json.networks_client import NetworksClientJSON |
Ken'ichi Ohmichi | a89dd6b | 2015-06-15 05:25:14 +0000 | [diff] [blame] | 59 | from tempest.services.compute.json.quota_classes_client import \ |
| 60 | QuotaClassesClientJSON |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 61 | from tempest.services.compute.json.quotas_client import QuotasClientJSON |
Ghanshyam | 9d9201d | 2014-04-16 19:28:09 +0900 | [diff] [blame] | 62 | from tempest.services.compute.json.security_group_default_rules_client import \ |
| 63 | SecurityGroupDefaultRulesClientJSON |
Matthew Treinish | a83a16e | 2012-12-07 13:44:02 -0500 | [diff] [blame] | 64 | from tempest.services.compute.json.security_groups_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 65 | SecurityGroupsClientJSON |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 66 | from tempest.services.compute.json.servers_client import ServersClientJSON |
Leo Toyoda | 3ae31e1 | 2013-04-19 11:19:57 +0900 | [diff] [blame] | 67 | from tempest.services.compute.json.services_client import ServicesClientJSON |
Ken'ichi Ohmichi | c3dfdb2 | 2015-01-22 04:39:58 +0000 | [diff] [blame] | 68 | from tempest.services.compute.json.tenant_networks_client import \ |
| 69 | TenantNetworksClientJSON |
Leo Toyoda | d80b6a0 | 2013-05-08 12:15:13 +0900 | [diff] [blame] | 70 | from tempest.services.compute.json.tenant_usages_client import \ |
| 71 | TenantUsagesClientJSON |
Matthew Treinish | a83a16e | 2012-12-07 13:44:02 -0500 | [diff] [blame] | 72 | from tempest.services.compute.json.volumes_extensions_client import \ |
harika-vakadi | 1a9ad61 | 2012-12-14 19:12:08 +0530 | [diff] [blame] | 73 | VolumesExtensionsClientJSON |
Ken'ichi Ohmichi | dc5fe44 | 2015-02-13 04:00:47 +0000 | [diff] [blame] | 74 | from tempest.services.data_processing.v1_1.data_processing_client import \ |
| 75 | DataProcessingClient |
Nikhil Manchanda | dd6886f | 2014-03-03 01:58:45 -0800 | [diff] [blame] | 76 | from tempest.services.database.json.flavors_client import \ |
| 77 | DatabaseFlavorsClientJSON |
ravikumar-venkatesan | 9e81b44 | 2014-12-08 09:57:56 +0000 | [diff] [blame] | 78 | from tempest.services.database.json.limits_client import \ |
| 79 | DatabaseLimitsClientJSON |
Peter Stachowski | 320f9c7 | 2014-04-21 16:13:23 -0400 | [diff] [blame] | 80 | from tempest.services.database.json.versions_client import \ |
| 81 | DatabaseVersionsClientJSON |
Jamie Lennox | c429e6a | 2015-02-24 10:42:42 +1100 | [diff] [blame] | 82 | from tempest.services.identity.v2.json.identity_client import \ |
| 83 | IdentityClientJSON |
nayna-patel | 914b471 | 2013-07-16 08:29:05 +0000 | [diff] [blame] | 84 | from tempest.services.identity.v3.json.credentials_client import \ |
| 85 | CredentialsClientJSON |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 86 | from tempest.services.identity.v3.json.endpoints_client import \ |
| 87 | EndPointClientJSON |
rajalakshmi-ganesan | 7312bb5 | 2013-01-29 20:03:42 +0530 | [diff] [blame] | 88 | from tempest.services.identity.v3.json.identity_client import \ |
| 89 | IdentityV3ClientJSON |
harika-vakadi | 40e1011 | 2013-02-08 14:38:09 +0530 | [diff] [blame] | 90 | from tempest.services.identity.v3.json.policy_client import PolicyClientJSON |
ravikumar-venkatesan | 3052e94 | 2014-05-12 18:25:17 +0000 | [diff] [blame] | 91 | from tempest.services.identity.v3.json.region_client import RegionClientJSON |
harika-vakadi | a92dd74 | 2013-02-19 20:41:22 +0530 | [diff] [blame] | 92 | from tempest.services.identity.v3.json.service_client import \ |
| 93 | ServiceClientJSON |
Matthew Treinish | 6d59c99 | 2013-03-01 16:20:04 -0500 | [diff] [blame] | 94 | from tempest.services.image.v1.json.image_client import ImageClientJSON |
Matthew Treinish | a62347f | 2013-03-01 16:37:30 -0500 | [diff] [blame] | 95 | from tempest.services.image.v2.json.image_client import ImageClientV2JSON |
Victoria MartÃnez de la Cruz | 1173b6e | 2014-09-22 18:32:13 -0300 | [diff] [blame] | 96 | from tempest.services.messaging.json.messaging_client import \ |
| 97 | MessagingClientJSON |
raiesmh08 | 6769832 | 2013-08-20 13:09:01 +0530 | [diff] [blame] | 98 | from tempest.services.network.json.network_client import NetworkClientJSON |
dwalleck | 5d73443 | 2012-10-04 01:11:47 -0500 | [diff] [blame] | 99 | from tempest.services.object_storage.account_client import AccountClient |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 100 | from tempest.services.object_storage.container_client import ContainerClient |
| 101 | from tempest.services.object_storage.object_client import ObjectClient |
Steve Baker | c60e4e3 | 2013-05-06 15:22:41 +1200 | [diff] [blame] | 102 | from tempest.services.orchestration.json.orchestration_client import \ |
| 103 | OrchestrationClient |
Nikolay Pliashechnikov | b053aab | 2013-11-05 06:06:44 -0800 | [diff] [blame] | 104 | from tempest.services.telemetry.json.telemetry_client import \ |
| 105 | TelemetryClientJSON |
Nayna Patel | 4a5024c | 2013-11-18 07:08:23 +0000 | [diff] [blame] | 106 | from tempest.services.volume.json.admin.volume_hosts_client import \ |
| 107 | VolumeHostsClientJSON |
Sylvain Baubeau | fdd3459 | 2014-02-20 18:40:10 +0100 | [diff] [blame] | 108 | from tempest.services.volume.json.admin.volume_quotas_client import \ |
| 109 | VolumeQuotasClientJSON |
Abhijeet.Jain | 0056b07 | 2014-04-15 09:32:29 +0530 | [diff] [blame] | 110 | from tempest.services.volume.json.admin.volume_services_client import \ |
| 111 | VolumesServicesClientJSON |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 112 | from tempest.services.volume.json.admin.volume_types_client import \ |
| 113 | VolumeTypesClientJSON |
Abhijeet.Jain | 6109bb8 | 2014-05-01 10:29:15 +0530 | [diff] [blame] | 114 | from tempest.services.volume.json.availability_zone_client import \ |
| 115 | VolumeAvailabilityZoneClientJSON |
Giulio Fidente | 74b08ad | 2014-01-18 04:02:51 +0100 | [diff] [blame] | 116 | from tempest.services.volume.json.backups_client import BackupsClientJSON |
Matthew Treinish | 2324e6b | 2013-10-21 20:25:17 +0000 | [diff] [blame] | 117 | from tempest.services.volume.json.extensions_client import \ |
| 118 | ExtensionsClientJSON as VolumeExtensionClientJSON |
Swapnil Kulkarni | 7dba3e6 | 2014-08-14 09:05:07 +0000 | [diff] [blame] | 119 | from tempest.services.volume.json.qos_client import QosSpecsClientJSON |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 120 | from tempest.services.volume.json.snapshots_client import SnapshotsClientJSON |
| 121 | from tempest.services.volume.json.volumes_client import VolumesClientJSON |
Chandan Kumar | 65eb859 | 2014-11-12 18:32:32 +0530 | [diff] [blame] | 122 | from tempest.services.volume.v2.json.admin.volume_hosts_client import \ |
| 123 | VolumeHostsV2ClientJSON |
Chandan Kumar | dd23f63 | 2014-11-17 15:27:48 +0530 | [diff] [blame] | 124 | from tempest.services.volume.v2.json.admin.volume_quotas_client import \ |
| 125 | VolumeQuotasV2Client |
jun xie | 9f12382 | 2014-11-20 14:21:23 +0800 | [diff] [blame] | 126 | from tempest.services.volume.v2.json.admin.volume_services_client import \ |
| 127 | VolumesServicesV2ClientJSON |
Chandan Kumar | 449e4c0 | 2014-09-12 07:26:19 -0400 | [diff] [blame] | 128 | from tempest.services.volume.v2.json.admin.volume_types_client import \ |
| 129 | VolumeTypesV2ClientJSON |
Zhi Kun Liu | 5339552 | 2014-07-18 16:05:52 +0800 | [diff] [blame] | 130 | from tempest.services.volume.v2.json.availability_zone_client import \ |
| 131 | VolumeV2AvailabilityZoneClientJSON |
jun xie | ebc3da3 | 2014-11-18 14:34:56 +0800 | [diff] [blame] | 132 | from tempest.services.volume.v2.json.backups_client import BackupsClientV2JSON |
Zhi Kun Liu | 5339552 | 2014-07-18 16:05:52 +0800 | [diff] [blame] | 133 | from tempest.services.volume.v2.json.extensions_client import \ |
| 134 | ExtensionsV2ClientJSON as VolumeV2ExtensionClientJSON |
Swapnil Kulkarni | 7dba3e6 | 2014-08-14 09:05:07 +0000 | [diff] [blame] | 135 | from tempest.services.volume.v2.json.qos_client import QosSpecsV2ClientJSON |
Zhi Kun Liu | 38641c6 | 2014-07-10 20:12:48 +0800 | [diff] [blame] | 136 | from tempest.services.volume.v2.json.snapshots_client import \ |
| 137 | SnapshotsV2ClientJSON |
Zhi Kun Liu | 8cc3c84 | 2014-01-07 10:44:34 +0800 | [diff] [blame] | 138 | from tempest.services.volume.v2.json.volumes_client import VolumesV2ClientJSON |
Vincent Hou | 6b8a7b7 | 2012-08-25 01:24:33 +0800 | [diff] [blame] | 139 | |
Sean Dague | 86bd842 | 2013-12-20 09:56:44 -0500 | [diff] [blame] | 140 | CONF = config.CONF |
Jay Pipes | 3f981df | 2012-03-27 18:59:44 -0400 | [diff] [blame] | 141 | LOG = logging.getLogger(__name__) |
| 142 | |
Vincent Hou | 6b8a7b7 | 2012-08-25 01:24:33 +0800 | [diff] [blame] | 143 | |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 144 | class Manager(manager.Manager): |
Daryl Walleck | 1465d61 | 2011-11-02 02:22:15 -0500 | [diff] [blame] | 145 | |
Jay Pipes | 3f981df | 2012-03-27 18:59:44 -0400 | [diff] [blame] | 146 | """ |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 147 | Top level manager for OpenStack tempest clients |
Jay Pipes | 3f981df | 2012-03-27 18:59:44 -0400 | [diff] [blame] | 148 | """ |
| 149 | |
Ken'ichi Ohmichi | c2b11ce | 2015-01-16 07:17:29 +0000 | [diff] [blame] | 150 | default_params = { |
| 151 | 'disable_ssl_certificate_validation': |
| 152 | CONF.identity.disable_ssl_certificate_validation, |
| 153 | 'ca_certs': CONF.identity.ca_certificates_file, |
| 154 | 'trace_requests': CONF.debug.trace_requests |
| 155 | } |
| 156 | |
Ken'ichi Ohmichi | 737a603 | 2015-01-21 07:04:42 +0000 | [diff] [blame] | 157 | # NOTE: Tempest uses timeout values of compute API if project specific |
| 158 | # timeout values don't exist. |
| 159 | default_params_with_timeout_values = { |
| 160 | 'build_interval': CONF.compute.build_interval, |
| 161 | 'build_timeout': CONF.compute.build_timeout |
| 162 | } |
| 163 | default_params_with_timeout_values.update(default_params) |
| 164 | |
Andrea Frittoli | c097835 | 2015-02-06 15:57:40 +0000 | [diff] [blame] | 165 | def __init__(self, credentials=None, service=None): |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 166 | super(Manager, self).__init__(credentials=credentials) |
Brant Knudson | c7ca334 | 2013-03-28 21:08:50 -0500 | [diff] [blame] | 167 | |
Ken'ichi Ohmichi | 80ec0b9 | 2015-01-16 06:43:10 +0000 | [diff] [blame] | 168 | self._set_compute_clients() |
ravikumar-venkatesan | 9e81b44 | 2014-12-08 09:57:56 +0000 | [diff] [blame] | 169 | self._set_database_clients() |
Ken'ichi Ohmichi | 80ec0b9 | 2015-01-16 06:43:10 +0000 | [diff] [blame] | 170 | self._set_identity_clients() |
| 171 | self._set_volume_clients() |
Ken'ichi Ohmichi | c95eb85 | 2015-01-22 01:57:57 +0000 | [diff] [blame] | 172 | self._set_object_storage_clients() |
Ken'ichi Ohmichi | cd4a51e | 2014-11-13 07:25:33 +0000 | [diff] [blame] | 173 | |
Ken'ichi Ohmichi | 1f88ece | 2015-01-23 03:33:11 +0000 | [diff] [blame] | 174 | self.baremetal_client = BaremetalClientJSON( |
| 175 | self.auth_provider, |
| 176 | CONF.baremetal.catalog_type, |
| 177 | CONF.identity.region, |
| 178 | endpoint_type=CONF.baremetal.endpoint_type, |
| 179 | **self.default_params_with_timeout_values) |
Ken'ichi Ohmichi | a182e86 | 2015-01-21 01:16:37 +0000 | [diff] [blame] | 180 | self.network_client = NetworkClientJSON( |
| 181 | self.auth_provider, |
| 182 | CONF.network.catalog_type, |
| 183 | CONF.network.region or CONF.identity.region, |
| 184 | endpoint_type=CONF.network.endpoint_type, |
| 185 | build_interval=CONF.network.build_interval, |
| 186 | build_timeout=CONF.network.build_timeout, |
| 187 | **self.default_params) |
Ken'ichi Ohmichi | 2183a65 | 2015-01-22 05:00:20 +0000 | [diff] [blame] | 188 | self.messaging_client = MessagingClientJSON( |
| 189 | self.auth_provider, |
| 190 | CONF.messaging.catalog_type, |
| 191 | CONF.identity.region, |
| 192 | **self.default_params_with_timeout_values) |
Sean Dague | f3c7591 | 2014-11-24 11:45:11 -0500 | [diff] [blame] | 193 | if CONF.service_available.ceilometer: |
| 194 | self.telemetry_client = TelemetryClientJSON( |
Ken'ichi Ohmichi | d5dba1c | 2015-01-23 02:23:22 +0000 | [diff] [blame] | 195 | self.auth_provider, |
| 196 | CONF.telemetry.catalog_type, |
| 197 | CONF.identity.region, |
| 198 | endpoint_type=CONF.telemetry.endpoint_type, |
| 199 | **self.default_params_with_timeout_values) |
Sean Dague | 86bd842 | 2013-12-20 09:56:44 -0500 | [diff] [blame] | 200 | if CONF.service_available.glance: |
Masayuki Igawa | bc7e189 | 2015-03-03 11:46:48 +0900 | [diff] [blame] | 201 | self.image_client = ImageClientJSON( |
| 202 | self.auth_provider, |
| 203 | CONF.image.catalog_type, |
| 204 | CONF.image.region or CONF.identity.region, |
| 205 | endpoint_type=CONF.image.endpoint_type, |
| 206 | build_interval=CONF.image.build_interval, |
| 207 | build_timeout=CONF.image.build_timeout, |
| 208 | **self.default_params) |
| 209 | self.image_client_v2 = ImageClientV2JSON( |
| 210 | self.auth_provider, |
| 211 | CONF.image.catalog_type, |
| 212 | CONF.image.region or CONF.identity.region, |
| 213 | endpoint_type=CONF.image.endpoint_type, |
| 214 | build_interval=CONF.image.build_interval, |
| 215 | build_timeout=CONF.image.build_timeout, |
| 216 | **self.default_params) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 217 | self.orchestration_client = OrchestrationClient( |
Ken'ichi Ohmichi | c2b11ce | 2015-01-16 07:17:29 +0000 | [diff] [blame] | 218 | self.auth_provider, |
| 219 | CONF.orchestration.catalog_type, |
| 220 | CONF.orchestration.region or CONF.identity.region, |
| 221 | endpoint_type=CONF.orchestration.endpoint_type, |
| 222 | build_interval=CONF.orchestration.build_interval, |
| 223 | build_timeout=CONF.orchestration.build_timeout, |
| 224 | **self.default_params) |
Ken'ichi Ohmichi | 4e83b5e | 2015-02-13 04:07:34 +0000 | [diff] [blame] | 225 | self.data_processing_client = DataProcessingClient( |
| 226 | self.auth_provider, |
| 227 | CONF.data_processing.catalog_type, |
| 228 | CONF.identity.region, |
| 229 | endpoint_type=CONF.data_processing.endpoint_type, |
| 230 | **self.default_params_with_timeout_values) |
Ken'ichi Ohmichi | b38eb00 | 2015-01-23 02:35:01 +0000 | [diff] [blame] | 231 | self.negative_client = negative_rest_client.NegativeRestClient( |
David Kranz | 1e33e37 | 2015-03-20 09:42:56 -0400 | [diff] [blame] | 232 | self.auth_provider, service, **self.default_params) |
Ken'ichi Ohmichi | c2b11ce | 2015-01-16 07:17:29 +0000 | [diff] [blame] | 233 | |
Andrea Frittoli | 32d7499 | 2015-03-06 17:01:07 +0000 | [diff] [blame] | 234 | # Generating EC2 credentials in tempest is only supported |
| 235 | # with identity v2 |
| 236 | if CONF.identity_feature_enabled.api_v2 and \ |
| 237 | CONF.identity.auth_version == 'v2': |
| 238 | # EC2 and S3 clients, if used, will check onfigured AWS credentials |
| 239 | # and generate new ones if needed |
| 240 | self.ec2api_client = botoclients.APIClientEC2(self.identity_client) |
| 241 | self.s3_client = botoclients.ObjectClientS3(self.identity_client) |
Jay Pipes | 5067728 | 2012-01-06 15:39:20 -0500 | [diff] [blame] | 242 | |
Ken'ichi Ohmichi | 80ec0b9 | 2015-01-16 06:43:10 +0000 | [diff] [blame] | 243 | def _set_compute_clients(self): |
Ken'ichi Ohmichi | 4771cbc | 2015-01-19 23:45:23 +0000 | [diff] [blame] | 244 | params = { |
| 245 | 'service': CONF.compute.catalog_type, |
| 246 | 'region': CONF.compute.region or CONF.identity.region, |
| 247 | 'endpoint_type': CONF.compute.endpoint_type, |
| 248 | 'build_interval': CONF.compute.build_interval, |
| 249 | 'build_timeout': CONF.compute.build_timeout |
| 250 | } |
| 251 | params.update(self.default_params) |
| 252 | |
| 253 | self.agents_client = AgentsClientJSON(self.auth_provider, **params) |
| 254 | self.networks_client = NetworksClientJSON(self.auth_provider, **params) |
| 255 | self.migrations_client = MigrationsClientJSON(self.auth_provider, |
| 256 | **params) |
Ken'ichi Ohmichi | 65225ef | 2014-11-19 01:06:25 +0000 | [diff] [blame] | 257 | self.security_group_default_rules_client = ( |
Ken'ichi Ohmichi | 4771cbc | 2015-01-19 23:45:23 +0000 | [diff] [blame] | 258 | SecurityGroupDefaultRulesClientJSON(self.auth_provider, **params)) |
| 259 | self.certificates_client = CertificatesClientJSON(self.auth_provider, |
| 260 | **params) |
Masayuki Igawa | 8f9c0c8 | 2015-03-03 09:38:08 +0900 | [diff] [blame] | 261 | self.servers_client = ServersClientJSON( |
| 262 | self.auth_provider, |
| 263 | enable_instance_password=CONF.compute_feature_enabled |
| 264 | .enable_instance_password, |
| 265 | **params) |
Ken'ichi Ohmichi | 4771cbc | 2015-01-19 23:45:23 +0000 | [diff] [blame] | 266 | self.limits_client = LimitsClientJSON(self.auth_provider, **params) |
| 267 | self.images_client = ImagesClientJSON(self.auth_provider, **params) |
| 268 | self.keypairs_client = KeyPairsClientJSON(self.auth_provider, **params) |
| 269 | self.quotas_client = QuotasClientJSON(self.auth_provider, **params) |
| 270 | self.quota_classes_client = QuotaClassesClientJSON(self.auth_provider, |
| 271 | **params) |
| 272 | self.flavors_client = FlavorsClientJSON(self.auth_provider, **params) |
| 273 | self.extensions_client = ExtensionsClientJSON(self.auth_provider, |
| 274 | **params) |
| 275 | self.floating_ips_client = FloatingIPsClientJSON(self.auth_provider, |
| 276 | **params) |
Ken'ichi Ohmichi | cd4a51e | 2014-11-13 07:25:33 +0000 | [diff] [blame] | 277 | self.security_groups_client = SecurityGroupsClientJSON( |
Ken'ichi Ohmichi | 4771cbc | 2015-01-19 23:45:23 +0000 | [diff] [blame] | 278 | self.auth_provider, **params) |
| 279 | self.interfaces_client = InterfacesClientJSON(self.auth_provider, |
| 280 | **params) |
| 281 | self.fixed_ips_client = FixedIPsClientJSON(self.auth_provider, |
| 282 | **params) |
Ken'ichi Ohmichi | cd4a51e | 2014-11-13 07:25:33 +0000 | [diff] [blame] | 283 | self.availability_zone_client = AvailabilityZoneClientJSON( |
Ken'ichi Ohmichi | 4771cbc | 2015-01-19 23:45:23 +0000 | [diff] [blame] | 284 | self.auth_provider, **params) |
| 285 | self.aggregates_client = AggregatesClientJSON(self.auth_provider, |
| 286 | **params) |
| 287 | self.services_client = ServicesClientJSON(self.auth_provider, **params) |
| 288 | self.tenant_usages_client = TenantUsagesClientJSON(self.auth_provider, |
| 289 | **params) |
| 290 | self.hosts_client = HostsClientJSON(self.auth_provider, **params) |
| 291 | self.hypervisor_client = HypervisorClientJSON(self.auth_provider, |
| 292 | **params) |
Ken'ichi Ohmichi | cd4a51e | 2014-11-13 07:25:33 +0000 | [diff] [blame] | 293 | self.instance_usages_audit_log_client = \ |
Ken'ichi Ohmichi | 4771cbc | 2015-01-19 23:45:23 +0000 | [diff] [blame] | 294 | InstanceUsagesAuditLogClientJSON(self.auth_provider, **params) |
Ken'ichi Ohmichi | c3dfdb2 | 2015-01-22 04:39:58 +0000 | [diff] [blame] | 295 | self.tenant_networks_client = \ |
| 296 | TenantNetworksClientJSON(self.auth_provider, **params) |
YuikoTakada | ac0879a | 2015-01-22 02:40:03 +0000 | [diff] [blame] | 297 | self.baremetal_nodes_client = BaremetalNodesClientJSON( |
| 298 | self.auth_provider, **params) |
Ken'ichi Ohmichi | 4771cbc | 2015-01-19 23:45:23 +0000 | [diff] [blame] | 299 | |
| 300 | # NOTE: The following client needs special timeout values because |
| 301 | # the API is a proxy for the other component. |
| 302 | params_volume = copy.deepcopy(params) |
| 303 | params_volume.update({ |
| 304 | 'build_interval': CONF.volume.build_interval, |
| 305 | 'build_timeout': CONF.volume.build_timeout |
| 306 | }) |
| 307 | self.volumes_extensions_client = VolumesExtensionsClientJSON( |
Markus Zoeller | 3d2a21c | 2015-02-27 12:04:22 +0100 | [diff] [blame] | 308 | self.auth_provider, default_volume_size=CONF.volume.volume_size, |
| 309 | **params_volume) |
Ken'ichi Ohmichi | cd4a51e | 2014-11-13 07:25:33 +0000 | [diff] [blame] | 310 | |
ravikumar-venkatesan | 9e81b44 | 2014-12-08 09:57:56 +0000 | [diff] [blame] | 311 | def _set_database_clients(self): |
| 312 | self.database_flavors_client = DatabaseFlavorsClientJSON( |
| 313 | self.auth_provider, |
| 314 | CONF.database.catalog_type, |
| 315 | CONF.identity.region, |
| 316 | **self.default_params_with_timeout_values) |
| 317 | self.database_limits_client = DatabaseLimitsClientJSON( |
| 318 | self.auth_provider, |
| 319 | CONF.database.catalog_type, |
| 320 | CONF.identity.region, |
| 321 | **self.default_params_with_timeout_values) |
| 322 | self.database_versions_client = DatabaseVersionsClientJSON( |
| 323 | self.auth_provider, |
| 324 | CONF.database.catalog_type, |
| 325 | CONF.identity.region, |
| 326 | **self.default_params_with_timeout_values) |
| 327 | |
Ken'ichi Ohmichi | 80ec0b9 | 2015-01-16 06:43:10 +0000 | [diff] [blame] | 328 | def _set_identity_clients(self): |
ghanshyam | d26b5cd | 2015-02-09 14:48:58 +0900 | [diff] [blame] | 329 | params = { |
| 330 | 'service': CONF.identity.catalog_type, |
| 331 | 'region': CONF.identity.region, |
| 332 | 'endpoint_type': 'adminURL' |
| 333 | } |
| 334 | params.update(self.default_params_with_timeout_values) |
| 335 | |
| 336 | self.identity_client = IdentityClientJSON(self.auth_provider, |
| 337 | **params) |
| 338 | self.identity_v3_client = IdentityV3ClientJSON(self.auth_provider, |
| 339 | **params) |
| 340 | self.endpoints_client = EndPointClientJSON(self.auth_provider, |
| 341 | **params) |
| 342 | self.service_client = ServiceClientJSON(self.auth_provider, **params) |
| 343 | self.policy_client = PolicyClientJSON(self.auth_provider, **params) |
| 344 | self.region_client = RegionClientJSON(self.auth_provider, **params) |
| 345 | self.credentials_client = CredentialsClientJSON(self.auth_provider, |
| 346 | **params) |
Andrea Frittoli | 9001235 | 2015-02-25 21:58:02 +0000 | [diff] [blame] | 347 | # Token clients do not use the catalog. They only need default_params. |
Andrea Frittoli (andreaf) | 03e546f | 2015-05-13 12:44:47 +0100 | [diff] [blame] | 348 | # They read auth_url, so they should only be set if the corresponding |
| 349 | # API version is marked as enabled |
| 350 | if CONF.identity_feature_enabled.api_v2: |
| 351 | if CONF.identity.uri: |
| 352 | self.token_client = TokenClientJSON( |
| 353 | CONF.identity.uri, **self.default_params) |
| 354 | else: |
| 355 | msg = 'Identity v2 API enabled, but no identity.uri set' |
| 356 | raise exceptions.InvalidConfiguration(msg) |
Ken'ichi Ohmichi | 41951b0 | 2014-11-19 01:57:43 +0000 | [diff] [blame] | 357 | if CONF.identity_feature_enabled.api_v3: |
Andrea Frittoli (andreaf) | 03e546f | 2015-05-13 12:44:47 +0100 | [diff] [blame] | 358 | if CONF.identity.uri_v3: |
| 359 | self.token_v3_client = V3TokenClientJSON( |
| 360 | CONF.identity.uri_v3, **self.default_params) |
| 361 | else: |
| 362 | msg = 'Identity v3 API enabled, but no identity.uri_v3 set' |
| 363 | raise exceptions.InvalidConfiguration(msg) |
Ken'ichi Ohmichi | 41951b0 | 2014-11-19 01:57:43 +0000 | [diff] [blame] | 364 | |
Ken'ichi Ohmichi | 80ec0b9 | 2015-01-16 06:43:10 +0000 | [diff] [blame] | 365 | def _set_volume_clients(self): |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 366 | params = { |
| 367 | 'service': CONF.volume.catalog_type, |
| 368 | 'region': CONF.volume.region or CONF.identity.region, |
| 369 | 'endpoint_type': CONF.volume.endpoint_type, |
| 370 | 'build_interval': CONF.volume.build_interval, |
| 371 | 'build_timeout': CONF.volume.build_timeout |
| 372 | } |
| 373 | params.update(self.default_params) |
| 374 | |
| 375 | self.volume_qos_client = QosSpecsClientJSON(self.auth_provider, |
| 376 | **params) |
Ken'ichi Ohmichi | 532ae92 | 2014-11-19 01:37:15 +0000 | [diff] [blame] | 377 | self.volume_qos_v2_client = QosSpecsV2ClientJSON( |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 378 | self.auth_provider, **params) |
jun xie | 9f12382 | 2014-11-20 14:21:23 +0800 | [diff] [blame] | 379 | self.volume_services_v2_client = VolumesServicesV2ClientJSON( |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 380 | self.auth_provider, **params) |
| 381 | self.backups_client = BackupsClientJSON(self.auth_provider, **params) |
| 382 | self.backups_v2_client = BackupsClientV2JSON(self.auth_provider, |
| 383 | **params) |
| 384 | self.snapshots_client = SnapshotsClientJSON(self.auth_provider, |
| 385 | **params) |
| 386 | self.snapshots_v2_client = SnapshotsV2ClientJSON(self.auth_provider, |
| 387 | **params) |
Ken'ichi Ohmichi | 234da80 | 2015-02-13 04:48:06 +0000 | [diff] [blame] | 388 | self.volumes_client = VolumesClientJSON( |
| 389 | self.auth_provider, default_volume_size=CONF.volume.volume_size, |
| 390 | **params) |
| 391 | self.volumes_v2_client = VolumesV2ClientJSON( |
| 392 | self.auth_provider, default_volume_size=CONF.volume.volume_size, |
| 393 | **params) |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 394 | self.volume_types_client = VolumeTypesClientJSON(self.auth_provider, |
| 395 | **params) |
Ken'ichi Ohmichi | 532ae92 | 2014-11-19 01:37:15 +0000 | [diff] [blame] | 396 | self.volume_services_client = VolumesServicesClientJSON( |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 397 | self.auth_provider, **params) |
| 398 | self.volume_hosts_client = VolumeHostsClientJSON(self.auth_provider, |
| 399 | **params) |
Ken'ichi Ohmichi | 532ae92 | 2014-11-19 01:37:15 +0000 | [diff] [blame] | 400 | self.volume_hosts_v2_client = VolumeHostsV2ClientJSON( |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 401 | self.auth_provider, **params) |
| 402 | self.volume_quotas_client = VolumeQuotasClientJSON(self.auth_provider, |
| 403 | **params) |
| 404 | self.volume_quotas_v2_client = VolumeQuotasV2Client(self.auth_provider, |
| 405 | **params) |
Ken'ichi Ohmichi | 532ae92 | 2014-11-19 01:37:15 +0000 | [diff] [blame] | 406 | self.volumes_extension_client = VolumeExtensionClientJSON( |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 407 | self.auth_provider, **params) |
Ken'ichi Ohmichi | 532ae92 | 2014-11-19 01:37:15 +0000 | [diff] [blame] | 408 | self.volumes_v2_extension_client = VolumeV2ExtensionClientJSON( |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 409 | self.auth_provider, **params) |
Ken'ichi Ohmichi | 532ae92 | 2014-11-19 01:37:15 +0000 | [diff] [blame] | 410 | self.volume_availability_zone_client = \ |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 411 | VolumeAvailabilityZoneClientJSON(self.auth_provider, **params) |
Ken'ichi Ohmichi | 532ae92 | 2014-11-19 01:37:15 +0000 | [diff] [blame] | 412 | self.volume_v2_availability_zone_client = \ |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 413 | VolumeV2AvailabilityZoneClientJSON(self.auth_provider, **params) |
Ken'ichi Ohmichi | 532ae92 | 2014-11-19 01:37:15 +0000 | [diff] [blame] | 414 | self.volume_types_v2_client = VolumeTypesV2ClientJSON( |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 415 | self.auth_provider, **params) |
Ken'ichi Ohmichi | 532ae92 | 2014-11-19 01:37:15 +0000 | [diff] [blame] | 416 | |
Ken'ichi Ohmichi | c95eb85 | 2015-01-22 01:57:57 +0000 | [diff] [blame] | 417 | def _set_object_storage_clients(self): |
Ken'ichi Ohmichi | 564b2ad | 2015-01-22 02:08:59 +0000 | [diff] [blame] | 418 | params = { |
| 419 | 'service': CONF.object_storage.catalog_type, |
| 420 | 'region': CONF.object_storage.region or CONF.identity.region, |
| 421 | 'endpoint_type': CONF.object_storage.endpoint_type |
| 422 | } |
| 423 | params.update(self.default_params_with_timeout_values) |
| 424 | |
| 425 | self.account_client = AccountClient(self.auth_provider, **params) |
| 426 | self.container_client = ContainerClient(self.auth_provider, **params) |
| 427 | self.object_client = ObjectClient(self.auth_provider, **params) |
Ken'ichi Ohmichi | c95eb85 | 2015-01-22 01:57:57 +0000 | [diff] [blame] | 428 | |
Jay Pipes | 5067728 | 2012-01-06 15:39:20 -0500 | [diff] [blame] | 429 | |
Jay Pipes | ff10d55 | 2012-04-06 14:18:50 -0400 | [diff] [blame] | 430 | class AdminManager(Manager): |
| 431 | |
| 432 | """ |
Attila Fazekas | cadcb1f | 2013-01-21 23:10:53 +0100 | [diff] [blame] | 433 | Manager object that uses the admin credentials for its |
Jay Pipes | ff10d55 | 2012-04-06 14:18:50 -0400 | [diff] [blame] | 434 | managed client objects |
| 435 | """ |
| 436 | |
Andrea Frittoli | c097835 | 2015-02-06 15:57:40 +0000 | [diff] [blame] | 437 | def __init__(self, service=None): |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 438 | super(AdminManager, self).__init__( |
Andrea Frittoli | 9efbe95 | 2015-01-29 12:43:09 +0000 | [diff] [blame] | 439 | credentials=cred_provider.get_configured_credentials( |
| 440 | 'identity_admin'), |
Andrea Frittoli | 422fbdf | 2014-03-20 10:05:18 +0000 | [diff] [blame] | 441 | service=service) |