Merge "Check create-Floating-IP-Bulk Nova API attributes"

This commit is contained in:
Jenkins 2014-06-19 23:12:07 +00:00 committed by Gerrit Code Review
commit fe3a91cbee
3 changed files with 21 additions and 1 deletions

View File

@ -74,7 +74,7 @@ class FloatingIPsBulkAdminTestJSON(base.BaseV2ComputeAdminTest):
self.assertEqual(self.ip_range, body['ip_range'])
resp, ips_list = self.client.list_floating_ips_bulk()
self.assertEqual(200, resp.status)
self.assertNotEqual(0, len(body))
self.assertNotEqual(0, len(ips_list))
for ip in netaddr.IPNetwork(self.ip_range).iter_hosts():
self.assertIn(str(ip), map(lambda x: x['address'], ips_list))
resp, body = self.client.delete_floating_ips_bulk(self.ip_range)

View File

@ -98,3 +98,22 @@ floating_ip_pools = {
add_remove_floating_ip = {
'status_code': [202]
}
create_floating_ips_bulk = {
'status_code': [200],
'response_body': {
'type': 'object',
'properties': {
'floating_ips_bulk_create': {
'type': 'object',
'properties': {
'interface': {'type': ['string', 'null']},
'ip_range': {'type': 'string'},
'pool': {'type': ['string', 'null']},
},
'required': ['interface', 'ip_range', 'pool']
}
},
'required': ['floating_ips_bulk_create']
}
}

View File

@ -123,6 +123,7 @@ class FloatingIPsClientJSON(rest_client.RestClient):
post_body = json.dumps({'floating_ips_bulk_create': post_body})
resp, body = self.post('os-floating-ips-bulk', post_body)
body = json.loads(body)
self.validate_response(schema.create_floating_ips_bulk, resp, body)
return resp, body['floating_ips_bulk_create']
def list_floating_ips_bulk(self):