Update Robot Framework format - step 10
[integration/test.git] / csit / suites / netconf / restperfclient / performance.robot
index 7bf765403592cab657e9f7c1dfd98df1b335bf94..898617785b88184dc8ba9af3db1c27e746685dc0 100644 (file)
@@ -1,53 +1,69 @@
 *** Settings ***
-Documentation     netconf-restperfclient Update performance test suite.
+Documentation       netconf-restperfclient Update performance test suite.
 ...
-...               Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+...                 Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
 ...
-...               This program and the accompanying materials are made available under the
-...               terms of the Eclipse Public License v1.0 which accompanies this distribution,
-...               and is available at http://www.eclipse.org/legal/epl-v10.html
+...                 This program and the accompanying materials are made available under the
+...                 terms of the Eclipse Public License v1.0 which accompanies this distribution,
+...                 and is available at http://www.eclipse.org/legal/epl-v10.html
 ...
 ...
-...               Perform given count of update operations on device data mounted onto a
-...               netconf connector (using the netconf-testtool-restperfclient tool) and
-...               see how much time it took. More exactly, it sends the data to a restconf
-...               mountpoint of the netconf connector belonging to the device, which turns
-...               out to turn the first request sent to a "create" request and the
-...               remaining requests to "update" requests (due to how the testtool device
-...               behavior is implemented).
-Suite Setup       Setup_Everything
-Suite Teardown    Teardown_Everything
-Test Setup        SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
-Test Teardown     SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
-Library           Collections
-Library           RequestsLibrary
-Library           OperatingSystem
-Library           String
-Library           SSHLibrary    timeout=10s
-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
+...                 Perform given count of update operations on device data mounted onto a
+...                 netconf connector (using the netconf-testtool-restperfclient tool) and
+...                 see how much time it took. More exactly, it sends the data to a restconf
+...                 mountpoint of the netconf connector belonging to the device, which turns
+...                 out to turn the first request sent to a "create" request and the
+...                 remaining requests to "update" requests (due to how the testtool device
+...                 behavior is implemented).
+
+Library             Collections
+Library             RequestsLibrary
+Library             OperatingSystem
+Library             String
+Library             SSHLibrary    timeout=10s
+Resource            ${CURDIR}/../../../libraries/KarafKeywords.robot
+Resource            ${CURDIR}/../../../libraries/NetconfKeywords.robot
+Resource            ${CURDIR}/../../../libraries/NexusKeywords.robot
+Resource            ${CURDIR}/../../../libraries/RestPerfClient.robot
+Resource            ${CURDIR}/../../../libraries/SetupUtils.robot
+Resource            ${CURDIR}/../../../libraries/TemplatedRequests.robot
+Resource            ${CURDIR}/../../../libraries/Utils.robot
+Variables           ${CURDIR}/../../../variables/Variables.py
+
+Suite Setup         Setup_Everything
+Suite Teardown      Teardown_Everything
+Test Setup          SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
+Test Teardown       SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
+
 
 *** Variables ***
-${DEVICE_NAME}    ${FIRST_TESTTOOL_PORT}-sim-device
-${REQUEST_COUNT}    65536
+${DEVICE_NAME}                      ${FIRST_TESTTOOL_PORT}-sim-device
+${REQUEST_COUNT}                    16384
 ${directory_with_crud_templates}    ${CURDIR}/../../../variables/netconf/CRUD
+${device_type}                      full-uri-device
+
 
 *** Test Cases ***
 Start_Testtool
     [Documentation]    Deploy and start test tool, then wait for all its devices to become online.
     # Start test tool
     SSHLibrary.Switch_Connection    ${testtool}
-    NetconfKeywords.Install_And_Start_Testtool    device-count=1    schemas=${CURDIR}/../../../variables/netconf/CRUD/schemas    mdsal=false    debug=false
+    IF    '${IS_KARAF_APPL}' == 'True'
+        NetconfKeywords.Install_And_Start_Testtool
+        ...    device-count=1
+        ...    schemas=${CURDIR}/../../../variables/netconf/CRUD/schemas
+        ...    debug=false
+    ELSE
+        NetconfKeywords.Start_Testtool
+        ...    ${NETCONF_FILENAME}
+        ...    device-count=1
+        ...    schemas=${CURDIR}/../../../variables/netconf/CRUD/schemas
+        ...    debug=false
+    END
 
 Configure_Device_On_Netconf
     [Documentation]    Configure the testtool device on Netconf connector.
-    NetconfKeywords.Configure_Device_In_Netconf    ${DEVICE_NAME}
+    NetconfKeywords.Configure_Device_In_Netconf    ${DEVICE_NAME}    device_type=${device_type}
 
 Wait_For_Device_To_Become_Connected
     [Documentation]    Wait until the device becomes available through Netconf.
@@ -55,21 +71,20 @@ 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}
+    ${template_as_string}=    BuiltIn.Create_Dictionary    DEVICE_NAME=${device_name}
+    TemplatedRequests.Post_As_Xml_Templated    ${directory_with_crud_templates}${/}cars    ${template_as_string}
 
 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}
-    ${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
+    ${url}=    BuiltIn.Set_Variable
+    ...    /rests/data/network-topology:network-topology/topology\=topology-netconf/node\=${DEVICE_NAME}/yang-ext:mount/car:cars
+    RestPerfClient.Invoke_Restperfclient    ${TESTTOOL_DEVICE_TIMEOUT}    ${url}    async=false
 
 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.
-    ${restperfclientlog}=    RestPerfClient.Get_Current_Log_Name
     ${result}=    RestPerfClient.Grep_Restperfclient_Log    thread timed out
     BuiltIn.Should_Be_Equal    '${result}'    ''
     ${result}=    RestPerfClient.Grep_Restperfclient_Log    Request failed
@@ -83,25 +98,31 @@ Cleanup_And_Collect
     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
+    ${value}=    BuiltIn.Evaluate    ${REQUEST_COUNT}/10+20
     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
-    RestPerfClient.Setup_Restperfclient
+    IF    '${IS_KARAF_APPL}' == 'False'
+        RestPerfClient.Setup_Restperfclient
+        ...    build_version=${NETCONF_TESTTOOL_VERSION}
+        ...    build_location=org/opendaylight/netconf
+    ELSE
+        RestPerfClient.Setup_Restperfclient
+    END
     # Connect to the tools system (testtool)
     ${testtool}=    SSHKeywords.Open_Connection_To_Tools_System
     BuiltIn.Set_Suite_Variable    ${testtool}    ${testtool}
+    ${device_type}=    BuiltIn.Set_Variable_If    ${USE_NETCONF_CONNECTOR}==${True}    default    ${device_type}
+    BuiltIn.Set_Suite_Variable    ${device_type}
 
 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}