Merge "Support for ipv6 in compute response JSON schema"
diff --git a/tempest/api_schema/response/compute/v2_1/fixed_ips.py b/tempest/api_schema/response/compute/v2_1/fixed_ips.py
index 6d5ba67..3586b70 100644
--- a/tempest/api_schema/response/compute/v2_1/fixed_ips.py
+++ b/tempest/api_schema/response/compute/v2_1/fixed_ips.py
@@ -12,6 +12,8 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from tempest.api_schema.response.compute.v2_1 import parameter_types
+
 get_fixed_ip = {
     'status_code': [200],
     'response_body': {
@@ -20,10 +22,7 @@
             'fixed_ip': {
                 'type': 'object',
                 'properties': {
-                    'address': {
-                        'type': 'string',
-                        'format': 'ip-address'
-                    },
+                    'address': parameter_types.ip_address,
                     'cidr': {'type': 'string'},
                     'host': {'type': 'string'},
                     'hostname': {'type': 'string'}
diff --git a/tempest/api_schema/response/compute/v2_1/floating_ips.py b/tempest/api_schema/response/compute/v2_1/floating_ips.py
index 28dd40a..3551681 100644
--- a/tempest/api_schema/response/compute/v2_1/floating_ips.py
+++ b/tempest/api_schema/response/compute/v2_1/floating_ips.py
@@ -12,6 +12,8 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from tempest.api_schema.response.compute.v2_1 import parameter_types
+
 common_floating_ip_info = {
     'type': 'object',
     'properties': {
@@ -21,14 +23,8 @@
         'id': {'type': ['integer', 'string']},
         'pool': {'type': ['string', 'null']},
         'instance_id': {'type': ['string', 'null']},
-        'ip': {
-            'type': 'string',
-            'format': 'ip-address'
-        },
-        'fixed_ip': {
-            'type': ['string', 'null'],
-            'format': 'ip-address'
-        }
+        'ip': parameter_types.ip_address,
+        'fixed_ip': parameter_types.ip_address
     },
     'additionalProperties': False,
     'required': ['id', 'pool', 'instance_id',
@@ -131,18 +127,12 @@
                 'items': {
                     'type': 'object',
                     'properties': {
-                        'address': {
-                            'type': 'string',
-                            'format': 'ip-address'
-                        },
+                        'address': parameter_types.ip_address,
                         'instance_uuid': {'type': ['string', 'null']},
                         'interface': {'type': ['string', 'null']},
                         'pool': {'type': ['string', 'null']},
                         'project_id': {'type': ['string', 'null']},
-                        'fixed_ip': {
-                            'type': ['string', 'null'],
-                            'format': 'ip-address'
-                        }
+                        'fixed_ip': parameter_types.ip_address
                     },
                     'additionalProperties': False,
                     # NOTE: fixed_ip is introduced after JUNO release,
diff --git a/tempest/api_schema/response/compute/v2_1/hypervisors.py b/tempest/api_schema/response/compute/v2_1/hypervisors.py
index e24389d..05901b6 100644
--- a/tempest/api_schema/response/compute/v2_1/hypervisors.py
+++ b/tempest/api_schema/response/compute/v2_1/hypervisors.py
@@ -14,6 +14,8 @@
 
 import copy
 
+from tempest.api_schema.response.compute.v2_1 import parameter_types
+
 get_hypervisor_statistics = {
     'status_code': [200],
     'response_body': {
@@ -57,10 +59,7 @@
         'cpu_info': {'type': 'string'},
         'current_workload': {'type': 'integer'},
         'disk_available_least': {'type': ['integer', 'null']},
-        'host_ip': {
-            'type': 'string',
-            'format': 'ip-address'
-        },
+        'host_ip': parameter_types.ip_address,
         'free_disk_gb': {'type': 'integer'},
         'free_ram_mb': {'type': 'integer'},
         'hypervisor_hostname': {'type': 'string'},
diff --git a/tempest/api_schema/response/compute/v2_1/interfaces.py b/tempest/api_schema/response/compute/v2_1/interfaces.py
index b18fba6..130775b 100644
--- a/tempest/api_schema/response/compute/v2_1/interfaces.py
+++ b/tempest/api_schema/response/compute/v2_1/interfaces.py
@@ -27,10 +27,7 @@
                         'type': 'string',
                         'format': 'uuid'
                     },
-                    'ip_address': {
-                        'type': 'string',
-                        'format': 'ipv4'
-                    }
+                    'ip_address': parameter_types.ip_address
                 },
                 'additionalProperties': False,
                 'required': ['subnet_id', 'ip_address']
diff --git a/tempest/api_schema/response/compute/v2_1/parameter_types.py b/tempest/api_schema/response/compute/v2_1/parameter_types.py
index 7b4264c..07cc890 100644
--- a/tempest/api_schema/response/compute/v2_1/parameter_types.py
+++ b/tempest/api_schema/response/compute/v2_1/parameter_types.py
@@ -33,14 +33,27 @@
     'pattern': '(?:[a-f0-9]{2}:){5}[a-f0-9]{2}'
 }
 
+ip_address = {
+    'oneOf': [
+        {
+            'type': 'string',
+            'oneOf': [
+                {'format': 'ipv4'},
+                {'format': 'ipv6'}
+            ]
+        },
+        {'type': 'null'}
+    ]
+}
+
 access_ip_v4 = {
     'type': 'string',
-    'anyOf': [{'format': 'ipv4'}, {'enum': ['']}]
+    'oneOf': [{'format': 'ipv4'}, {'enum': ['']}]
 }
 
 access_ip_v6 = {
     'type': 'string',
-    'anyOf': [{'format': 'ipv6'}, {'enum': ['']}]
+    'oneOf': [{'format': 'ipv6'}, {'enum': ['']}]
 }
 
 addresses = {
@@ -55,7 +68,7 @@
                     'version': {'type': 'integer'},
                     'addr': {
                         'type': 'string',
-                        'anyOf': [
+                        'oneOf': [
                             {'format': 'ipv4'},
                             {'format': 'ipv6'}
                         ]