Remove base_hosts_client for the reability
The service clients for the volume service are different from
the other services and it is a little difficult to read and
debug because that consists of multiple layers for v1 and v2.
That could be useful for the code optimization, but actually
the merit seems small and unreadable.
This patch removes these layers from the volume clients.
Partially implements blueprint consistent-service-method-names
Change-Id: I176ca1fefcb93b1cc071ab02a53f89571d129b3f
diff --git a/tempest/services/volume/base/admin/base_hosts_client.py b/tempest/services/volume/base/admin/base_hosts_client.py
deleted file mode 100644
index 382e9a8..0000000
--- a/tempest/services/volume/base/admin/base_hosts_client.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright 2013 OpenStack Foundation
-# 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 oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
-
-from tempest.lib.common import rest_client
-
-
-class BaseHostsClient(rest_client.RestClient):
- """Client class to send CRUD Volume Hosts API requests"""
-
- def list_hosts(self, **params):
- """Lists all hosts."""
-
- url = 'os-hosts'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
diff --git a/tempest/services/volume/v1/json/admin/hosts_client.py b/tempest/services/volume/v1/json/admin/hosts_client.py
index 3b52968..56ba12c 100644
--- a/tempest/services/volume/v1/json/admin/hosts_client.py
+++ b/tempest/services/volume/v1/json/admin/hosts_client.py
@@ -13,8 +13,23 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.services.volume.base.admin import base_hosts_client
+from oslo_serialization import jsonutils as json
+from six.moves.urllib import parse as urllib
+
+from tempest.lib.common import rest_client
-class HostsClient(base_hosts_client.BaseHostsClient):
+class HostsClient(rest_client.RestClient):
"""Client class to send CRUD Volume Host API V1 requests"""
+
+ def list_hosts(self, **params):
+ """Lists all hosts."""
+
+ url = 'os-hosts'
+ if params:
+ url += '?%s' % urllib.urlencode(params)
+
+ resp, body = self.get(url)
+ body = json.loads(body)
+ self.expected_success(200, resp.status)
+ return rest_client.ResponseBody(resp, body)
diff --git a/tempest/services/volume/v2/json/admin/hosts_client.py b/tempest/services/volume/v2/json/admin/hosts_client.py
index e092c6a..dd7c482 100644
--- a/tempest/services/volume/v2/json/admin/hosts_client.py
+++ b/tempest/services/volume/v2/json/admin/hosts_client.py
@@ -13,9 +13,24 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.services.volume.base.admin import base_hosts_client
+from oslo_serialization import jsonutils as json
+from six.moves.urllib import parse as urllib
+
+from tempest.lib.common import rest_client
-class HostsClient(base_hosts_client.BaseHostsClient):
+class HostsClient(rest_client.RestClient):
"""Client class to send CRUD Volume V2 API requests"""
api_version = "v2"
+
+ def list_hosts(self, **params):
+ """Lists all hosts."""
+
+ url = 'os-hosts'
+ if params:
+ url += '?%s' % urllib.urlencode(params)
+
+ resp, body = self.get(url)
+ body = json.loads(body)
+ self.expected_success(200, resp.status)
+ return rest_client.ResponseBody(resp, body)