summaryrefslogtreecommitdiffstats
path: root/testcases/vPing
diff options
context:
space:
mode:
authorCNlukai <lukai1@huawei.com>2016-01-27 12:02:29 +0800
committerCNlukai <lukai1@huawei.com>2016-01-27 17:51:07 +0800
commitecc77fad440a63627755e7ff042a98f34f3e9b75 (patch)
treeab1eec8816869b405b2d8bbe0e1c8348ad205cd6 /testcases/vPing
parentc277f40e639c40c00a62bb84eda18dd0b8f7797e (diff)
FUNCTEST-127
FIx the condition judgment of vping Change-Id: I58abace66fb73e0531affc651194473718dfacd5 Signed-off-by: CNlukai <lukai1@huawei.com>
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,