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
This commit is contained in:
Ghanshyam 2014-05-07 16:38:43 +09:00
parent 9f921d698f
commit 9541ad1294
4 changed files with 12 additions and 0 deletions

View File

@ -123,3 +123,8 @@ set_get_server_metadata_item = {
'required': ['meta']
}
}
list_addresses_by_network = {
'status_code': [200],
'response_body': parameter_types.addresses
}

View File

@ -76,3 +76,8 @@ attach_detach_volume = {
}
set_get_server_metadata_item = copy.deepcopy(servers.set_server_metadata)
list_addresses_by_network = {
'status_code': [200],
'response_body': addresses_v3
}

View File

@ -199,6 +199,7 @@ class ServersClientJSON(rest_client.RestClient):
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,

View File

@ -199,6 +199,7 @@ class ServersV3ClientJSON(rest_client.RestClient):
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):