diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-04-16 15:03:53 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-04-16 15:03:54 +0000 |
commit | 728e39e48e431297d12f02b0604a14b4c0cc7434 (patch) | |
tree | b8edf01aaee62561eda1107b5e353ccb82949046 | |
parent | 1f970f0716ad5aec0e32b3a2e5dd777cb7d69a31 (diff) | |
parent | 72d0927d47a9d89da7499a9cfbe9b89ec6cb5740 (diff) | |
download | tempest-728e39e48e431297d12f02b0604a14b4c0cc7434.tar.gz |
Merge "Arrange quotas response schema into one file"
-rw-r--r-- | tempest/api_schema/response/compute/quotas.py | 46 | ||||
-rw-r--r-- | tempest/api_schema/response/compute/v2_1/quota_classes.py | 16 | ||||
-rw-r--r-- | tempest/api_schema/response/compute/v2_1/quotas.py | 67 | ||||
-rw-r--r-- | tempest/services/compute/json/quotas_client.py | 11 |
4 files changed, 55 insertions, 85 deletions
diff --git a/tempest/api_schema/response/compute/quotas.py b/tempest/api_schema/response/compute/quotas.py deleted file mode 100644 index 863104c8f..000000000 --- a/tempest/api_schema/response/compute/quotas.py +++ /dev/null @@ -1,46 +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. - -common_quota_set = { - 'status_code': [200], - 'response_body': { - 'type': 'object', - 'properties': { - 'quota_set': { - 'type': 'object', - 'properties': { - 'instances': {'type': 'integer'}, - 'cores': {'type': 'integer'}, - 'ram': {'type': 'integer'}, - 'floating_ips': {'type': 'integer'}, - 'fixed_ips': {'type': 'integer'}, - 'metadata_items': {'type': 'integer'}, - 'key_pairs': {'type': 'integer'}, - 'security_groups': {'type': 'integer'}, - 'security_group_rules': {'type': 'integer'}, - 'server_group_members': {'type': 'integer'}, - 'server_groups': {'type': 'integer'}, - }, - # NOTE: server_group_members and server_groups are represented - # when enabling quota_server_group extension. So they should - # not be required. - 'required': ['instances', 'cores', 'ram', - 'floating_ips', 'fixed_ips', - 'metadata_items', 'key_pairs', - 'security_groups', 'security_group_rules'] - } - }, - 'required': ['quota_set'] - } -} diff --git a/tempest/api_schema/response/compute/v2_1/quota_classes.py b/tempest/api_schema/response/compute/v2_1/quota_classes.py index a7374df0b..a0cdaf563 100644 --- a/tempest/api_schema/response/compute/v2_1/quota_classes.py +++ b/tempest/api_schema/response/compute/v2_1/quota_classes.py @@ -20,12 +20,12 @@ 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. -quota_set = copy.deepcopy(quotas.quota_set) -quota_set['response_body']['properties']['quota_class_set'] = ( - quota_set['response_body']['properties'].pop('quota_set')) -quota_set['response_body']['required'] = ['quota_class_set'] +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'] -quota_set_update = copy.deepcopy(quotas.quota_set_update) -quota_set_update['response_body']['properties']['quota_class_set'] = ( - quota_set_update['response_body']['properties'].pop('quota_set')) -quota_set_update['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/api_schema/response/compute/v2_1/quotas.py b/tempest/api_schema/response/compute/v2_1/quotas.py index 630b227c7..9141f7e53 100644 --- a/tempest/api_schema/response/compute/v2_1/quotas.py +++ b/tempest/api_schema/response/compute/v2_1/quotas.py @@ -14,34 +14,49 @@ import copy -from tempest.api_schema.response.compute import quotas +update_quota_set = { + 'status_code': [200], + 'response_body': { + 'type': 'object', + 'properties': { + 'quota_set': { + 'type': 'object', + 'properties': { + 'instances': {'type': 'integer'}, + 'cores': {'type': 'integer'}, + 'ram': {'type': 'integer'}, + 'floating_ips': {'type': 'integer'}, + 'fixed_ips': {'type': 'integer'}, + 'metadata_items': {'type': 'integer'}, + 'key_pairs': {'type': 'integer'}, + 'security_groups': {'type': 'integer'}, + 'security_group_rules': {'type': 'integer'}, + 'server_group_members': {'type': 'integer'}, + 'server_groups': {'type': 'integer'}, + 'injected_files': {'type': 'integer'}, + 'injected_file_content_bytes': {'type': 'integer'}, + 'injected_file_path_bytes': {'type': 'integer'} + }, + # NOTE: server_group_members and server_groups are represented + # when enabling quota_server_group extension. So they should + # not be required. + 'required': ['instances', 'cores', 'ram', + 'floating_ips', 'fixed_ips', + 'metadata_items', 'key_pairs', + 'security_groups', 'security_group_rules', + 'injected_files', 'injected_file_content_bytes', + 'injected_file_path_bytes'] + } + }, + 'required': ['quota_set'] + } +} -quota_set = copy.deepcopy(quotas.common_quota_set) -quota_set['response_body']['properties']['quota_set']['properties'][ +get_quota_set = copy.deepcopy(update_quota_set) +get_quota_set['response_body']['properties']['quota_set']['properties'][ 'id'] = {'type': 'string'} -quota_set['response_body']['properties']['quota_set']['properties'][ - 'injected_files'] = {'type': 'integer'} -quota_set['response_body']['properties']['quota_set']['properties'][ - 'injected_file_content_bytes'] = {'type': 'integer'} -quota_set['response_body']['properties']['quota_set']['properties'][ - 'injected_file_path_bytes'] = {'type': 'integer'} -quota_set['response_body']['properties']['quota_set']['required'].extend([ - 'id', - 'injected_files', - 'injected_file_content_bytes', - 'injected_file_path_bytes']) - -quota_set_update = copy.deepcopy(quotas.common_quota_set) -quota_set_update['response_body']['properties']['quota_set']['properties'][ - 'injected_files'] = {'type': 'integer'} -quota_set_update['response_body']['properties']['quota_set']['properties'][ - 'injected_file_content_bytes'] = {'type': 'integer'} -quota_set_update['response_body']['properties']['quota_set']['properties'][ - 'injected_file_path_bytes'] = {'type': 'integer'} -quota_set_update['response_body']['properties']['quota_set'][ - 'required'].extend(['injected_files', - 'injected_file_content_bytes', - 'injected_file_path_bytes']) +get_quota_set['response_body']['properties']['quota_set']['required'].extend([ + 'id']) delete_quota = { 'status_code': [202] diff --git a/tempest/services/compute/json/quotas_client.py b/tempest/services/compute/json/quotas_client.py index 89f4acddf..6e38c47e1 100644 --- a/tempest/services/compute/json/quotas_client.py +++ b/tempest/services/compute/json/quotas_client.py @@ -31,7 +31,7 @@ class QuotasClientJSON(service_client.ServiceClient): url += '?user_id=%s' % str(user_id) resp, body = self.get(url) body = json.loads(body) - self.validate_response(schema.quota_set, resp, body) + self.validate_response(schema.get_quota_set, resp, body) return service_client.ResponseBody(resp, body['quota_set']) def get_default_quota_set(self, tenant_id): @@ -40,7 +40,7 @@ class QuotasClientJSON(service_client.ServiceClient): url = 'os-quota-sets/%s/defaults' % str(tenant_id) resp, body = self.get(url) body = json.loads(body) - self.validate_response(schema.quota_set, resp, body) + self.validate_response(schema.get_quota_set, resp, body) return service_client.ResponseBody(resp, body['quota_set']) def update_quota_set(self, tenant_id, user_id=None, @@ -105,7 +105,7 @@ class QuotasClientJSON(service_client.ServiceClient): post_body) body = json.loads(body) - self.validate_response(schema.quota_set_update, resp, body) + self.validate_response(schema.update_quota_set, resp, body) return service_client.ResponseBody(resp, body['quota_set']) def delete_quota_set(self, tenant_id): @@ -123,7 +123,7 @@ class QuotaClassesClientJSON(service_client.ServiceClient): url = 'os-quota-class-sets/%s' % str(quota_class_id) resp, body = self.get(url) body = json.loads(body) - self.validate_response(classes_schema.quota_set, resp, body) + self.validate_response(classes_schema.get_quota_class_set, resp, body) return service_client.ResponseBody(resp, body['quota_class_set']) def update_quota_class_set(self, quota_class_id, **kwargs): @@ -136,5 +136,6 @@ class QuotaClassesClientJSON(service_client.ServiceClient): post_body) body = json.loads(body) - self.validate_response(classes_schema.quota_set_update, resp, body) + self.validate_response(classes_schema.update_quota_class_set, + resp, body) return service_client.ResponseBody(resp, body['quota_class_set']) |