Merge "Verify hypervisor uptime attributes of Nova API"

This commit is contained in:
Jenkins 2014-03-28 09:21:37 +00:00 committed by Gerrit Code Review
commit 00c7ecb1ac
3 changed files with 11 additions and 0 deletions

View File

@ -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 @@ common_hypervisors_info = {
'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']

View File

@ -71,6 +71,7 @@ class HypervisorClientJSON(rest_client.RestClient):
"""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):

View File

@ -69,6 +69,7 @@ class HypervisorV3ClientJSON(rest_client.RestClient):
"""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):