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