summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--functest/ci/exec_test.sh3
-rwxr-xr-xfunctest/ci/testcases.yaml4
-rw-r--r--functest/opnfv_tests/vnf/__init__.py0
-rw-r--r--functest/opnfv_tests/vnf/vRNC/__init__.py0
-rwxr-xr-xfunctest/opnfv_tests/vnf/vRNC/parser.py87
5 files changed, 50 insertions, 44 deletions
diff --git a/functest/ci/exec_test.sh b/functest/ci/exec_test.sh
index cc885c4cb..576784297 100644
--- a/functest/ci/exec_test.sh
+++ b/functest/ci/exec_test.sh
@@ -153,9 +153,6 @@ function run_test(){
source ${ODL_SFC_DIR}/tackerc
python ${ODL_SFC_DIR}/sfc.py $report
;;
- "parser")
- python ${FUNCTEST_TEST_DIR}/vnf/vRNC/parser.py $report
- ;;
*)
echo "The test case '${test_name}' does not exist."
exit 1
diff --git a/functest/ci/testcases.yaml b/functest/ci/testcases.yaml
index a5ddcf235..e5424a63d 100755
--- a/functest/ci/testcases.yaml
+++ b/functest/ci/testcases.yaml
@@ -231,7 +231,9 @@ tiers:
dependencies:
installer: 'fuel'
scenario: '^((?!bgpvpn|noha).)*$'
-
+ run:
+ module: 'functest.opnfv_tests.vnf.vRNC.parser'
+ class: 'Parser'
-
name: openstack
order: 4
diff --git a/functest/opnfv_tests/vnf/__init__.py b/functest/opnfv_tests/vnf/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/functest/opnfv_tests/vnf/__init__.py
diff --git a/functest/opnfv_tests/vnf/vRNC/__init__.py b/functest/opnfv_tests/vnf/vRNC/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/functest/opnfv_tests/vnf/vRNC/__init__.py
diff --git a/functest/opnfv_tests/vnf/vRNC/parser.py b/functest/opnfv_tests/vnf/vRNC/parser.py
index 33d4d50c0..c8d82bf7d 100755
--- a/functest/opnfv_tests/vnf/vRNC/parser.py
+++ b/functest/opnfv_tests/vnf/vRNC/parser.py
@@ -14,57 +14,64 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-import argparse
+import sys
import time
-import functest.utils.functest_logger as ft_logger
-import functest.utils.functest_utils as functest_utils
-import functest.utils.functest_constants as ft_constants
+import argparse
-parser = argparse.ArgumentParser()
-parser.add_argument("-r", "--report",
- help="Create json result file",
- action="store_true")
-args = parser.parse_args()
+import functest.core.TestCasesBase as base
+import functest.utils.functest_logger as ft_logger
+import functest.utils.functest_utils as ft_utils
-PARSER_REPO = ft_constants.PARSER_REPO
-RESULTS_DIR = ft_constants.FUNCTEST_RESULTS_DIR
-logger = ft_logger.Logger("parser").getLogger()
+class Parser(base.TestCasesBase):
+ def __init__(self):
+ super(Parser, self).__init__()
+ self.project_name = "parser"
+ self.case_name = "parser-basics"
+ self.parser_repo = self.get_conf('general.directories.dir_repo_parser')
+ self.results_dir = self.get_conf('general.directories.dir_results')
+ self.logger = ft_logger.Logger("parser").getLogger()
+ self.log_file = self.results_dir + '/parser.log'
+ def run(self, **kwargs):
+ cmd = 'cd %s/tests && ./functest_run.sh' % self.parser_repo
-def main():
- project = 'parser'
- case_name = 'parser-basics'
- cmd = 'cd %s/tests && ./functest_run.sh' % PARSER_REPO
+ self.start_time = time.time()
+ ret = ft_utils.execute_command(cmd,
+ info=True,
+ output_file=self.log_file)
+ self.stop_time = time.time()
- start_time = time.time()
- log_file = RESULTS_DIR + "/parser.log"
- ret = functest_utils.execute_command(cmd,
- info=True,
- output_file=log_file)
- stop_time = time.time()
+ self.criteria, details = ft_utils.check_test_result(self.project_name,
+ ret,
+ self.start_time,
+ self.stop_time)
- status, details = functest_utils.check_test_result(project,
- ret,
- start_time,
- stop_time)
+ ft_utils.logger_test_results(self.project_name,
+ self.case_name,
+ self.criteria,
+ details)
- functest_utils.logger_test_results(project,
- case_name,
- status,
- details)
+ return ret
- if args.report:
- logger.debug("Report Parser Results to DB......")
- functest_utils.push_results_to_db(project,
- case_name,
- start_time,
- stop_time,
- status,
- details)
- exit(ret)
+ @staticmethod
+ def get_conf(parameter):
+ return ft_utils.get_functest_config(parameter)
if __name__ == '__main__':
- main()
+ args_parser = argparse.ArgumentParser()
+ args_parser.add_argument("-r", "--report",
+ help="Create json result file",
+ action="store_true")
+ args = vars(args_parser.parse_args())
+ parser = Parser()
+ try:
+ result = parser.run(**args)
+ if result != base.TestCasesBase.EX_OK:
+ sys.exit(result)
+ if args['report']:
+ sys.exit(parser.push_to_db())
+ except Exception:
+ sys.exit(base.TestCasesBase.EX_RUN_ERROR)