Validate for list flavor attributes of V2/V3 APIs

This patch adds the JSON schema for Nova V2/V3 list flavor APIs
response and validate the response with added JSON schema to
block the backward incompatibility change in the future.

The response body of V2 & V3 list flavor APIs is same and given below:

{
    "flavors": [
        {
            "name": "m1.tiny",
            "links": [
                {
                    "href": "http://openstack.example.com/v2/flavors/1",
                    "rel": "self"
                },
                {
                    "href": "http://openstack.example.com/flavors/1",
                    "rel": "bookmark"
                }
            ],
            "id": "1"
         }
    ]
}

Partially implements blueprint nova-api-attribute-test

Change-Id: Ie0539e2b81e6a3446cbd705afe223c8a178bd13f
diff --git a/tempest/api_schema/compute/flavors.py b/tempest/api_schema/compute/flavors.py
new file mode 100644
index 0000000..a6367d4
--- /dev/null
+++ b/tempest/api_schema/compute/flavors.py
@@ -0,0 +1,37 @@
+# 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.
+
+from tempest.api_schema.compute import parameter_types
+
+list_flavors = {
+    'status_code': [200],
+    'response_body': {
+        'type': 'object',
+        'properties': {
+            'flavors': {
+                'type': 'array',
+                'items': {
+                    'type': 'object',
+                    'properties': {
+                        'name': {'type': 'string'},
+                        'links': parameter_types.links,
+                        'id': {'type': 'string'}
+                    },
+                    'required': ['name', 'links', 'id']
+                }
+            }
+        },
+        'required': ['flavors']
+    }
+}
diff --git a/tempest/services/compute/json/flavors_client.py b/tempest/services/compute/json/flavors_client.py
index bc64117..bc4a64f 100644
--- a/tempest/services/compute/json/flavors_client.py
+++ b/tempest/services/compute/json/flavors_client.py
@@ -16,6 +16,7 @@
 import json
 import urllib
 
+from tempest.api_schema.compute import flavors as common_schema
 from tempest.api_schema.compute import flavors_access as schema_access
 from tempest.common import rest_client
 from tempest import config
@@ -36,6 +37,7 @@
 
         resp, body = self.get(url)
         body = json.loads(body)
+        self.validate_response(common_schema.list_flavors, resp, body)
         return resp, body['flavors']
 
     def list_flavors_with_detail(self, params=None):
diff --git a/tempest/services/compute/v3/json/flavors_client.py b/tempest/services/compute/v3/json/flavors_client.py
index 655e279..3fdb3ca 100644
--- a/tempest/services/compute/v3/json/flavors_client.py
+++ b/tempest/services/compute/v3/json/flavors_client.py
@@ -16,6 +16,7 @@
 import json
 import urllib
 
+from tempest.api_schema.compute import flavors as common_schema
 from tempest.api_schema.compute import flavors_access as schema_access
 from tempest.common import rest_client
 from tempest import config
@@ -36,6 +37,7 @@
 
         resp, body = self.get(url)
         body = json.loads(body)
+        self.validate_response(common_schema.list_flavors, resp, body)
         return resp, body['flavors']
 
     def list_flavors_with_detail(self, params=None):