Validate get_instance_usage_audit_log Nova V2 API

This patch adds the JSON schema for get_instance_usage_audit_log Nova
V2 APIs and validate the response of the API with added JSON schema
to block the backward incompatibility change in the future.

Response body of V2 GET instance_usage_audit_log is below-

{
    "instance_usage_audit_log": {
        "hosts_not_run": [
            "%(hostid)s"
        ],
        "log": {},
        "num_hosts": 1,
        "num_hosts_done": 0,
        "num_hosts_not_run": 1,
        "num_hosts_running": 0,
        "overall_status": "0 of 1 hosts done. 0 errors.",
        "period_beginning": "%(timestamp)s",
        "period_ending": "%(timestamp)s",
        "total_errors": 0,
        "total_instances": 0
    }
}

Partially implements blueprint nova-api-attribute-test

Change-Id: I0112c331e83ade95f3a6a9d5e5434d76703a09eb
diff --git a/tempest/api_schema/compute/v2/instance_usage_audit_logs.py b/tempest/api_schema/compute/v2/instance_usage_audit_logs.py
new file mode 100644
index 0000000..c1509b4
--- /dev/null
+++ b/tempest/api_schema/compute/v2/instance_usage_audit_logs.py
@@ -0,0 +1,48 @@
+# Copyright 2014 NEC Corporation.  All rights reserved.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
+#    not use this file except in compliance with the License. You may obtain
+#    a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+#    License for the specific language governing permissions and limitations
+#    under the License.
+
+common_instance_usage_audit_log = {
+    'type': 'object',
+    'properties': {
+        'hosts_not_run': {
+            'type': 'array',
+            'items': {'type': 'string'}
+        },
+        'log': {'type': 'object'},
+        'num_hosts': {'type': 'integer'},
+        'num_hosts_done': {'type': 'integer'},
+        'num_hosts_not_run': {'type': 'integer'},
+        'num_hosts_running': {'type': 'integer'},
+        'overall_status': {'type': 'string'},
+        'period_beginning': {'type': 'string'},
+        'period_ending': {'type': 'string'},
+        'total_errors': {'type': 'integer'},
+        'total_instances': {'type': 'integer'}
+    },
+    'required': ['hosts_not_run', 'log', 'num_hosts', 'num_hosts_done',
+                 'num_hosts_not_run', 'num_hosts_running', 'overall_status',
+                 'period_beginning', 'period_ending', 'total_errors',
+                 'total_instances']
+}
+
+get_instance_usage_audit_log = {
+    'status_code': [200],
+    'response_body': {
+        'type': 'object',
+        'properties': {
+            'instance_usage_audit_log': common_instance_usage_audit_log
+        },
+        'required': ['instance_usage_audit_log']
+    }
+}
diff --git a/tempest/services/compute/json/instance_usage_audit_log_client.py b/tempest/services/compute/json/instance_usage_audit_log_client.py
index 1f6e988..4088be9 100644
--- a/tempest/services/compute/json/instance_usage_audit_log_client.py
+++ b/tempest/services/compute/json/instance_usage_audit_log_client.py
@@ -15,6 +15,8 @@
 
 import json
 
+from tempest.api_schema.compute.v2 import instance_usage_audit_logs \
+    as schema
 from tempest.common import rest_client
 from tempest import config
 
@@ -38,4 +40,5 @@
         url = 'os-instance_usage_audit_log/%s' % time_before
         resp, body = self.get(url)
         body = json.loads(body)
+        self.validate_response(schema.get_instance_usage_audit_log, resp, body)
         return resp, body["instance_usage_audit_log"]