aboutsummaryrefslogtreecommitdiffstats
path: root/testcases/features
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2016-09-12 18:17:07 +0200
committerJose Lausuch <jose.lausuch@ericsson.com>2016-09-13 08:09:04 +0000
commitb2c633fc572d842ea093ecab51356290eca1e692 (patch)
tree9d73c128f435c03ecacae1d61dde45dca6c19b71 /testcases/features
parentc0e15d39c9755a5dd7e1e086789d30561e0bf848 (diff)
[ODL-SFC] Add push resulst to DB
Change-Id: I314cbda828f6ebda70f7fb4e7d39e781696bc073 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'testcases/features')
-rwxr-xr-xtestcases/features/sfc/sfc.py60
1 files changed, 38 insertions, 22 deletions
diff --git a/testcases/features/sfc/sfc.py b/testcases/features/sfc/sfc.py
index c84810efa..5a361cda5 100755
--- a/testcases/features/sfc/sfc.py
+++ b/testcases/features/sfc/sfc.py
@@ -58,6 +58,11 @@ def main():
# Allow any port so that tacker commands reaches the server.
# This will be deleted when tacker is included in OPNFV installation
+ status = "PASS"
+ failures = 0
+ 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}'")
@@ -315,7 +320,7 @@ def main():
logger.info("Waiting for 60 seconds before TEST")
for j in range(0, 6):
- logger.info("Test starting in {0} seconds".format(str((6 - j)*10)))
+ logger.info("Test starting in {0} seconds".format(str((6 - j) * 10)))
time.sleep(10)
i = 0
@@ -333,10 +338,13 @@ def main():
logger.info('\033[92m' + "TEST 1 [PASSED] "
"==> SSH BLOCKED" + '\033[0m')
i = i + 1
+ json_results.update({"Test 1: SSH Blocked": "Passed"})
else:
logger.error('\033[91m' + "TEST 1 [FAILED] "
"==> SSH NOT BLOCKED" + '\033[0m')
- return
+ status = "FAIL"
+ json_results.update({"Test 1: SSH Blocked": "Failed"})
+ failures += 1
except:
logger.debug("Waiting for %s..." % floatip_client)
time.sleep(6)
@@ -353,10 +361,13 @@ def main():
logger.info('\033[92m' + "TEST 2 [PASSED] "
"==> HTTP WORKS" + '\033[0m')
i = i + 1
+ json_results.update({"Test 2: HTTP works": "Passed"})
else:
logger.error('\033[91m' + "TEST 2 [FAILED] "
"==> HTTP BLOCKED" + '\033[0m')
- return
+ status = "FAIL"
+ json_results.update({"Test 2: HTTP works": "Failed"})
+ failures += 1
except:
logger.debug("Waiting for %s..." % floatip_client)
time.sleep(6)
@@ -389,13 +400,16 @@ def main():
(stdin, stdout, stderr) = ssh.exec_command(command)
if "timed out" in stdout.readlines()[0]:
- logger.info('\033[92m' + "TEST 3 [WORKS] "
+ logger.info('\033[92m' + "TEST 3 [PASSED] "
"==> HTTP BLOCKED" + '\033[0m')
i = i + 1
+ json_results.update({"Test 3: HTTP Blocked": "Passed"})
else:
logger.error('\033[91m' + "TEST 3 [FAILED] "
"==> HTTP NOT BLOCKED" + '\033[0m')
- return
+ status = "FAIL"
+ json_results.update({"Test 3: HTTP Blocked": "Failed"})
+ failures += 1
except:
logger.debug("Waiting for %s..." % floatip_client)
time.sleep(6)
@@ -409,13 +423,16 @@ def main():
(stdin, stdout, stderr) = ssh.exec_command(command)
if "succeeded" in stdout.readlines()[0]:
- logger.info('\033[92m' + "TEST 4 [WORKS] "
+ logger.info('\033[92m' + "TEST 4 [PASSED] "
"==> SSH WORKS" + '\033[0m')
i = i + 1
+ json_results.update({"Test 4: SSH works": "Passed"})
else:
logger.error('\033[91m' + "TEST 4 [FAILED] "
"==> SSH BLOCKED" + '\033[0m')
- return
+ status = "FAIL"
+ json_results.update({"Test 4: SSH works": "Failed"})
+ failures += 1
except:
logger.debug("Waiting for %s..." % floatip_client)
time.sleep(6)
@@ -426,21 +443,20 @@ def main():
logger.info('\033[92m' + "SFC TEST WORKED"
" :) \n" + '\033[0m')
- # TODO report results to DB
- # functest_utils.logger_test_results("SFC",
- # "odl-sfc",
- # status, details)
- # see doctor, promise, domino, ...
- # if args.report:
- # logger.info("Pushing odl-SFC results")
- # functest_utils.push_results_to_db("functest",
- # "odl-sfc",
- # start_time,
- # stop_time,
- # status,
- # details)
-
- sys.exit(0)
+ if args.report:
+ stop_time = time.time()
+ json_results.update({"tests": "4", "failures": int(failures)})
+ logger.debug("Promise Results json: " + str(json_results))
+ ft_utils.push_results_to_db("sfc",
+ "functest-odl-sfc",
+ start_time,
+ stop_time,
+ status,
+ json_results)
+ if status == "PASS":
+ sys.exit(0)
+ else:
+ sys.exit(1)
if __name__ == '__main__':
main()