Verify list agents attributes of V2/V3 APIs
This patch adds the JSON schema for Nova V2/V3 list agents APIs
includes the attributes to block the backward incompatibility change
in the future.
The response body of v2 and v3 API is the below:
{
"agents": [
{
"agent_id": 1,
"hypervisor": "xen",
"os": "linux",
"architecture": "x86",
"version": "7.0",
"url": "xxx://xxx/xxx/xxx1",
"md5hash": "add6bb58e139be103324d04d82d8f546"
}
]
}
Partially implements blueprint nova-api-attribute-test
Change-Id: I59fc1a54b32554d7c9827ce912d3197f78c4cd12
diff --git a/tempest/services/compute/json/agents_client.py b/tempest/services/compute/json/agents_client.py
index 19821e7..98d8896 100644
--- a/tempest/services/compute/json/agents_client.py
+++ b/tempest/services/compute/json/agents_client.py
@@ -15,6 +15,7 @@
import json
import urllib
+from tempest.api_schema.compute import agents as common_schema
from tempest.api_schema.compute.v2 import agents as schema
from tempest.common import rest_client
from tempest import config
@@ -37,7 +38,9 @@
if params:
url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url)
- return resp, json.loads(body).get('agents')
+ body = json.loads(body)
+ self.validate_response(common_schema.list_agents, resp, body)
+ return resp, body['agents']
def create_agent(self, **kwargs):
"""Create an agent build."""