Validate get limits attributes of Nova V2 API

Now most attributes of Nova v2/v3 APIs are not checked in Tempest,
and this patch adds some tests which check these attributes to block
the backward incompatibility change in the future.

This patch adds the checks of "get limits" API responses.

The response body of v2 API is the following:
  {
    "limits": {
      "absolute": {
        "maxTotalRAMSize": 51200,
        "totalCoresUsed": 0,
        "maxTotalInstances": 10,
        "maxTotalFloatingIps": 10,
        "totalSecurityGroupsUsed": 0,
        "maxTotalCores": 20,
        "totalFloatingIpsUsed": 0,
        "maxSecurityGroups": 10,
        "maxServerMeta": 128,
        "maxPersonality": 5,
        "maxImageMeta": 128,
        "maxPersonalitySize": 10240,
        "maxSecurityGroupRules": 20,
        "maxTotalKeypairs": 100,
        "totalRAMUsed": 0,
        "totalInstancesUsed": 0
      },
      "rate": []
    }
  }

Partially implements blueprint nova-api-attribute-test

Change-Id: I503db2986ddcafb899f16d1547fd4857d355f2ed
diff --git a/tempest/api_schema/compute/v2/limits.py b/tempest/api_schema/compute/v2/limits.py
new file mode 100644
index 0000000..b9857f1
--- /dev/null
+++ b/tempest/api_schema/compute/v2/limits.py
@@ -0,0 +1,94 @@
+# 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'}
+                        },
+                        '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'}
+                                        }
+                                    }
+                                },
+                                'regex': {'type': 'string'},
+                                'uri': {'type': 'string'}
+                            }
+                        }
+                    }
+                },
+                'required': ['absolute', 'rate']
+            }
+        },
+        'required': ['limits']
+    }
+}
diff --git a/tempest/services/compute/json/limits_client.py b/tempest/services/compute/json/limits_client.py
index 1493718..e503bef 100644
--- a/tempest/services/compute/json/limits_client.py
+++ b/tempest/services/compute/json/limits_client.py
@@ -15,6 +15,7 @@
 
 import json
 
+from tempest.api_schema.compute.v2 import limits as schema
 from tempest.common import rest_client
 from tempest import config
 
@@ -30,11 +31,13 @@
     def get_absolute_limits(self):
         resp, body = self.get("limits")
         body = json.loads(body)
+        self.validate_response(schema.get_limit, resp, body)
         return resp, body['limits']['absolute']
 
     def get_specific_absolute_limit(self, absolute_limit):
         resp, body = self.get("limits")
         body = json.loads(body)
+        self.validate_response(schema.get_limit, resp, body)
         if absolute_limit not in body['limits']['absolute']:
             return None
         else: