aboutsummaryrefslogtreecommitdiffstats
path: root/sfc/tests/functest/run_sfc_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'sfc/tests/functest/run_sfc_tests.py')
-rw-r--r--sfc/tests/functest/run_sfc_tests.py28
1 files changed, 17 insertions, 11 deletions
diff --git a/sfc/tests/functest/run_sfc_tests.py b/sfc/tests/functest/run_sfc_tests.py
index a1e73040..7c0b9d15 100644
--- a/sfc/tests/functest/run_sfc_tests.py
+++ b/sfc/tests/functest/run_sfc_tests.py
@@ -1,4 +1,4 @@
-#!/bin/python
+#!/usr/bin/env python
#
# Copyright (c) 2015 All rights reserved
# This program and the accompanying materials
@@ -11,18 +11,17 @@
import importlib
import os
import time
+import logging
import sys
import yaml
-from functest.core import testcase
+from collections import OrderedDict
from opnfv.utils import ovs_logger as ovs_log
from opnfv.deployment.factory import Factory as DeploymentFactory
from sfc.lib import cleanup as sfc_cleanup
from sfc.lib import config as sfc_config
from sfc.lib import odl_utils as odl_utils
-
-from collections import OrderedDict
-import logging
+from xtesting.core import testcase
logger = logging.getLogger(__name__)
COMMON_CONFIG = sfc_config.CommonConfig()
@@ -104,7 +103,7 @@ class SfcFunctest(testcase.TestCase):
self.__disable_heat_resource_finder_cache_apex(controllers)
elif installer_type == "fuel":
self.__disable_heat_resource_finder_cache_fuel(controllers)
- elif installer_type == "osa":
+ elif installer_type == "osa" or "compass":
pass
else:
raise Exception('Unsupported installer')
@@ -149,12 +148,20 @@ class SfcFunctest(testcase.TestCase):
(test_name, test_descr))
logger.info(title)
logger.info("%s\n" % ("=" * len(title)))
- t = importlib.import_module(
+ module = importlib.import_module(
"sfc.tests.functest.{0}".format(test_name),
package=None)
+
+ testcase_config = sfc_config.TestcaseConfig(test_name)
+ supported_installers = test_cfg['supported_installers']
+ vnf_names = test_cfg['vnf_names']
+
+ tc_class = getattr(module, test_cfg['class_name'])
+ tc_instance = tc_class(testcase_config, supported_installers,
+ vnf_names)
start_time = time.time()
try:
- result, creators = t.main()
+ result, creators = tc_instance.run()
except Exception as e:
logger.error("Exception when executing: %s" % test_name)
logger.error(e)
@@ -187,8 +194,7 @@ class SfcFunctest(testcase.TestCase):
return testcase.TestCase.EX_RUN_ERROR
-if __name__ == '__main__':
- logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(name)s'
- '- %(levelname)s - %(message)s')
+def main():
+ logging.basicConfig(level=logging.INFO)
SFC = SfcFunctest()
sys.exit(SFC.run())