Commit 7839f153 authored by Giorgos Korfiatis's avatar Giorgos Korfiatis

cyclades: Expose user and tenant ID of floating IPs

Include user_id and tenant_id in the API details of a floating IP.
parent 249c3327
......@@ -124,6 +124,8 @@ 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),
"user_id": floating_ip.userid,
"tenant_id": floating_ip.project,
"deleted": floating_ip.deleted}
......
......@@ -65,7 +65,8 @@ class FloatingIPAPITest(BaseAPITest):
self.assertEqual(json.loads(response.content)["floatingips"], [])
def test_list_ips(self):
ip = mf.IPv4AddressFactory(userid="user1", floating_ip=True)
ip = mf.IPv4AddressFactory(userid="user1", project="user1",
floating_ip=True)
with mocked_quotaholder():
response = self.get(URL, "user1")
self.assertSuccess(response)
......@@ -77,10 +78,13 @@ class FloatingIPAPITest(BaseAPITest):
"id": str(ip.id),
"port_id": str(ip.nic.id),
"deleted": False,
"user_id": "user1",
"tenant_id": "user1",
"floating_network_id": str(ip.network_id)})
def test_get_ip(self):
ip = mf.IPv4AddressFactory(userid="user1", floating_ip=True)
ip = mf.IPv4AddressFactory(userid="user1", project="user1",
floating_ip=True)
with mocked_quotaholder():
response = self.get(URL + "/%s" % ip.id, "user1")
self.assertSuccess(response)
......@@ -92,6 +96,8 @@ class FloatingIPAPITest(BaseAPITest):
"id": str(ip.id),
"port_id": str(ip.nic.id),
"deleted": False,
"user_id": "user1",
"tenant_id": "user1",
"floating_network_id": str(ip.network_id)})
def test_wrong_user(self):
......@@ -124,6 +130,8 @@ class FloatingIPAPITest(BaseAPITest):
"id": str(ip.id),
"port_id": None,
"deleted": False,
"user_id": "test_user",
"tenant_id": "test_user",
"floating_network_id": str(self.pool.id)})
def test_reserve_empty_body(self):
......@@ -198,6 +206,8 @@ class FloatingIPAPITest(BaseAPITest):
"id": str(ip.id),
"port_id": None,
"deleted": False,
"user_id": "test_user",
"tenant_id": "test_user",
"floating_network_id": str(self.pool.id)})
# Already reserved
......
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