aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2016-12-21 14:51:30 +0100
committerjose.lausuch <jose.lausuch@ericsson.com>2016-12-21 16:13:50 +0100
commit9ed0c2088646f497300e6048ced2e1b2fd87bdfe (patch)
tree5b831bc8446d40d761fcf94b21be8fbeb39a0665
parenta59fea1046d167b4609c9b86836d178e799dc688 (diff)
Adapt SDNVPN tests using Featurebase
Change-Id: I8be4bb72ba1d3b7eb2ba6e1edccf61d4186e07c6 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
-rwxr-xr-xfunctest/ci/config_functest.yaml22
-rwxr-xr-xfunctest/opnfv_tests/features/sdnvpn.py70
-rw-r--r--functest/utils/functest_constants.py2
3 files changed, 19 insertions, 75 deletions
diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml
index a819a5795..6be73d94b 100755
--- a/functest/ci/config_functest.yaml
+++ b/functest/ci/config_functest.yaml
@@ -12,26 +12,26 @@ general:
# Absolute path
dir_home: /home/opnfv
dir_repos: /home/opnfv/repos
- repo_functest: /home/opnfv/repos/functest
+ repo_functest: /home/opnfv/repos/functest
dir_repo_rally: /home/opnfv/repos/rally
- repo_tempest: /home/opnfv/repos/tempest
+ repo_tempest: /home/opnfv/repos/tempest
dir_repo_releng: /home/opnfv/repos/releng
dir_repo_vims_test: /home/opnfv/repos/vims-test
- dir_repo_sdnvpn: /home/opnfv/repos/sdnvpn
- repo_sfc: /home/opnfv/repos/sfc
+ repo_sdnvpn: /home/opnfv/repos/sdnvpn
+ repo_sfc: /home/opnfv/repos/sfc
dir_repo_onos: /home/opnfv/repos/onos
dir_repo_promise: /home/opnfv/repos/promise
dir_repo_doctor: /home/opnfv/repos/doctor
- repo_copper: /home/opnfv/repos/copper
+ repo_copper: /home/opnfv/repos/copper
dir_repo_ovno: /home/opnfv/repos/ovno
- repo_parser: /home/opnfv/repos/parser
+ repo_parser: /home/opnfv/repos/parser
dir_repo_domino: /home/opnfv/repos/domino
dir_repo_snaps: /home/opnfv/repos/snaps
- functest: /home/opnfv/functest
- functest_test: /home/opnfv/repos/functest/functest/opnfv_tests
- results: /home/opnfv/functest/results
- functest_conf: /home/opnfv/functest/conf
- functest_data: /home/opnfv/functest/data
+ functest: /home/opnfv/functest
+ functest_test: /home/opnfv/repos/functest/functest/opnfv_tests
+ results: /home/opnfv/functest/results
+ functest_conf: /home/opnfv/functest/conf
+ functest_data: /home/opnfv/functest/data
dir_vIMS_data: /home/opnfv/functest/data/vIMS/
dir_rally_inst: /home/opnfv/.rally
diff --git a/functest/opnfv_tests/features/sdnvpn.py b/functest/opnfv_tests/features/sdnvpn.py
index 451299eb3..1919a03c2 100755
--- a/functest/opnfv_tests/features/sdnvpn.py
+++ b/functest/opnfv_tests/features/sdnvpn.py
@@ -7,70 +7,14 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
#
+import functest.core.feature_base as base
-import argparse
-import os
-import sys
-import time
-
-import functest.core.testcase_base as testcase_base
-import functest.utils.functest_constants as ft_constants
-import functest.utils.functest_logger as ft_logger
-import functest.utils.functest_utils as ft_utils
-
-
-class SdnVpnTests(testcase_base.TestcaseBase):
- SDNVPN_REPO_TESTS = os.path.join(
- ft_constants.SDNVPN_REPO_DIR, "tests/functest")
- logger = ft_logger.Logger("sdnvpn").getLogger()
+class SdnVpnTests(base.FeatureBase):
def __init__(self):
- super(SdnVpnTests, self).__init__()
- self.project_name = "sdnvpn"
- self.case_name = "bgpvpn"
-
- def main(self, **kwargs):
- os.chdir(self.SDNVPN_REPO_TESTS)
- cmd = 'run_tests.py'
- log_file = os.path.join(
- ft_constants.FUNCTEST_RESULTS_DIR, "sdnvpn.log")
- start_time = time.time()
-
- ret = ft_utils.execute_command(cmd,
- output_file=log_file)
-
- stop_time = time.time()
- if ret == 0:
- self.logger.info("%s OK" % self.case_name)
- status = 'PASS'
- else:
- self.logger.info("%s FAILED" % self.case_name)
- status = "FAIL"
-
- # report status only if tests run (FAIL OR PASS)
- self.criteria = status
- self.start_time = start_time
- self.stop_time = stop_time
- self.details = {}
-
- def run(self):
- kwargs = {}
- return self.main(**kwargs)
-
-
-if __name__ == '__main__':
- parser = argparse.ArgumentParser()
- parser.add_argument("-r", "--report",
- help="Create json result file",
- action="store_true")
- args = vars(parser.parse_args())
- sdnvpn = SdnVpnTests()
- try:
- result = sdnvpn.main(**args)
- if result != testcase_base.TestcaseBase.EX_OK:
- sys.exit(result)
- if args['report']:
- sys.exit(sdnvpn.push_to_db())
- except Exception:
- sys.exit(testcase_base.TestcaseBase.EX_RUN_ERROR)
+ super(SdnVpnTests, self).__init__(project='sdnvpn',
+ case='bgpvpn',
+ repo='dir_repo_sdnvpn')
+ dir_sfc_functest = '{}/sdnvpn/test/functest'.format(self.repo)
+ self.cmd = 'cd %s && python ./run_tests.py' % dir_sfc_functest
diff --git a/functest/utils/functest_constants.py b/functest/utils/functest_constants.py
index dfa59eb37..991a2972f 100644
--- a/functest/utils/functest_constants.py
+++ b/functest/utils/functest_constants.py
@@ -89,7 +89,7 @@ OPENSTACK_SNAPSHOT_FILE = get_value('general.openstack.snapshot_file',
DOMINO_REPO_DIR = get_value('general.dir.dir_repo_domino',
'DOMINO_REPO_DIR')
-SDNVPN_REPO_DIR = get_value('general.dir.dir_repo_sdnvpn',
+SDNVPN_REPO_DIR = get_value('general.dir.repo_sdnvpn',
'SDNVPN_REPO_DIR')
SFC_REPO_DIR = get_value('general.dir.repo_sfc',
'SFC_REPO_DIR')