From c9ae2766fd566358a1ac3a38a7dc6f7b22a3449f Mon Sep 17 00:00:00 2001 From: Martin Klozik Date: Wed, 23 Aug 2017 14:31:31 +0100 Subject: opnfvresultdb: Update data reported to result DB Data reported to result DB were updated to comply with recent API version and requirements. JIRA: VSPERF-488 Change-Id: I6ab02ea54d99099e88b0d5ab6e9745ee8297f544 Signed-off-by: Martin Klozik Signed-off-by: Mars Toktonaliev Signed-off-by: Morgan Richomme Reviewed-by: Al Morton Reviewed-by: Christian Trautman Reviewed-by: Sridhar Rao Reviewed-by: Trevor Cooper --- testcases/testcase.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'testcases') diff --git a/testcases/testcase.py b/testcases/testcase.py index a213bbe8..01b3a975 100644 --- a/testcases/testcase.py +++ b/testcases/testcase.py @@ -24,6 +24,7 @@ import re import time import subprocess +from datetime import datetime as dt from conf import settings as S from conf import get_test_param, merge_spec import core.component_factory as component_factory @@ -58,6 +59,7 @@ class TestCase(object): cfg = copy.deepcopy(test_cfg) self._testcase_start_time = time.time() + self._testcase_stop_time = self._testcase_start_time self._hugepages_mounted = False self._traffic_ctl = None self._vnf_ctl = None @@ -355,8 +357,9 @@ class TestCase(object): # tear down test execution environment and log results self.run_finalize() + self._testcase_stop_time = time.time() self._testcase_run_time = time.strftime("%H:%M:%S", - time.gmtime(time.time() - + time.gmtime(self._testcase_stop_time - self._testcase_start_time)) logging.info("Testcase execution time: " + self._testcase_run_time) # report test results @@ -394,6 +397,11 @@ class TestCase(object): item[ResultsConstants.VSWITCH] = S.getValue('VSWITCH') item[ResultsConstants.TRAFFIC_TYPE] = self._traffic['l3']['proto'] item[ResultsConstants.TEST_RUN_TIME] = self._testcase_run_time + # convert timestamps to human readable format + item[ResultsConstants.TEST_START_TIME] = dt.fromtimestamp( + self._testcase_start_time).strftime('%Y-%m-%d %H:%M:%S') + item[ResultsConstants.TEST_STOP_TIME] = dt.fromtimestamp( + self._testcase_stop_time).strftime('%Y-%m-%d %H:%M:%S') if self._traffic['multistream']: item[ResultsConstants.SCAL_STREAM_COUNT] = self._traffic['multistream'] item[ResultsConstants.SCAL_STREAM_TYPE] = self._traffic['stream_type'] -- cgit 1.2.3-korg