From 6da6b66a1affe7a79180a49534602a02e7994c7f Mon Sep 17 00:00:00 2001 From: Martin Klozik Date: Mon, 11 Jan 2016 17:56:45 +0100 Subject: reporting: add vswitch, vnf and trafficgen version into the report Final test report MD file should contain information about version of vswitch, vnf, VM loopback forwarding application and traffic generator used during the test. In case that component is cloned from GIT repository, then hash of its recent commit should be part of the report too. Change-Id: I4eb398bc95bc5030d0852d08bcf9febbf17640d4 JIRA: VSPERF-172 Signed-off-by: Martin Klozik Reviewed-by: Maryam Tahhan Reviewed-by: Radek Zetik Reviewed-by: Al Morton Reviewed-by: Brian Castelli Reviewed-by: Tv Rao --- tools/report/report.jinja | 11 ++++++++++- tools/report/report.py | 39 ++++++++++++++++++++++++--------------- 2 files changed, 34 insertions(+), 16 deletions(-) (limited to 'tools/report') diff --git a/tools/report/report.jinja b/tools/report/report.jinja index 6542a202..f59dba72 100644 --- a/tools/report/report.jinja +++ b/tools/report/report.jinja @@ -61,7 +61,16 @@ Below is the environment that the test was performed in: - CPU cores: {{tests[0].env.cpu_cores}} - Memory: {{tests[0].env.memory}} - Virtual Switch Set-up: {{tests[0].deployment}} -- IxNetwork: {{tests[0].env.ixnetwork_ver}} +- vswitchperf: GIT tag: {{tests[0].env.vsperf['git_tag']}} +- Traffic Generator: {{tests[0].env.traffic_gen['name']}}, Version: {{tests[0].env.traffic_gen['version']}}, GIT tag: {{tests[0].env.traffic_gen['git_tag']}} +- vSwitch: {{tests[0].env.vswitch['name']}}, Version: {{tests[0].env.vswitch['version']}}, GIT tag: {{tests[0].env.vswitch['git_tag']}} +- DPDK Version: {{tests[0].env.dpdk['version']}}, GIT tag: {{tests[0].env.dpdk['git_tag']}} +{%- if 'vnf' in tests[0].env %} +- VNF: {{tests[0].env.vnf['name']}}, Version: {{tests[0].env.vnf['version']}}, GIT tag: {{tests[0].env.vnf['git_tag']}} +- VM images: {% for guest_image in tests[0].env.guest_image %}{{guest_image}} {% endfor %} +- VM loopback apps: {% for loopback_app in tests[0].env.loopback_app %}{{loopback_app['name']}}, Version: {{loopback_app['version']}}, GIT tag: {{loopback_app['git_tag']}} + {% endfor %} +{%- endif %} For each test, a summary of the key test results is provided. {% for test in tests %} diff --git a/tools/report/report.py b/tools/report/report.py index d51ff47d..4264c055 100644 --- a/tools/report/report.py +++ b/tools/report/report.py @@ -1,4 +1,4 @@ -# Copyright 2015 Intel Corporation. +# Copyright 2015-2016 Intel Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -24,14 +24,14 @@ import jinja2 import logging from core.results.results_constants import ResultsConstants -from conf import settings +from conf import settings as S from tools import systeminfo _TEMPLATE_FILE = 'report.jinja' _ROOT_DIR = os.path.normpath(os.path.dirname(os.path.realpath(__file__))) -def _get_env(): +def _get_env(result): """ Get system configuration. @@ -53,8 +53,18 @@ def _get_env(): 'cpu_cores': systeminfo.get_cpu_cores(), 'memory' : systeminfo.get_memory(), 'platform': systeminfo.get_platform(), + 'vsperf': systeminfo.get_version('vswitchperf'), + 'traffic_gen': systeminfo.get_version(S.getValue('TRAFFICGEN')), + 'vswitch': systeminfo.get_version(S.getValue('VSWITCH')), + 'dpdk': systeminfo.get_version('dpdk'), } + if result[ResultsConstants.DEPLOYMENT].count('v'): + env.update({'vnf': systeminfo.get_version(S.getValue('VNF')), + 'guest_image': S.getValue('GUEST_IMAGE'), + 'loopback_app': list(map(systeminfo.get_version, S.getValue('GUEST_LOOPBACK'))), + }) + return env @@ -78,28 +88,27 @@ def generate(input_file, tc_results, tc_stats): try: for result in tc_results: test_config = {} - for tc_conf in settings.getValue('PERFORMANCE_TESTS'): + for tc_conf in S.getValue('PERFORMANCE_TESTS'): if tc_conf['Name'] == result[ResultsConstants.ID]: test_config = tc_conf break - # remove id and deployment from results but store their values - tc_id = result[ResultsConstants.ID] - tc_deployment = result[ResultsConstants.DEPLOYMENT] - del result[ResultsConstants.ID] - del result[ResultsConstants.DEPLOYMENT] - # pass test results, env details and configuration to template tests.append({ - 'ID': tc_id.upper(), - 'id': tc_id, - 'deployment': tc_deployment, + 'ID': result[ResultsConstants.ID].upper(), + 'id': result[ResultsConstants.ID], + 'deployment': result[ResultsConstants.DEPLOYMENT], 'conf': test_config, 'result': result, - 'env': _get_env(), + 'env': _get_env(result), 'stats': tc_stats }) + # remove id and deployment from results before rendering + # but after _get_env() is called; tests dict has its shallow copy + del result[ResultsConstants.ID] + del result[ResultsConstants.DEPLOYMENT] + template_vars = { 'tests': tests, } @@ -117,6 +126,6 @@ def generate(input_file, tc_results, tc_stats): if __name__ == '__main__': - settings.load_from_dir('conf') + S.load_from_dir('conf') OUT = generate(sys.argv[1], '', '') print('Test report written to "%s"...' % OUT) -- cgit 1.2.3-korg