Merge "Verify the list volume attributes of Nova APIs"
diff --git a/tempest/api_schema/compute/v2/volumes.py b/tempest/api_schema/compute/v2/volumes.py
index 16ed7c2..9cfd7e3 100644
--- a/tempest/api_schema/compute/v2/volumes.py
+++ b/tempest/api_schema/compute/v2/volumes.py
@@ -20,10 +20,7 @@
             'volume': {
                 'type': 'object',
                 'properties': {
-                    # NOTE: Now the type of 'id' is integer, but here allows
-                    # 'string' also because we will be able to change it to
-                    # 'uuid' in the future.
-                    'id': {'type': ['integer', 'string']},
+                    'id': {'type': 'string'},
                     'status': {'type': 'string'},
                     'displayName': {'type': ['string', 'null']},
                     'availabilityZone': {'type': 'string'},
@@ -38,11 +35,17 @@
                         'items': {
                             'type': 'object',
                             'properties': {
-                                'id': {'type': ['integer', 'string']},
+                                'id': {'type': 'string'},
                                 'device': {'type': 'string'},
-                                'volumeId': {'type': ['integer', 'string']},
+                                'volumeId': {'type': 'string'},
                                 'serverId': {'type': ['integer', 'string']}
                             }
+                            # NOTE- If volume is not attached to any server
+                            # then, 'attachments' attributes comes as array
+                            # with empty objects "[{}]" due to that elements
+                            # of 'attachments' cannot defined as 'required'.
+                            # If it would come as empty array "[]" then,
+                            # those elements can be defined as 'required'.
                         }
                     }
                 },
@@ -54,3 +57,54 @@
         'required': ['volume']
     }
 }
+
+list_volumes = {
+    'status_code': [200],
+    'response_body': {
+        'type': 'object',
+        'properties': {
+            'volumes': {
+                'type': 'array',
+                'items': {
+                    'type': 'object',
+                    'properties': {
+                        'id': {'type': 'string'},
+                        'status': {'type': 'string'},
+                        'displayName': {'type': ['string', 'null']},
+                        'availabilityZone': {'type': 'string'},
+                        'createdAt': {'type': 'string'},
+                        'displayDescription': {'type': ['string', 'null']},
+                        'volumeType': {'type': 'string'},
+                        'snapshotId': {'type': ['string', 'null']},
+                        'metadata': {'type': 'object'},
+                        'size': {'type': 'integer'},
+                        'attachments': {
+                            'type': 'array',
+                            'items': {
+                                'type': 'object',
+                                'properties': {
+                                    'id': {'type': 'string'},
+                                    'device': {'type': 'string'},
+                                    'volumeId': {'type': 'string'},
+                                    'serverId': {'type': ['integer', 'string']}
+                                }
+                                # NOTE- If volume is not attached to any server
+                                # then, 'attachments' attributes comes as array
+                                # with empty object "[{}]" due to that elements
+                                # of 'attachments' cannot defined as 'required'
+                                # If it would come as empty array "[]" then,
+                                # those elements can be defined as 'required'.
+                            }
+                        }
+                    },
+                    'required': ['id', 'status', 'displayName',
+                                 'availabilityZone', 'createdAt',
+                                 'displayDescription', 'volumeType',
+                                 'snapshotId', 'metadata', 'size',
+                                 'attachments']
+                }
+            }
+        },
+        'required': ['volumes']
+    }
+}
diff --git a/tempest/services/compute/json/volumes_extensions_client.py b/tempest/services/compute/json/volumes_extensions_client.py
index 451dbac..17468eb 100644
--- a/tempest/services/compute/json/volumes_extensions_client.py
+++ b/tempest/services/compute/json/volumes_extensions_client.py
@@ -42,6 +42,7 @@
 
         resp, body = self.get(url)
         body = json.loads(body)
+        self.validate_response(schema.list_volumes, resp, body)
         return resp, body['volumes']
 
     def list_volumes_with_detail(self, params=None):
@@ -52,6 +53,7 @@
 
         resp, body = self.get(url)
         body = json.loads(body)
+        self.validate_response(schema.list_volumes, resp, body)
         return resp, body['volumes']
 
     def get_volume(self, volume_id):