Validate floating IP in server['addresses'] scenario
While reviewing nova fix I03be8100155d343eb6a4ea9eda3f1498ad3fb4cf
it was noticed that when you delete a floating IP via the Nova
API which is associated to a server, and using neutron, the
server's instance_info_cache is not directly updated, which is what
populates the server.addresses field. nova-network does refresh the
info_cache when deleting an associated floating IP.
This patch adds validation to a scenario test that runs on both
nova-network and neutron to check this behavior.
Depends-On: I8a8ae8cdbe2d9d77e7f1ae94ebdf6e4ad46eaf00
Change-Id: I5f6b9754289a9e53115320132a2f6629d7f637cb
Related-Bug: #1614538
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index dba1c92..a67927a 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -96,6 +96,13 @@
'%s' % (secgroup['id'], server['id']))
raise exceptions.TimeoutException(msg)
+ def _get_floating_ip_in_server_addresses(self, floating_ip, server):
+ for network_name, addresses in server['addresses'].items():
+ for address in addresses:
+ if (address['OS-EXT-IPS:type'] == 'floating' and
+ address['addr'] == floating_ip['ip']):
+ return address
+
@test.idempotent_id('bdbb5441-9204-419d-a225-b4fdbfb1a1a8')
@test.services('compute', 'volume', 'image', 'network')
def test_minimum_basic_scenario(self):
@@ -121,6 +128,16 @@
self.cinder_show(volume)
floating_ip = self.create_floating_ip(server)
+ # fetch the server again to make sure the addresses were refreshed
+ # after associating the floating IP
+ server = self.servers_client.show_server(server['id'])['server']
+ address = self._get_floating_ip_in_server_addresses(
+ floating_ip, server)
+ self.assertIsNotNone(
+ address,
+ "Failed to find floating IP '%s' in server addresses: %s" %
+ (floating_ip['ip'], server['addresses']))
+
self.create_and_add_security_group_to_server(server)
# check that we can SSH to the server before reboot
@@ -135,3 +152,13 @@
floating_ip['ip'], private_key=keypair['private_key'])
self.check_partitions()
+
+ # delete the floating IP, this should refresh the server addresses
+ self.compute_floating_ips_client.delete_floating_ip(floating_ip['id'])
+ server = self.servers_client.show_server(server['id'])['server']
+ address = self._get_floating_ip_in_server_addresses(
+ floating_ip, server)
+ self.assertIsNone(
+ address,
+ "Floating IP '%s' should not be in server addresses: %s" %
+ (floating_ip['ip'], server['addresses']))