aboutsummaryrefslogtreecommitdiffstats
path: root/testcases/vPing
diff options
context:
space:
mode:
authorJose Lausuch <jose.lausuch@ericsson.com>2016-01-27 09:53:50 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-01-27 09:53:51 +0000
commitdcb741e8e0cfabd2f8eaa6df255e58c5b3389a22 (patch)
tree435faf24037e3bd93f64d3b15d4ea4ced638d003 /testcases/vPing
parent5423e53c8c88fcdd62197671ac7e101bb952c783 (diff)
parentecc77fad440a63627755e7ff042a98f34f3e9b75 (diff)
Merge "FUNCTEST-127 FIx the condition judgment of vping"
Diffstat (limited to 'testcases/vPing')
-rw-r--r--testcases/vPing/CI/libraries/vPing2.py37
1 files changed, 21 insertions, 16 deletions
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,