4 # Copyright 2015 Intel Corporation.
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
25 def results2opnfv_dashboard(results_path, int_data):
27 the method open the csv file with results and calls json encoder
29 testcases = os.listdir(results_path)
30 for test in testcases:
31 if not ".csv" in test:
33 resfile = results_path + '/' + test
34 with open(resfile, 'r') as in_file:
35 reader = csv.DictReader(in_file)
36 _push_results(reader, int_data)
38 def _push_results(reader, int_data):
40 the method encodes results and sends them into opnfv dashboard
42 db_url = "http://213.77.62.197"
43 url = db_url + "/results"
45 allowed_pkt = ["64", "128", "512", "1024", "1518"]
46 details = {"64": '', "128": '', "512": '', "1024": '', "1518": ''}
48 for row_reader in reader:
49 if allowed_pkt.count(row_reader['packet_size']) == 0:
50 logging.error("The framesize is not supported in opnfv dashboard")
53 casename = _generate_test_name(row_reader['id'], int_data)
54 if "back2back" in row_reader['id']:
55 details[row_reader['packet_size']] = row_reader['b2b_frames']
57 details[row_reader['packet_size']] = row_reader['throughput_rx_fps']
60 body = {"project_name": "vsperf",
61 "case_name": casename,
62 "pod_name": int_data['pod'],
63 "installer": int_data['installer'],
67 myData = requests.post(url, json=body)
68 logging.info("Results for %s sent to opnfv, http response: %s", casename, myData)
69 logging.debug("the body sent to opnfv")
72 def _generate_test_name(testcase, int_data):
74 the method generates testcase name for releng
76 cuse = int_data['cuse']
77 vanilla = int_data['vanilla']
80 names = {'phy2phy_tput': ["tput_ovsdpdk", "tput_ovsdpdk", "tput_ovs"],
81 'back2back': ["b2b_ovsdpdk", "b2b_ovsdpdk", "b2b_ovs"],
82 'phy2phy_tput_mod_vlan': ["tput_mod_vlan_ovsdpdk", "tput_mod_vlan_ovsdpdk", "tput_mod_vlan_ovs"],
83 'phy2phy_cont': ["cont_ovsdpdk", "cont_ovsdpdk", "cont_ovs"],
84 'pvp_cont': ["pvp_cont_ovsdpdkuser", "pvp_cont_ovsdpdkcuse", "pvp_cont_ovsvirtio"],
85 'pvvp_cont': ["pvvp_cont_ovsdpdkuser", "pvvp_cont_ovsdpdkcuse", "pvvp_cont_ovsvirtio"],
86 'phy2phy_scalability': ["scalability_ovsdpdk", "scalability_ovsdpdk", "scalability_ovs"],
87 'pvp_tput': ["pvp_tput_ovsdpdkuser", "pvp_tput_ovsdpdkcuse", "pvp_tput_ovsvirtio"],
88 'pvp_back2back': ["pvp_b2b_ovsdpdkuser", "pvp_b2b_ovsdpdkcuse", "pvp_b2b_ovsvirtio"],
89 'pvvp_tput': ["pvvp_tput_ovsdpdkuser", "pvvp_tput_ovsdpdkcuse", "pvvp_tput_ovsvirtio"],
90 'pvvp_back2back': ["pvvp_b2b_ovsdpdkuser", "pvvp_b2b_ovsdpdkcuse", "pvvp_b2b_ovsvirtio"],
91 'phy2phy_cpu_load': ["cpu_load_ovsdpdk", "cpu_load_ovsdpdk", "cpu_load_ovs"],
92 'phy2phy_mem_load': ["mem_load_ovsdpdk", "mem_load_ovsdpdk", "mem_load_ovs"]}
94 for name, name_list in names.items():
98 res_name = name_list[2]
101 res_name = name_list[1]
103 res_name = name_list[0]