aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2017-08-23 14:31:31 +0100
committerMartin Klozik <martinx.klozik@intel.com>2017-08-23 15:18:14 +0100
commitc9ae2766fd566358a1ac3a38a7dc6f7b22a3449f (patch)
tree81c1e918112dc2fa2d0f3120b241fe55f4df83f8
parent1375b9eff007b51af9b04b4c36975c39cc04cde8 (diff)
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 <martinx.klozik@intel.com> Signed-off-by: Mars Toktonaliev <mars.toktonaliev@nokia.com> Signed-off-by: Morgan Richomme <morgan.richomme@orange.com> Reviewed-by: Al Morton <acmorton@att.com> Reviewed-by: Christian Trautman <ctrautma@redhat.com> Reviewed-by: Sridhar Rao <sridhar.rao@spirent.com> Reviewed-by: Trevor Cooper <trevor.cooper@intel.com>
-rw-r--r--conf/10_custom.conf2
-rw-r--r--core/results/results_constants.py2
-rw-r--r--testcases/testcase.py10
-rw-r--r--tools/opnfvdashboard/opnfvdashboard.py13
-rwxr-xr-xvsperf15
5 files changed, 39 insertions, 3 deletions
diff --git a/conf/10_custom.conf b/conf/10_custom.conf
index 1d62c0ce..9622fd71 100644
--- a/conf/10_custom.conf
+++ b/conf/10_custom.conf
@@ -118,7 +118,7 @@ TRAFFICGEN_MOONGEN_LINE_SPEED_GBPS = '10'
#TEST_PARAMS = {'TRAFFICGEN_PKT_SIZES':(64,)}
OPNFV_INSTALLER = "Fuel"
-OPNFV_URL = "http://testresults.opnfv.org/testapi"
+OPNFV_URL = "http://testresults.opnfv.org/test/api/v1"
PACKAGE_LIST = "src/package-list.mk"
diff --git a/core/results/results_constants.py b/core/results/results_constants.py
index f6fbaad2..ef2df847 100644
--- a/core/results/results_constants.py
+++ b/core/results/results_constants.py
@@ -66,6 +66,8 @@ class ResultsConstants(object):
OPTIMAL_LEARNING_RATE_FPS = 'optimal_learning_rate_fps'
TEST_RUN_TIME = "test_execution_time"
+ TEST_START_TIME = "start_time"
+ TEST_STOP_TIME = "stop_time"
@staticmethod
def get_traffic_constants():
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']
diff --git a/tools/opnfvdashboard/opnfvdashboard.py b/tools/opnfvdashboard/opnfvdashboard.py
index 3f465c04..c24b9f8c 100644
--- a/tools/opnfvdashboard/opnfvdashboard.py
+++ b/tools/opnfvdashboard/opnfvdashboard.py
@@ -45,12 +45,20 @@ def _push_results(reader, int_data):
version = ""
allowed_pkt = ["64", "128", "512", "1024", "1518"]
details = {"64": '', "128": '', "512": '', "1024": '', "1518": ''}
+ test_start = None
+ test_stop = None
for row_reader in reader:
if allowed_pkt.count(row_reader['packet_size']) == 0:
logging.error("The framesize is not supported in opnfv dashboard")
continue
+ # test execution time includes all frame sizes, so start & stop time
+ # is the same (repeated) for every framesize in CSV file
+ if test_start is None:
+ test_start = row_reader['start_time']
+ test_stop = row_reader['stop_time']
+
casename = _generate_test_name(row_reader['id'], int_data)
if "back2back" in row_reader['id']:
details[row_reader['packet_size']] = row_reader['b2b_frames']
@@ -73,10 +81,15 @@ def _push_results(reader, int_data):
# Build body
body = {"project_name": "vsperf",
+ "scenario": "vsperf",
+ "start_date": test_start,
+ "stop_date": test_stop,
"case_name": casename,
"pod_name": int_data['pod'],
"installer": int_data['installer'],
"version": version,
+ "build_tag": int_data['build_tag'],
+ "criteria": int_data['criteria'],
"details": details}
my_data = requests.post(url, json=body)
diff --git a/vsperf b/vsperf
index bb0e199b..f4bc63b8 100755
--- a/vsperf
+++ b/vsperf
@@ -306,7 +306,18 @@ def get_vswitch_names(rst_files):
# fallback to the default value
return ['vSwitch']
+def get_build_tag():
+ """ Function will return a Jenkins job ID environment variable.
+ """
+
+ try:
+ build_tag = os.environ['BUILD_TAG']
+
+ except KeyError:
+ _LOGGER.warning('Cannot detect Jenkins job ID')
+ build_tag = "none"
+ return build_tag
def generate_final_report():
""" Function will check if partial test results are available
@@ -692,12 +703,14 @@ def main():
if args['opnfvpod']:
pod_name = args['opnfvpod']
- installer_name = settings.getValue('OPNFV_INSTALLER')
+ installer_name = str(settings.getValue('OPNFV_INSTALLER')).lower()
opnfv_url = settings.getValue('OPNFV_URL')
pkg_list = settings.getValue('PACKAGE_LIST')
int_data = {'vanilla': False,
'pod': pod_name,
+ 'criteria': "PASS",
+ 'build_tag': get_build_tag(),
'installer': installer_name,
'pkg_list': pkg_list,
'db_url': opnfv_url}