Add a response header validation

Nova API sometimes returns important information in a response header,
and Tempest needs to check it for keeping the backward compatibility.
This patch adds the check for "create a server snapshot" API as the
sample.

Partially implements blueprint nova-api-attribute-test

Change-Id: I2441147ee050e7b818906aaa754dcec4480d8c18
diff --git a/tempest/common/rest_client.py b/tempest/common/rest_client.py
index 8c07d4f..5ad2901 100644
--- a/tempest/common/rest_client.py
+++ b/tempest/common/rest_client.py
@@ -593,10 +593,12 @@
                 msg = ("The status code(%s) is different than the expected "
                        "one(%s)") % (resp.status, response_code)
                 raise exceptions.InvalidHttpSuccessCode(msg)
-            response_schema = schema.get('response_body')
-            if response_schema:
+
+            # Check the body of a response
+            body_schema = schema.get('response_body')
+            if body_schema:
                 try:
-                    jsonschema.validate(body, response_schema)
+                    jsonschema.validate(body, body_schema)
                 except jsonschema.ValidationError as ex:
                     msg = ("HTTP response body is invalid (%s)") % ex
                     raise exceptions.InvalidHTTPResponseBody(msg)
@@ -605,6 +607,15 @@
                     msg = ("HTTP response body should not exist (%s)") % body
                     raise exceptions.InvalidHTTPResponseBody(msg)
 
+            # Check the header of a response
+            header_schema = schema.get('response_header')
+            if header_schema:
+                try:
+                    jsonschema.validate(resp, header_schema)
+                except jsonschema.ValidationError as ex:
+                    msg = ("HTTP response header is invalid (%s)") % ex
+                    raise exceptions.InvalidHTTPResponseHeader(msg)
+
 
 class NegativeRestClient(RestClient):
     """