Commit 3b7d3e38 authored by Dionysis Grigoropoulos's avatar Dionysis Grigoropoulos
Browse files

cyclades: Add tenant_id/user_id fields in floating ips

* Add tenant_id and user_id in floating ip responses
* Update tests to comply with this change
parent cd4789c3
......@@ -99,7 +99,9 @@ def ip_to_dict(floating_ip):
"floating_ip_address": floating_ip.address,
"port_id": str(port_id) if port_id else None,
"floating_network_id": str(floating_ip.network_id),
"deleted": floating_ip.deleted}
"deleted": floating_ip.deleted,
"tenant_id": floating_ip.userid,
"user_id": floating_ip.userid}
@api.api_method(http_method="GET", user_required=True, logger=log,
......@@ -144,7 +146,6 @@ def allocate_floating_ip(request):
userid = request.user_uniq
log.info('allocate_floating_ip user: %s request: %s', userid, req)
# the network_pool is a mandatory field
network_id = api.utils.get_attribute(floating_ip_dict,
"floating_network_id",
......
......@@ -77,7 +77,9 @@ class FloatingIPAPITest(BaseAPITest):
"id": str(ip.id),
"port_id": str(ip.nic.id),
"deleted": False,
"floating_network_id": str(ip.network_id)})
"floating_network_id": str(ip.network_id),
"tenant_id": ip.userid,
"user_id": ip.userid})
def test_get_ip(self):
ip = mf.IPv4AddressFactory(userid="user1", floating_ip=True)
......@@ -92,7 +94,9 @@ class FloatingIPAPITest(BaseAPITest):
"id": str(ip.id),
"port_id": str(ip.nic.id),
"deleted": False,
"floating_network_id": str(ip.network_id)})
"floating_network_id": str(ip.network_id),
"tenant_id": ip.userid,
"user_id": ip.userid})
def test_wrong_user(self):
ip = mf.IPv4AddressFactory(userid="user1", floating_ip=True)
......@@ -124,7 +128,9 @@ class FloatingIPAPITest(BaseAPITest):
"id": str(ip.id),
"port_id": None,
"deleted": False,
"floating_network_id": str(self.pool.id)})
"floating_network_id": str(self.pool.id),
"tenant_id": ip.userid,
"user_id": ip.userid})
def test_reserve_empty_body(self):
"""Test reserve FIP without specifying network."""
......@@ -198,7 +204,9 @@ class FloatingIPAPITest(BaseAPITest):
"id": str(ip.id),
"port_id": None,
"deleted": False,
"floating_network_id": str(self.pool.id)})
"floating_network_id": str(self.pool.id),
"tenant_id": ip.userid,
"user_id": ip.userid})
# Already reserved
with mocked_quotaholder():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment