Verify list_addresses_by_network APIs attributes
This patch adds the JSON schema for Nova V2 & V3 server
list_addresses_by_network APIs response and validate the
response with added JSON schema to block the backward
incompatibility change in the future.
The response body of server list_addresses_by_network V2 API is below:
{
"private": [
{
"version": 4,
"addr": "192.168.0.3"
}
]
}
The response body of server list_addresses_by_network V3 API is below:
{
"private": [
{
"version": 4,
"addr": "192.168.0.3",
"type": "fixed",
"mac_addr": "aa:bb:cc:dd:ee:ff"
}
]
}
Partially implements blueprint nova-api-attribute-test
Change-Id: I76e25523708fb9454518f215dc60f201d7483464
diff --git a/tempest/api_schema/compute/v2/servers.py b/tempest/api_schema/compute/v2/servers.py
index 05d37af..e90f436 100644
--- a/tempest/api_schema/compute/v2/servers.py
+++ b/tempest/api_schema/compute/v2/servers.py
@@ -123,3 +123,8 @@
'required': ['meta']
}
}
+
+list_addresses_by_network = {
+ 'status_code': [200],
+ 'response_body': parameter_types.addresses
+}
diff --git a/tempest/api_schema/compute/v3/servers.py b/tempest/api_schema/compute/v3/servers.py
index 6926dbd..956b5ad 100644
--- a/tempest/api_schema/compute/v3/servers.py
+++ b/tempest/api_schema/compute/v3/servers.py
@@ -76,3 +76,8 @@
}
set_get_server_metadata_item = copy.deepcopy(servers.set_server_metadata)
+
+list_addresses_by_network = {
+ 'status_code': [200],
+ 'response_body': addresses_v3
+}
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index f6b76e9..6fd2870 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -199,6 +199,7 @@
resp, body = self.get("servers/%s/ips/%s" %
(str(server_id), network_id))
body = json.loads(body)
+ self.validate_response(schema.list_addresses_by_network, resp, body)
return resp, body
def action(self, server_id, action_name, response_key,
diff --git a/tempest/services/compute/v3/json/servers_client.py b/tempest/services/compute/v3/json/servers_client.py
index a6d49f1..75ad0a5 100644
--- a/tempest/services/compute/v3/json/servers_client.py
+++ b/tempest/services/compute/v3/json/servers_client.py
@@ -199,6 +199,7 @@
resp, body = self.get("servers/%s/ips/%s" %
(str(server_id), network_id))
body = json.loads(body)
+ self.validate_response(schema.list_addresses_by_network, resp, body)
return resp, body
def action(self, server_id, action_name, response_key, **kwargs):