Merge "Find floating ip by ip address"
This commit is contained in:
@@ -48,6 +48,9 @@ class FloatingIP(resource.Resource):
|
|||||||
fixed_ip_address = resource.Body('fixed_ip_address')
|
fixed_ip_address = resource.Body('fixed_ip_address')
|
||||||
#: The floating IP address.
|
#: The floating IP address.
|
||||||
floating_ip_address = resource.Body('floating_ip_address')
|
floating_ip_address = resource.Body('floating_ip_address')
|
||||||
|
#: Floating IP object doesn't have name attribute, set ip address to name
|
||||||
|
#: so that user could find floating IP by UUID or IP address using find_ip
|
||||||
|
name = floating_ip_address
|
||||||
#: The ID of the network associated with the floating IP.
|
#: The ID of the network associated with the floating IP.
|
||||||
floating_network_id = resource.Body('floating_network_id')
|
floating_network_id = resource.Body('floating_network_id')
|
||||||
#: The port ID.
|
#: The port ID.
|
||||||
|
@@ -118,10 +118,15 @@ class TestFloatingIP(base.BaseFunctionalTest):
|
|||||||
cls.assertIs(cls.name, sub.name)
|
cls.assertIs(cls.name, sub.name)
|
||||||
return sub
|
return sub
|
||||||
|
|
||||||
def test_find(self):
|
def test_find_by_id(self):
|
||||||
sot = self.conn.network.find_ip(self.FIP.id)
|
sot = self.conn.network.find_ip(self.FIP.id)
|
||||||
self.assertEqual(self.FIP.id, sot.id)
|
self.assertEqual(self.FIP.id, sot.id)
|
||||||
|
|
||||||
|
def test_find_by_ip_address(self):
|
||||||
|
sot = self.conn.network.find_ip(self.FIP.floating_ip_address)
|
||||||
|
self.assertEqual(self.FIP.floating_ip_address, sot.floating_ip_address)
|
||||||
|
self.assertEqual(self.FIP.floating_ip_address, sot.name)
|
||||||
|
|
||||||
def test_find_available_ip(self):
|
def test_find_available_ip(self):
|
||||||
sot = self.conn.network.find_available_ip()
|
sot = self.conn.network.find_available_ip()
|
||||||
self.assertIsNotNone(sot.id)
|
self.assertIsNotNone(sot.id)
|
||||||
|
Reference in New Issue
Block a user