Test updating FIP with a different port
The test creates two servers, first one with a floating ip. Then the
floating ip is updated and associated with the port from the second
server and connectivity is checked.
Related-bug: #1835029
Change-Id: I7f48a67af172911d52f62322d2d9fd0222c4c0a1
diff --git a/neutron_tempest_plugin/scenario/base.py b/neutron_tempest_plugin/scenario/base.py
index f24c82b..d87a365 100644
--- a/neutron_tempest_plugin/scenario/base.py
+++ b/neutron_tempest_plugin/scenario/base.py
@@ -378,3 +378,30 @@
"""
self.wait_for_server_status(
server, constants.SERVER_STATUS_ACTIVE, client)
+
+ def check_servers_hostnames(self, servers, log_errors=True):
+ """Compare hostnames of given servers with their names."""
+ try:
+ for server in servers:
+ kwargs = {}
+ try:
+ kwargs['port'] = server['port_forwarding']['external_port']
+ except KeyError:
+ pass
+ ssh_client = ssh.Client(
+ self.fip['floating_ip_address'],
+ CONF.validation.image_ssh_user,
+ pkey=self.keypair['private_key'],
+ **kwargs)
+ self.assertIn(server['name'],
+ ssh_client.exec_command('hostname'))
+ except lib_exc.SSHTimeout as ssh_e:
+ LOG.debug(ssh_e)
+ if log_errors:
+ self._log_console_output(servers)
+ raise
+ except AssertionError as assert_e:
+ LOG.debug(assert_e)
+ if log_errors:
+ self._log_console_output(servers)
+ raise