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 |
Ken'ichi Ohmichi | 8e7a4f8 | 2015-09-16 21:26:19 +0900 | [diff] [blame] | 19 | from tempest_lib.services.compute.agents_client import AgentsClient |
ghanshyam | d1dac39 | 2015-10-13 15:30:24 +0900 | [diff] [blame] | 20 | from tempest_lib.services.compute.aggregates_client import AggregatesClient |
ghanshyam | 384dc79 | 2015-10-13 16:03:13 +0900 | [diff] [blame] | 21 | from tempest_lib.services.compute.availability_zone_client import \ |
| 22 | AvailabilityZoneClient |
ghanshyam | 9fab7cc | 2015-10-13 16:12:23 +0900 | [diff] [blame] | 23 | from tempest_lib.services.compute.baremetal_nodes_client import \ |
| 24 | BaremetalNodesClient |
ghanshyam | 4328a96 | 2015-10-13 16:18:09 +0900 | [diff] [blame] | 25 | from tempest_lib.services.compute.certificates_client import \ |
| 26 | CertificatesClient |
ghanshyam | 0805a9e | 2015-10-13 16:24:44 +0900 | [diff] [blame] | 27 | from tempest_lib.services.compute.extensions_client import \ |
| 28 | ExtensionsClient |
ghanshyam | 969281e | 2015-10-14 14:17:57 +0900 | [diff] [blame] | 29 | from tempest_lib.services.compute.fixed_ips_client import FixedIPsClient |
ghanshyam | 2f6f5f1 | 2015-10-14 14:27:36 +0900 | [diff] [blame] | 30 | from tempest_lib.services.compute.flavors_client import FlavorsClient |
ghanshyam | bf9e600 | 2015-10-14 14:32:30 +0900 | [diff] [blame] | 31 | from tempest_lib.services.compute.floating_ip_pools_client import \ |
| 32 | FloatingIPPoolsClient |
ghanshyam | 1a286ab | 2015-10-14 14:37:07 +0900 | [diff] [blame] | 33 | from tempest_lib.services.compute.floating_ips_bulk_client import \ |
| 34 | FloatingIPsBulkClient |
Ghanshyam | 9d53dc2 | 2015-12-21 11:48:12 +0900 | [diff] [blame] | 35 | from tempest_lib.services.compute.floating_ips_client import \ |
| 36 | FloatingIPsClient as ComputeFloatingIPsClient |
ghanshyam | c898a28 | 2015-10-14 14:44:06 +0900 | [diff] [blame] | 37 | from tempest_lib.services.compute.hosts_client import HostsClient |
ghanshyam | 7dd1b49 | 2015-10-14 14:47:25 +0900 | [diff] [blame] | 38 | from tempest_lib.services.compute.hypervisor_client import \ |
| 39 | HypervisorClient |
Ken'ichi Ohmichi | 69dcf44 | 2015-11-30 11:48:01 +0000 | [diff] [blame] | 40 | from tempest_lib.services.compute.images_client import ImagesClient \ |
| 41 | as ComputeImagesClient |
ghanshyam | e6ee3e4 | 2015-11-20 18:20:57 +0900 | [diff] [blame] | 42 | from tempest_lib.services.compute.instance_usage_audit_log_client import \ |
| 43 | InstanceUsagesAuditLogClient |
Ken'ichi Ohmichi | c3f22ce | 2015-12-03 05:21:37 +0000 | [diff] [blame] | 44 | from tempest_lib.services.compute.interfaces_client import InterfacesClient |
ghanshyam | 54e55cc | 2015-11-20 18:26:15 +0900 | [diff] [blame] | 45 | from tempest_lib.services.compute.limits_client import LimitsClient |
ghanshyam | eb6e221 | 2015-11-20 18:30:46 +0900 | [diff] [blame] | 46 | from tempest_lib.services.compute.migrations_client import MigrationsClient |
ghanshyam | 6ca351a | 2015-11-20 18:35:30 +0900 | [diff] [blame] | 47 | from tempest_lib.services.compute.networks_client import NetworksClient \ |
| 48 | as ComputeNetworksClient |
ghanshyam | 1a6acef | 2015-11-24 13:37:33 +0900 | [diff] [blame] | 49 | from tempest_lib.services.compute.quota_classes_client import \ |
| 50 | QuotaClassesClient |
ghanshyam | 2f0b2f9 | 2015-11-24 13:45:10 +0900 | [diff] [blame] | 51 | from tempest_lib.services.compute.quotas_client import QuotasClient |
ghanshyam | a478b51 | 2015-11-24 13:52:31 +0900 | [diff] [blame] | 52 | from tempest_lib.services.compute.security_group_default_rules_client import \ |
| 53 | SecurityGroupDefaultRulesClient |
Ghanshyam | 3d06752 | 2015-12-21 12:13:49 +0900 | [diff] [blame] | 54 | from tempest_lib.services.compute.security_group_rules_client import \ |
John Warren | 5cdbf42 | 2016-01-05 12:42:43 -0500 | [diff] [blame] | 55 | SecurityGroupRulesClient as ComputeSecurityGroupRulesClient |
ghanshyam | 94ef649 | 2015-11-25 16:43:26 +0900 | [diff] [blame] | 56 | from tempest_lib.services.compute.security_groups_client import \ |
John Warren | f234551 | 2015-12-10 13:39:30 -0500 | [diff] [blame] | 57 | SecurityGroupsClient as ComputeSecurityGroupsClient |
Ghanshyam | 47d5f40 | 2015-12-21 12:59:04 +0900 | [diff] [blame] | 58 | from tempest_lib.services.compute.server_groups_client import \ |
| 59 | ServerGroupsClient |
Ghanshyam | 4cc30d9 | 2015-12-21 14:17:59 +0900 | [diff] [blame] | 60 | from tempest_lib.services.compute.servers_client import ServersClient |
ghanshyam | ef23f22 | 2015-11-25 16:50:09 +0900 | [diff] [blame] | 61 | from tempest_lib.services.compute.services_client import ServicesClient |
ghanshyam | ef4ca25 | 2015-11-25 16:55:55 +0900 | [diff] [blame] | 62 | from tempest_lib.services.compute.snapshots_client import \ |
| 63 | SnapshotsClient as ComputeSnapshotsClient |
ghanshyam | 06acc8e | 2015-11-25 17:06:52 +0900 | [diff] [blame] | 64 | from tempest_lib.services.compute.tenant_networks_client import \ |
| 65 | TenantNetworksClient |
ghanshyam | a1f7170 | 2015-11-25 17:11:59 +0900 | [diff] [blame] | 66 | from tempest_lib.services.compute.tenant_usages_client import \ |
| 67 | TenantUsagesClient |
ghanshyam | 3075346 | 2015-11-25 17:58:07 +0900 | [diff] [blame] | 68 | from tempest_lib.services.compute.versions_client import VersionsClient |
ghanshyam | 692d7c9 | 2015-11-25 21:16:52 +0900 | [diff] [blame] | 69 | from tempest_lib.services.compute.volumes_client import \ |
| 70 | VolumesClient as ComputeVolumesClient |
Ken'ichi Ohmichi | 5f80ce3 | 2015-09-10 23:51:14 +0000 | [diff] [blame] | 71 | from tempest_lib.services.identity.v2.token_client import TokenClient |
| 72 | from tempest_lib.services.identity.v3.token_client import V3TokenClient |
Ken'ichi Ohmichi | ea3c221 | 2016-01-04 04:35:49 +0000 | [diff] [blame] | 73 | from tempest_lib.services.network.floating_ips_client import FloatingIPsClient |
Doug Hellmann | 583ce2c | 2015-03-11 14:55:46 +0000 | [diff] [blame] | 74 | |
Ken'ichi Ohmichi | 4266268 | 2015-01-05 05:00:04 +0000 | [diff] [blame] | 75 | from tempest.common import negative_rest_client |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 76 | from tempest import config |
Andrea Frittoli (andreaf) | 03e546f | 2015-05-13 12:44:47 +0100 | [diff] [blame] | 77 | from tempest import exceptions |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 78 | from tempest import manager |
Ken'ichi Ohmichi | 884d106 | 2015-01-23 03:24:41 +0000 | [diff] [blame] | 79 | from tempest.services.baremetal.v1.json.baremetal_client import \ |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 80 | BaremetalClient |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 81 | from tempest.services.compute.json.keypairs_client import KeyPairsClient |
Ken'ichi Ohmichi | dc5fe44 | 2015-02-13 04:00:47 +0000 | [diff] [blame] | 82 | from tempest.services.data_processing.v1_1.data_processing_client import \ |
| 83 | DataProcessingClient |
Nikhil Manchanda | dd6886f | 2014-03-03 01:58:45 -0800 | [diff] [blame] | 84 | from tempest.services.database.json.flavors_client import \ |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 85 | DatabaseFlavorsClient |
ravikumar-venkatesan | 9e81b44 | 2014-12-08 09:57:56 +0000 | [diff] [blame] | 86 | from tempest.services.database.json.limits_client import \ |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 87 | DatabaseLimitsClient |
Peter Stachowski | 320f9c7 | 2014-04-21 16:13:23 -0400 | [diff] [blame] | 88 | from tempest.services.database.json.versions_client import \ |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 89 | DatabaseVersionsClient |
Jamie Lennox | c429e6a | 2015-02-24 10:42:42 +1100 | [diff] [blame] | 90 | from tempest.services.identity.v2.json.identity_client import \ |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 91 | IdentityClient |
Daniel Mellado | 6b16b92 | 2015-12-07 12:43:08 +0000 | [diff] [blame] | 92 | from tempest.services.identity.v2.json.roles_client import \ |
| 93 | RolesClient |
Daniel Mellado | b04da90 | 2015-11-20 17:43:12 +0100 | [diff] [blame] | 94 | from tempest.services.identity.v2.json.tenants_client import \ |
| 95 | TenantsClient |
Daniel Mellado | 82c83a5 | 2015-12-09 15:16:49 +0000 | [diff] [blame] | 96 | from tempest.services.identity.v2.json.users_client import \ |
| 97 | UsersClient |
nayna-patel | 914b471 | 2013-07-16 08:29:05 +0000 | [diff] [blame] | 98 | from tempest.services.identity.v3.json.credentials_client import \ |
Yaroslav Lobankov | 425ea1e | 2015-11-20 12:28:39 +0300 | [diff] [blame] | 99 | CredentialsClient as CredentialsV3Client |
Sean Dague | 2416cf3 | 2013-04-10 08:29:07 -0400 | [diff] [blame] | 100 | from tempest.services.identity.v3.json.endpoints_client import \ |
Yaroslav Lobankov | 425ea1e | 2015-11-20 12:28:39 +0300 | [diff] [blame] | 101 | EndPointClient as EndPointV3Client |
| 102 | from tempest.services.identity.v3.json.groups_client import \ |
| 103 | GroupsClient as GroupsV3Client |
| 104 | from tempest.services.identity.v3.json.identity_client import IdentityV3Client |
Yaroslav Lobankov | ed4d15c | 2015-12-18 11:30:10 +0300 | [diff] [blame] | 105 | from tempest.services.identity.v3.json.policies_client import \ |
| 106 | PoliciesClient as PoliciesV3Client |
Yaroslav Lobankov | 757d1a2 | 2015-12-18 11:43:02 +0300 | [diff] [blame] | 107 | from tempest.services.identity.v3.json.regions_client import \ |
| 108 | RegionsClient as RegionsV3Client |
Yaroslav Lobankov | 69d9056 | 2015-12-18 12:06:40 +0300 | [diff] [blame] | 109 | from tempest.services.identity.v3.json.services_client import \ |
| 110 | ServicesClient as IdentityServicesV3Client |
Ken'ichi Ohmichi | 69dcf44 | 2015-11-30 11:48:01 +0000 | [diff] [blame] | 111 | from tempest.services.image.v1.json.images_client import ImagesClient |
| 112 | from tempest.services.image.v2.json.images_client import ImagesClientV2 |
Victoria MartÃnez de la Cruz | 1173b6e | 2014-09-22 18:32:13 -0300 | [diff] [blame] | 113 | from tempest.services.messaging.json.messaging_client import \ |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 114 | MessagingClient |
Ken'ichi Ohmichi | 7186006 | 2015-12-15 08:20:13 +0000 | [diff] [blame] | 115 | from tempest.services.network.json.agents_client import AgentsClient \ |
| 116 | as NetworkAgentsClient |
John Warren | dd20b3e | 2015-12-03 13:11:28 -0500 | [diff] [blame] | 117 | from tempest.services.network.json.metering_label_rules_client import \ |
| 118 | MeteringLabelRulesClient |
John Warren | 6d0083a | 2015-11-30 18:12:30 -0500 | [diff] [blame] | 119 | from tempest.services.network.json.metering_labels_client import \ |
| 120 | MeteringLabelsClient |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 121 | from tempest.services.network.json.network_client import NetworkClient |
John Warren | 94d8faf | 2015-09-15 12:22:24 -0400 | [diff] [blame] | 122 | from tempest.services.network.json.networks_client import NetworksClient |
John Warren | 49c0fe5 | 2015-10-22 12:35:54 -0400 | [diff] [blame] | 123 | from tempest.services.network.json.ports_client import PortsClient |
Ken'ichi Ohmichi | 756d8ff | 2015-12-15 09:47:54 +0000 | [diff] [blame] | 124 | from tempest.services.network.json.quotas_client import QuotasClient \ |
| 125 | as NetworkQuotasClient |
John Warren | 456d9ae | 2016-01-12 15:36:33 -0500 | [diff] [blame^] | 126 | from tempest.services.network.json.security_group_rules_client import \ |
| 127 | SecurityGroupRulesClient |
John Warren | f9606e9 | 2015-12-10 12:12:42 -0500 | [diff] [blame] | 128 | from tempest.services.network.json.security_groups_client import \ |
| 129 | SecurityGroupsClient |
Ken'ichi Ohmichi | f3f8aba | 2015-12-15 08:11:00 +0000 | [diff] [blame] | 130 | from tempest.services.network.json.subnetpools_client import SubnetpoolsClient |
John Warren | 3961acd | 2015-10-02 14:38:53 -0400 | [diff] [blame] | 131 | from tempest.services.network.json.subnets_client import SubnetsClient |
dwalleck | 5d73443 | 2012-10-04 01:11:47 -0500 | [diff] [blame] | 132 | from tempest.services.object_storage.account_client import AccountClient |
Attila Fazekas | 6968dd5 | 2013-02-15 17:05:53 +0100 | [diff] [blame] | 133 | from tempest.services.object_storage.container_client import ContainerClient |
| 134 | from tempest.services.object_storage.object_client import ObjectClient |
Steve Baker | c60e4e3 | 2013-05-06 15:22:41 +1200 | [diff] [blame] | 135 | from tempest.services.orchestration.json.orchestration_client import \ |
| 136 | OrchestrationClient |
liu-sheng | 67b730e | 2015-07-16 15:19:33 +0800 | [diff] [blame] | 137 | from tempest.services.telemetry.json.alarming_client import AlarmingClient |
Nikolay Pliashechnikov | b053aab | 2013-11-05 06:06:44 -0800 | [diff] [blame] | 138 | from tempest.services.telemetry.json.telemetry_client import \ |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 139 | TelemetryClient |
Yaroslav Lobankov | aef0298 | 2015-12-02 17:42:32 +0300 | [diff] [blame] | 140 | from tempest.services.volume.v1.json.admin.hosts_client import \ |
Yaroslav Lobankov | 4c23779 | 2015-12-02 18:43:48 +0300 | [diff] [blame] | 141 | HostsClient as VolumeHostsClient |
Yaroslav Lobankov | aef0298 | 2015-12-02 17:42:32 +0300 | [diff] [blame] | 142 | from tempest.services.volume.v1.json.admin.quotas_client import \ |
Yaroslav Lobankov | 4c23779 | 2015-12-02 18:43:48 +0300 | [diff] [blame] | 143 | QuotasClient as VolumeQuotasClient |
Yaroslav Lobankov | aef0298 | 2015-12-02 17:42:32 +0300 | [diff] [blame] | 144 | from tempest.services.volume.v1.json.admin.services_client import \ |
Yaroslav Lobankov | 4c23779 | 2015-12-02 18:43:48 +0300 | [diff] [blame] | 145 | ServicesClient as VolumeServicesClient |
Yaroslav Lobankov | aef0298 | 2015-12-02 17:42:32 +0300 | [diff] [blame] | 146 | from tempest.services.volume.v1.json.admin.types_client import \ |
Yaroslav Lobankov | 4c23779 | 2015-12-02 18:43:48 +0300 | [diff] [blame] | 147 | TypesClient as VolumeTypesClient |
Yaroslav Lobankov | db4a2e1 | 2015-11-28 20:04:54 +0300 | [diff] [blame] | 148 | from tempest.services.volume.v1.json.availability_zone_client import \ |
Yaroslav Lobankov | 4c23779 | 2015-12-02 18:43:48 +0300 | [diff] [blame] | 149 | AvailabilityZoneClient as VolumeAvailabilityZoneClient |
Yaroslav Lobankov | db4a2e1 | 2015-11-28 20:04:54 +0300 | [diff] [blame] | 150 | from tempest.services.volume.v1.json.backups_client import BackupsClient |
| 151 | from tempest.services.volume.v1.json.extensions_client import \ |
Yaroslav Lobankov | 4c23779 | 2015-12-02 18:43:48 +0300 | [diff] [blame] | 152 | ExtensionsClient as VolumeExtensionsClient |
Yaroslav Lobankov | db4a2e1 | 2015-11-28 20:04:54 +0300 | [diff] [blame] | 153 | from tempest.services.volume.v1.json.qos_client import QosSpecsClient |
| 154 | from tempest.services.volume.v1.json.snapshots_client import SnapshotsClient |
| 155 | from tempest.services.volume.v1.json.volumes_client import VolumesClient |
Yaroslav Lobankov | aef0298 | 2015-12-02 17:42:32 +0300 | [diff] [blame] | 156 | from tempest.services.volume.v2.json.admin.hosts_client import \ |
Yaroslav Lobankov | 4c23779 | 2015-12-02 18:43:48 +0300 | [diff] [blame] | 157 | HostsClient as VolumeHostsV2Client |
Yaroslav Lobankov | aef0298 | 2015-12-02 17:42:32 +0300 | [diff] [blame] | 158 | from tempest.services.volume.v2.json.admin.quotas_client import \ |
Yaroslav Lobankov | 4c23779 | 2015-12-02 18:43:48 +0300 | [diff] [blame] | 159 | QuotasClient as VolumeQuotasV2Client |
Yaroslav Lobankov | aef0298 | 2015-12-02 17:42:32 +0300 | [diff] [blame] | 160 | from tempest.services.volume.v2.json.admin.services_client import \ |
Yaroslav Lobankov | 4c23779 | 2015-12-02 18:43:48 +0300 | [diff] [blame] | 161 | ServicesClient as VolumeServicesV2Client |
Yaroslav Lobankov | aef0298 | 2015-12-02 17:42:32 +0300 | [diff] [blame] | 162 | from tempest.services.volume.v2.json.admin.types_client import \ |
Yaroslav Lobankov | 4c23779 | 2015-12-02 18:43:48 +0300 | [diff] [blame] | 163 | TypesClient as VolumeTypesV2Client |
Zhi Kun Liu | 5339552 | 2014-07-18 16:05:52 +0800 | [diff] [blame] | 164 | from tempest.services.volume.v2.json.availability_zone_client import \ |
Yaroslav Lobankov | 4c23779 | 2015-12-02 18:43:48 +0300 | [diff] [blame] | 165 | AvailabilityZoneClient as VolumeAvailabilityZoneV2Client |
| 166 | from tempest.services.volume.v2.json.backups_client import \ |
| 167 | BackupsClient as BackupsV2Client |
Zhi Kun Liu | 5339552 | 2014-07-18 16:05:52 +0800 | [diff] [blame] | 168 | from tempest.services.volume.v2.json.extensions_client import \ |
Yaroslav Lobankov | 4c23779 | 2015-12-02 18:43:48 +0300 | [diff] [blame] | 169 | ExtensionsClient as VolumeExtensionsV2Client |
| 170 | from tempest.services.volume.v2.json.qos_client import \ |
| 171 | QosSpecsClient as QosSpecsV2Client |
Zhi Kun Liu | 38641c6 | 2014-07-10 20:12:48 +0800 | [diff] [blame] | 172 | from tempest.services.volume.v2.json.snapshots_client import \ |
Yaroslav Lobankov | 4c23779 | 2015-12-02 18:43:48 +0300 | [diff] [blame] | 173 | SnapshotsClient as SnapshotsV2Client |
| 174 | from tempest.services.volume.v2.json.volumes_client import \ |
| 175 | VolumesClient as VolumesV2Client |
Vincent Hou | 6b8a7b7 | 2012-08-25 01:24:33 +0800 | [diff] [blame] | 176 | |
Sean Dague | 86bd842 | 2013-12-20 09:56:44 -0500 | [diff] [blame] | 177 | CONF = config.CONF |
Jay Pipes | 3f981df | 2012-03-27 18:59:44 -0400 | [diff] [blame] | 178 | LOG = logging.getLogger(__name__) |
| 179 | |
Vincent Hou | 6b8a7b7 | 2012-08-25 01:24:33 +0800 | [diff] [blame] | 180 | |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 181 | class Manager(manager.Manager): |
Ken'ichi Ohmichi | 2e2ee19 | 2015-11-19 09:48:27 +0000 | [diff] [blame] | 182 | """Top level manager for OpenStack tempest clients""" |
Jay Pipes | 3f981df | 2012-03-27 18:59:44 -0400 | [diff] [blame] | 183 | |
Ken'ichi Ohmichi | c2b11ce | 2015-01-16 07:17:29 +0000 | [diff] [blame] | 184 | default_params = { |
| 185 | 'disable_ssl_certificate_validation': |
| 186 | CONF.identity.disable_ssl_certificate_validation, |
| 187 | 'ca_certs': CONF.identity.ca_certificates_file, |
| 188 | 'trace_requests': CONF.debug.trace_requests |
| 189 | } |
| 190 | |
Ken'ichi Ohmichi | 737a603 | 2015-01-21 07:04:42 +0000 | [diff] [blame] | 191 | # NOTE: Tempest uses timeout values of compute API if project specific |
| 192 | # timeout values don't exist. |
| 193 | default_params_with_timeout_values = { |
| 194 | 'build_interval': CONF.compute.build_interval, |
| 195 | 'build_timeout': CONF.compute.build_timeout |
| 196 | } |
| 197 | default_params_with_timeout_values.update(default_params) |
| 198 | |
ghanshyam | 4e2be34 | 2015-11-27 18:07:46 +0900 | [diff] [blame] | 199 | def __init__(self, credentials, service=None, api_microversions=None): |
| 200 | """Initialization of Manager class. |
Brant Knudson | c7ca334 | 2013-03-28 21:08:50 -0500 | [diff] [blame] | 201 | |
ghanshyam | 4e2be34 | 2015-11-27 18:07:46 +0900 | [diff] [blame] | 202 | Setup all services clients and make them available for tests cases. |
| 203 | :param credentials: type Credentials or TestResources |
| 204 | :param service: Service name |
| 205 | :param api_microversions: This is dict of services catalog type |
| 206 | and their microversion which will be set on respective |
| 207 | services clients. |
| 208 | {<service catalog type>: request_microversion} |
| 209 | Example : |
| 210 | {'compute': request_microversion} |
| 211 | - request_microversion will be set on all compute |
| 212 | service clients. |
| 213 | OR |
| 214 | {'compute': request_microversion, |
| 215 | 'volume': request_microversion} |
| 216 | - request_microversion of compute will be set on all |
| 217 | compute service clients. |
| 218 | - request_microversion of volume will be set on all |
| 219 | volume service clients. |
| 220 | """ |
| 221 | super(Manager, self).__init__(credentials=credentials) |
| 222 | self.api_microversions = api_microversions or {} |
Ken'ichi Ohmichi | 80ec0b9 | 2015-01-16 06:43:10 +0000 | [diff] [blame] | 223 | self._set_compute_clients() |
ravikumar-venkatesan | 9e81b44 | 2014-12-08 09:57:56 +0000 | [diff] [blame] | 224 | self._set_database_clients() |
Ken'ichi Ohmichi | 80ec0b9 | 2015-01-16 06:43:10 +0000 | [diff] [blame] | 225 | self._set_identity_clients() |
| 226 | self._set_volume_clients() |
Ken'ichi Ohmichi | c95eb85 | 2015-01-22 01:57:57 +0000 | [diff] [blame] | 227 | self._set_object_storage_clients() |
Ken'ichi Ohmichi | cd4a51e | 2014-11-13 07:25:33 +0000 | [diff] [blame] | 228 | |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 229 | self.baremetal_client = BaremetalClient( |
Ken'ichi Ohmichi | 1f88ece | 2015-01-23 03:33:11 +0000 | [diff] [blame] | 230 | self.auth_provider, |
| 231 | CONF.baremetal.catalog_type, |
| 232 | CONF.identity.region, |
| 233 | endpoint_type=CONF.baremetal.endpoint_type, |
| 234 | **self.default_params_with_timeout_values) |
Ken'ichi Ohmichi | 7186006 | 2015-12-15 08:20:13 +0000 | [diff] [blame] | 235 | self.network_agents_client = NetworkAgentsClient( |
| 236 | self.auth_provider, |
| 237 | CONF.network.catalog_type, |
| 238 | CONF.network.region or CONF.identity.region, |
| 239 | endpoint_type=CONF.network.endpoint_type, |
| 240 | build_interval=CONF.network.build_interval, |
| 241 | build_timeout=CONF.network.build_timeout, |
| 242 | **self.default_params) |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 243 | self.network_client = NetworkClient( |
Ken'ichi Ohmichi | a182e86 | 2015-01-21 01:16:37 +0000 | [diff] [blame] | 244 | self.auth_provider, |
| 245 | CONF.network.catalog_type, |
| 246 | CONF.network.region or CONF.identity.region, |
| 247 | endpoint_type=CONF.network.endpoint_type, |
| 248 | build_interval=CONF.network.build_interval, |
| 249 | build_timeout=CONF.network.build_timeout, |
| 250 | **self.default_params) |
John Warren | 94d8faf | 2015-09-15 12:22:24 -0400 | [diff] [blame] | 251 | self.networks_client = NetworksClient( |
| 252 | self.auth_provider, |
| 253 | CONF.network.catalog_type, |
| 254 | CONF.network.region or CONF.identity.region, |
| 255 | endpoint_type=CONF.network.endpoint_type, |
| 256 | build_interval=CONF.network.build_interval, |
| 257 | build_timeout=CONF.network.build_timeout, |
| 258 | **self.default_params) |
Ken'ichi Ohmichi | f3f8aba | 2015-12-15 08:11:00 +0000 | [diff] [blame] | 259 | self.subnetpools_client = SubnetpoolsClient( |
| 260 | self.auth_provider, |
| 261 | CONF.network.catalog_type, |
| 262 | CONF.network.region or CONF.identity.region, |
| 263 | endpoint_type=CONF.network.endpoint_type, |
| 264 | build_interval=CONF.network.build_interval, |
| 265 | build_timeout=CONF.network.build_timeout, |
| 266 | **self.default_params) |
John Warren | 3961acd | 2015-10-02 14:38:53 -0400 | [diff] [blame] | 267 | self.subnets_client = SubnetsClient( |
| 268 | self.auth_provider, |
| 269 | CONF.network.catalog_type, |
| 270 | CONF.network.region or CONF.identity.region, |
| 271 | endpoint_type=CONF.network.endpoint_type, |
| 272 | build_interval=CONF.network.build_interval, |
| 273 | build_timeout=CONF.network.build_timeout, |
| 274 | **self.default_params) |
John Warren | 49c0fe5 | 2015-10-22 12:35:54 -0400 | [diff] [blame] | 275 | self.ports_client = PortsClient( |
| 276 | self.auth_provider, |
| 277 | CONF.network.catalog_type, |
| 278 | CONF.network.region or CONF.identity.region, |
| 279 | endpoint_type=CONF.network.endpoint_type, |
| 280 | build_interval=CONF.network.build_interval, |
| 281 | build_timeout=CONF.network.build_timeout, |
| 282 | **self.default_params) |
Ken'ichi Ohmichi | 756d8ff | 2015-12-15 09:47:54 +0000 | [diff] [blame] | 283 | self.network_quotas_client = NetworkQuotasClient( |
| 284 | self.auth_provider, |
| 285 | CONF.network.catalog_type, |
| 286 | CONF.network.region or CONF.identity.region, |
| 287 | endpoint_type=CONF.network.endpoint_type, |
| 288 | build_interval=CONF.network.build_interval, |
| 289 | build_timeout=CONF.network.build_timeout, |
| 290 | **self.default_params) |
John Warren | fbf2a89 | 2015-11-17 12:36:14 -0500 | [diff] [blame] | 291 | self.floating_ips_client = FloatingIPsClient( |
| 292 | self.auth_provider, |
| 293 | CONF.network.catalog_type, |
| 294 | CONF.network.region or CONF.identity.region, |
| 295 | endpoint_type=CONF.network.endpoint_type, |
| 296 | build_interval=CONF.network.build_interval, |
| 297 | build_timeout=CONF.network.build_timeout, |
| 298 | **self.default_params) |
John Warren | 6d0083a | 2015-11-30 18:12:30 -0500 | [diff] [blame] | 299 | self.metering_labels_client = MeteringLabelsClient( |
| 300 | self.auth_provider, |
| 301 | CONF.network.catalog_type, |
| 302 | CONF.network.region or CONF.identity.region, |
| 303 | endpoint_type=CONF.network.endpoint_type, |
| 304 | build_interval=CONF.network.build_interval, |
| 305 | build_timeout=CONF.network.build_timeout, |
| 306 | **self.default_params) |
John Warren | dd20b3e | 2015-12-03 13:11:28 -0500 | [diff] [blame] | 307 | self.metering_label_rules_client = MeteringLabelRulesClient( |
| 308 | self.auth_provider, |
| 309 | CONF.network.catalog_type, |
| 310 | CONF.network.region or CONF.identity.region, |
| 311 | endpoint_type=CONF.network.endpoint_type, |
| 312 | build_interval=CONF.network.build_interval, |
| 313 | build_timeout=CONF.network.build_timeout, |
| 314 | **self.default_params) |
John Warren | 456d9ae | 2016-01-12 15:36:33 -0500 | [diff] [blame^] | 315 | self.security_group_rules_client = SecurityGroupRulesClient( |
| 316 | self.auth_provider, |
| 317 | CONF.network.catalog_type, |
| 318 | CONF.network.region or CONF.identity.region, |
| 319 | endpoint_type=CONF.network.endpoint_type, |
| 320 | build_interval=CONF.network.build_interval, |
| 321 | build_timeout=CONF.network.build_timeout, |
| 322 | **self.default_params) |
John Warren | f9606e9 | 2015-12-10 12:12:42 -0500 | [diff] [blame] | 323 | self.security_groups_client = SecurityGroupsClient( |
| 324 | self.auth_provider, |
| 325 | CONF.network.catalog_type, |
| 326 | CONF.network.region or CONF.identity.region, |
| 327 | endpoint_type=CONF.network.endpoint_type, |
| 328 | build_interval=CONF.network.build_interval, |
| 329 | build_timeout=CONF.network.build_timeout, |
| 330 | **self.default_params) |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 331 | self.messaging_client = MessagingClient( |
Ken'ichi Ohmichi | 2183a65 | 2015-01-22 05:00:20 +0000 | [diff] [blame] | 332 | self.auth_provider, |
| 333 | CONF.messaging.catalog_type, |
| 334 | CONF.identity.region, |
| 335 | **self.default_params_with_timeout_values) |
Sean Dague | f3c7591 | 2014-11-24 11:45:11 -0500 | [diff] [blame] | 336 | if CONF.service_available.ceilometer: |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 337 | self.telemetry_client = TelemetryClient( |
Ken'ichi Ohmichi | d5dba1c | 2015-01-23 02:23:22 +0000 | [diff] [blame] | 338 | self.auth_provider, |
| 339 | CONF.telemetry.catalog_type, |
| 340 | CONF.identity.region, |
| 341 | endpoint_type=CONF.telemetry.endpoint_type, |
| 342 | **self.default_params_with_timeout_values) |
liu-sheng | 67b730e | 2015-07-16 15:19:33 +0800 | [diff] [blame] | 343 | if CONF.service_available.aodh: |
| 344 | self.alarming_client = AlarmingClient( |
| 345 | self.auth_provider, |
| 346 | CONF.alarming.catalog_type, |
| 347 | CONF.identity.region, |
| 348 | endpoint_type=CONF.alarming.endpoint_type, |
| 349 | **self.default_params_with_timeout_values) |
Sean Dague | 86bd842 | 2013-12-20 09:56:44 -0500 | [diff] [blame] | 350 | if CONF.service_available.glance: |
Ken'ichi Ohmichi | 69dcf44 | 2015-11-30 11:48:01 +0000 | [diff] [blame] | 351 | self.image_client = ImagesClient( |
Masayuki Igawa | bc7e189 | 2015-03-03 11:46:48 +0900 | [diff] [blame] | 352 | self.auth_provider, |
| 353 | CONF.image.catalog_type, |
| 354 | CONF.image.region or CONF.identity.region, |
| 355 | endpoint_type=CONF.image.endpoint_type, |
| 356 | build_interval=CONF.image.build_interval, |
| 357 | build_timeout=CONF.image.build_timeout, |
| 358 | **self.default_params) |
Ken'ichi Ohmichi | 69dcf44 | 2015-11-30 11:48:01 +0000 | [diff] [blame] | 359 | self.image_client_v2 = ImagesClientV2( |
Masayuki Igawa | bc7e189 | 2015-03-03 11:46:48 +0900 | [diff] [blame] | 360 | self.auth_provider, |
| 361 | CONF.image.catalog_type, |
| 362 | CONF.image.region or CONF.identity.region, |
| 363 | endpoint_type=CONF.image.endpoint_type, |
| 364 | build_interval=CONF.image.build_interval, |
| 365 | build_timeout=CONF.image.build_timeout, |
| 366 | **self.default_params) |
Andrea Frittoli | 8bbdb16 | 2014-01-06 11:06:13 +0000 | [diff] [blame] | 367 | self.orchestration_client = OrchestrationClient( |
Ken'ichi Ohmichi | c2b11ce | 2015-01-16 07:17:29 +0000 | [diff] [blame] | 368 | self.auth_provider, |
| 369 | CONF.orchestration.catalog_type, |
| 370 | CONF.orchestration.region or CONF.identity.region, |
| 371 | endpoint_type=CONF.orchestration.endpoint_type, |
| 372 | build_interval=CONF.orchestration.build_interval, |
| 373 | build_timeout=CONF.orchestration.build_timeout, |
| 374 | **self.default_params) |
Ken'ichi Ohmichi | 4e83b5e | 2015-02-13 04:07:34 +0000 | [diff] [blame] | 375 | self.data_processing_client = DataProcessingClient( |
| 376 | self.auth_provider, |
| 377 | CONF.data_processing.catalog_type, |
| 378 | CONF.identity.region, |
| 379 | endpoint_type=CONF.data_processing.endpoint_type, |
| 380 | **self.default_params_with_timeout_values) |
Ken'ichi Ohmichi | b38eb00 | 2015-01-23 02:35:01 +0000 | [diff] [blame] | 381 | self.negative_client = negative_rest_client.NegativeRestClient( |
David Kranz | 1e33e37 | 2015-03-20 09:42:56 -0400 | [diff] [blame] | 382 | self.auth_provider, service, **self.default_params) |
Ken'ichi Ohmichi | c2b11ce | 2015-01-16 07:17:29 +0000 | [diff] [blame] | 383 | |
ghanshyam | 4e2be34 | 2015-11-27 18:07:46 +0900 | [diff] [blame] | 384 | self._set_api_microversions() |
| 385 | |
Ken'ichi Ohmichi | 80ec0b9 | 2015-01-16 06:43:10 +0000 | [diff] [blame] | 386 | def _set_compute_clients(self): |
Ken'ichi Ohmichi | 4771cbc | 2015-01-19 23:45:23 +0000 | [diff] [blame] | 387 | params = { |
| 388 | 'service': CONF.compute.catalog_type, |
| 389 | 'region': CONF.compute.region or CONF.identity.region, |
| 390 | 'endpoint_type': CONF.compute.endpoint_type, |
| 391 | 'build_interval': CONF.compute.build_interval, |
| 392 | 'build_timeout': CONF.compute.build_timeout |
| 393 | } |
| 394 | params.update(self.default_params) |
| 395 | |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 396 | self.agents_client = AgentsClient(self.auth_provider, **params) |
John Warren | 9487a18 | 2015-09-14 18:12:56 -0400 | [diff] [blame] | 397 | self.compute_networks_client = ComputeNetworksClient( |
| 398 | self.auth_provider, **params) |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 399 | self.migrations_client = MigrationsClient(self.auth_provider, |
| 400 | **params) |
Ken'ichi Ohmichi | 65225ef | 2014-11-19 01:06:25 +0000 | [diff] [blame] | 401 | self.security_group_default_rules_client = ( |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 402 | SecurityGroupDefaultRulesClient(self.auth_provider, **params)) |
| 403 | self.certificates_client = CertificatesClient(self.auth_provider, |
| 404 | **params) |
| 405 | self.servers_client = ServersClient( |
Masayuki Igawa | 8f9c0c8 | 2015-03-03 09:38:08 +0900 | [diff] [blame] | 406 | self.auth_provider, |
| 407 | enable_instance_password=CONF.compute_feature_enabled |
| 408 | .enable_instance_password, |
| 409 | **params) |
Ken'ichi Ohmichi | 7ca54b8 | 2015-07-07 01:10:26 +0000 | [diff] [blame] | 410 | self.server_groups_client = ServerGroupsClient( |
| 411 | self.auth_provider, **params) |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 412 | self.limits_client = LimitsClient(self.auth_provider, **params) |
Ghanshyam | ae76c12 | 2015-12-22 13:41:35 +0900 | [diff] [blame] | 413 | self.compute_images_client = ComputeImagesClient(self.auth_provider, |
| 414 | **params) |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 415 | self.keypairs_client = KeyPairsClient(self.auth_provider, **params) |
| 416 | self.quotas_client = QuotasClient(self.auth_provider, **params) |
| 417 | self.quota_classes_client = QuotaClassesClient(self.auth_provider, |
| 418 | **params) |
| 419 | self.flavors_client = FlavorsClient(self.auth_provider, **params) |
| 420 | self.extensions_client = ExtensionsClient(self.auth_provider, |
| 421 | **params) |
Ken'ichi Ohmichi | f576770 | 2015-07-29 23:39:10 +0000 | [diff] [blame] | 422 | self.floating_ip_pools_client = FloatingIPPoolsClient( |
Ken'ichi Ohmichi | 03af1c5 | 2015-07-13 00:28:05 +0000 | [diff] [blame] | 423 | self.auth_provider, **params) |
Ken'ichi Ohmichi | f576770 | 2015-07-29 23:39:10 +0000 | [diff] [blame] | 424 | self.floating_ips_bulk_client = FloatingIPsBulkClient( |
Ken'ichi Ohmichi | 2b26e75 | 2015-07-13 00:44:36 +0000 | [diff] [blame] | 425 | self.auth_provider, **params) |
John Warren | e74890a | 2015-11-11 15:18:01 -0500 | [diff] [blame] | 426 | self.compute_floating_ips_client = ComputeFloatingIPsClient( |
| 427 | self.auth_provider, **params) |
John Warren | 5cdbf42 | 2016-01-05 12:42:43 -0500 | [diff] [blame] | 428 | self.compute_security_group_rules_client = \ |
| 429 | ComputeSecurityGroupRulesClient(self.auth_provider, **params) |
John Warren | f234551 | 2015-12-10 13:39:30 -0500 | [diff] [blame] | 430 | self.compute_security_groups_client = ComputeSecurityGroupsClient( |
Ken'ichi Ohmichi | 4771cbc | 2015-01-19 23:45:23 +0000 | [diff] [blame] | 431 | self.auth_provider, **params) |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 432 | self.interfaces_client = InterfacesClient(self.auth_provider, |
| 433 | **params) |
| 434 | self.fixed_ips_client = FixedIPsClient(self.auth_provider, |
| 435 | **params) |
| 436 | self.availability_zone_client = AvailabilityZoneClient( |
Ken'ichi Ohmichi | 4771cbc | 2015-01-19 23:45:23 +0000 | [diff] [blame] | 437 | self.auth_provider, **params) |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 438 | self.aggregates_client = AggregatesClient(self.auth_provider, |
| 439 | **params) |
| 440 | self.services_client = ServicesClient(self.auth_provider, **params) |
| 441 | self.tenant_usages_client = TenantUsagesClient(self.auth_provider, |
| 442 | **params) |
| 443 | self.hosts_client = HostsClient(self.auth_provider, **params) |
| 444 | self.hypervisor_client = HypervisorClient(self.auth_provider, |
| 445 | **params) |
Ken'ichi Ohmichi | cd4a51e | 2014-11-13 07:25:33 +0000 | [diff] [blame] | 446 | self.instance_usages_audit_log_client = \ |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 447 | InstanceUsagesAuditLogClient(self.auth_provider, **params) |
Ken'ichi Ohmichi | c3dfdb2 | 2015-01-22 04:39:58 +0000 | [diff] [blame] | 448 | self.tenant_networks_client = \ |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 449 | TenantNetworksClient(self.auth_provider, **params) |
| 450 | self.baremetal_nodes_client = BaremetalNodesClient( |
YuikoTakada | ac0879a | 2015-01-22 02:40:03 +0000 | [diff] [blame] | 451 | self.auth_provider, **params) |
Ken'ichi Ohmichi | 4771cbc | 2015-01-19 23:45:23 +0000 | [diff] [blame] | 452 | |
| 453 | # NOTE: The following client needs special timeout values because |
| 454 | # the API is a proxy for the other component. |
| 455 | params_volume = copy.deepcopy(params) |
| 456 | params_volume.update({ |
| 457 | 'build_interval': CONF.volume.build_interval, |
| 458 | 'build_timeout': CONF.volume.build_timeout |
| 459 | }) |
Ken'ichi Ohmichi | ea3f26a | 2015-09-29 00:18:39 +0000 | [diff] [blame] | 460 | self.volumes_extensions_client = ComputeVolumesClient( |
Ken'ichi Ohmichi | c492178 | 2015-08-05 08:14:42 +0000 | [diff] [blame] | 461 | self.auth_provider, **params_volume) |
Ken'ichi Ohmichi | 2b6012b | 2015-09-03 01:56:19 +0000 | [diff] [blame] | 462 | self.compute_versions_client = VersionsClient(self.auth_provider, |
| 463 | **params_volume) |
Ken'ichi Ohmichi | b7e2730 | 2015-09-29 00:11:20 +0000 | [diff] [blame] | 464 | self.snapshots_extensions_client = ComputeSnapshotsClient( |
Gaozexu | b9c9d6e | 2015-09-10 17:08:04 +0800 | [diff] [blame] | 465 | self.auth_provider, **params_volume) |
Ken'ichi Ohmichi | cd4a51e | 2014-11-13 07:25:33 +0000 | [diff] [blame] | 466 | |
ravikumar-venkatesan | 9e81b44 | 2014-12-08 09:57:56 +0000 | [diff] [blame] | 467 | def _set_database_clients(self): |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 468 | self.database_flavors_client = DatabaseFlavorsClient( |
ravikumar-venkatesan | 9e81b44 | 2014-12-08 09:57:56 +0000 | [diff] [blame] | 469 | self.auth_provider, |
| 470 | CONF.database.catalog_type, |
| 471 | CONF.identity.region, |
| 472 | **self.default_params_with_timeout_values) |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 473 | self.database_limits_client = DatabaseLimitsClient( |
ravikumar-venkatesan | 9e81b44 | 2014-12-08 09:57:56 +0000 | [diff] [blame] | 474 | self.auth_provider, |
| 475 | CONF.database.catalog_type, |
| 476 | CONF.identity.region, |
| 477 | **self.default_params_with_timeout_values) |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 478 | self.database_versions_client = DatabaseVersionsClient( |
ravikumar-venkatesan | 9e81b44 | 2014-12-08 09:57:56 +0000 | [diff] [blame] | 479 | self.auth_provider, |
| 480 | CONF.database.catalog_type, |
| 481 | CONF.identity.region, |
| 482 | **self.default_params_with_timeout_values) |
| 483 | |
Ken'ichi Ohmichi | 80ec0b9 | 2015-01-16 06:43:10 +0000 | [diff] [blame] | 484 | def _set_identity_clients(self): |
ghanshyam | d26b5cd | 2015-02-09 14:48:58 +0900 | [diff] [blame] | 485 | params = { |
| 486 | 'service': CONF.identity.catalog_type, |
Jane Zadorozhna | c786213 | 2015-07-10 14:34:50 +0300 | [diff] [blame] | 487 | 'region': CONF.identity.region |
ghanshyam | d26b5cd | 2015-02-09 14:48:58 +0900 | [diff] [blame] | 488 | } |
| 489 | params.update(self.default_params_with_timeout_values) |
Jane Zadorozhna | c786213 | 2015-07-10 14:34:50 +0300 | [diff] [blame] | 490 | params_v2_admin = params.copy() |
| 491 | params_v2_admin['endpoint_type'] = CONF.identity.v2_admin_endpoint_type |
| 492 | # Client uses admin endpoint type of Keystone API v2 |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 493 | self.identity_client = IdentityClient(self.auth_provider, |
Jane Zadorozhna | c786213 | 2015-07-10 14:34:50 +0300 | [diff] [blame] | 494 | **params_v2_admin) |
Daniel Mellado | b04da90 | 2015-11-20 17:43:12 +0100 | [diff] [blame] | 495 | self.tenants_client = TenantsClient(self.auth_provider, |
| 496 | **params_v2_admin) |
Daniel Mellado | 6b16b92 | 2015-12-07 12:43:08 +0000 | [diff] [blame] | 497 | self.roles_client = RolesClient(self.auth_provider, |
| 498 | **params_v2_admin) |
Daniel Mellado | 82c83a5 | 2015-12-09 15:16:49 +0000 | [diff] [blame] | 499 | self.users_client = UsersClient(self.auth_provider, |
| 500 | **params_v2_admin) |
Jane Zadorozhna | c786213 | 2015-07-10 14:34:50 +0300 | [diff] [blame] | 501 | params_v2_public = params.copy() |
| 502 | params_v2_public['endpoint_type'] = ( |
| 503 | CONF.identity.v2_public_endpoint_type) |
| 504 | # Client uses public endpoint type of Keystone API v2 |
| 505 | self.identity_public_client = IdentityClient(self.auth_provider, |
| 506 | **params_v2_public) |
Daniel Mellado | b04da90 | 2015-11-20 17:43:12 +0100 | [diff] [blame] | 507 | self.tenants_public_client = TenantsClient(self.auth_provider, |
| 508 | **params_v2_public) |
Daniel Mellado | 6b16b92 | 2015-12-07 12:43:08 +0000 | [diff] [blame] | 509 | self.roles_public_client = RolesClient(self.auth_provider, |
| 510 | **params_v2_public) |
Daniel Mellado | 82c83a5 | 2015-12-09 15:16:49 +0000 | [diff] [blame] | 511 | self.users_public_client = UsersClient(self.auth_provider, |
| 512 | **params_v2_public) |
Jane Zadorozhna | c786213 | 2015-07-10 14:34:50 +0300 | [diff] [blame] | 513 | params_v3 = params.copy() |
| 514 | params_v3['endpoint_type'] = CONF.identity.v3_endpoint_type |
Yaroslav Lobankov | 425ea1e | 2015-11-20 12:28:39 +0300 | [diff] [blame] | 515 | # Clients below use the endpoint type of Keystone API v3 |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 516 | self.identity_v3_client = IdentityV3Client(self.auth_provider, |
Jane Zadorozhna | c786213 | 2015-07-10 14:34:50 +0300 | [diff] [blame] | 517 | **params_v3) |
Yaroslav Lobankov | 425ea1e | 2015-11-20 12:28:39 +0300 | [diff] [blame] | 518 | self.endpoints_client = EndPointV3Client(self.auth_provider, |
| 519 | **params_v3) |
Yaroslav Lobankov | 69d9056 | 2015-12-18 12:06:40 +0300 | [diff] [blame] | 520 | self.identity_services_client = IdentityServicesV3Client( |
| 521 | self.auth_provider, **params_v3) |
Yaroslav Lobankov | ed4d15c | 2015-12-18 11:30:10 +0300 | [diff] [blame] | 522 | self.policies_client = PoliciesV3Client(self.auth_provider, |
| 523 | **params_v3) |
Yaroslav Lobankov | 757d1a2 | 2015-12-18 11:43:02 +0300 | [diff] [blame] | 524 | self.regions_client = RegionsV3Client(self.auth_provider, **params_v3) |
Yaroslav Lobankov | 425ea1e | 2015-11-20 12:28:39 +0300 | [diff] [blame] | 525 | self.credentials_client = CredentialsV3Client(self.auth_provider, |
| 526 | **params_v3) |
| 527 | self.groups_client = GroupsV3Client(self.auth_provider, **params_v3) |
Andrea Frittoli | 9001235 | 2015-02-25 21:58:02 +0000 | [diff] [blame] | 528 | # 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] | 529 | # They read auth_url, so they should only be set if the corresponding |
| 530 | # API version is marked as enabled |
| 531 | if CONF.identity_feature_enabled.api_v2: |
| 532 | if CONF.identity.uri: |
Ken'ichi Ohmichi | 5f80ce3 | 2015-09-10 23:51:14 +0000 | [diff] [blame] | 533 | self.token_client = TokenClient( |
Andrea Frittoli (andreaf) | 03e546f | 2015-05-13 12:44:47 +0100 | [diff] [blame] | 534 | CONF.identity.uri, **self.default_params) |
| 535 | else: |
| 536 | msg = 'Identity v2 API enabled, but no identity.uri set' |
| 537 | raise exceptions.InvalidConfiguration(msg) |
Ken'ichi Ohmichi | 41951b0 | 2014-11-19 01:57:43 +0000 | [diff] [blame] | 538 | if CONF.identity_feature_enabled.api_v3: |
Andrea Frittoli (andreaf) | 03e546f | 2015-05-13 12:44:47 +0100 | [diff] [blame] | 539 | if CONF.identity.uri_v3: |
Ken'ichi Ohmichi | 5f80ce3 | 2015-09-10 23:51:14 +0000 | [diff] [blame] | 540 | self.token_v3_client = V3TokenClient( |
Andrea Frittoli (andreaf) | 03e546f | 2015-05-13 12:44:47 +0100 | [diff] [blame] | 541 | CONF.identity.uri_v3, **self.default_params) |
| 542 | else: |
| 543 | msg = 'Identity v3 API enabled, but no identity.uri_v3 set' |
| 544 | raise exceptions.InvalidConfiguration(msg) |
Ken'ichi Ohmichi | 41951b0 | 2014-11-19 01:57:43 +0000 | [diff] [blame] | 545 | |
Ken'ichi Ohmichi | 80ec0b9 | 2015-01-16 06:43:10 +0000 | [diff] [blame] | 546 | def _set_volume_clients(self): |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 547 | params = { |
| 548 | 'service': CONF.volume.catalog_type, |
| 549 | 'region': CONF.volume.region or CONF.identity.region, |
| 550 | 'endpoint_type': CONF.volume.endpoint_type, |
| 551 | 'build_interval': CONF.volume.build_interval, |
| 552 | 'build_timeout': CONF.volume.build_timeout |
| 553 | } |
| 554 | params.update(self.default_params) |
| 555 | |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 556 | self.volume_qos_client = QosSpecsClient(self.auth_provider, |
| 557 | **params) |
| 558 | self.volume_qos_v2_client = QosSpecsV2Client( |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 559 | self.auth_provider, **params) |
Yaroslav Lobankov | 4c23779 | 2015-12-02 18:43:48 +0300 | [diff] [blame] | 560 | self.volume_services_client = VolumeServicesClient( |
| 561 | self.auth_provider, **params) |
| 562 | self.volume_services_v2_client = VolumeServicesV2Client( |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 563 | self.auth_provider, **params) |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 564 | self.backups_client = BackupsClient(self.auth_provider, **params) |
Yaroslav Lobankov | 4c23779 | 2015-12-02 18:43:48 +0300 | [diff] [blame] | 565 | self.backups_v2_client = BackupsV2Client(self.auth_provider, |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 566 | **params) |
| 567 | self.snapshots_client = SnapshotsClient(self.auth_provider, |
| 568 | **params) |
| 569 | self.snapshots_v2_client = SnapshotsV2Client(self.auth_provider, |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 570 | **params) |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 571 | self.volumes_client = VolumesClient( |
Ken'ichi Ohmichi | 234da80 | 2015-02-13 04:48:06 +0000 | [diff] [blame] | 572 | self.auth_provider, default_volume_size=CONF.volume.volume_size, |
| 573 | **params) |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 574 | self.volumes_v2_client = VolumesV2Client( |
Ken'ichi Ohmichi | 234da80 | 2015-02-13 04:48:06 +0000 | [diff] [blame] | 575 | self.auth_provider, default_volume_size=CONF.volume.volume_size, |
| 576 | **params) |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 577 | self.volume_types_client = VolumeTypesClient(self.auth_provider, |
| 578 | **params) |
Yaroslav Lobankov | 4c23779 | 2015-12-02 18:43:48 +0300 | [diff] [blame] | 579 | self.volume_types_v2_client = VolumeTypesV2Client( |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 580 | self.auth_provider, **params) |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 581 | self.volume_hosts_client = VolumeHostsClient(self.auth_provider, |
| 582 | **params) |
| 583 | self.volume_hosts_v2_client = VolumeHostsV2Client( |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 584 | self.auth_provider, **params) |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 585 | self.volume_quotas_client = VolumeQuotasClient(self.auth_provider, |
| 586 | **params) |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 587 | self.volume_quotas_v2_client = VolumeQuotasV2Client(self.auth_provider, |
| 588 | **params) |
Yaroslav Lobankov | 4c23779 | 2015-12-02 18:43:48 +0300 | [diff] [blame] | 589 | self.volumes_extension_client = VolumeExtensionsClient( |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 590 | self.auth_provider, **params) |
Yaroslav Lobankov | 4c23779 | 2015-12-02 18:43:48 +0300 | [diff] [blame] | 591 | self.volumes_v2_extension_client = VolumeExtensionsV2Client( |
Ken'ichi Ohmichi | f85e9bd | 2015-01-27 12:51:47 +0000 | [diff] [blame] | 592 | self.auth_provider, **params) |
Ken'ichi Ohmichi | 532ae92 | 2014-11-19 01:37:15 +0000 | [diff] [blame] | 593 | self.volume_availability_zone_client = \ |
Ken'ichi Ohmichi | a628707 | 2015-07-02 02:43:15 +0000 | [diff] [blame] | 594 | VolumeAvailabilityZoneClient(self.auth_provider, **params) |
Ken'ichi Ohmichi | 532ae92 | 2014-11-19 01:37:15 +0000 | [diff] [blame] | 595 | self.volume_v2_availability_zone_client = \ |
Yaroslav Lobankov | 4c23779 | 2015-12-02 18:43:48 +0300 | [diff] [blame] | 596 | VolumeAvailabilityZoneV2Client(self.auth_provider, **params) |
Ken'ichi Ohmichi | 532ae92 | 2014-11-19 01:37:15 +0000 | [diff] [blame] | 597 | |
Ken'ichi Ohmichi | c95eb85 | 2015-01-22 01:57:57 +0000 | [diff] [blame] | 598 | def _set_object_storage_clients(self): |
Ken'ichi Ohmichi | 564b2ad | 2015-01-22 02:08:59 +0000 | [diff] [blame] | 599 | params = { |
| 600 | 'service': CONF.object_storage.catalog_type, |
| 601 | 'region': CONF.object_storage.region or CONF.identity.region, |
| 602 | 'endpoint_type': CONF.object_storage.endpoint_type |
| 603 | } |
| 604 | params.update(self.default_params_with_timeout_values) |
| 605 | |
| 606 | self.account_client = AccountClient(self.auth_provider, **params) |
| 607 | self.container_client = ContainerClient(self.auth_provider, **params) |
| 608 | self.object_client = ObjectClient(self.auth_provider, **params) |
ghanshyam | 4e2be34 | 2015-11-27 18:07:46 +0900 | [diff] [blame] | 609 | |
| 610 | def _set_api_microversions(self): |
| 611 | service_clients = [x for x in self.__dict__ if x.endswith('_client')] |
| 612 | for client in service_clients: |
| 613 | client_obj = getattr(self, client) |
| 614 | microversion = self.api_microversions.get(client_obj.service) |
| 615 | if microversion: |
| 616 | if hasattr(client_obj, 'set_api_microversion'): |
| 617 | client_obj.set_api_microversion(microversion) |
| 618 | else: |
| 619 | LOG.debug("Need to implement set_api_microversion on %s" |
| 620 | % client) |