From de39be86dddc6fd590d9dbc9bad084e6be45aa13 Mon Sep 17 00:00:00 2001 From: Stamatis Katsaounis Date: Fri, 8 Feb 2019 11:38:08 +0200 Subject: Dynamic results version and vnf type recognition This patch makes it able to fetch the version from the testsuite. Furthermore, in case of ONAP test cases it adds the vnf_type to the produced results.json file in order to be parsed from the results portal. Finally, it creates a testuite for ONAP TOSCA related tests. Change-Id: I613358c445cfe62730b98fee5e8c6fba7d322e90 Signed-off-by: Stamatis Katsaounis --- dovetail/report.py | 5 ++++- dovetail/run.py | 4 ++++ dovetail/tests/unit/test_report.py | 8 ++++++-- etc/compliance/onap.1.0.0.yml | 2 ++ etc/compliance/onap.tosca.2019.04.yaml | 8 ++++++++ etc/compliance/ovp.2018.09.yaml | 1 + etc/conf/dovetail_config.yml | 1 + 7 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 etc/compliance/onap.tosca.2019.04.yaml diff --git a/dovetail/report.py b/dovetail/report.py index 0918e42a..9a41d299 100644 --- a/dovetail/report.py +++ b/dovetail/report.py @@ -71,11 +71,14 @@ class Report(object): # egeokun: using a hardcoded string instead of pbr version for # versioning the result file. The version of the results.json is # logically independent of the release of Dovetail. - report_obj['version'] = '2018.09' + report_obj['version'] = dt_cfg.dovetail_config.get('version') report_obj['build_tag'] = dt_cfg.dovetail_config['build_tag'] report_obj['test_date'] =\ datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S UTC') report_obj['duration'] = duration + vnf_type = dt_cfg.dovetail_config.get('vnf_type') + if vnf_type: + report_obj['vnf_type'] = vnf_type report_obj['testcases_list'] = [] if not testcase_list: diff --git a/dovetail/run.py b/dovetail/run.py index 04df9121..98d70011 100755 --- a/dovetail/run.py +++ b/dovetail/run.py @@ -229,6 +229,10 @@ def get_testcase_list(logger=None, **kwargs): if testsuite_validation and testarea_validation: testsuite_yaml = load_testsuite(testsuite) + dt_cfg.dovetail_config['version'] = dt_utils.get_value_from_dict( + 'version', testsuite_yaml) + dt_cfg.dovetail_config['vnf_type'] = dt_utils.get_value_from_dict( + 'vnf_type', testsuite_yaml) testcase_list = dt_testcase.Testcase.get_testcases_for_testsuite( testsuite_yaml, testarea) return check_testcase_list(testcase_list, logger) diff --git a/dovetail/tests/unit/test_report.py b/dovetail/tests/unit/test_report.py index 8cf2e025..d97cacf8 100644 --- a/dovetail/tests/unit/test_report.py +++ b/dovetail/tests/unit/test_report.py @@ -182,7 +182,8 @@ class ReportTesting(unittest.TestCase): testcase_list = ['ta.tb.tc', 'td.te.tf'] duration = 42 mock_config.dovetail_config = { - 'build_tag': 'build_tag' + 'build_tag': 'build_tag', + 'version': '2018.09' } utc_obj = Mock() utc_obj.strftime.return_value = '2018-01-13 13:13:13 UTC' @@ -232,7 +233,9 @@ class ReportTesting(unittest.TestCase): report.logger = logger_obj duration = 42 mock_config.dovetail_config = { - 'build_tag': 'build_tag' + 'build_tag': 'build_tag', + 'version': '2018.09', + 'vnf_type': 'tosca' } utc_obj = Mock() utc_obj.strftime.return_value = '2018-01-13 13:13:13 UTC' @@ -242,6 +245,7 @@ class ReportTesting(unittest.TestCase): expected = { 'version': '2018.09', 'build_tag': 'build_tag', + 'vnf_type': 'tosca', 'test_date': '2018-01-13 13:13:13 UTC', 'duration': duration, 'testcases_list': [] diff --git a/etc/compliance/onap.1.0.0.yml b/etc/compliance/onap.1.0.0.yml index e9e805c4..b7566b3f 100644 --- a/etc/compliance/onap.1.0.0.yml +++ b/etc/compliance/onap.1.0.0.yml @@ -1,6 +1,8 @@ --- onap.1.0.0: name: onap.1.0.0 + version: '1.0.0' + vnf_type: tosca testcases_list: optional: - onap.lifecycle.tc001 diff --git a/etc/compliance/onap.tosca.2019.04.yaml b/etc/compliance/onap.tosca.2019.04.yaml new file mode 100644 index 00000000..45df66ed --- /dev/null +++ b/etc/compliance/onap.tosca.2019.04.yaml @@ -0,0 +1,8 @@ +--- +onap.tosca.2019.04: + name: onap.tosca.2019.04 + version: '2019.04' + vnf_type: tosca + testcases_list: + mandatory: + - onap-vtp.validate.csar diff --git a/etc/compliance/ovp.2018.09.yaml b/etc/compliance/ovp.2018.09.yaml index 9821b4cb..14e92ac4 100644 --- a/etc/compliance/ovp.2018.09.yaml +++ b/etc/compliance/ovp.2018.09.yaml @@ -1,6 +1,7 @@ --- ovp.2018.09: name: ovp.2018.09 + version: '2018.09' testcases_list: mandatory: - functest.vping.userdata diff --git a/etc/conf/dovetail_config.yml b/etc/conf/dovetail_config.yml index 74f54c9c..a6aaab06 100644 --- a/etc/conf/dovetail_config.yml +++ b/etc/conf/dovetail_config.yml @@ -18,6 +18,7 @@ testsuite_supported: - debug - healthcheck - ovp.2018.09 + - onap.tosca.2019.04 - onap.1.0.0 # used for testcase cmd template in jinja2 format -- cgit 1.2.3-korg