3 # Copyright 2015 Intel Corporation.
5 # Licensed under the Apache License, Version 2.0 (the "License"),
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 def get_vsperf_cases():
19 get the list of the supported test cases
20 TODO: update the list when adding a new test case for the dashboard
22 return ["tput_ovsdpdk", "tput_ovs",
23 "b2b_ovsdpdk", "b2b_ovs",
24 "tput_mod_vlan_ovsdpdk", "tput_mod_vlan_ovs",
25 "cont_ovsdpdk", "cont_ovs",
26 "pvp_cont_ovsdpdkuser", "pvp_cont_ovsdpdkcuse", "pvp_cont_ovsvirtio",
27 "pvvp_cont_ovsdpdkuser", "pvvp_cont_ovsdpdkcuse", "pvvp_cont_ovsvirtio",
28 "scalability_ovsdpdk", "scalability_ovs",
29 "pvp_tput_ovsdpdkuser", "pvp_tput_ovsdpdkcuse", "pvp_tput_ovsvirtio",
30 "pvp_b2b_ovsdpdkuser", "pvp_b2b_ovsdpdkcuse", "pvp_b2b_ovsvirtio",
31 "pvvp_tput_ovsdpdkuser", "pvvp_tput_ovsdpdkcuse", "pvvp_tput_ovsvirtio",
32 "pvvp_b2b_ovsdpdkuser", "pvvp_b2b_ovsdpdkcuse", "pvvp_b2b_ovsvirtio",
33 "cpu_load_ovsdpdk", "cpu_load_ovs",
34 "mem_load_ovsdpdk", "mem_load_ovs"]
37 def check_vsperf_case_exist(case):
39 check if the testcase exists
40 if the test case is not defined or not declared in the list
43 vsperf_cases = get_vsperf_cases()
45 if (case is None or case not in vsperf_cases):
51 def format_vsperf_for_dashboard(case, results):
53 generic method calling the method corresponding to the test case
54 check that the testcase is properly declared first
55 then build the call to the specific method
57 if check_vsperf_case_exist(case):
58 res = format_common_for_dashboard(case, results)
61 print "Test cases not declared"
65 def format_common_for_dashboard(case, results):
67 Common post processing
69 test_data_description = case + " results for Dashboard"
70 test_data = [{'description': test_data_description}]
74 graph_name = "B2B frames"
76 graph_name = "Rx frames per second"
78 # Graph 1: Rx fps = f(time)
79 # ********************************
82 new_element.append({'x': data['creation_date'],
83 'y1': data['details']['64'],
84 'y2': data['details']['128'],
85 'y3': data['details']['512'],
86 'y4': data['details']['1024'],
87 'y5': data['details']['1518']})
89 test_data.append({'name': graph_name,
90 'info': {'type': "graph",
92 'y1label': 'frame size 64B',
93 'y2label': 'frame size 128B',
94 'y3label': 'frame size 512B',
95 'y4label': 'frame size 1024B',
96 'y5label': 'frame size 1518B'},
97 'data_set': new_element})
104 ############################ For local test ################################
108 ans = [{'creation_date': '2015-09-12', 'project_name': 'vsperf', 'version': 'ovs_master', 'pod_name': 'pod1-vsperf', 'case_name': 'tput_ovsdpdk', 'installer': 'build_sie', 'details': {'64': '26.804', '1024': '1097.284', '512': '178.137', '1518': '12635.860', '128': '100.564'}},
109 {'creation_date': '2015-09-33', 'project_name': 'vsperf', 'version': 'ovs_master', 'pod_name': 'pod1-vsperf', 'case_name': 'tput_ovsdpdk', 'installer': 'build_sie', 'details': {'64': '16.804', '1024': '1087.284', '512': '168.137', '1518': '12625.860', '128': '99.564'}}]
111 result = format_vsperf_for_dashboard("pvp_cont_ovsdpdkcuse", ans)
114 result = format_vsperf_for_dashboard("b2b_ovsdpdk", ans)
117 result = format_vsperf_for_dashboard("non_existing", ans)
120 if __name__ == '__main__':