Merge "Define 'links' as a common parameter type"
diff --git a/tempest/api_schema/compute/parameter_types.py b/tempest/api_schema/compute/parameter_types.py
new file mode 100644
index 0000000..67c0c9b
--- /dev/null
+++ b/tempest/api_schema/compute/parameter_types.py
@@ -0,0 +1,28 @@
+# 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.
+
+links = {
+    'type': 'array',
+    'items': {
+        'type': 'object',
+        'properties': {
+            'href': {
+                'type': 'string',
+                'format': 'uri'
+            },
+            'rel': {'type': 'string'}
+        },
+        'required': ['href', 'rel']
+    }
+}
diff --git a/tempest/api_schema/compute/v2/images.py b/tempest/api_schema/compute/v2/images.py
index 41b8fff..41593c6 100644
--- a/tempest/api_schema/compute/v2/images.py
+++ b/tempest/api_schema/compute/v2/images.py
@@ -12,6 +12,8 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from tempest.api_schema.compute import parameter_types
+
 get_image = {
     'status_code': [200],
     'response_body': {
@@ -23,20 +25,7 @@
                     'id': {'type': 'string'},
                     'status': {'type': 'string'},
                     'updated': {'type': 'string'},
-                    'links': {
-                        'type': 'array',
-                        'items': {
-                            'type': 'object',
-                            'properties': {
-                                'href': {
-                                    'type': 'string',
-                                    'format': 'uri'
-                                },
-                                'rel': {'type': 'string'}
-                            },
-                            'required': ['href', 'rel']
-                        }
-                    },
+                    'links': parameter_types.links,
                     'name': {'type': 'string'},
                     'created': {'type': 'string'},
                     'OS-EXT-IMG-SIZE:size': {'type': 'integer'},
@@ -51,20 +40,7 @@
                             # allows 'string' also because we will be able to
                             # change it to 'uuid' in the future.
                             'id': {'type': ['integer', 'string']},
-                            'links': {
-                                'type': 'array',
-                                'items': {
-                                    'type': 'object',
-                                    'properties': {
-                                        'href': {
-                                            'type': 'string',
-                                            'format': 'uri'
-                                        },
-                                        'rel': {'type': 'string'}
-                                    },
-                                    'required': ['href', 'rel']
-                                }
-                            }
+                            'links': parameter_types.links
                         },
                         'required': ['id', 'links']
                     }
diff --git a/tempest/api_schema/compute/v2/servers.py b/tempest/api_schema/compute/v2/servers.py
index 7f06ca6..b4e6e53 100644
--- a/tempest/api_schema/compute/v2/servers.py
+++ b/tempest/api_schema/compute/v2/servers.py
@@ -12,6 +12,8 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from tempest.api_schema.compute import parameter_types
+
 create_server = {
     'status_code': [202],
     'response_body': {
@@ -25,20 +27,7 @@
                     # as a server id.
                     'id': {'type': ['integer', 'string']},
                     'security_groups': {'type': 'array'},
-                    'links': {
-                        'type': 'array',
-                        'items': {
-                            'type': 'object',
-                            'properties': {
-                                'href': {
-                                    'type': 'string',
-                                    'format': 'uri'
-                                },
-                                'rel': {'type': 'string'}
-                            },
-                            'required': ['href', 'rel']
-                        }
-                    },
+                    'links': parameter_types.links,
                     'adminPass': {'type': 'string'},
                     'OS-DCF:diskConfig': {'type': 'string'}
                 },
diff --git a/tempest/api_schema/compute/v3/servers.py b/tempest/api_schema/compute/v3/servers.py
index e69b25f..390962e 100644
--- a/tempest/api_schema/compute/v3/servers.py
+++ b/tempest/api_schema/compute/v3/servers.py
@@ -12,6 +12,8 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from tempest.api_schema.compute import parameter_types
+
 create_server = {
     'status_code': [202],
     'response_body': {
@@ -25,20 +27,7 @@
                     # as a server id.
                     'id': {'type': ['integer', 'string']},
                     'os-security-groups:security_groups': {'type': 'array'},
-                    'links': {
-                        'type': 'array',
-                        'items': {
-                            'type': 'object',
-                            'properties': {
-                                'href': {
-                                    'type': 'string',
-                                    'format': 'uri'
-                                },
-                                'rel': {'type': 'string'}
-                            },
-                            'required': ['href', 'rel']
-                        }
-                    },
+                    'links': parameter_types.links,
                     'admin_password': {'type': 'string'},
                     'os-access-ips:access_ip_v4': {'type': 'string'},
                     'os-access-ips:access_ip_v6': {'type': 'string'}