+ OperatingSystem.Create_File ${file_prefix}${file_name} ${output_log}
+
+Collect Logs
+ [Documentation] Collect logs and detailed results for debugging
+ ${files}= SSHLibrary.List Files In Directory .
+ ${tool_log}= Get_Log_File ${tool_log_name}
+ ${tool_output}= Get_Log_File ${tool_output_name}
+ ${tool_results1}= Get_Log_File ${tool_results1_name}
+ ${tool_results2}= Get_Log_File ${tool_results2_name}
+
+Check Results
+ [Documentation] Check outputs for expected content. Fail in case of unexpected content.
+ ${tool_log}= Get_Log_File ${tool_log_name}
+ BuiltIn.Should Contain ${tool_log} Total execution time:
+ BuiltIn.Should Not Contain ${tool_log} status: NOK
+
+Set_Node_Ip_For_Benchmark
+ [Arguments] ${state} ${tested_ds} ${file_prefix}
+ [Documentation] Returns the node ip which should be tested
+ BuiltIn.Return From Keyword If ${NUM_ODL_SYSTEM}==1 ${ODL_SYSTEM_1_IP}
+ ${shard_type}= BuiltIn.Set_Variable_If "${tested_ds}"=="CONFIG" config operational
+ ${leader} ${followers}= ClusterManagement.Get_Leader_And_Followers_For_Shard shard_type=${shard_type}
+ BuiltIn.Return From Keyword If "${state}"=="leader" ${ODL_SYSTEM_${leader}_IP}
+ BuiltIn.Return From Keyword ${ODL_SYSTEM_@{followers}[0]_IP}
+
+Measuring_Template
+ [Arguments] ${state} ${tested_ds} ${file_prefix}
+ [Documentation] Keywork which will cover a whole banchmark.
+ ... If ${file_prefix} is ${Empty} we have 1 node odl.
+ ${odl_node_ip}= Set_Node_Ip_For_Benchmark ${state} ${tested_ds} ${file_prefix}
+ Start_Benchmark_Tool ${tested_ds} ${odl_node_ip}
+ Wait_Until_Benchmark_Tool_Finish ${TIMEOUT}
+ SSHLibrary.File Should Exist ${tool_results1_name}
+ SSHLibrary.File Should Exist ${tool_results2_name}
+ Check Results
+ Store_File_To_Robot ${tool_results1_name} ${file_prefix}
+ Store_File_To_Robot ${tool_results2_name} ${file_prefix}
+ [Teardown] Stop_Measurement_And_Save_Logs
+
+Stop_Measurement_And_Save_Logs
+ Stop_Benchmark_Tool
+ Collect Logs
+
+Merge_Csv
+ [Arguments] ${final_file}
+ [Documentation] Creates ${final_file} csv file from existing files in the current directory
+ ${final_columns}= BuiltIn.Set_Variable ${Empty}
+ ${final_values}= BuiltIn.Set_variable ${Empty}
+ @{csv_files}= OperatingSystem.List_Files_In_Directory . *${final_file}
+ Collections.Sort_List ${csv_files}
+ : FOR ${file} IN @{csv_files}
+ \ BuiltIn.Log_To_Console ${file}
+ \ ${csv_content}= OperatingSystem.GetFile ${file}
+ \ ${column_names}= Get_Column_Names ${file} ${csv_content}
+ \ ${column_values}= String.Get_Line ${csv_content} 1
+ \ ${final_columns}= BuiltIn.Set_Variable_If "${final_columns}"=="${Empty}" ${column_names} ${final_columns},${column_names}
+ \ ${final_values}= BuiltIn.Set_Variable_If "${final_values}"=="${Empty}" ${column_values} ${final_values},${column_values}
+ ${content}= BuiltIn.Catenate SEPARATOR=${\n} ${final_columns} ${final_values}
+ OperatingSystem.Create_File ${final_file} ${content}
+
+Get_Column_Names
+ [Arguments] ${file_name} ${file_content}
+ [Documentation] Returns the first line of the given csv file. It is modified if the file name
+ ... indicates that it is the file from the shard follower.
+ ${column_names}= String.Get_Line ${file_content} 0
+ BuiltIn.Return_From_Keyword_If "_fol_" not in "${file_name}" ${column_names}
+ # now we have followers and FOL_ will be prepended to the column names
+ @{columns} String.Split_String ${column_names} ,
+ ${final_columns} BuiltIn.Set_Variable ${Empty}
+ : FOR ${column} IN @{columns}
+ \ ${final_columns} BuiltIn.Set_Variable_If "${final_columns}"=="${Empty}" FOL_${column} ${final_columns},FOL_${column}
+ BuiltIn.Return_From_Keyword ${final_columns}