Use Tempest-lib's compute limits_client
Compute limits_client has been migrated to
tempest-lib- I80c6e148ae30148e591d24675fe068c829a0867a
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 commits makes Tempest to use compute limits_client
from Tempest-lib.
Change-Id: I915deafd6e513f98e4d621d4e91409dd35d6e19e
diff --git a/tempest/api_schema/response/compute/v2_1/limits.py b/tempest/api_schema/response/compute/v2_1/limits.py
deleted file mode 100644
index 81f175f..0000000
--- a/tempest/api_schema/response/compute/v2_1/limits.py
+++ /dev/null
@@ -1,106 +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.
-
-get_limit = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'limits': {
- 'type': 'object',
- 'properties': {
- 'absolute': {
- 'type': 'object',
- 'properties': {
- 'maxTotalRAMSize': {'type': 'integer'},
- 'totalCoresUsed': {'type': 'integer'},
- 'maxTotalInstances': {'type': 'integer'},
- 'maxTotalFloatingIps': {'type': 'integer'},
- 'totalSecurityGroupsUsed': {'type': 'integer'},
- 'maxTotalCores': {'type': 'integer'},
- 'totalFloatingIpsUsed': {'type': 'integer'},
- 'maxSecurityGroups': {'type': 'integer'},
- 'maxServerMeta': {'type': 'integer'},
- 'maxPersonality': {'type': 'integer'},
- 'maxImageMeta': {'type': 'integer'},
- 'maxPersonalitySize': {'type': 'integer'},
- 'maxSecurityGroupRules': {'type': 'integer'},
- 'maxTotalKeypairs': {'type': 'integer'},
- 'totalRAMUsed': {'type': 'integer'},
- 'totalInstancesUsed': {'type': 'integer'},
- 'maxServerGroupMembers': {'type': 'integer'},
- 'maxServerGroups': {'type': 'integer'},
- 'totalServerGroupsUsed': {'type': 'integer'}
- },
- 'additionalProperties': False,
- # NOTE(gmann): maxServerGroupMembers, maxServerGroups
- # and totalServerGroupsUsed are API extension,
- # and some environments return a response without these
- # attributes.So they are not 'required'.
- 'required': ['maxImageMeta',
- 'maxPersonality',
- 'maxPersonalitySize',
- 'maxSecurityGroupRules',
- 'maxSecurityGroups',
- 'maxServerMeta',
- 'maxTotalCores',
- 'maxTotalFloatingIps',
- 'maxTotalInstances',
- 'maxTotalKeypairs',
- 'maxTotalRAMSize',
- 'totalCoresUsed',
- 'totalFloatingIpsUsed',
- 'totalInstancesUsed',
- 'totalRAMUsed',
- 'totalSecurityGroupsUsed']
- },
- 'rate': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'limit': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'next-available':
- {'type': 'string'},
- 'remaining':
- {'type': 'integer'},
- 'unit':
- {'type': 'string'},
- 'value':
- {'type': 'integer'},
- 'verb':
- {'type': 'string'}
- },
- 'additionalProperties': False,
- }
- },
- 'regex': {'type': 'string'},
- 'uri': {'type': 'string'}
- },
- 'additionalProperties': False,
- }
- }
- },
- 'additionalProperties': False,
- 'required': ['absolute', 'rate']
- }
- },
- 'additionalProperties': False,
- 'required': ['limits']
- }
-}
diff --git a/tempest/clients.py b/tempest/clients.py
index 991c033..fa5edbf 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -38,6 +38,7 @@
from tempest_lib.services.compute.images_client import ImagesClient
from tempest_lib.services.compute.instance_usage_audit_log_client import \
InstanceUsagesAuditLogClient
+from tempest_lib.services.compute.limits_client import LimitsClient
from tempest_lib.services.identity.v2.token_client import TokenClient
from tempest_lib.services.identity.v3.token_client import V3TokenClient
@@ -53,7 +54,6 @@
from tempest.services.compute.json.interfaces_client import \
InterfacesClient
from tempest.services.compute.json.keypairs_client import KeyPairsClient
-from tempest.services.compute.json.limits_client import LimitsClient
from tempest.services.compute.json.migrations_client import \
MigrationsClient
from tempest.services.compute.json.networks_client import NetworksClient \
diff --git a/tempest/services/compute/json/limits_client.py b/tempest/services/compute/json/limits_client.py
deleted file mode 100644
index b64b4a5..0000000
--- a/tempest/services/compute/json/limits_client.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright 2012 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 tempest.api_schema.response.compute.v2_1 import limits as schema
-from tempest.common import service_client
-
-
-class LimitsClient(service_client.ServiceClient):
-
- def show_limits(self):
- resp, body = self.get("limits")
- body = json.loads(body)
- self.validate_response(schema.get_limit, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/tests/services/compute/test_limits_client.py b/tempest/tests/services/compute/test_limits_client.py
deleted file mode 100644
index 733d3d1..0000000
--- a/tempest/tests/services/compute/test_limits_client.py
+++ /dev/null
@@ -1,67 +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.
-
-from tempest_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import limits_client
-from tempest.tests.services.compute import base
-
-
-class TestLimitsClient(base.BaseComputeServiceTest):
-
- def setUp(self):
- super(TestLimitsClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = limits_client.LimitsClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_show_limits(self, bytes_body=False):
- expected = {
- "limits": {
- "rate": [],
- "absolute": {
- "maxServerMeta": 128,
- "maxPersonality": 5,
- "totalServerGroupsUsed": 0,
- "maxImageMeta": 128,
- "maxPersonalitySize": 10240,
- "maxServerGroups": 10,
- "maxSecurityGroupRules": 20,
- "maxTotalKeypairs": 100,
- "totalCoresUsed": 0,
- "totalRAMUsed": 0,
- "totalInstancesUsed": 0,
- "maxSecurityGroups": 10,
- "totalFloatingIpsUsed": 0,
- "maxTotalCores": 20,
- "totalSecurityGroupsUsed": 0,
- "maxTotalFloatingIps": 10,
- "maxTotalInstances": 10,
- "maxTotalRAMSize": 51200,
- "maxServerGroupMembers": 10
- }
- }
- }
-
- self.check_service_client_function(
- self.client.show_limits,
- 'tempest.common.service_client.ServiceClient.get',
- expected,
- bytes_body)
-
- def test_show_limits_with_str_body(self):
- self._test_show_limits()
-
- def test_show_limits_with_bytes_body(self):
- self._test_show_limits(bytes_body=True)