3 # Copyright (c) 2015 Orange
4 # morgan.richomme@orange.com
6 # This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # This script is used to build dashboard ready json results
13 # It may be used for all the test case of the Functest project
14 # a new method format_<Test_case>_for_dashboard(results)
15 # v0.1: basic example with methods for odl, Tempest, Rally and vPing
19 def get_functest_cases():
21 get the list of the supported test cases
22 TODO: update the list when adding a new test case for the dashboard
24 return ["vPing", "Tempest", "odl", "Rally"]
27 def format_functest_for_dashboard(case, results):
29 generic method calling the method corresponding to the test case
30 check that the testcase is properly declared first
31 then build the call to the specific method
33 if check_functest_case_exist(case):
34 cmd = "format_" + case + "_for_dashboard(results)"
38 print "Test cases not declared"
42 def check_functest_case_exist(case):
44 check if the testcase exists
45 if the test case is not defined or not declared in the list
48 functest_cases = get_functest_cases()
50 if (case is None or case not in functest_cases):
56 def format_Tempest_for_dashboard(results):
58 Post processing for the Tempest test case
60 test_data = [{'description': 'Tempest results for Dashboard'}]
64 def format_odl_for_dashboard(results):
66 Post processing for the odl test case
68 test_data = [{'description': 'odl results for Dashboard'}]
72 def format_Rally_for_dashboard(results):
74 Post processing for the Rally test case
76 test_data = [{'description': 'Rally results for Dashboard'}]
80 def format_vPing_for_dashboard(results):
82 Post processing for the vPing test case
84 test_data = [{'description': 'vPing results for Dashboard'}]
86 # Graph 1: Test_Duration = f(time)
87 # ********************************
90 new_element.append({'x': data['creation_date'],
91 'y': data['details']['duration']})
93 test_data.append({'name': "vPing duration",
94 'info': {'type': "graph",
96 'ylabel': 'duration (s)'},
97 'data_set': new_element})
106 if data['details']['status'] == "OK":
109 test_data.append({'name': "vPing status",
110 'info': {"type": "bar"},
111 'data_set': [{'Nb tests': nbTest,
112 'Nb Success': nbTestOk}]})