Check hypervisor statistics attributes of Nova API
This patch adds the JSON Schema for response of Nova V2 & V3
hypervisor statistics APIs ('os-hypervisors/statistics)
and validate the response with added JSON Schema to block
the backward incompatibility change in the future.
The response body of V2 & V3 hypervisor statistics APIs is same
& given below:
{
"hypervisor_statistics": {
"count": 1,
"current_workload": 0,
"disk_available_least": 0,
"free_disk_gb": 1028,
"free_ram_mb": 7680,
"local_gb": 1028,
"local_gb_used": 0,
"memory_mb": 8192,
"memory_mb_used": 512,
"running_vms": 0,
"vcpus": 1,
"vcpus_used": 0
}
}
Partially implements blueprint nova-api-attribute-test
Change-Id: I7cd1e81c722e0117b9f2fc98e9b2d2bf7eb5177c
diff --git a/tempest/services/compute/json/hypervisor_client.py b/tempest/services/compute/json/hypervisor_client.py
index c6b13b0..be704e7 100644
--- a/tempest/services/compute/json/hypervisor_client.py
+++ b/tempest/services/compute/json/hypervisor_client.py
@@ -15,6 +15,7 @@
import json
+from tempest.api_schema.compute import hypervisors as common_schema
from tempest.common import rest_client
from tempest import config
@@ -55,6 +56,7 @@
"""Get hypervisor statistics over all compute nodes."""
resp, body = self.get('os-hypervisors/statistics')
body = json.loads(body)
+ self.validate_response(common_schema.hypervisor_statistics, resp, body)
return resp, body['hypervisor_statistics']
def get_hypervisor_uptime(self, hyper_id):