Host openstack utils in SDNVPN
[sdnvpn.git] / sdnvpn / test / functest / tempest.py
index 1acbb42..d34af0b 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 #
-# Copyright (c) 2015 All rights reserved
+# Copyright (c) 2017 All rights reserved
 # This program and the accompanying materials
 # are made available under the terms of the Apache License, Version 2.0
 # which accompanies this distribution, and is available at
@@ -9,23 +9,27 @@
 #
 #
 import ConfigParser
+import logging
 import os
 import re
 import shutil
 
-import functest.utils.functest_logger as ft_logger
-import functest.utils.functest_utils as ft_utils
+import functest.opnfv_tests.openstack.tempest.conf_utils as tempest_utils
 
-logger = ft_logger.Logger("sdnvpn-tempest").getLogger()
+logger = logging.getLogger('sdnvpn-tempest')
 
 
 def main():
-    src_tempest_dir = ft_utils.get_deployment_dir()
+    verifier_repo_dir = tempest_utils.get_verifier_repo_dir(None)
+    src_tempest_dir = tempest_utils.get_verifier_deployment_dir(None, None)
+
     if not src_tempest_dir:
         logger.error("Rally deployment not found.")
         exit(-1)
 
-    src_tempest_conf = src_tempest_dir + '/tempest.conf'
+    tempest_utils.configure_verifier(src_tempest_dir)
+
+    src_tempest_conf = os.path.join(src_tempest_dir, 'tempest.conf')
     bgpvpn_tempest_conf = src_tempest_dir + '/bgpvpn_tempest.conf'
 
     if not os.path.isfile(src_tempest_conf):
@@ -41,13 +45,14 @@ def main():
     with open(bgpvpn_tempest_conf, 'wb') as tempest_conf:
         config.write(tempest_conf)
 
-    cmd_line = (src_tempest_dir +
+    cmd_line = (verifier_repo_dir +
                 "/run_tempest.sh -C %s -t -N -- "
                 "networking_bgpvpn_tempest" % bgpvpn_tempest_conf)
     logger.info("Executing: %s" % cmd_line)
     cmd = os.popen(cmd_line)
     output = cmd.read()
     logger.debug(output)
+
     # Results parsing
     error_logs = ""
     duration = 0
@@ -75,7 +80,7 @@ def main():
         if int(failed) == 0:
             status = "PASS"
         else:
-            status = "FAILED"
+            status = "FAIL"
 
         return {"status": status, "details": results}
     except:
@@ -83,4 +88,5 @@ def main():
 
 
 if __name__ == '__main__':
+    logging.basicConfig(level=logging.INFO)
     main()