summaryrefslogtreecommitdiffstats
path: root/testcases
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2015-08-19 07:52:39 +0100
committerMaryam Tahhan <maryam.tahhan@intel.com>2015-08-19 13:08:40 +0000
commitc99fda7cb1019c036c5caa828e2febe935d4aaf0 (patch)
tree257a8afeefd46372db4e7e2e60ecfd25793f078a /testcases
parent3af55a78fcd572f93b1a46178bffc4c8e90534f2 (diff)
Initial reporting implemenation
Reporting from TOIT was merged and improved. Default template was modified to support any testcase and to show more details about system environment. Affected files: * docs/NEWS.md * testcases/testcase.py * tools/report/__init__.py * tools/report/report.jinja * tools/report/report.py * tools/systeminfo.py * vsperf JIRA: VSPERF-71 Change-Id: I4dc84ca69e5c292eae1f8dede1411c06ae3ef8af Signed-off-by: Martin Klozik (martinx.klozik@intel.com) Reviewed-by: Maryam Tahhan <maryam.tahhan@intel.com> Reviewed-by: Billy O Mahony <billy.o.mahony@intel.com>
Diffstat (limited to 'testcases')
-rw-r--r--testcases/testcase.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/testcases/testcase.py b/testcases/testcase.py
index 77d5992d..6191a117 100644
--- a/testcases/testcase.py
+++ b/testcases/testcase.py
@@ -19,6 +19,7 @@ import os
import logging
from collections import OrderedDict
+from core.results.results_constants import ResultsConstants
import core.component_factory as component_factory
from core.loader import Loader
@@ -39,7 +40,7 @@ class TestCase(object):
self.name = cfg['Name']
self.desc = cfg.get('Description', 'No description given.')
self._traffic_type = cfg['Traffic Type']
- self._deployment = cfg['Deployment']
+ self.deployment = cfg['Deployment']
self._collector = cfg['Collector']
self._bidir = cfg['biDirectional']
self._frame_mod = cfg.get('Frame Modification', None)
@@ -61,10 +62,10 @@ class TestCase(object):
self._traffic_type,
loader.get_trafficgen_class())
vnf_ctl = component_factory.create_vnf(
- self._deployment,
+ self.deployment,
loader.get_vnf_class())
vswitch_ctl = component_factory.create_vswitch(
- self._deployment,
+ self.deployment,
loader.get_vswitch_class(),
self._bidir)
collector_ctl = component_factory.create_collector(
@@ -98,13 +99,28 @@ class TestCase(object):
self._logger.debug("Collector Results:")
self._logger.debug(collector_ctl.get_results())
+ output_file = "result_" + self.name + "_" + self.deployment +".csv"
- output_file = "result_" + self.name + "_" + self._deployment +".csv"
-
- self._write_result_to_file(
- traffic_ctl.get_results(),
+ TestCase._write_result_to_file(
+ self._append_results(traffic_ctl.get_results()),
os.path.join(self._results_dir, output_file))
+ def _append_results(self, results):
+ """
+ Method appends mandatory Test Case results to list of dictionaries.
+
+ :param results: list of dictionaries which contains results from
+ traffic generator.
+
+ :returns: modified list of dictionaries.
+ """
+ for item in results:
+ item[ResultsConstants.ID] = self.name
+ item[ResultsConstants.DEPLOYMENT] = self.deployment
+
+ return results
+
+
@staticmethod
def _write_result_to_file(results, output):
"""Write list of dictionaries to a CSV file.