blob: 3e53e3e7744ace6c72eb3c0ef7cd2d6fa001e05e [file] [log] [blame]
dwallecke62b9f02012-10-10 23:34:42 -05001# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
ZhiQiang Fan39f97222013-09-20 04:49:44 +08003# Copyright 2012 OpenStack Foundation
dwallecke62b9f02012-10-10 23:34:42 -05004# All Rights Reserved.
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17
18import json
19from tempest.common.rest_client import RestClient
20
21
22class LimitsClientJSON(RestClient):
23
24 def __init__(self, config, username, password, auth_url, tenant_name=None):
25 super(LimitsClientJSON, self).__init__(config, username, password,
26 auth_url, tenant_name)
27 self.service = self.config.compute.catalog_type
28
rajalakshmi-ganesana4ab0072012-08-07 19:48:56 +053029 def get_absolute_limits(self):
dwallecke62b9f02012-10-10 23:34:42 -050030 resp, body = self.get("limits")
31 body = json.loads(body)
rajalakshmi-ganesana4ab0072012-08-07 19:48:56 +053032 return resp, body['limits']['absolute']
dwallecke62b9f02012-10-10 23:34:42 -050033
rajalakshmi-ganesana4ab0072012-08-07 19:48:56 +053034 def get_specific_absolute_limit(self, absolute_limit):
35 resp, body = self.get("limits")
36 body = json.loads(body)
37 if absolute_limit not in body['limits']['absolute']:
38 return None
39 else:
40 return body['limits']['absolute'][absolute_limit]