Add response schema validation for volume limits

This is to add response schema validation for volume limits.
Besides, totalSnapshotsUsed should be integer in the response
of "Show absolute limits for project", I48f61f50defe9782d5a7afb7d7fa245f562785a0
will fix the api doc.

Change-Id: I245dd944f29681f3f41febafa7901f8f233a2776
partially-implements: blueprint volume-response-schema-validation
diff --git a/tempest/lib/api_schema/response/volume/limits.py b/tempest/lib/api_schema/response/volume/limits.py
new file mode 100644
index 0000000..99af180
--- /dev/null
+++ b/tempest/lib/api_schema/response/volume/limits.py
@@ -0,0 +1,55 @@
+# Copyright 2018 ZTE 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.
+
+show_limits = {
+    'status_code': [200],
+    'response_body': {
+        'type': 'object',
+        'properties': {
+            'limits': {
+                'type': 'object',
+                'properties': {
+                    'rate': {'type': 'array'},
+                    'absolute': {
+                        'type': 'object',
+                        'properties': {
+                            'totalSnapshotsUsed': {'type': 'integer'},
+                            'maxTotalBackups': {'type': 'integer'},
+                            'maxTotalVolumeGigabytes': {'type': 'integer'},
+                            'maxTotalSnapshots': {'type': 'integer'},
+                            'maxTotalBackupGigabytes': {'type': 'integer'},
+                            'totalBackupGigabytesUsed': {'type': 'integer'},
+                            'maxTotalVolumes': {'type': 'integer'},
+                            'totalVolumesUsed': {'type': 'integer'},
+                            'totalBackupsUsed': {'type': 'integer'},
+                            'totalGigabytesUsed': {'type': 'integer'},
+                        },
+                        'additionalProperties': False,
+                        'required': ['totalSnapshotsUsed', 'maxTotalBackups',
+                                     'maxTotalVolumeGigabytes',
+                                     'maxTotalSnapshots',
+                                     'maxTotalBackupGigabytes',
+                                     'totalBackupGigabytesUsed',
+                                     'maxTotalVolumes', 'totalVolumesUsed',
+                                     'totalBackupsUsed', 'totalGigabytesUsed']
+                    }
+                },
+                'additionalProperties': False,
+                'required': ['rate', 'absolute'],
+            }
+        },
+        'additionalProperties': False,
+        'required': ['limits']
+    }
+}
diff --git a/tempest/lib/services/volume/v3/limits_client.py b/tempest/lib/services/volume/v3/limits_client.py
index 9500254..a8d1377 100644
--- a/tempest/lib/services/volume/v3/limits_client.py
+++ b/tempest/lib/services/volume/v3/limits_client.py
@@ -15,6 +15,7 @@
 
 from oslo_serialization import jsonutils as json
 
+from tempest.lib.api_schema.response.volume import limits as schema
 from tempest.lib.common import rest_client
 
 
@@ -26,5 +27,5 @@
         url = "limits"
         resp, body = self.get(url)
         body = json.loads(body)
-        self.expected_success(200, resp.status)
+        self.validate_response(schema.show_limits, resp, body)
         return rest_client.ResponseBody(resp, body)