Verify quotas attributes through Nova os-quota-sets API

This patch adds checks whether a response of Nova os-quota-sets
get/get defaultAPI
includes the attributes to block the backward incompatibility change
in the future.

The quotas response body of v2 API is the following:
{
    "quota_set": {
        "id": "231a1e7fd1b344f9874d0334d98b459c",
        "instances": 10,
        "cores": 20,
        "ram": 51200,
        "floating_ips": 10,
        "fixed_ips": -1,
        "metadata_items": 128,
        "injected_files": 5,
        "injected_file_content_bytes": 10240,
        "injected_file_path_bytes": 255,
        "key_pairs": 100,
        "security_groups": 10
        "security_group_rules": 20,
    }
}

The one of v3 API is the following:
{
    "quota_set": {
        "id": "231a1e7fd1b344f9874d0334d98b459c",
        "instances": 10,
        "cores": 20,
        "ram": 51200,
        "floating_ips": 10,
        "fixed_ips": -1,
        "metadata_items": 128,
        "key_pairs": 100,
        "security_groups": 10
        "security_group_rules": 20,
    }
}

Partially implements blueprint nova-api-attribute-test

Change-Id: I8a45ba601b92f17808227a4853a42e812a2a082e
diff --git a/tempest/api_schema/compute/v2/quotas.py b/tempest/api_schema/compute/v2/quotas.py
new file mode 100644
index 0000000..d69cbd7
--- /dev/null
+++ b/tempest/api_schema/compute/v2/quotas.py
@@ -0,0 +1,47 @@
+# 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.
+
+quota_set = {
+    'status_code': [200],
+    'response_body': {
+        'type': 'object',
+        'properties': {
+            'quota_set': {
+                'type': 'object',
+                'properties': {
+                    'id': {'type': 'string'},
+                    'instances': {'type': 'integer'},
+                    'cores': {'type': 'integer'},
+                    'ram': {'type': 'integer'},
+                    'floating_ips': {'type': 'integer'},
+                    'fixed_ips': {'type': 'integer'},
+                    'metadata_items': {'type': 'integer'},
+                    'injected_files': {'type': 'integer'},
+                    'injected_file_content_bytes': {'type': 'integer'},
+                    'injected_file_path_bytes': {'type': 'integer'},
+                    'key_pairs': {'type': 'integer'},
+                    'security_groups': {'type': 'integer'},
+                    'security_group_rules': {'type': 'integer'}
+                },
+                'required': ['id', 'instances', 'cores', 'ram',
+                             'floating_ips', 'fixed_ips',
+                             'metadata_items', 'injected_files',
+                             'injected_file_content_bytes',
+                             'injected_file_path_bytes', 'key_pairs',
+                             'security_groups', 'security_group_rules']
+            }
+        },
+        'required': ['quota_set']
+    }
+}
diff --git a/tempest/api_schema/compute/v3/__init__.py b/tempest/api_schema/compute/v3/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tempest/api_schema/compute/v3/__init__.py
diff --git a/tempest/api_schema/compute/v3/quotas.py b/tempest/api_schema/compute/v3/quotas.py
new file mode 100644
index 0000000..1b9989d
--- /dev/null
+++ b/tempest/api_schema/compute/v3/quotas.py
@@ -0,0 +1,42 @@
+# 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.
+
+quota_set = {
+    'status_code': [200],
+    'response_body': {
+        'type': 'object',
+        'properties': {
+            'quota_set': {
+                'type': 'object',
+                'properties': {
+                    'id': {'type': 'string'},
+                    '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'}
+                },
+                '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/json/quotas_client.py b/tempest/services/compute/json/quotas_client.py
index 2fae927..9346183 100644
--- a/tempest/services/compute/json/quotas_client.py
+++ b/tempest/services/compute/json/quotas_client.py
@@ -15,6 +15,7 @@
 
 import json
 
+from tempest.api_schema.compute.v2 import quotas as schema
 from tempest.common import rest_client
 from tempest import config
 
@@ -35,6 +36,7 @@
             url += '?user_id=%s' % str(user_id)
         resp, body = self.get(url)
         body = json.loads(body)
+        self.validate_response(schema.quota_set, resp, body)
         return resp, body['quota_set']
 
     def get_default_quota_set(self, tenant_id):
@@ -43,6 +45,7 @@
         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)
         return resp, body['quota_set']
 
     def update_quota_set(self, tenant_id, force=None,
diff --git a/tempest/services/compute/v3/json/quotas_client.py b/tempest/services/compute/v3/json/quotas_client.py
index ed92aae..a8507c4 100644
--- a/tempest/services/compute/v3/json/quotas_client.py
+++ b/tempest/services/compute/v3/json/quotas_client.py
@@ -15,6 +15,7 @@
 
 import json
 
+from tempest.api_schema.compute.v3 import quotas as schema
 from tempest.common import rest_client
 from tempest import config
 
@@ -35,6 +36,7 @@
             url += '?user_id=%s' % str(user_id)
         resp, body = self.get(url)
         body = json.loads(body)
+        self.validate_response(schema.quota_set, resp, body)
         return resp, body['quota_set']
 
     def get_quota_set_detail(self, tenant_id):
@@ -51,6 +53,7 @@
         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)
         return resp, body['quota_set']
 
     def update_quota_set(self, tenant_id, force=None,
@@ -97,6 +100,7 @@
         resp, body = self.put('os-quota-sets/%s' % str(tenant_id), post_body)
 
         body = json.loads(body)
+        self.validate_response(schema.quota_set, resp, body)
         return resp, body['quota_set']
 
     def delete_quota_set(self, tenant_id):