Add missing timeout to the test tool device performance test
[integration/test.git] / csit / suites / netconf / restperfclient / performance.robot
index 411321a23ec665cfc50ceff33c3b3333b20ecfb4..7c24c8ddf5c817a7153cb26ef55cd84357346392 100644 (file)
@@ -33,10 +33,9 @@ Resource          ${CURDIR}/../../../libraries/Utils.robot
 Variables         ${CURDIR}/../../../variables/Variables.py
 
 *** Variables ***
-${DIRECTORY_WITH_CRUD_TEMPLATES}    ${CURDIR}/../../../variables/netconf/CRUD
-${DIRECTORY_WITH_TEMPLATE_FOLDERS}    ${CURDIR}/../../../variables/netconf/RestPerfClient
 ${DEVICE_NAME}    ${FIRST_TESTTOOL_PORT}-sim-device
 ${REQUEST_COUNT}    65536
+${directory_with_crud_templates}    ${CURDIR}/../../../variables/netconf/CRUD
 
 *** Test Cases ***
 Start_Testtool
@@ -56,10 +55,11 @@ Wait_For_Device_To_Become_Connected
 Create_Device_Data
     [Documentation]    Send some sample test data into the device and check that the request went OK.
     ${template_as_string}=    BuiltIn.Set_Variable    {'DEVICE_NAME': '${DEVICE_NAME}'}
-    NetconfViaRestconf.Post_Xml_Template_Folder_Via_Restconf    ${DIRECTORY_WITH_CRUD_TEMPLATES}${/}cars    ${template_as_string}
+    NetconfViaRestconf.Post_Xml_Template_Folder_Via_Restconf    ${directory_with_crud_templates}${/}cars    ${template_as_string}
 
 Deploy_And_Run_RestPerfClient
     [Documentation]    Deploy and execute restperfclient, asking it to send the specified amount of requests to the netconf connector of the device.
+    [Timeout]    ${TESTTOOL_DEVICE_TIMEOUT_FOR_TESTCASE}
     SSHLibrary.Switch_Connection    ${restperfclient}
     SSHLibrary.Put_File    ${CURDIR}/../../../variables/netconf/RestPerfClient/request1.json
     ${filename}=    NexusKeywords.Deploy_Test_Tool    netconf    netconf-testtool    rest-perf-client
@@ -73,7 +73,7 @@ Deploy_And_Run_RestPerfClient
     BuiltIn.Log    Running restperfclient: ${command}
     ${restperfclientlog}=    Utils.Get_Log_File_Name    restperfclient
     BuiltIn.Set_Suite_Variable    ${restperfclientlog}    ${restperfclientlog}
-    Execute_Command_Passes    ${command} >${restperfclientlog} 2>&1
+    SSHKeywords.Execute_Command_Passes    ${command} >${restperfclientlog} 2>&1
     SSHLibrary.Get_File    ${restperfclientlog}
     ${result}=    SSHLibrary.Execute_Command    grep "FINISHED. Execution time:" ${restperfclientlog}
     BuiltIn.Should_Not_Be_Equal    '${result}'    ''
@@ -83,6 +83,8 @@ Check_For_Failed_Requests
     ...    This is a separate test case to distinguish between restperfclient
     ...    failure and failed requests. Failed requests are rejected because
     ...    we don't want to test performance of ODL rejecting our requests.
+    ${result}=    SSHLibrary.Execute_Command    grep "thread timed out" ${restperfclientlog}
+    BuiltIn.Should_Be_Equal    '${result}'    ''
     ${result}=    SSHLibrary.Execute_Command    grep "Request failed" ${restperfclientlog}
     BuiltIn.Should_Be_Equal    '${result}'    ''
     ${result}=    SSHLibrary.Execute_Command    grep "Status code" ${restperfclientlog}
@@ -96,6 +98,11 @@ Deconfigure_Device_From_Netconf
 *** Keywords ***
 Setup_Everything
     [Documentation]    Setup everything needed for the test cases.
+    # Calculate and set the value of the timeout
+    ${value}=    BuiltIn.Evaluate    ${REQUEST_COUNT}/50+10
+    Utils.Set_User_Configurable_Variable_Default    TESTTOOL_DEVICE_TIMEOUT    ${value} s
+    ${value}=    DateTime.Add_Time_To_Time    ${TESTTOOL_DEVICE_TIMEOUT}    60s    result_format=compact
+    Utils.Set_User_Configurable_Variable_Default    TESTTOOL_DEVICE_TIMEOUT_FOR_TESTCASE    ${value}
     # Setup resources used by the suite.
     SetupUtils.Setup_Utils_For_Setup_And_Teardown
     NetconfKeywords.Setup_Netconf_Keywords