Use Tempest-lib's compute quota_classes_client
Compute quota_classes_client has been migrated to
tempest-lib- I48ce2ddf21218eb02f6ae47cb0356c340ced06ae
Now Tempest-lib provides this client as stable interface so Tempest
should start using this from lib and remove its own copy.
Also remove its unit tests.
This commit makes Tempest to use compute quota_classes_client
from Tempest-lib.
Change-Id: Ibb1d3cbd7d7ffe3a73899f24d315a64fb72e22fe
diff --git a/tempest/api_schema/response/compute/v2_1/quota_classes.py b/tempest/api_schema/response/compute/v2_1/quota_classes.py
deleted file mode 100644
index a0cdaf5..0000000
--- a/tempest/api_schema/response/compute/v2_1/quota_classes.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2014 IBM 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.
-
-import copy
-
-from tempest.api_schema.response.compute.v2_1 import quotas
-
-# NOTE(mriedem): os-quota-class-sets responses are the same as os-quota-sets
-# except for the key in the response body is quota_class_set instead of
-# quota_set, so update this copy of the schema from os-quota-sets.
-get_quota_class_set = copy.deepcopy(quotas.get_quota_set)
-get_quota_class_set['response_body']['properties']['quota_class_set'] = (
- get_quota_class_set['response_body']['properties'].pop('quota_set'))
-get_quota_class_set['response_body']['required'] = ['quota_class_set']
-
-update_quota_class_set = copy.deepcopy(quotas.update_quota_set)
-update_quota_class_set['response_body']['properties']['quota_class_set'] = (
- update_quota_class_set['response_body']['properties'].pop('quota_set'))
-update_quota_class_set['response_body']['required'] = ['quota_class_set']
diff --git a/tempest/clients.py b/tempest/clients.py
index 68915ac..f11267f 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -42,6 +42,8 @@
from tempest_lib.services.compute.migrations_client import MigrationsClient
from tempest_lib.services.compute.networks_client import NetworksClient \
as ComputeNetworksClient
+from tempest_lib.services.compute.quota_classes_client import \
+ QuotaClassesClient
from tempest_lib.services.identity.v2.token_client import TokenClient
from tempest_lib.services.identity.v3.token_client import V3TokenClient
@@ -57,8 +59,6 @@
from tempest.services.compute.json.interfaces_client import \
InterfacesClient
from tempest.services.compute.json.keypairs_client import KeyPairsClient
-from tempest.services.compute.json.quota_classes_client import \
- QuotaClassesClient
from tempest.services.compute.json.quotas_client import QuotasClient
from tempest.services.compute.json.security_group_default_rules_client import \
SecurityGroupDefaultRulesClient
diff --git a/tempest/services/compute/json/quota_classes_client.py b/tempest/services/compute/json/quota_classes_client.py
deleted file mode 100644
index 7aac5e4..0000000
--- a/tempest/services/compute/json/quota_classes_client.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright 2012 NTT Data
-# 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 tempest.api_schema.response.compute.v2_1\
- import quota_classes as classes_schema
-from tempest.common import service_client
-
-
-class QuotaClassesClient(service_client.ServiceClient):
-
- def show_quota_class_set(self, quota_class_id):
- """List the quota class set for a quota class."""
-
- url = 'os-quota-class-sets/%s' % quota_class_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(classes_schema.get_quota_class_set, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def update_quota_class_set(self, quota_class_id, **kwargs):
- """Updates the quota class's limits for one or more resources."""
- post_body = json.dumps({'quota_class_set': kwargs})
-
- resp, body = self.put('os-quota-class-sets/%s' % quota_class_id,
- post_body)
-
- body = json.loads(body)
- self.validate_response(classes_schema.update_quota_class_set,
- resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/tests/common/test_service_clients.py b/tempest/tests/common/test_service_clients.py
index 4225da8..26ede41 100644
--- a/tempest/tests/common/test_service_clients.py
+++ b/tempest/tests/common/test_service_clients.py
@@ -19,7 +19,6 @@
from tempest.services.baremetal.v1.json import baremetal_client
from tempest.services.compute.json import floating_ips_client
from tempest.services.compute.json import interfaces_client
-from tempest.services.compute.json import quota_classes_client
from tempest.services.compute.json import security_group_rules_client
from tempest.services.compute.json import server_groups_client
from tempest.services.compute.json import servers_client
@@ -89,7 +88,6 @@
baremetal_client.BaremetalClient,
floating_ips_client.FloatingIPsClient,
interfaces_client.InterfacesClient,
- quota_classes_client.QuotaClassesClient,
security_group_rules_client.SecurityGroupRulesClient,
server_groups_client.ServerGroupsClient,
servers_client.ServersClient,
diff --git a/tempest/tests/services/compute/test_quota_classes_client.py b/tempest/tests/services/compute/test_quota_classes_client.py
deleted file mode 100644
index 29800a2..0000000
--- a/tempest/tests/services/compute/test_quota_classes_client.py
+++ /dev/null
@@ -1,72 +0,0 @@
-# Copyright 2015 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.
-
-import copy
-
-from tempest_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import quota_classes_client
-from tempest.tests.services.compute import base
-
-
-class TestQuotaClassesClient(base.BaseComputeServiceTest):
-
- FAKE_QUOTA_CLASS_SET = {
- "injected_file_content_bytes": 10240,
- "metadata_items": 128,
- "server_group_members": 10,
- "server_groups": 10,
- "ram": 51200,
- "floating_ips": 10,
- "key_pairs": 100,
- "id": u'\u2740(*\xb4\u25e1`*)\u2740',
- "instances": 10,
- "security_group_rules": 20,
- "security_groups": 10,
- "injected_files": 5,
- "cores": 20,
- "fixed_ips": -1,
- "injected_file_path_bytes": 255,
- }
-
- def setUp(self):
- super(TestQuotaClassesClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = quota_classes_client.QuotaClassesClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_show_quota_class_set(self, bytes_body=False):
- fake_body = {'quota_class_set': self.FAKE_QUOTA_CLASS_SET}
- self.check_service_client_function(
- self.client.show_quota_class_set,
- 'tempest.common.service_client.ServiceClient.get',
- fake_body,
- bytes_body,
- quota_class_id="test")
-
- def test_show_quota_class_set_with_str_body(self):
- self._test_show_quota_class_set()
-
- def test_show_quota_class_set_with_bytes_body(self):
- self._test_show_quota_class_set(bytes_body=True)
-
- def test_update_quota_class_set(self):
- fake_quota_class_set = copy.deepcopy(self.FAKE_QUOTA_CLASS_SET)
- fake_quota_class_set.pop("id")
- fake_body = {'quota_class_set': fake_quota_class_set}
- self.check_service_client_function(
- self.client.update_quota_class_set,
- 'tempest.common.service_client.ServiceClient.put',
- fake_body,
- quota_class_id="test")