Remove dead code that somehow survived code cleanup
[integration/test.git] / csit / suites / netconf / restperfclient / performance.robot
index 1c7847e86f5aec5ef67464efcdea95f21462028d..17f24a277e2fa5ba408c8920a6d2f8536e4674f7 100644 (file)
@@ -28,6 +28,7 @@ Resource          ${CURDIR}/../../../libraries/KarafKeywords.robot
 Resource          ${CURDIR}/../../../libraries/NetconfKeywords.robot
 Resource          ${CURDIR}/../../../libraries/NetconfViaRestconf.robot
 Resource          ${CURDIR}/../../../libraries/NexusKeywords.robot
+Resource          ${CURDIR}/../../../libraries/RestPerfClient.robot
 Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
 Resource          ${CURDIR}/../../../libraries/Utils.robot
 Variables         ${CURDIR}/../../../variables/Variables.py
@@ -57,56 +58,50 @@ Create_Device_Data
     ${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}
 
-Deploy_And_Run_RestPerfClient
+Run_Restperfclient
     [Documentation]    Deploy and execute restperfclient, asking it to send the specified amount of requests to the netconf connector of the device.
-    SSHLibrary.Switch_Connection    ${restperfclient}
-    SSHLibrary.Put_File    ${CURDIR}/../../../variables/netconf/RestPerfClient/request1.json
-    ${filename}=    NexusKeywords.Deploy_Test_Tool    netconf    netconf-testtool    rest-perf-client
-    ${timeout}=    BuiltIn.Evaluate    ${REQUEST_COUNT}/100+10
-    SSHLibrary.Set_Client_Configuration    timeout=${timeout}
-    ${options}=    BuiltIn.Set_Variable    --ip ${ODL_SYSTEM_IP} --port ${RESTCONFPORT} --edits ${REQUEST_COUNT}
-    ${options}=    BuiltIn.Set_Variable    ${options} --destination /restconf/config/network-topology:network-topology/topology/topology-netconf/node/${DEVICE_NAME}/yang-ext:mount/car:cars
-    ${options}=    BuiltIn.Set_Variable    ${options} --edit-content request1.json
-    ${options}=    BuiltIn.Set_Variable    ${options} --auth ${ODL_RESTCONF_USER} ${ODL_RESTCONF_PASSWORD}
-    ${command}=    NexusKeywords.Compose_Full_Java_Command    -Xmx1G -XX:MaxPermSize=256M -jar ${filename} ${options}
-    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
-    SSHLibrary.Get_File    ${restperfclientlog}
-    ${result}=    SSHLibrary.Execute_Command    grep "FINISHED. Execution time:" ${restperfclientlog}
-    BuiltIn.Should_Not_Be_Equal    '${result}'    ''
+    [Timeout]    ${TESTTOOL_DEVICE_TIMEOUT_FOR_TESTCASE}
+    ${url}=    BuiltIn.Set_Variable    /restconf/config/network-topology:network-topology/topology/topology-netconf/node/${DEVICE_NAME}/yang-ext:mount/car:cars
+    RestPerfClient.Invoke_Restperfclient    ${TESTTOOL_DEVICE_TIMEOUT}    ${url}    async=true
 
 Check_For_Failed_Requests
     [Documentation]    Make sure there are no failed requests in the restperfclient log.
     ...    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 "Request failed" ${restperfclientlog}
+    ${result}=    RestPerfClient.Grep_Restperfclient_Log    thread timed out
     BuiltIn.Should_Be_Equal    '${result}'    ''
-    ${result}=    SSHLibrary.Execute_Command    grep "Status code" ${restperfclientlog}
+    ${result}=    RestPerfClient.Grep_Restperfclient_Log    Request failed
+    BuiltIn.Should_Be_Equal    '${result}'    ''
+    ${result}=    RestPerfClient.Grep_Restperfclient_Log    Status code
     BuiltIn.Should_Be_Equal    '${result}'    ''
 
-Deconfigure_Device_From_Netconf
+Cleanup_And_Collect
     [Documentation]    Deconfigure the testtool device on Netconf connector.
     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+    RestPerfClient.Collect_From_Restperfclient
     NetconfKeywords.Remove_Device_From_Netconf    ${DEVICE_NAME}
 
 *** 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}    2m    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
-    # Connect to the tools system (rest-perf-client)
-    ${restperfclient}=    SSHKeywords.Open_Connection_To_Tools_System
-    BuiltIn.Set_Suite_Variable    ${restperfclient}    ${restperfclient}
-    ${testtool}=    SSHLibrary.Get Connection
-    BuiltIn.Set_Suite_Variable    ${testtool}    ${testtool.index}
+    RestPerfClient.Setup_Restperfclient
+    # Connect to the tools system (testtool)
+    ${testtool}=    SSHKeywords.Open_Connection_To_Tools_System
+    BuiltIn.Set_Suite_Variable    ${testtool}    ${testtool}
 
 Teardown_Everything
     [Documentation]    Teardown the test infrastructure, perform cleanup and release all resources.
     Teardown_Netconf_Via_Restconf
     RequestsLibrary.Delete_All_Sessions
+    RestPerfClient.Teardown_Restperfclient
     SSHLibrary.Switch_Connection    ${testtool}
     BuiltIn.Run_Keyword_And_Ignore_Error    NetconfKeywords.Stop_Testtool