Verify "get quotas detail" API response attributes
This patch adds checks whether a response of
Nova os-quota-sets get detail v3 API includes the attributes
to block the backward incompatibility change in the future.
The quotas response body of v3 API is the following:
{
"quota_set": {
"id": "30032cae7b864e5aad589c506fa83b70",
"instances": {
"reserved": 0,
"limit": 10,
"in_use": 0
},
"cores": {
"reserved": 0,
"limit": 20,
"in_use": 0
},
"ram": {
"reserved": 0,
"limit": 51200,
"in_use": 0
},
"floating_ips": {
"reserved": 0,
"limit": 10,
"in_use": 0
},
"fixed_ips": {
"reserved": 0,
"limit": -1,
"in_use": 0
},
"metadata_items": {
"reserved": 0,
"limit": 128,
"in_use": 0
},
"key_pairs": {
"reserved": 0,
"limit": 100,
"in_use": 0
},
"security_groups": {
"reserved": 0,
"limit": 10,
"in_use": 0
},
"security_group_rules": {
"reserved": 0,
"limit": 20,
"in_use": 0
}
}
}
Partially implements blueprint nova-api-attribute-test
Change-Id: I6600f834b031b6c832176f640b0b481d6af8a371
diff --git a/tempest/api_schema/compute/v3/quotas.py b/tempest/api_schema/compute/v3/quotas.py
index 1b9989d..5378c0f 100644
--- a/tempest/api_schema/compute/v3/quotas.py
+++ b/tempest/api_schema/compute/v3/quotas.py
@@ -40,3 +40,42 @@
'required': ['quota_set']
}
}
+
+quota_common_info = {
+ 'type': 'object',
+ 'properties': {
+ 'reserved': {'type': 'integer'},
+ 'limit': {'type': 'integer'},
+ 'in_use': {'type': 'integer'}
+ },
+ 'required': ['reserved', 'limit', 'in_use']
+}
+
+quota_set_detail = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'quota_set': {
+ 'type': 'object',
+ 'properties': {
+ 'id': {'type': 'string'},
+ 'instances': quota_common_info,
+ 'cores': quota_common_info,
+ 'ram': quota_common_info,
+ 'floating_ips': quota_common_info,
+ 'fixed_ips': quota_common_info,
+ 'metadata_items': quota_common_info,
+ 'key_pairs': quota_common_info,
+ 'security_groups': quota_common_info,
+ 'security_group_rules': quota_common_info
+ },
+ 'required': ['id', 'instances', 'cores', 'ram',
+ 'floating_ips', 'fixed_ips',
+ 'metadata_items', 'key_pairs',
+ 'security_groups', 'security_group_rules']
+ }
+ },
+ 'required': ['quota_set']
+ }
+}
diff --git a/tempest/services/compute/v3/json/quotas_client.py b/tempest/services/compute/v3/json/quotas_client.py
index a8507c4..870c22e 100644
--- a/tempest/services/compute/v3/json/quotas_client.py
+++ b/tempest/services/compute/v3/json/quotas_client.py
@@ -45,6 +45,7 @@
url = 'os-quota-sets/%s/detail' % str(tenant_id)
resp, body = self.get(url)
body = json.loads(body)
+ self.validate_response(schema.quota_set_detail, resp, body)
return resp, body['quota_set']
def get_default_quota_set(self, tenant_id):