test_metadata_routed: save console log
In case the commands that check metadata fails save console log.
Change-Id: I7f3582faf429d796493d7dc9837977b5c0f74922
diff --git a/neutron_tempest_plugin/scenario/test_metadata.py b/neutron_tempest_plugin/scenario/test_metadata.py
index 91ecc97..05f0f04 100644
--- a/neutron_tempest_plugin/scenario/test_metadata.py
+++ b/neutron_tempest_plugin/scenario/test_metadata.py
@@ -23,6 +23,7 @@
from neutron_tempest_plugin.common import ssh
from neutron_tempest_plugin import config
+from neutron_tempest_plugin import exceptions
from neutron_tempest_plugin.scenario import base
LOG = logging.getLogger(__name__)
@@ -133,17 +134,22 @@
self.network, use_advanced_image=use_advanced_image)
self.wait_for_server_active(server=vm.server)
self.wait_for_guest_os_ready(vm.server)
- self._assert_has_ssh_connectivity(vm.ssh_client)
+ self.check_connectivity(host=vm.floating_ip['floating_ip_address'],
+ ssh_client=vm.ssh_client)
interface = self._get_primary_interface(vm.ssh_client)
- out = vm.ssh_client.exec_command(
- 'curl http://[%(address)s%%25%(interface)s]/' % {
- 'address': nlib_const.METADATA_V6_IP,
- 'interface': interface})
- self.assertIn('latest', out)
+ try:
+ out = vm.ssh_client.exec_command(
+ 'curl http://[%(address)s%%25%(interface)s]/' % {
+ 'address': nlib_const.METADATA_V6_IP,
+ 'interface': interface})
+ self.assertIn('latest', out)
- out = vm.ssh_client.exec_command(
- 'curl http://[%(address)s%%25%(interface)s]/openstack/' % {
- 'address': nlib_const.METADATA_V6_IP,
- 'interface': interface})
- self.assertIn('latest', out)
+ out = vm.ssh_client.exec_command(
+ 'curl http://[%(address)s%%25%(interface)s]/openstack/' % {
+ 'address': nlib_const.METADATA_V6_IP,
+ 'interface': interface})
+ self.assertIn('latest', out)
+ except exceptions.SSHExecCommandFailed:
+ self._log_console_output()
+ self._log_local_network_status()