*** Variables ***
${DIRECTORY_WITH_DEVICE_TEMPLATES} ${CURDIR}/../variables/netconf/device
${FIRST_TESTTOOL_PORT} 17830
+${BASE_NETCONF_DEVICE_PORT} 17830
+${DEVICE_NAME_BASE} netconf-scaling-device
*** Keywords ***
Setup_NetconfKeywords
# "Interrupt_Program_And_Download_Its_Log" which will get an argument stating the name of
# the log file to get.
SSHLibrary.Get_File testtool.log
+
+NetconfKeywords__Perform_Operation_With_Checking_On_Next_Device
+ [Arguments] ${operation}
+ ${number}= BuiltIn.Evaluate ${current_port}-${BASE_NETCONF_DEVICE_PORT}+1
+ BuiltIn.Wait_Until_Keyword_Succeeds 10s 1s NetconfKeywords.Check_Device_Up_And_Running ${number}
+ BuiltIn.Run_Keyword ${operation} ${DEVICE_NAME_BASE}-${number}
+ ${next}= BuiltIn.Evaluate ${current_port}+1
+ BuiltIn.Set_Suite_Variable ${current_port} ${next}
+
+Perform_Operation_On_Each_Device
+ [Arguments] ${operation} ${count}=${DEVICE_COUNT}
+ BuiltIn.Set_Suite_Variable ${current_port} ${BASE_NETCONF_DEVICE_PORT}
+ BuiltIn.Repeat_Keyword ${count} times NetconfKeywords__Perform_Operation_With_Checking_On_Next_Device ${operation}
--- /dev/null
+*** Settings ***
+Documentation netconf-connector scaling test suite (single-threaded GET requests).
+...
+... Copyright (c) 2015 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
+...
+...
+... Performs scaling tests:
+... - Configuring devices one by one.
+... - Sending requests for configuration data.
+... - Deconfiguring devices one by one.
+Suite Setup Setup_Everything
+Suite Teardown Teardown_Everything
+Library RequestsLibrary
+Library SSHLibrary timeout=10s
+Resource ${CURDIR}/../../../libraries/KarafKeywords.robot
+Resource ${CURDIR}/../../../libraries/NetconfKeywords.robot
+Resource ${CURDIR}/../../../libraries/SetupUtils.robot
+Resource ${CURDIR}/../../../libraries/Utils.robot
+Variables ${CURDIR}/../../../variables/Variables.py
+
+*** Variables ***
+${DEVICE_COUNT} 500
+${memory_usage_leeway} 16 # in MB
+
+*** Test Cases ***
+Configure_Devices_Onto_Netconf
+ [Documentation] Make requests to configure the testtool devices.
+ [Tags] critical
+ NetconfKeywords.Perform_Operation_On_Each_Device Configure_Device
+
+Get_Data_From_Devices
+ [Documentation] Ask testtool devices for data.
+ NetconfKeywords.Perform_Operation_On_Each_Device Check_Device_Data
+
+Deconfigure_Devices_From_Netconf
+ [Documentation] Make requests to deconfigure the testtool devices.
+ [Tags] critical
+ NetconfKeywords.Perform_Operation_On_Each_Device Deconfigure_Device
+ [Teardown] Report_Failure_Due_To_Bug 4547
+
+*** Keywords ***
+Setup_Everything
+ [Documentation] Setup everything needed for the test cases.
+ # Setup resources used by the suite.
+ RequestsLibrary.Create_Session config http://${ODL_SYSTEM_IP}:${RESTCONFPORT}${CONFIG_API} auth=${AUTH}
+ RequestsLibrary.Create_Session operational http://${ODL_SYSTEM_IP}:${RESTCONFPORT}${OPERATIONAL_API} auth=${AUTH}
+ SSHLibrary.Set_Default_Configuration prompt=${TOOLS_SYSTEM_PROMPT}
+ SetupUtils.Setup_Utils_For_Setup_And_Teardown
+ NetconfKeywords.Setup_Netconf_Keywords
+ # Connect to the tools machine
+ SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP}
+ Utils.Flexible_Mininet_Login
+ # Deploy testtool on it
+ NetconfKeywords.Install_And_Start_Testtool device-count=${DEVICE_COUNT}
+
+Teardown_Everything
+ [Documentation] Teardown the test infrastructure, perform cleanup and release all resources.
+ Teardown_Netconf_Via_Restconf
+ RequestsLibrary.Delete_All_Sessions
+ NetconfKeywords.Stop_Testtool
+
+Configure_Device
+ [Arguments] ${current_name}
+ [Documentation] Operation for configuring the device in the Netconf subsystem and connecting to it.
+ KarafKeywords.Log_Message_To_Controller_Karaf Connecting device ${current_name}
+ NetconfKeywords.Configure_Device_In_Netconf ${current_name} device_port=${current_port}
+ KarafKeywords.Log_Message_To_Controller_Karaf Waiting for device ${current_name} to connect
+ NetconfKeywords.Wait_Device_Connected ${current_name} period=0.5s
+ KarafKeywords.Log_Message_To_Controller_Karaf Device ${current_name} connected
+
+Check_Device_Data
+ [Arguments] ${current_name}
+ [Documentation] Opration for getting the configuration data of the device and checking that it matches what is expected.
+ KarafKeywords.Log_Message_To_Controller_Karaf Getting data from device ${current_name}
+ ${data}= Utils.Get_Data_From_URI config network-topology:network-topology/topology/topology-netconf/node/${current_name}/yang-ext:mount headers=${ACCEPT_XML}
+ KarafKeywords.Log_Message_To_Controller_Karaf Got data from device ${current_name}
+ BuiltIn.Should_Be_Equal ${data} <data xmlns="${ODL_NETCONF_NAMESPACE}"></data>
+
+Deconfigure_Device
+ [Arguments] ${current_name}
+ [Documentation] Operation for deconfiguring the device from Netconf.
+ KarafKeywords.Log_Message_To_Controller_Karaf Removing device ${current_name}
+ NetconfKeywords.Remove_Device_From_Netconf ${current_name}
+ KarafKeywords.Log_Message_To_Controller_Karaf Waiting for device ${current_name} to disappear
+ NetconfKeywords.Wait_Device_Fully_Removed ${current_name} period=0.5s
+ KarafKeywords.Log_Message_To_Controller_Karaf Device ${current_name} removed