Merge "Check show_hypervisor attributes of Nova V2/V3 API"
diff --git a/tempest/api_schema/compute/hypervisors.py b/tempest/api_schema/compute/hypervisors.py
index 3c24a38..7de5147 100644
--- a/tempest/api_schema/compute/hypervisors.py
+++ b/tempest/api_schema/compute/hypervisors.py
@@ -97,3 +97,53 @@
         'required': ['hypervisors']
     }
 }
+
+common_show_hypervisor = {
+    'status_code': [200],
+    'response_body': {
+        'type': 'object',
+        'properties': {
+            'hypervisor': {
+                'type': 'object',
+                'properties': {
+                    'cpu_info': {'type': 'string'},
+                    'current_workload': {'type': 'integer'},
+                    'disk_available_least': {'type': 'integer'},
+                    'host_ip': {
+                        'type': 'string',
+                        'format': 'ip-address'
+                    },
+                    'free_disk_gb': {'type': 'integer'},
+                    'free_ram_mb': {'type': 'integer'},
+                    'hypervisor_hostname': {'type': 'string'},
+                    'hypervisor_type': {'type': 'string'},
+                    'hypervisor_version': {'type': 'integer'},
+                    'id': {'type': ['integer', 'string']},
+                    'local_gb': {'type': 'integer'},
+                    'local_gb_used': {'type': 'integer'},
+                    'memory_mb': {'type': 'integer'},
+                    'memory_mb_used': {'type': 'integer'},
+                    'running_vms': {'type': 'integer'},
+                    'service': {
+                        'type': 'object',
+                        'properties': {
+                            'host': {'type': 'string'},
+                            'id': {'type': ['integer', 'string']}
+                        },
+                        'required': ['host', 'id']
+                    },
+                    'vcpus': {'type': 'integer'},
+                    'vcpus_used': {'type': 'integer'}
+                },
+                'required': ['cpu_info', 'current_workload',
+                             'disk_available_least', 'host_ip',
+                             'free_disk_gb', 'free_ram_mb',
+                             'hypervisor_hostname', 'hypervisor_type',
+                             'hypervisor_version', 'id', 'local_gb',
+                             'local_gb_used', 'memory_mb', 'memory_mb_used',
+                             'running_vms', 'service', 'vcpus', 'vcpus_used']
+            }
+        },
+        'required': ['hypervisor']
+    }
+}
diff --git a/tempest/api_schema/compute/v3/hypervisors.py b/tempest/api_schema/compute/v3/hypervisors.py
index 0a6ec76..6eb0072 100644
--- a/tempest/api_schema/compute/v3/hypervisors.py
+++ b/tempest/api_schema/compute/v3/hypervisors.py
@@ -20,3 +20,8 @@
 # Defining extra attributes for V3 show hypervisor schema
 list_hypervisors_detail['response_body']['properties']['hypervisors'][
     'items']['properties']['os-pci:pci_stats'] = {'type': 'array'}
+
+show_hypervisor = copy.deepcopy(hypervisors.common_show_hypervisor)
+# Defining extra attributes for V3 show hypervisor schema
+show_hypervisor['response_body']['properties']['hypervisor']['properties'][
+    'os-pci:pci_stats'] = {'type': 'array'}
diff --git a/tempest/services/compute/json/hypervisor_client.py b/tempest/services/compute/json/hypervisor_client.py
index 3fcc879..89a7961 100644
--- a/tempest/services/compute/json/hypervisor_client.py
+++ b/tempest/services/compute/json/hypervisor_client.py
@@ -46,6 +46,8 @@
         """Display the details of the specified hypervisor."""
         resp, body = self.get('os-hypervisors/%s' % hyper_id)
         body = json.loads(body)
+        self.validate_response(common_schema.common_show_hypervisor,
+                               resp, body)
         return resp, body['hypervisor']
 
     def get_hypervisor_servers(self, hyper_name):
diff --git a/tempest/services/compute/v3/json/hypervisor_client.py b/tempest/services/compute/v3/json/hypervisor_client.py
index c02f75c..0ba6ebf 100644
--- a/tempest/services/compute/v3/json/hypervisor_client.py
+++ b/tempest/services/compute/v3/json/hypervisor_client.py
@@ -46,6 +46,7 @@
         """Display the details of the specified hypervisor."""
         resp, body = self.get('os-hypervisors/%s' % hyper_id)
         body = json.loads(body)
+        self.validate_response(v3schema.show_hypervisor, resp, body)
         return resp, body['hypervisor']
 
     def get_hypervisor_servers(self, hyper_name):