Verify list-Floating-IP-Bulk Nova API attributes
This patch adds the JSON schema for Nova V2 list-Floating-IP-Bulk
API response and validate the response with added JSON schema
to block the backward incompatibility change in the future.
The response body of list-Floating-IP-Bulk V2 API is below:
{
"floating_ip_info": [
{
"address": "10.10.10.1",
"instance_uuid": null,
"interface": "eth0",
"pool": "nova",
"project_id": null
},
{
"address": "10.10.10.3",
"instance_uuid": null,
"interface": "eth0",
"pool": "nova",
"project_id": null
}
]
}
Partially implements blueprint nova-api-attribute-test
Change-Id: I43b6f0618cb85d78577e7c63d8fbf08acc5e93a3
diff --git a/tempest/api_schema/compute/v2/floating_ips.py b/tempest/api_schema/compute/v2/floating_ips.py
index 782f5c8..fd368ef 100644
--- a/tempest/api_schema/compute/v2/floating_ips.py
+++ b/tempest/api_schema/compute/v2/floating_ips.py
@@ -128,3 +128,31 @@
'required': ['floating_ips_bulk_delete']
}
}
+
+list_floating_ips_bulk = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'floating_ip_info': {
+ 'type': 'array',
+ 'items': {
+ 'type': 'object',
+ 'properties': {
+ 'address': {
+ 'type': 'string',
+ 'format': 'ip-address'
+ },
+ 'instance_uuid': {'type': ['string', 'null']},
+ 'interface': {'type': ['string', 'null']},
+ 'pool': {'type': ['string', 'null']},
+ 'project_id': {'type': ['string', 'null']}
+ },
+ 'required': ['address', 'instance_uuid', 'interface',
+ 'pool', 'project_id']
+ }
+ }
+ },
+ 'required': ['floating_ip_info']
+ }
+}
diff --git a/tempest/services/compute/json/floating_ips_client.py b/tempest/services/compute/json/floating_ips_client.py
index 0028eea..cd195f4 100644
--- a/tempest/services/compute/json/floating_ips_client.py
+++ b/tempest/services/compute/json/floating_ips_client.py
@@ -130,6 +130,7 @@
"""Returns a list of all floating IPs bulk."""
resp, body = self.get('os-floating-ips-bulk')
body = json.loads(body)
+ self.validate_response(schema.list_floating_ips_bulk, resp, body)
return resp, body['floating_ip_info']
def delete_floating_ips_bulk(self, ip_range):