summaryrefslogtreecommitdiffstats
path: root/dovetail/report.py
diff options
context:
space:
mode:
authorStamatis Katsaounis <mokats@intracom-telecom.com>2019-01-24 15:46:09 +0200
committerStamatis Katsaounis <mokats@intracom-telecom.com>2019-02-01 07:38:35 +0000
commit6b9e62527829867f52a8d18efb09d85b76b35436 (patch)
tree992ead76dc790a4812990ab4f77a5728293cfa3f /dovetail/report.py
parentb7ee5abe9b73cbc0928bf9ac080a6aecf05bcb7e (diff)
Add ONAP VVP Heat Template validation tests
Change-Id: I9a3d56932ce41191901381831013768d1c57a749 Signed-off-by: Stamatis Katsaounis <mokats@intracom-telecom.com>
Diffstat (limited to 'dovetail/report.py')
-rw-r--r--dovetail/report.py88
1 files changed, 73 insertions, 15 deletions
diff --git a/dovetail/report.py b/dovetail/report.py
index ce88ed13..0918e42a 100644
--- a/dovetail/report.py
+++ b/dovetail/report.py
@@ -29,7 +29,8 @@ from testcase import Testcase
class Report(object):
results = {'functest': {}, 'yardstick': {}, 'functest-k8s': {},
- 'bottlenecks': {}, 'shell': {}, 'vnftest': {}, 'onap-vtp': {}}
+ 'bottlenecks': {}, 'shell': {}, 'vnftest': {}, 'onap-vtp': {},
+ 'onap-vvp': {}}
logger = None
@@ -488,15 +489,52 @@ class OnapVtpCrawler(Crawler):
return json_results
+class OnapVvpCrawler(Crawler):
+
+ logger = None
+
+ def __init__(self):
+ self.type = 'onap-vvp'
+ self.logger.debug('Create crawler: {}'.format(self.type))
+
+ @classmethod
+ def create_log(cls):
+ cls.logger = dt_logger.Logger(__name__ + '.OnapVvpCrawler').getLogger()
+
+ def crawl(self, testcase, file_path):
+ return self.crawl_from_file(testcase, file_path)
+
+ def crawl_from_file(self, testcase, file_path):
+ if not os.path.exists(file_path):
+ self.logger.error('Result file not found: {}'.format(file_path))
+ return None
+ criteria = 'FAIL'
+ with open(file_path, 'r') as f:
+ try:
+ data = json.load(f)
+ criteria = data['outcome']
+ except KeyError as e:
+ self.logger.exception('Outcome field not found {}'.format(e))
+ except ValueError:
+ self.logger.exception('Result file has invalid format')
+ json_results = {'criteria': criteria}
+
+ testcase.set_results(json_results)
+ return json_results
+
+
class CrawlerFactory(object):
- CRAWLER_MAP = {'functest': FunctestCrawler,
- 'yardstick': YardstickCrawler,
- 'bottlenecks': BottlenecksCrawler,
- 'vnftest': VnftestCrawler,
- 'shell': ShellCrawler,
- 'functest-k8s': FunctestK8sCrawler,
- 'onap-vtp': OnapVtpCrawler}
+ CRAWLER_MAP = {
+ 'functest': FunctestCrawler,
+ 'yardstick': YardstickCrawler,
+ 'bottlenecks': BottlenecksCrawler,
+ 'vnftest': VnftestCrawler,
+ 'shell': ShellCrawler,
+ 'functest-k8s': FunctestK8sCrawler,
+ 'onap-vtp': OnapVtpCrawler,
+ 'onap-vvp': OnapVvpCrawler
+ }
@classmethod
def create(cls, type):
@@ -667,15 +705,35 @@ class OnapVtpChecker(object):
return
+class OnapVvpChecker(object):
+
+ logger = None
+
+ @classmethod
+ def create_log(cls):
+ cls.logger = dt_logger.Logger(__name__ + '.OnapVvpChecker').getLogger()
+
+ @staticmethod
+ def check(testcase, result):
+ if not result:
+ testcase.passed('FAIL')
+ else:
+ testcase.passed(result['criteria'])
+ return
+
+
class CheckerFactory(object):
- CHECKER_MAP = {'functest': FunctestChecker,
- 'yardstick': YardstickChecker,
- 'bottlenecks': BottlenecksChecker,
- 'shell': ShellChecker,
- 'vnftest': VnftestChecker,
- 'functest-k8s': FunctestK8sChecker,
- 'onap-vtp': OnapVtpChecker}
+ CHECKER_MAP = {
+ 'functest': FunctestChecker,
+ 'yardstick': YardstickChecker,
+ 'bottlenecks': BottlenecksChecker,
+ 'shell': ShellChecker,
+ 'vnftest': VnftestChecker,
+ 'functest-k8s': FunctestK8sChecker,
+ 'onap-vtp': OnapVtpChecker,
+ 'onap-vvp': OnapVvpChecker
+ }
@classmethod
def create(cls, type):