2 Documentation MD-SAL Data Store benchmarking.
4 ... Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
6 ... This program and the accompanying materials are made available under the
7 ... terms of the Eclipse Public License v1.0 which accompanies this distribution,
8 ... and is available at http://www.eclipse.org/legal/epl-v10.html
10 ... This test suite uses the odl-dsbenchmark-impl feature controlled
11 ... via dsbenchmark.py tool for testing the MD-SAL Data Store performance.
12 ... (see the 'https://wiki.opendaylight.org/view/Controller_Core_Functionality_Tutorials:Tutorials:Data_Store_Benchmarking_and_Data_Access_Patterns')
14 ... Based on values in test suite variables it triggers required numbers of
15 ... warm-up and measured test runs: odl-dsbenchmark-impl module generates
16 ... (towards MD-SAL Data Store) specified structure, type and number of operations.
17 ... The test suite performs checks for start-up and test execution timeouts
18 ... (Start Measurement, Wait For Results) and basic checks for test runs results
19 ... (Check Results). Finally it provides total numbers per operation structure and type
20 ... (by default in the perf_per_struct.csv, perf_per_ops.csv files)
21 ... suitable for plotting in system test environment. See also the
22 ... 'https://wiki.opendaylight.org/view/CrossProject:Integration_Group:System_Test:Step_by_Step_Guide#Optional_-_Plot_a_graph_from_your_job'
23 ... Included totals can be filtered using the FILTER parameter (RegExp).
24 ... Because of the way how graphs are drawn, it is recomended to keep
25 ... all test suite variables unchanged as defined for the 1st build.
26 ... Parameters WARMUPS, RUNS and accordingly the TIMEOUT value can be changed
27 ... for each build if needed. Parameter UNITS defines time units returned
28 ... by odl-dsbenchmark-impl module. The dsbenchmark.py tool always returns
29 ... values in miliseconds.
31 ... When running this robot suite always use --exclude tag for distinguish
32 ... the run for 3node setup: need a benchmark for leader and follow (--exclude singlenode_setup)
33 ... the run for 1node setup: no followr present (--exclude clustered_setup)
34 Suite Setup Setup_Everything
35 Suite Teardown Teardown_Everything
36 Test Setup SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
37 Test Teardown SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
38 Library OperatingSystem
39 Library SSHLibrary timeout=10s
40 Library RequestsLibrary
41 Variables ${CURDIR}/../../../variables/Variables.py
42 Resource ${CURDIR}/../../../libraries/ClusterManagement.robot
43 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
44 Resource ${CURDIR}/../../../libraries/Utils.robot
45 Resource ${CURDIR}/../../../libraries/WaitForFailure.robot
49 ${TX_TYPE} {TX-CHAINING,SIMPLE-TX}
50 ${OP_TYPE} {PUT,READ,MERGE,DELETE}
59 ${tool} dsbenchmark.py
61 ${tool_startup_timeout} 10s
62 ${tool_log_name} dsbenchmark.log
63 ${tool_output_name} test.csv
64 ${tool_results1_name} perf_per_struct.csv
65 ${tool_results2_name} perf_per_ops.csv
68 Measure_Both_Datastores_For_One_Node_Odl_Setup
69 [Tags] critical singlenode_setup
70 [Template] Measuring_Template
71 leader {CONFIG,OPERATIONAL} both_lead_
74 [Tags] critical clustered_setup
75 [Template] Measuring_Template
76 leader CONFIG conf_lead_
78 Measure_Operational_Leader
79 [Tags] critical clustered_setup
80 [Template] Measuring_Template
81 leader OPERATIONAL op_lead_
83 Measure_Config_Follwer
84 [Tags] critical clustered_setup
85 [Template] Measuring_Template
86 follower CONFIG conf_fol_
88 Measure_Operational_Follower
89 [Tags] critical clustered_setup
90 [Template] Measuring_Template
91 follower OPERATIONAL op_fol_
94 [Documentation] Merge created csvs into given file necause plot plugin cannot have more
95 ... source files for one graph.
96 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
97 Merge_Csv perf_per_ops.csv
98 Merge_Csv perf_per_struct.csv
102 [Documentation] Setup imported resources, SSH-login to mininet machine,
103 ... create HTTP session, put Python tool to mininet machine.
104 SetupUtils.Setup_Utils_For_Setup_And_Teardown
105 SSHLibrary.Set_Default_Configuration prompt=${TOOLS_SYSTEM_PROMPT}
106 SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP}
107 Utils.Flexible_Mininet_Login
108 SSHLibrary.Put_File ${CURDIR}/../../../../tools/mdsal_benchmark/${tool}
109 SSHKeywords.Virtual_Env_Create
110 SSHKeywords.Virtual_Env_Install_Package requests
111 ClusterManagement.Run_Karaf_Command_On_List_Or_All log:set ${ODL_LOG_LEVEL}
114 [Documentation] Cleaning-up
115 SSHKeywords.Virtual_Env_Delete
116 SSHLibrary.Close_All_Connections
119 [Arguments] ${tested_datastore} ${tested_node_ip}
120 [Documentation] Start the benchmark tool. Check that it has been running at least for ${tool_startup_timeout} period.
121 ${command}= BuiltIn.Set_Variable python ${tool} --host ${tested_node_ip} --port ${RESTCONFPORT} --warmup ${WARMUPS} --runs ${RUNS} --total ${TOTAL_OPS} --inner ${INNER_OPS} --txtype ${TX_TYPE} --ops ${OPS_PER_TX} --optype ${OP_TYPE} --plot ${FILTER} --units ${UNITS} --datastore ${tested_datastore} ${tool_args} &> ${tool_log_name}
122 BuiltIn.Log ${command}
123 SSHKeywords.Virtual_Env_Activate_On_Current_Session
124 ${output}= SSHLibrary.Write ${command}
125 ${status} ${message}= BuiltIn.Run Keyword And Ignore Error Write Until Expected Output ${EMPTY} ${TOOLS_SYSTEM_PROMPT} ${tool_startup_timeout}
127 BuiltIn.Log ${status}
128 BuiltIn.Log ${message}
129 BuiltIn.Run Keyword If '${status}' == 'PASS' BuiltIn.Fail Benchmark tool is not running
131 Wait_Until_Benchmark_Tool_Finish
132 [Arguments] ${timeout}
133 [Documentation] Wait until the benchmark tool is finished. Fail in case of test timeout (${timeout}).
134 ... In order to prevent SSH session from closing due to inactivity, newline is sent every check.
135 BuiltIn.Wait Until Keyword Succeeds ${timeout} 30s BuiltIn.Run Keywords SSHLibrary.Write ${EMPTY}
136 ... AND SSHLibrary.Read Until Prompt
139 [Documentation] Stop the benchmark tool. Fail if still running.
141 Utils.Write_Bare_Ctrl_C
142 SSHLibrary.Read Until Prompt
143 SSHKeywords.Virtual_Env_Deactivate_On_Current_Session
146 [Arguments] ${file_name}
147 [Documentation] Return and log content of the provided file.
148 ${output_log}= SSHLibrary.Execute_Command cat ${file_name}
149 BuiltIn.Log ${output_log}
150 [Return] ${output_log}
153 [Arguments] ${file_name} ${file_prefix}
154 [Documentation] Store the provided file from the MININET to the ROBOT machine.
155 ${output_log}= SSHLibrary.Execute_Command cat ${file_name}
156 BuiltIn.Log ${output_log}
157 OperatingSystem.Create_File ${file_prefix}${file_name} ${output_log}
160 [Documentation] Collect logs and detailed results for debugging
161 ${files}= SSHLibrary.List Files In Directory .
162 ${tool_log}= Get_Log_File ${tool_log_name}
163 ${tool_output}= Get_Log_File ${tool_output_name}
164 ${tool_results1}= Get_Log_File ${tool_results1_name}
165 ${tool_results2}= Get_Log_File ${tool_results2_name}
168 [Documentation] Check outputs for expected content. Fail in case of unexpected content.
169 ${tool_log}= Get_Log_File ${tool_log_name}
170 BuiltIn.Should Contain ${tool_log} Total execution time:
171 BuiltIn.Should Not Contain ${tool_log} status: NOK
173 Set_Node_Ip_For_Benchmark
174 [Arguments] ${state} ${tested_ds} ${file_prefix}
175 [Documentation] Returns the node ip which should be tested
176 BuiltIn.Return From Keyword If ${NUM_ODL_SYSTEM}==1 ${ODL_SYSTEM_1_IP}
177 ${shard_type}= BuiltIn.Set_Variable_If "${tested_ds}"=="CONFIG" config operational
178 ${leader} ${followers}= ClusterManagement.Get_Leader_And_Followers_For_Shard shard_type=${shard_type}
179 BuiltIn.Return From Keyword If "${state}"=="leader" ${ODL_SYSTEM_${leader}_IP}
180 BuiltIn.Return From Keyword ${ODL_SYSTEM_@{followers}[0]_IP}
183 [Arguments] ${state} ${tested_ds} ${file_prefix}
184 [Documentation] Keywork which will cover a whole banchmark.
185 ... If ${file_prefix} is ${Empty} we have 1 node odl.
186 ${odl_node_ip}= Set_Node_Ip_For_Benchmark ${state} ${tested_ds} ${file_prefix}
187 Start_Benchmark_Tool ${tested_ds} ${odl_node_ip}
188 Wait_Until_Benchmark_Tool_Finish ${TIMEOUT}
189 SSHLibrary.File Should Exist ${tool_results1_name}
190 SSHLibrary.File Should Exist ${tool_results2_name}
192 Store_File_To_Robot ${tool_results1_name} ${file_prefix}
193 Store_File_To_Robot ${tool_results2_name} ${file_prefix}
194 [Teardown] Stop_Measurement_And_Save_Logs
196 Stop_Measurement_And_Save_Logs
201 [Arguments] ${final_file}
202 [Documentation] Creates ${final_file} csv file from existing files in the current directory
203 ${final_columns}= BuiltIn.Set_Variable ${Empty}
204 ${final_values}= BuiltIn.Set_variable ${Empty}
205 @{csv_files}= OperatingSystem.List_Files_In_Directory . *${final_file}
206 Collections.Sort_List ${csv_files}
207 : FOR ${file} IN @{csv_files}
208 \ BuiltIn.Log_To_Console ${file}
209 \ ${csv_content}= OperatingSystem.GetFile ${file}
210 \ ${column_names}= Get_Column_Names ${file} ${csv_content}
211 \ ${column_values}= String.Get_Line ${csv_content} 1
212 \ ${final_columns}= BuiltIn.Set_Variable_If "${final_columns}"=="${Empty}" ${column_names} ${final_columns},${column_names}
213 \ ${final_values}= BuiltIn.Set_Variable_If "${final_values}"=="${Empty}" ${column_values} ${final_values},${column_values}
214 ${content}= BuiltIn.Catenate SEPARATOR=${\n} ${final_columns} ${final_values}
215 OperatingSystem.Create_File ${final_file} ${content}
218 [Arguments] ${file_name} ${file_content}
219 [Documentation] Returns the first line of the given csv file. It is modified if the file name
220 ... indicates that it is the file from the shard follower.
221 ${column_names}= String.Get_Line ${file_content} 0
222 BuiltIn.Return_From_Keyword_If "_fol_" not in "${file_name}" ${column_names}
223 # now we have followers and FOL_ will be prepended to the column names
224 @{columns} String.Split_String ${column_names} ,
225 ${final_columns} BuiltIn.Set_Variable ${Empty}
226 : FOR ${column} IN @{columns}
227 \ ${final_columns} BuiltIn.Set_Variable_If "${final_columns}"=="${Empty}" FOL_${column} ${final_columns},FOL_${column}
228 BuiltIn.Return_From_Keyword ${final_columns}