Verify attributes through Nova "list security groups" API
This patch adds checks whether a response of Nova "list security groups" API
includes the attributes to block the backward incompatibility change
in the future.
The response body of v2 API is the below:
{
"security_groups": [
{
"id": 17,
"name": "default",
"tenant_id": "f5e60a2a87ed4a02ae1ab388bdb10cb5",
"rules": [],
"description": "default"
}
]
}
Partially implements blueprint nova-api-attribute-test
Change-Id: Ibb2cc07e6d723e836b554f08168757aa93f61890
diff --git a/tempest/services/compute/json/security_groups_client.py b/tempest/services/compute/json/security_groups_client.py
index 899d4ef..9267be7 100644
--- a/tempest/services/compute/json/security_groups_client.py
+++ b/tempest/services/compute/json/security_groups_client.py
@@ -16,6 +16,7 @@
import json
import urllib
+from tempest.api_schema.compute.v2 import security_groups as schema
from tempest.common import rest_client
from tempest import config
from tempest import exceptions
@@ -38,6 +39,7 @@
resp, body = self.get(url)
body = json.loads(body)
+ self.validate_response(schema.list_security_groups, resp, body)
return resp, body['security_groups']
def get_security_group(self, security_group_id):
@@ -119,6 +121,7 @@
"""List all rules for a security group."""
resp, body = self.get('os-security-groups')
body = json.loads(body)
+ self.validate_response(schema.list_security_groups, resp, body)
for sg in body['security_groups']:
if sg['id'] == security_group_id:
return resp, sg['rules']