summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testcases/config_functest.yaml2
-rw-r--r--testcases/vPing/CI/libraries/vPing2.py37
2 files changed, 22 insertions, 17 deletions
diff --git a/testcases/config_functest.yaml b/testcases/config_functest.yaml
index 7aa0be8e6..bab1a4b94 100644
--- a/testcases/config_functest.yaml
+++ b/testcases/config_functest.yaml
@@ -65,7 +65,7 @@ general:
neutron_router_name: functest-router
vping:
- ping_timeout: 300
+ ping_timeout: 200
vm_flavor: m1.small #adapt to your environment
vm_name_1: opnfv-vping-1
vm_name_2: opnfv-vping-2
diff --git a/testcases/vPing/CI/libraries/vPing2.py b/testcases/vPing/CI/libraries/vPing2.py
index 912627b76..7714dfcb8 100644
--- a/testcases/vPing/CI/libraries/vPing2.py
+++ b/testcases/vPing/CI/libraries/vPing2.py
@@ -449,16 +449,16 @@ def main():
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- timeout = 20
+ timeout = 50
while timeout > 0:
try:
- ssh.connect(floatip, username=username, password=password, timeout=10)
+ ssh.connect(floatip, username=username, password=password, timeout=2)
logger.debug("SSH connection established to %s." % floatip)
break
except Exception, e:
#print e
logger.debug("Waiting for %s..." % floatip)
- time.sleep(2)
+ time.sleep(6)
timeout -= 1
if timeout == 0: # 300 sec timeout (5 min)
@@ -496,6 +496,7 @@ def main():
duration = 0
cmd = '~/ping.sh ' + IP_1
+ flag = False
while True:
time.sleep(1)
# we do the SCP every time in the loop because while testing, I observed
@@ -508,20 +509,24 @@ def main():
# print "--"+console_log
# report if the test is failed
- if "vPing OK" in output:
- logger.info("vPing detected!")
-
- # we consider start time at VM1 booting
- end_time_ts = time.time()
- duration = round(end_time_ts - start_time_ts, 1)
- logger.info("vPing duration:'%s'" % duration)
- EXIT_CODE = 0
+ for line in output:
+ if "vPing OK" in output:
+ logger.info("vPing detected!")
+
+ # we consider start time at VM1 booting
+ end_time_ts = time.time()
+ duration = round(end_time_ts - start_time_ts, 1)
+ logger.info("vPing duration:'%s'" % duration)
+ EXIT_CODE = 0
+ flag = True
+ break
+ elif sec == PING_TIMEOUT:
+ logger.info("Timeout reached.")
+ flag = True
+ break
+ if flag :
break
- elif sec == PING_TIMEOUT:
- logger.info("Timeout reached.")
- break
- else:
- logger.debug("Pinging %s. Waiting for response..." % IP_2)
+ logger.debug("Pinging %s. Waiting for response..." % IP_1)
sec += 1
cleanup(nova_client, neutron_client, image_id, network_dic,