Verify hypervisor uptime attributes of Nova API

This patch adds the JSON Schema for response of Nova V2 & V3
hypervisor uptime APIs ('os-hypervisors/<hyper_id>/uptime')
and validate the response with added JSON Schema to block
the backward incompatibility change in the future.

The response body of V2 & V3 hypervisor uptime APIs is same
& given below:

{
    "hypervisor": {
        "id": %(hypervisor_id)s,
        "hypervisor_hostname": "fake-mini",
        "uptime": " 08:32:11 up 93 days, 18:25, 12 users,
                  load average: 0.20, 0.12, 0.14"
    }
}

Partially implements blueprint nova-api-attribute-test

Change-Id: I163c50e0ad277ef8ed639363d5e53f66e9f9d4e4
diff --git a/tempest/api_schema/compute/hypervisors.py b/tempest/api_schema/compute/hypervisors.py
index a935f87..630901e 100644
--- a/tempest/api_schema/compute/hypervisors.py
+++ b/tempest/api_schema/compute/hypervisors.py
@@ -12,6 +12,8 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+import copy
+
 hypervisor_statistics = {
     'status_code': [200],
     'response_body': {
@@ -186,3 +188,10 @@
         'required': ['hypervisor']
     }
 }
+
+
+hypervisor_uptime = copy.deepcopy(common_hypervisors_info)
+hypervisor_uptime['response_body']['properties']['hypervisor'][
+    'properties']['uptime'] = {'type': 'string'}
+hypervisor_uptime['response_body']['properties']['hypervisor'][
+    'required'] = ['id', 'hypervisor_hostname', 'uptime']
diff --git a/tempest/services/compute/json/hypervisor_client.py b/tempest/services/compute/json/hypervisor_client.py
index 28ca2a6..ef0e83a 100644
--- a/tempest/services/compute/json/hypervisor_client.py
+++ b/tempest/services/compute/json/hypervisor_client.py
@@ -69,6 +69,7 @@
         """Display the uptime of the specified hypervisor."""
         resp, body = self.get('os-hypervisors/%s/uptime' % hyper_id)
         body = json.loads(body)
+        self.validate_response(common_schema.hypervisor_uptime, resp, body)
         return resp, body['hypervisor']
 
     def search_hypervisor(self, hyper_name):
diff --git a/tempest/services/compute/v3/json/hypervisor_client.py b/tempest/services/compute/v3/json/hypervisor_client.py
index abe6788..5f4dad5 100644
--- a/tempest/services/compute/v3/json/hypervisor_client.py
+++ b/tempest/services/compute/v3/json/hypervisor_client.py
@@ -67,6 +67,7 @@
         """Display the uptime of the specified hypervisor."""
         resp, body = self.get('os-hypervisors/%s/uptime' % hyper_id)
         body = json.loads(body)
+        self.validate_response(common_schema.hypervisor_uptime, resp, body)
         return resp, body['hypervisor']
 
     def search_hypervisor(self, hyper_name):