Prepare run_tests to be called directly to main() 19/31919/2
authorjose.lausuch <jose.lausuch@ericsson.com>
Mon, 27 Mar 2017 15:01:48 +0000 (17:01 +0200)
committerjose.lausuch <jose.lausuch@ericsson.com>
Mon, 27 Mar 2017 15:27:55 +0000 (17:27 +0200)
Instead of python -> bash -> python, call
the BGPVPN test using main()

Change-Id: I8cca741814937e0a7a1d8b848fa8658e4f0d6fb5
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
sdnvpn/test/functest/run_tests.py

index 1130759..140aee2 100644 (file)
@@ -20,13 +20,7 @@ import functest.utils.functest_utils as ft_utils
 from sdnvpn.lib import config as sdnvpn_config
 
 
-parser = argparse.ArgumentParser()
-parser.add_argument("-r", "--report",
-                    help="Create json result file",
-                    action="store_true")
-args = parser.parse_args()
-
-logger = ft_logger.Logger("sdnvpn-run-tests").getLogger()
+logger = ft_logger.Logger(__name__).getLogger()
 
 COMMON_CONFIG = sdnvpn_config.CommonConfig()
 TEST_DB_URL = COMMON_CONFIG.test_db
@@ -42,7 +36,7 @@ def push_results(testname, start_time, end_time, criteria, details):
                                 details)
 
 
-def main():
+def main(report=False):
     # Workaround for https://jira.opnfv.org/projects/SDNVPN/issues/SDNVPN-100
     # and SDNVPN-126
     cmd_line = "neutron quota-update --subnet -1 --network -1 --port -1"
@@ -88,7 +82,7 @@ def main():
                 if status == "FAIL":
                     overall_status = "FAIL"
 
-            if args.report:
+            if report:
                 push_results(
                     test_name_db, start_time, end_time, status, details)
 
@@ -99,4 +93,9 @@ def main():
 
 
 if __name__ == '__main__':
-    main()
+    parser = argparse.ArgumentParser()
+    parser.add_argument("-r", "--report",
+                        help="Create json result file",
+                        action="store_true")
+    args = parser.parse_args()
+    main(report=args.report)