Merge "Consolidate _check_public_network_connectivity into NetworkScenarioTest"
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 4980e1f..db43f4e 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -29,6 +29,7 @@
from tempest.api.network import common as net_common
from tempest import auth
from tempest import clients
+from tempest.common import debug
from tempest.common import isolated_creds
from tempest.common.utils import data_utils
from tempest.common.utils.linux import remote_client
@@ -854,6 +855,27 @@
private_key)
linux_client.validate_authentication()
+ def _check_public_network_connectivity(self, ip_address, username,
+ private_key, should_connect=True,
+ msg=None, servers=None):
+ # The target login is assumed to have been configured for
+ # key-based authentication by cloud-init.
+ LOG.debug('checking network connections to IP %s with user: %s' %
+ (ip_address, username))
+ try:
+ self._check_vm_connectivity(ip_address,
+ username,
+ private_key,
+ should_connect=should_connect)
+ except Exception:
+ ex_msg = 'Public network connectivity check failed'
+ if msg:
+ ex_msg += ": " + msg
+ LOG.exception(ex_msg)
+ self._log_console_output(servers)
+ debug.log_net_debug()
+ raise
+
def _check_remote_connectivity(self, source, dest, should_succeed=True):
"""
check ping server via source ssh connection
diff --git a/tempest/scenario/test_network_advanced_server_ops.py b/tempest/scenario/test_network_advanced_server_ops.py
index e0d5779..37ff2f7 100644
--- a/tempest/scenario/test_network_advanced_server_ops.py
+++ b/tempest/scenario/test_network_advanced_server_ops.py
@@ -108,20 +108,6 @@
debug.log_ip_ns()
raise
- def _check_public_network_connectivity(self, floating_ip,
- username,
- private_key,
- should_connect=True):
- # The target login is assumed to have been configured for
- # key-based authentication by cloud-init.
- try:
- self._check_vm_connectivity(floating_ip, username, private_key,
- should_connect=should_connect)
- except Exception:
- LOG.exception("Public network connectivity check failed")
- debug.log_ip_ns()
- raise
-
def _check_network_connectivity(self, should_connect=True):
username = CONF.compute.image_ssh_user
private_key = self.keypair.private_key
@@ -130,10 +116,9 @@
private_key,
should_connect=should_connect)
floating_ip = self.floating_ip.floating_ip_address
- self._check_public_network_connectivity(floating_ip,
- username,
- private_key,
- should_connect=should_connect)
+ self._check_public_network_connectivity(floating_ip, username,
+ private_key, should_connect,
+ servers=[self.server])
def _wait_server_status_and_check_network_connectivity(self):
self.status_timeout(self.compute_client.servers, self.server.id,
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index d5ab3d3..7767c86 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -184,28 +184,16 @@
def _check_public_network_connectivity(self, should_connect=True,
msg=None):
- # The target login is assumed to have been configured for
- # key-based authentication by cloud-init.
ssh_login = CONF.compute.image_ssh_user
- LOG.debug('checking network connections')
floating_ip, server = self.floating_ip_tuple
ip_address = floating_ip.floating_ip_address
private_key = None
if should_connect:
private_key = self.servers[server].private_key
- try:
- self._check_vm_connectivity(ip_address,
- ssh_login,
- private_key,
- should_connect=should_connect)
- except Exception:
- ex_msg = 'Public network connectivity check failed'
- if msg:
- ex_msg += ": " + msg
- LOG.exception(ex_msg)
- self._log_console_output(servers=self.servers.keys())
- debug.log_net_debug()
- raise
+ # call the common method in the parent class
+ super(TestNetworkBasicOps, self)._check_public_network_connectivity(
+ ip_address, ssh_login, private_key, should_connect, msg,
+ self.servers.keys())
def _disassociate_floating_ips(self):
floating_ip, server = self.floating_ip_tuple