Use StatefulConnection class to verify connectivity in SG tests
There are two security group tests that are running for more than
20 minutes with RHEL image:
- test_multiple_ports_portrange_remote
- test_overlapping_sec_grp_rules
It happens because of the lack of privileges. I think it makes
sense to utilize the existing StatefulConnection class as it
has better service handling (start/stop) with all necessary
permissions
Change-Id: Iaca6fd3e6ed3c64ab3ca22817ad461479ecfa189
diff --git a/neutron_tempest_plugin/common/utils.py b/neutron_tempest_plugin/common/utils.py
index c28ce74..ab99db9 100644
--- a/neutron_tempest_plugin/common/utils.py
+++ b/neutron_tempest_plugin/common/utils.py
@@ -27,6 +27,7 @@
import eventlet
+from oslo_log import log
from tempest.lib import exceptions
from neutron_tempest_plugin import config
@@ -37,6 +38,7 @@
"https": 443,
}
CONF = config.CONF
+LOG = log.getLogger(__name__)
class classproperty(object):
@@ -202,20 +204,30 @@
timeout=self.test_timeout,
sleep=self.test_sleep)
try:
+ LOG.info("Checking connectivity between server and client -"
+ " attempt {}".format(self.test_attempt))
self.server_ssh.exec_command(
'grep {} output.txt'.format(self.test_str))
self.client_ssh.exec_command(
'grep {} output.txt'.format(self.test_str))
if not self.should_pass:
+ LOG.warning("attempt {} succeed while it should fail".format(
+ self.test_attempt))
return False
else:
if not self.connection_started:
self.connection_started = True
+ LOG.info("attempt {} succeed as it expected".format(
+ self.test_attempt))
return True
except exceptions.SSHExecCommandFailed:
if self.should_pass:
+ LOG.warning("attempt {} failed while it should pass".format(
+ self.test_attempt))
return False
else:
+ LOG.info("attempt {} failed as it expected".format(
+ self.test_attempt))
return True
finally:
self.test_attempt += 1