Results: Integrate with opnfv_test_dashboard 13/3913/3
authorRadek Zetik <radekx.zetik@intel.com>
Thu, 12 Nov 2015 20:07:40 +0000 (20:07 +0000)
committerMaryam Tahhan <maryam.tahhan@intel.com>
Tue, 8 Dec 2015 10:30:03 +0000 (10:30 +0000)
All the test projects generate results in different format.
The goal of a testing dashboard is to provide a consistent
view of the different tests from the different projects.
We need to enable the data collection for VSPERF, in other words
VSPERF pushes data using a REST API.
The feature is enabled by --opnfvpod parameter on vsperf command line.
The value of the parameter sets POD name.
Example:
--opnfvpod <pod_name>   or   --opnfvpod=<pod_name>
You need to specify installer name. It can be set in conf-file
default value:
OPNFV_INSTALLER = "Fuel"

JIRA: VSPERF-112

Change-Id: I37255414eebcc2ff0c12109c508dcd984663a830
Signed-off-by: Radek Zetik <radekx.zetik@intel.com>
Reviewed-by: Maryam Tahhan <maryam.tahhan@intel.com>
Reviewed-by: Brian Castelli <brian.castelli@spirent.com>
conf/10_custom.conf
docs/updates/NEWS.rst
tools/opnfvdashboard/__init__.py [new file with mode: 0644]
tools/opnfvdashboard/opnfvdashboard.py [new file with mode: 0644]
vsperf

index 8883cb7..28a3156 100644 (file)
@@ -61,3 +61,5 @@ TRAFFICGEN_IXNET_TESTER_RESULT_DIR = ''
 TRAFFICGEN_IXNET_DUT_RESULT_DIR = ''
 
 TEST_PARAMS = {'packet_sizes':'64'}
+
+OPNFV_INSTALLER = "Fuel"
index 0fe9e22..5618455 100755 (executable)
@@ -1,3 +1,9 @@
+November 2015
+==============
+New
+---
+- Support of opnfv_test_dashboard
+
 October 2015
 ==============
 New
diff --git a/tools/opnfvdashboard/__init__.py b/tools/opnfvdashboard/__init__.py
new file mode 100644 (file)
index 0000000..6cb0e6b
--- /dev/null
@@ -0,0 +1,18 @@
+# Copyright 2015 Intel Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""results to opnfvdashboardpackage.
+
+Contains generator json format of results for opnfv dashboard
+"""
diff --git a/tools/opnfvdashboard/opnfvdashboard.py b/tools/opnfvdashboard/opnfvdashboard.py
new file mode 100644 (file)
index 0000000..8aecfef
--- /dev/null
@@ -0,0 +1,106 @@
+"""
+vsperf2dashboard
+"""
+# Copyright 2015 Intel Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+import os
+import csv
+import requests
+import json
+import logging
+
+def results2opnfv_dashboard(results_path, int_data):
+    """
+    the method open the csv file with results and calls json encoder
+    """
+    testcases = os.listdir(results_path)
+    for test in testcases:
+        if not ".csv" in test:
+            continue
+        resfile = results_path + '/' + test
+        with open(resfile, 'r') as in_file:
+            reader = csv.DictReader(in_file)
+            _push_results(reader, int_data)
+
+def _push_results(reader, int_data):
+    """
+    the method encodes results and sends them into opnfv dashboard
+    """
+    db_url = "http://213.77.62.197"
+    url = db_url + "/results"
+    casename = ""
+    allowed_pkt = ["64", "128", "512", "1024", "1518"]
+    details = {"64": '', "128": '', "512": '', "1024": '', "1518": ''}
+
+    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
+
+        casename = _generate_test_name(row_reader['id'], int_data)
+        if "back2back" in row_reader['id']:
+            details[row_reader['packet_size']] = row_reader['b2b_frames']
+        else:
+            details[row_reader['packet_size']] = row_reader['throughput_rx_fps']
+
+    # Build body
+    body = {"project_name": "vsperf",
+            "case_name": casename,
+            "pod_name": int_data['pod'],
+            "installer": int_data['installer'],
+            "version": "OVS 2.4",
+            "details": details}
+
+    myData = requests.post(url, json=body)
+    logging.info("Results for %s sent to opnfv, http response: %s", casename, myData)
+    logging.debug("the body sent to opnfv")
+    logging.debug(body)
+
+def _generate_test_name(testcase, int_data):
+    """
+    the method generates testcase name for releng
+    """
+    cuse = int_data['cuse']
+    vanilla = int_data['vanilla']
+    res_name = ""
+
+    names = {'phy2phy_tput': ["tput_ovsdpdk", "tput_ovsdpdk", "tput_ovs"],
+             'back2back': ["b2b_ovsdpdk", "b2b_ovsdpdk", "b2b_ovs"],
+             'phy2phy_tput_mod_vlan': ["tput_mod_vlan_ovsdpdk", "tput_mod_vlan_ovsdpdk", "tput_mod_vlan_ovs"],
+             'phy2phy_cont': ["cont_ovsdpdk", "cont_ovsdpdk", "cont_ovs"],
+             'pvp_cont': ["pvp_cont_ovsdpdkuser", "pvp_cont_ovsdpdkcuse", "pvp_cont_ovsvirtio"],
+             'pvvp_cont': ["pvvp_cont_ovsdpdkuser", "pvvp_cont_ovsdpdkcuse", "pvvp_cont_ovsvirtio"],
+             'phy2phy_scalability': ["scalability_ovsdpdk", "scalability_ovsdpdk", "scalability_ovs"],
+             'pvp_tput': ["pvp_tput_ovsdpdkuser", "pvp_tput_ovsdpdkcuse", "pvp_tput_ovsvirtio"],
+             'pvp_back2back': ["pvp_b2b_ovsdpdkuser", "pvp_b2b_ovsdpdkcuse", "pvp_b2b_ovsvirtio"],
+             'pvvp_tput': ["pvvp_tput_ovsdpdkuser", "pvvp_tput_ovsdpdkcuse", "pvvp_tput_ovsvirtio"],
+             'pvvp_back2back': ["pvvp_b2b_ovsdpdkuser", "pvvp_b2b_ovsdpdkcuse", "pvvp_b2b_ovsvirtio"],
+             'phy2phy_cpu_load': ["cpu_load_ovsdpdk", "cpu_load_ovsdpdk", "cpu_load_ovs"],
+             'phy2phy_mem_load': ["mem_load_ovsdpdk", "mem_load_ovsdpdk", "mem_load_ovs"]}
+
+    for name, name_list in names.items():
+        if name != testcase:
+            continue
+        if vanilla == True:
+            res_name = name_list[2]
+        else:
+            if cuse == True:
+                res_name = name_list[1]
+            else:
+                res_name = name_list[0]
+        break
+
+    return res_name
diff --git a/vsperf b/vsperf
index e220e24..f6ddc63 100755 (executable)
--- a/vsperf
+++ b/vsperf
@@ -34,6 +34,7 @@ from core.loader import Loader
 from testcases import TestCase
 from tools import tasks
 from tools.pkt_gen import trafficgen
+from tools.opnfvdashboard import opnfvdashboard
 
 VERBOSITY_LEVELS = {
     'debug': logging.DEBUG,
@@ -153,6 +154,7 @@ def parse_arguments():
                        help='csv list of test parameters: key=val; e.g.'
                        'including pkt_sizes=x,y; duration=x; '
                        'rfc2544_trials=x ...')
+    group.add_argument('--opnfvpod', help='name of POD in opnfv')
 
     args = vars(parser.parse_args())
 
@@ -428,6 +430,20 @@ def main():
             output=settings.getValue('XUNIT_DIR'), outsuffix="",
             verbosity=0).run(suite)
 
+    if args['opnfvpod']:
+        pod_name = args['opnfvpod']
+        installer_name = settings.getValue('OPNFV_INSTALLER')
+
+        int_data = {'cuse': False,
+                    'vanilla': False,
+                    'pod': pod_name,
+                    'installer': installer_name}
+        if settings.getValue('VSWITCH').endswith('Vanilla'):
+            int_data['vanilla'] = True
+        if settings.getValue('VNF').endswith('Cuse'):
+            int_data['cuse'] = True
+        opnfvdashboard.results2opnfv_dashboard(results_path, int_data)
+
     #remove directory if no result files were created.
     if os.path.exists(results_path):
         files_list = os.listdir(results_path)