X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Flibraries%2FRestPerfClient.robot;h=ca1d892d632fce49ce3bde469ae0de661bb12466;hb=7bd240c505c386ed54bc4e8e331164837bc1e31c;hp=697f72f50b2760df28d25058608de5558809d8fa;hpb=3b77a4a8ae01264206d1cbd667827ef9ba302827;p=integration%2Ftest.git diff --git a/csit/libraries/RestPerfClient.robot b/csit/libraries/RestPerfClient.robot index 697f72f50b..ca1d892d63 100644 --- a/csit/libraries/RestPerfClient.robot +++ b/csit/libraries/RestPerfClient.robot @@ -23,8 +23,10 @@ Documentation RestPerfClient handling singleton resource. ... and currently all suites using this use also NetconfKeywords so this ... was postponed. Workaround for the problem: Initialize NexusKeywords ... manually before initializing this resource. +Library DateTime Library SSHLibrary Resource ${CURDIR}/NexusKeywords.robot +Resource ${CURDIR}/SetupUtils.robot Resource ${CURDIR}/SSHKeywords.robot Resource ${CURDIR}/Utils.robot @@ -45,6 +47,16 @@ Setup_Restperfclient ${prefix}= NexusKeywords.Compose_Full_Java_Command -Xmx1G -XX:MaxPermSize=256M -jar ${filename} BuiltIn.Set_Suite_Variable ${RestPerfClient__restperfclient_invocation_command_prefix} ${prefix} +RestPerfClient__Kill + Utils.Write_Bare_Ctrl_C + SSHLibrary.Set_Client_Configuration timeout=5 + SSHLibrary.Read_Until_Prompt + +Restperfclient__Invoke_With_Timeout + [Arguments] ${timeout} ${command} + [Timeout] ${timeout} + Execute_Command_Passes ${command} >${RestPerfClient__restperfclientlog} 2>&1 + Invoke_Restperfclient [Arguments] ${timeout} ${url} ${testcase}=${EMPTY} ${ip}=${ODL_SYSTEM_IP} ${port}=${RESTCONFPORT} ${count}=${REQUEST_COUNT} ... ${async}=false ${user}=${ODL_RESTCONF_USER} ${password}=${ODL_RESTCONF_PASSWORD} @@ -52,6 +64,7 @@ Invoke_Restperfclient ... Assemble the RestPerfClient invocation commad, setup the specified ... timeout for the SSH connection, invoke the assembled command and ... then check that RestPerfClient finished its run correctly. + ${restperfclient_running}= Set_Variable False ${logname}= Utils.Get_Log_File_Name restperfclient ${testcase} BuiltIn.Set_Suite_Variable ${RestPerfClient__restperfclientlog} ${logname} ${options}= BuiltIn.Set_Variable --ip ${ip} --port ${port} --edits ${count} @@ -63,11 +76,15 @@ Invoke_Restperfclient BuiltIn.Log Running restperfclient: ${command} SSHLibrary.Switch_Connection ${RestPerfClient__restperfclient} SSHLibrary.Set_Client_Configuration timeout=${timeout} - Set_Known_Bug_Id 5413 - Execute_Command_Passes ${command} >${RestPerfClient__restperfclientlog} 2>&1 - Set_Unknown_Bug_Id + ${keyword_timeout}= DateTime.Add_Time_To_Time ${timeout} 2m result_format=compact + SetupUtils.Set_Known_Bug_Id 5413 + ${restperfclient_running}= Set_Variable True + Restperfclient__Invoke_With_Timeout ${keyword_timeout} ${command} + ${restperfclient_running}= Set_Variable False + SetupUtils.Set_Unknown_Bug_Id ${result}= Grep_Restperfclient_Log FINISHED. Execution time: BuiltIn.Should_Not_Be_Equal '${result}' '' + [Teardown] BuiltIn.Run_Keyword_If ${restperfclient_running} BuiltIn.Run_Keyword_And_Ignore_Error RestPerfClient__Kill Grep_Restperfclient_Log [Arguments] ${pattern} @@ -76,9 +93,6 @@ Grep_Restperfclient_Log ${result}= SSHLibrary.Execute_Command grep '${pattern}' ${RestPerfClient__restperfclientlog} [Return] ${result} -Get_Current_Log_Name - [Return] ${RestPerfClient__restperfclientlog} - Collect_From_Restperfclient [Documentation] Collect useful data produced by restperfclient BuiltIn.Should_Not_Be_Equal '${RestPerfClient__restperfclientlog}' ''