Remove CONF values from volume clients
To move volume clients to tempest-lib, this patch moves
CONF values from volume clients to the client setting.
Change-Id: Iddd8306723c1ff33105f513c1993a0497a949c29
Depends-on: Ic86739dde83dcac8f68e53599967de53694f692f
diff --git a/tempest/clients.py b/tempest/clients.py
index 723e7b5..36d3e53 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -304,35 +304,53 @@
self.credentials_client = CredentialsClientJSON(self.auth_provider)
def _set_volume_clients(self):
- self.volume_qos_client = QosSpecsClientJSON(self.auth_provider)
+ params = {
+ 'service': CONF.volume.catalog_type,
+ 'region': CONF.volume.region or CONF.identity.region,
+ 'endpoint_type': CONF.volume.endpoint_type,
+ 'build_interval': CONF.volume.build_interval,
+ 'build_timeout': CONF.volume.build_timeout
+ }
+ params.update(self.default_params)
+
+ self.volume_qos_client = QosSpecsClientJSON(self.auth_provider,
+ **params)
self.volume_qos_v2_client = QosSpecsV2ClientJSON(
- self.auth_provider)
+ self.auth_provider, **params)
self.volume_services_v2_client = VolumesServicesV2ClientJSON(
- self.auth_provider)
- self.backups_client = BackupsClientJSON(self.auth_provider)
- self.backups_v2_client = BackupsClientV2JSON(self.auth_provider)
- self.snapshots_client = SnapshotsClientJSON(self.auth_provider)
- self.snapshots_v2_client = SnapshotsV2ClientJSON(self.auth_provider)
- self.volumes_client = VolumesClientJSON(self.auth_provider)
- self.volumes_v2_client = VolumesV2ClientJSON(self.auth_provider)
- self.volume_types_client = VolumeTypesClientJSON(self.auth_provider)
+ self.auth_provider, **params)
+ self.backups_client = BackupsClientJSON(self.auth_provider, **params)
+ self.backups_v2_client = BackupsClientV2JSON(self.auth_provider,
+ **params)
+ self.snapshots_client = SnapshotsClientJSON(self.auth_provider,
+ **params)
+ self.snapshots_v2_client = SnapshotsV2ClientJSON(self.auth_provider,
+ **params)
+ self.volumes_client = VolumesClientJSON(self.auth_provider, **params)
+ self.volumes_v2_client = VolumesV2ClientJSON(self.auth_provider,
+ **params)
+ self.volume_types_client = VolumeTypesClientJSON(self.auth_provider,
+ **params)
self.volume_services_client = VolumesServicesClientJSON(
- self.auth_provider)
- self.volume_hosts_client = VolumeHostsClientJSON(self.auth_provider)
+ self.auth_provider, **params)
+ self.volume_hosts_client = VolumeHostsClientJSON(self.auth_provider,
+ **params)
self.volume_hosts_v2_client = VolumeHostsV2ClientJSON(
- self.auth_provider)
- self.volume_quotas_client = VolumeQuotasClientJSON(self.auth_provider)
- self.volume_quotas_v2_client = VolumeQuotasV2Client(self.auth_provider)
+ self.auth_provider, **params)
+ self.volume_quotas_client = VolumeQuotasClientJSON(self.auth_provider,
+ **params)
+ self.volume_quotas_v2_client = VolumeQuotasV2Client(self.auth_provider,
+ **params)
self.volumes_extension_client = VolumeExtensionClientJSON(
- self.auth_provider)
+ self.auth_provider, **params)
self.volumes_v2_extension_client = VolumeV2ExtensionClientJSON(
- self.auth_provider)
+ self.auth_provider, **params)
self.volume_availability_zone_client = \
- VolumeAvailabilityZoneClientJSON(self.auth_provider)
+ VolumeAvailabilityZoneClientJSON(self.auth_provider, **params)
self.volume_v2_availability_zone_client = \
- VolumeV2AvailabilityZoneClientJSON(self.auth_provider)
+ VolumeV2AvailabilityZoneClientJSON(self.auth_provider, **params)
self.volume_types_v2_client = VolumeTypesV2ClientJSON(
- self.auth_provider)
+ self.auth_provider, **params)
def _set_object_storage_clients(self):
params = {
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index 9fb982c..48ea823 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -195,7 +195,14 @@
CONF.identity.region,
endpoint_type=CONF.telemetry.endpoint_type,
**default_params_with_timeout_values)
- self.volumes = volumes_client.VolumesClientJSON(_auth)
+ self.volumes = volumes_client.VolumesClientJSON(
+ _auth,
+ CONF.volume.catalog_type,
+ CONF.volume.region or CONF.identity.region,
+ endpoint_type=CONF.volume.endpoint_type,
+ build_interval=CONF.volume.build_interval,
+ build_timeout=CONF.volume.build_timeout,
+ **default_params)
self.networks = network_client.NetworkClientJSON(
_auth,
CONF.network.catalog_type,
diff --git a/tempest/services/volume/json/admin/volume_hosts_client.py b/tempest/services/volume/json/admin/volume_hosts_client.py
index cf566f2..1cd92b7 100644
--- a/tempest/services/volume/json/admin/volume_hosts_client.py
+++ b/tempest/services/volume/json/admin/volume_hosts_client.py
@@ -17,10 +17,9 @@
import urllib
from tempest.common import service_client
-from tempest.services.volume.json import base
-class BaseVolumeHostsClientJSON(base.VolumeClient):
+class BaseVolumeHostsClientJSON(service_client.ServiceClient):
"""
Client class to send CRUD Volume Hosts API requests to a Cinder endpoint
"""
diff --git a/tempest/services/volume/json/admin/volume_quotas_client.py b/tempest/services/volume/json/admin/volume_quotas_client.py
index 88df69f..19d320f 100644
--- a/tempest/services/volume/json/admin/volume_quotas_client.py
+++ b/tempest/services/volume/json/admin/volume_quotas_client.py
@@ -18,10 +18,9 @@
from tempest.common import service_client
from tempest.openstack.common import jsonutils
-from tempest.services.volume.json import base
-class BaseVolumeQuotasClientJSON(base.VolumeClient):
+class BaseVolumeQuotasClientJSON(service_client.ServiceClient):
"""
Client class to send CRUD Volume Quotas API requests to a Cinder endpoint
"""
diff --git a/tempest/services/volume/json/admin/volume_services_client.py b/tempest/services/volume/json/admin/volume_services_client.py
index d258f3d..1c4433f 100644
--- a/tempest/services/volume/json/admin/volume_services_client.py
+++ b/tempest/services/volume/json/admin/volume_services_client.py
@@ -17,10 +17,9 @@
import urllib
from tempest.common import service_client
-from tempest.services.volume.json import base
-class BaseVolumesServicesClientJSON(base.VolumeClient):
+class BaseVolumesServicesClientJSON(service_client.ServiceClient):
def list_services(self, params=None):
url = 'os-services'
diff --git a/tempest/services/volume/json/admin/volume_types_client.py b/tempest/services/volume/json/admin/volume_types_client.py
index b3b4ae6..f57d4d8 100644
--- a/tempest/services/volume/json/admin/volume_types_client.py
+++ b/tempest/services/volume/json/admin/volume_types_client.py
@@ -18,10 +18,9 @@
from tempest.common import service_client
from tempest import exceptions
-from tempest.services.volume.json import base
-class BaseVolumeTypesClientJSON(base.VolumeClient):
+class BaseVolumeTypesClientJSON(service_client.ServiceClient):
"""
Client class to send CRUD Volume Types API requests to a Cinder endpoint
"""
diff --git a/tempest/services/volume/json/availability_zone_client.py b/tempest/services/volume/json/availability_zone_client.py
index 8a0257e..bb5e39b 100644
--- a/tempest/services/volume/json/availability_zone_client.py
+++ b/tempest/services/volume/json/availability_zone_client.py
@@ -16,10 +16,9 @@
import json
from tempest.common import service_client
-from tempest.services.volume.json import base
-class BaseVolumeAvailabilityZoneClientJSON(base.VolumeClient):
+class BaseVolumeAvailabilityZoneClientJSON(service_client.ServiceClient):
def get_availability_zone_list(self):
resp, body = self.get('os-availability-zone')
diff --git a/tempest/services/volume/json/backups_client.py b/tempest/services/volume/json/backups_client.py
index 102e823..dad5aff 100644
--- a/tempest/services/volume/json/backups_client.py
+++ b/tempest/services/volume/json/backups_client.py
@@ -18,10 +18,9 @@
from tempest.common import service_client
from tempest import exceptions
-from tempest.services.volume.json import base
-class BaseBackupsClientJSON(base.VolumeClient):
+class BaseBackupsClientJSON(service_client.ServiceClient):
"""
Client class to send CRUD Volume backup API requests to a Cinder endpoint
"""
diff --git a/tempest/services/volume/json/base.py b/tempest/services/volume/json/base.py
deleted file mode 100644
index e6c72eb..0000000
--- a/tempest/services/volume/json/base.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright 2014 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from tempest.common import service_client
-from tempest import config
-
-CONF = config.CONF
-
-
-class VolumeClient(service_client.ServiceClient):
- """
- Base volume client class
- """
-
- def __init__(self, auth_provider):
- super(VolumeClient, self).__init__(
- auth_provider,
- CONF.volume.catalog_type,
- CONF.volume.region or CONF.identity.region,
- endpoint_type=CONF.volume.endpoint_type,
- build_interval=CONF.volume.build_interval,
- build_timeout=CONF.volume.build_timeout)
diff --git a/tempest/services/volume/json/extensions_client.py b/tempest/services/volume/json/extensions_client.py
index ae79dad..8a7bce7 100644
--- a/tempest/services/volume/json/extensions_client.py
+++ b/tempest/services/volume/json/extensions_client.py
@@ -16,10 +16,9 @@
import json
from tempest.common import service_client
-from tempest.services.volume.json import base
-class BaseExtensionsClientJSON(base.VolumeClient):
+class BaseExtensionsClientJSON(service_client.ServiceClient):
def list_extensions(self):
url = 'extensions'
diff --git a/tempest/services/volume/json/qos_client.py b/tempest/services/volume/json/qos_client.py
index 32555eb..63168cc 100644
--- a/tempest/services/volume/json/qos_client.py
+++ b/tempest/services/volume/json/qos_client.py
@@ -17,10 +17,9 @@
from tempest.common import service_client
from tempest import exceptions
-from tempest.services.volume.json import base
-class BaseQosSpecsClientJSON(base.VolumeClient):
+class BaseQosSpecsClientJSON(service_client.ServiceClient):
"""Client class to send CRUD QoS API requests"""
def is_resource_deleted(self, qos_id):
diff --git a/tempest/services/volume/json/snapshots_client.py b/tempest/services/volume/json/snapshots_client.py
index cd115df..100b34c 100644
--- a/tempest/services/volume/json/snapshots_client.py
+++ b/tempest/services/volume/json/snapshots_client.py
@@ -17,13 +17,12 @@
from tempest.common import service_client
from tempest import exceptions
from tempest.openstack.common import log as logging
-from tempest.services.volume.json import base
LOG = logging.getLogger(__name__)
-class BaseSnapshotsClientJSON(base.VolumeClient):
+class BaseSnapshotsClientJSON(service_client.ServiceClient):
"""Base Client class to send CRUD Volume API requests."""
create_resp = 200
diff --git a/tempest/services/volume/json/volumes_client.py b/tempest/services/volume/json/volumes_client.py
index c0f81fe..d834905 100644
--- a/tempest/services/volume/json/volumes_client.py
+++ b/tempest/services/volume/json/volumes_client.py
@@ -20,12 +20,11 @@
from tempest.common import service_client
from tempest import config
from tempest import exceptions
-from tempest.services.volume.json import base
CONF = config.CONF
-class BaseVolumesClientJSON(base.VolumeClient):
+class BaseVolumesClientJSON(service_client.ServiceClient):
"""
Base client class to send CRUD Volume API requests to a Cinder endpoint
"""
diff --git a/tempest/services/volume/v2/json/admin/volume_hosts_client.py b/tempest/services/volume/v2/json/admin/volume_hosts_client.py
index d631570..b93d031 100644
--- a/tempest/services/volume/v2/json/admin/volume_hosts_client.py
+++ b/tempest/services/volume/v2/json/admin/volume_hosts_client.py
@@ -21,8 +21,4 @@
"""
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
"""
-
- def __init__(self, auth_provider):
- super(VolumeHostsV2ClientJSON, self).__init__(auth_provider)
-
- self.api_version = "v2"
+ api_version = "v2"
diff --git a/tempest/services/volume/v2/json/admin/volume_quotas_client.py b/tempest/services/volume/v2/json/admin/volume_quotas_client.py
index 64f4f33..1dc48cd 100644
--- a/tempest/services/volume/v2/json/admin/volume_quotas_client.py
+++ b/tempest/services/volume/v2/json/admin/volume_quotas_client.py
@@ -20,8 +20,4 @@
"""
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
"""
-
- def __init__(self, auth_provider):
- super(VolumeQuotasV2Client, self).__init__(auth_provider)
-
- self.api_version = "v2"
+ api_version = "v2"
diff --git a/tempest/services/volume/v2/json/admin/volume_services_client.py b/tempest/services/volume/v2/json/admin/volume_services_client.py
index dc3c8ea..51224c5 100644
--- a/tempest/services/volume/v2/json/admin/volume_services_client.py
+++ b/tempest/services/volume/v2/json/admin/volume_services_client.py
@@ -20,7 +20,4 @@
"""
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
"""
-
- def __init__(self, auth_provider):
- super(VolumesServicesV2ClientJSON, self).__init__(auth_provider)
- self.api_version = "v2"
+ api_version = "v2"
diff --git a/tempest/services/volume/v2/json/admin/volume_types_client.py b/tempest/services/volume/v2/json/admin/volume_types_client.py
index 76fa45d..24099b2 100644
--- a/tempest/services/volume/v2/json/admin/volume_types_client.py
+++ b/tempest/services/volume/v2/json/admin/volume_types_client.py
@@ -21,8 +21,4 @@
"""
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
"""
-
- def __init__(self, auth_provider):
- super(VolumeTypesV2ClientJSON, self).__init__(auth_provider)
-
- self.api_version = "v2"
+ api_version = "v2"
diff --git a/tempest/services/volume/v2/json/availability_zone_client.py b/tempest/services/volume/v2/json/availability_zone_client.py
index 047ba1b..dc85634 100644
--- a/tempest/services/volume/v2/json/availability_zone_client.py
+++ b/tempest/services/volume/v2/json/availability_zone_client.py
@@ -18,9 +18,4 @@
class VolumeV2AvailabilityZoneClientJSON(
availability_zone_client.BaseVolumeAvailabilityZoneClientJSON):
-
- def __init__(self, auth_provider):
- super(VolumeV2AvailabilityZoneClientJSON, self).__init__(
- auth_provider)
-
- self.api_version = "v2"
+ api_version = "v2"
diff --git a/tempest/services/volume/v2/json/backups_client.py b/tempest/services/volume/v2/json/backups_client.py
index 9698075..30d9e8e 100644
--- a/tempest/services/volume/v2/json/backups_client.py
+++ b/tempest/services/volume/v2/json/backups_client.py
@@ -20,7 +20,4 @@
"""
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
"""
-
- def __init__(self, auth_provider):
- super(BackupsClientV2JSON, self).__init__(auth_provider)
- self.api_version = "v2"
+ api_version = "v2"
diff --git a/tempest/services/volume/v2/json/extensions_client.py b/tempest/services/volume/v2/json/extensions_client.py
index cc5244c..8dda833 100644
--- a/tempest/services/volume/v2/json/extensions_client.py
+++ b/tempest/services/volume/v2/json/extensions_client.py
@@ -17,8 +17,4 @@
class ExtensionsV2ClientJSON(extensions_client.BaseExtensionsClientJSON):
-
- def __init__(self, auth_provider):
- super(ExtensionsV2ClientJSON, self).__init__(auth_provider)
-
- self.api_version = "v2"
+ api_version = "v2"
diff --git a/tempest/services/volume/v2/json/qos_client.py b/tempest/services/volume/v2/json/qos_client.py
index a734df8..d17da6d 100644
--- a/tempest/services/volume/v2/json/qos_client.py
+++ b/tempest/services/volume/v2/json/qos_client.py
@@ -16,8 +16,4 @@
class QosSpecsV2ClientJSON(qos_client.BaseQosSpecsClientJSON):
-
- def __init__(self, auth_provider):
- super(QosSpecsV2ClientJSON, self).__init__(auth_provider)
-
- self.api_version = "v2"
+ api_version = "v2"
diff --git a/tempest/services/volume/v2/json/snapshots_client.py b/tempest/services/volume/v2/json/snapshots_client.py
index 553176b..90580f9 100644
--- a/tempest/services/volume/v2/json/snapshots_client.py
+++ b/tempest/services/volume/v2/json/snapshots_client.py
@@ -15,9 +15,5 @@
class SnapshotsV2ClientJSON(snapshots_client.BaseSnapshotsClientJSON):
"""Client class to send CRUD Volume V2 API requests."""
-
- def __init__(self, auth_provider):
- super(SnapshotsV2ClientJSON, self).__init__(auth_provider)
-
- self.api_version = "v2"
- self.create_resp = 202
+ api_version = "v2"
+ create_resp = 202
diff --git a/tempest/services/volume/v2/json/volumes_client.py b/tempest/services/volume/v2/json/volumes_client.py
index ac4342e..85ffb91 100644
--- a/tempest/services/volume/v2/json/volumes_client.py
+++ b/tempest/services/volume/v2/json/volumes_client.py
@@ -20,9 +20,5 @@
"""
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
"""
-
- def __init__(self, auth_provider):
- super(VolumesV2ClientJSON, self).__init__(auth_provider)
-
- self.api_version = "v2"
- self.create_resp = 202
+ api_version = "v2"
+ create_resp = 202
diff --git a/tempest/tests/common/test_service_clients.py b/tempest/tests/common/test_service_clients.py
index 8a2782d..2b31d6b 100644
--- a/tempest/tests/common/test_service_clients.py
+++ b/tempest/tests/common/test_service_clients.py
@@ -41,7 +41,8 @@
from tempest.services.compute.json import servers_client
from tempest.services.compute.json import services_client
from tempest.services.compute.json import tenant_usages_client
-from tempest.services.compute.json import volumes_extensions_client
+from tempest.services.compute.json import volumes_extensions_client \
+ as compute_volumes_extensions_client
from tempest.services.database.json import flavors_client as db_flavor_client
from tempest.services.database.json import versions_client as db_version_client
from tempest.services.messaging.json import messaging_client
@@ -51,6 +52,37 @@
from tempest.services.object_storage import object_client
from tempest.services.orchestration.json import orchestration_client
from tempest.services.telemetry.json import telemetry_client
+from tempest.services.volume.json.admin import volume_hosts_client
+from tempest.services.volume.json.admin import volume_quotas_client
+from tempest.services.volume.json.admin import volume_services_client
+from tempest.services.volume.json.admin import volume_types_client
+from tempest.services.volume.json import availability_zone_client \
+ as volume_az_client
+from tempest.services.volume.json import backups_client
+from tempest.services.volume.json import extensions_client \
+ as volume_extensions_client
+from tempest.services.volume.json import qos_client
+from tempest.services.volume.json import snapshots_client
+from tempest.services.volume.json import volumes_client
+from tempest.services.volume.v2.json.admin import volume_hosts_client \
+ as volume_v2_hosts_client
+from tempest.services.volume.v2.json.admin import volume_quotas_client \
+ as volume_v2_quotas_client
+from tempest.services.volume.v2.json.admin import volume_services_client \
+ as volume_v2_services_client
+from tempest.services.volume.v2.json.admin import volume_types_client \
+ as volume_v2_types_client
+from tempest.services.volume.v2.json import availability_zone_client \
+ as volume_v2_az_client
+from tempest.services.volume.v2.json import backups_client \
+ as volume_v2_backups_client
+from tempest.services.volume.v2.json import extensions_client \
+ as volume_v2_extensions_client
+from tempest.services.volume.v2.json import qos_client as volume_v2_qos_client
+from tempest.services.volume.v2.json import snapshots_client \
+ as volume_v2_snapshots_client
+from tempest.services.volume.v2.json import volumes_client as \
+ volume_v2_volumes_client
from tempest.tests import base
@@ -84,7 +116,7 @@
servers_client.ServersClientJSON,
services_client.ServicesClientJSON,
tenant_usages_client.TenantUsagesClientJSON,
- volumes_extensions_client.VolumesExtensionsClientJSON,
+ compute_volumes_extensions_client.VolumesExtensionsClientJSON,
db_flavor_client.DatabaseFlavorsClientJSON,
db_version_client.DatabaseVersionsClientJSON,
messaging_client.MessagingClientJSON,
@@ -93,7 +125,28 @@
container_client.ContainerClient,
object_client.ObjectClient,
orchestration_client.OrchestrationClient,
- telemetry_client.TelemetryClientJSON]
+ telemetry_client.TelemetryClientJSON,
+ qos_client.QosSpecsClientJSON,
+ volume_hosts_client.VolumeHostsClientJSON,
+ volume_quotas_client.VolumeQuotasClientJSON,
+ volume_services_client.VolumesServicesClientJSON,
+ volume_types_client.VolumeTypesClientJSON,
+ volume_az_client.VolumeAvailabilityZoneClientJSON,
+ backups_client.BackupsClientJSON,
+ volume_extensions_client.ExtensionsClientJSON,
+ snapshots_client.SnapshotsClientJSON,
+ volumes_client.VolumesClientJSON,
+ volume_v2_hosts_client.VolumeHostsV2ClientJSON,
+ volume_v2_quotas_client.VolumeQuotasV2Client,
+ volume_v2_services_client.VolumesServicesV2ClientJSON,
+ volume_v2_types_client.VolumeTypesV2ClientJSON,
+ volume_v2_az_client.VolumeV2AvailabilityZoneClientJSON,
+ volume_v2_backups_client.BackupsClientV2JSON,
+ volume_v2_extensions_client.ExtensionsV2ClientJSON,
+ volume_v2_qos_client.QosSpecsV2ClientJSON,
+ volume_v2_snapshots_client.SnapshotsV2ClientJSON,
+ volume_v2_volumes_client.VolumesV2ClientJSON,
+ ]
for client in test_clients:
fake_string = six.text_type(random.randint(1, 0x7fffffff))