Check list servers attributes of Nova APIs

This patch adds the JSON schema for Nova V2 & V3 list servers
APIs response and validate the response with added JSON schema
to block the backward incompatibility change in the future.

Response status of list servers V2 & V3 APIs is same and given below-

{
    "servers": [
        {
            "id": "22c91117-08de-4894-9aa9-6ef382400985",
            "links": [
                {
                    "href": "http://openstack.example.com/v3/servers/
                    22c91117-08de-4894-9aa9-6ef382400985",
                    "rel": "self"
                },
                {
                    "href": "http://openstack.example.com/servers/
                    22c91117-08de-4894-9aa9-6ef382400985",
                    "rel": "bookmark"
                }
            ],
            "name": "new-server-test"
        }
    ]
}

Partially implements blueprint nova-api-attribute-test

Change-Id: I5e3854011f00b468dc63eddafd7e76a9048b1997
This commit is contained in:
Ghanshyam
2014-04-21 17:16:21 +09:00
parent 9f921d698f
commit 623c38fe92
3 changed files with 24 additions and 0 deletions

View File

@@ -117,3 +117,25 @@ list_server_metadata = copy.deepcopy(set_server_metadata)
delete_server_metadata_item = {
'status_code': [204]
}
list_servers = {
'status_code': [200],
'response_body': {
'type': 'object',
'properties': {
'servers': {
'type': 'array',
'items': {
'type': 'object',
'properties': {
'id': {'type': 'string'},
'links': parameter_types.links,
'name': {'type': 'string'}
},
'required': ['id', 'links', 'name']
}
}
},
'required': ['servers']
}
}

View File

@@ -150,6 +150,7 @@ class ServersClientJSON(rest_client.RestClient):
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(common_schema.list_servers, resp, body)
return resp, body
def list_servers_with_detail(self, params=None):

View File

@@ -150,6 +150,7 @@ class ServersV3ClientJSON(rest_client.RestClient):
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(common_schema.list_servers, resp, body)
return resp, body
def list_servers_with_detail(self, params=None):