aboutsummaryrefslogtreecommitdiffstats
path: root/testcases/features
diff options
context:
space:
mode:
Diffstat (limited to 'testcases/features')
-rwxr-xr-xtestcases/features/sfc/sfc.py39
1 files changed, 32 insertions, 7 deletions
diff --git a/testcases/features/sfc/sfc.py b/testcases/features/sfc/sfc.py
index e0bf4e8d7..3f46026ad 100755
--- a/testcases/features/sfc/sfc.py
+++ b/testcases/features/sfc/sfc.py
@@ -52,6 +52,16 @@ TACKER_SCRIPT = 'sfc_tacker.bash'
TEARDOWN_SCRIPT = "sfc_teardown.bash"
TACKER_CHANGECLASSI = "sfc_change_classi.bash"
+ssh_options = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
+
+
+def check_ssh(ip):
+ cmd = "sshpass -p opnfv ssh " + ssh_options + " -q " + ip + " exit"
+ success = subprocess.call(cmd, shell=True) == 0
+ if not success:
+ logger.debug("Wating for SSH connectivity in SF with IP: %s" % ip)
+ return success
+
def main():
@@ -63,7 +73,6 @@ def main():
start_time = time.time()
json_results = {}
- ssh_options = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
contr_cmd = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2"
" 'fuel node'|grep controller|awk '{print $10}'")
logger.info("Executing script to get ip_server: '%s'" % contr_cmd)
@@ -98,7 +107,7 @@ def main():
subprocess.call(iptable_cmd2, shell=True, stderr=subprocess.PIPE)
logger.info("Changing firewall policy in controller: '%s'" % iptable_cmd3)
- subprocess.call(iptable_cmd2, shell=True, stderr=subprocess.PIPE)
+ subprocess.call(iptable_cmd3, shell=True, stderr=subprocess.PIPE)
# Getting the different clients
@@ -263,13 +272,29 @@ def main():
logger.error('Failed to obtain IPs, cant continue, exiting')
return
- logger.info("Waiting 60 seconds for floating IP assignment")
- for j in range(0, 6):
- logger.debug("Test starting in {0} seconds".format(str((6 - j) * 10)))
- time.sleep(10)
-
logger.debug("Floating IPs for SFs: %s..." % ips)
+ # Check SSH connectivity to VNFs
+ r = 0
+ retries = 100
+ check = [False, False]
+
+ logger.info("Checking SSH connectivity to the SFs with ips %s" % str(ips))
+ while r < retries and not all(check):
+ try:
+ check = [check_ssh(ips[0]), check_ssh(ips[1])]
+ except Exception:
+ logger.exception("SSH check failed")
+ check = [False, False]
+ time.sleep(3)
+ r += 1
+
+ logger.info("SSH connectivity to the SFs established")
+
+ if not all(check):
+ logger.error("Cannot establish SSH connection to the SFs")
+ sys.exit(1)
+
# SSH TO START THE VXLAN_TOOL ON SF1
logger.info("Configuring the SFs")
try: