2 Documentation netconf-connector scaling test suite to find max connected devices
4 ... Copyright (c) 2019 Lumina Networks, Inc. and others. All rights reserved.
6 ... This program and the accompanying materials are made available under the
7 ... terms of the Eclipse Public License v1.0 which accompanies this distribution,
8 ... and is available at http://www.eclipse.org/legal/epl-v10.html
11 ... Increasing numbers of netconf devices will be connected and cleaned up
12 ... while validating and profiling between each iteration.
13 Suite Setup Setup_Everything
14 Suite Teardown Teardown_Everything
15 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
18 Library SSHLibrary timeout=10s
19 Resource ../../../libraries/CheckJVMResource.robot
20 Resource ../../../libraries/KarafKeywords.robot
21 Resource ../../../libraries/NetconfKeywords.robot
22 Resource ../../../libraries/SetupUtils.robot
23 Resource ../../../libraries/SSHKeywords.robot
24 Resource ../../../variables/Variables.robot
27 ${INIT_DEVICE_COUNT} 250
28 ${MAX_DEVICE_COUNT} 5000
29 ${DEVICE_INCREMENT} 250
30 ${DEVICE_NAME_BASE} netconf-scaling-device
31 ${DEVICE_TYPE} full-uri-device
35 ${MIN_CONNECT_TIMEOUT} 300
36 ${DEVICES_RESULT_FILE} devices.csv
37 ${INSTALL_TESTTOOL} True
38 ${TESTTOOL_EXECUTABLE} ${EMPTY}
41 Find Max Netconf Devices
42 [Documentation] Find max number of switches starting from ${MIN_SWITCHES} till reaching ${MAX_SWITCHES} in steps of ${STEP_SWITCHES}
43 ${error_message} = BuiltIn.Set Variable Failure initializing suite
44 ${maximum_devices} = BuiltIn.Set Variable ${0}
45 ${discover_time} = BuiltIn.Set Variable 0
46 ${start} = BuiltIn.Convert to Integer ${INIT_DEVICE_COUNT}
47 ${stop} = BuiltIn.Convert to Integer ${MAX_DEVICE_COUNT}
48 ${increment} = BuiltIn.Convert to Integer ${DEVICE_INCREMENT}
49 ${schema_dir} = Run Keyword If "${SCHEMA_MODEL}" == "juniper" Get Juniper Device Schemas
50 ... ELSE Set Variable none
51 Run Keyword And Ignore Error CheckJVMResource.Get JVM Memory
52 FOR ${devices} IN RANGE ${start} ${stop+1} ${increment}
53 ${timeout} = BuiltIn.Evaluate ${devices}*${TIMEOUT_FACTOR}
54 ${timeout} = Set Variable If ${timeout} > ${MIN_CONNECT_TIMEOUT} ${timeout} ${MIN_CONNECT_TIMEOUT}
55 Log To Console Starting Iteration with ${devices} devices
56 Run Keyword If "${INSTALL_TESTTOOL}"=="True" NetconfKeywords.Install_And_Start_Testtool debug=false schemas=${schema_dir} device-count=${devices}
57 ... ELSE NetconfKeywords.Start_Testtool ${TESTTOOL_EXECUTABLE} debug=false schemas=${schema_dir} device-count=${devices}
58 ${status} ${result} = Run Keyword And Ignore Error NetconfKeywords.Perform_Operation_On_Each_Device Configure_Device timeout=${timeout}
59 Exit For Loop If '${status}' == 'FAIL'
60 ${status} ${result} = Run Keyword And Ignore Error NetconfKeywords.Perform_Operation_On_Each_Device Wait_Connected timeout=${timeout} log_response=False
61 Exit For Loop If '${status}' == 'FAIL'
62 ${status} ${result} = Run Keyword And Ignore Error Issue_Requests_On_Devices ${TOOLS_SYSTEM_IP} ${devices}
64 Exit For Loop If '${status}' == 'FAIL'
65 ${status} ${result} = Run Keyword And Ignore Error NetconfKeywords.Perform_Operation_On_Each_Device Wait_Connected timeout=${timeout} log_response=False
66 Exit For Loop If '${status}' == 'FAIL'
67 ${status} ${result} = Run Keyword And Ignore Error NetconfKeywords.Perform_Operation_On_Each_Device Deconfigure_Device timeout=${timeout}
68 Exit For Loop If '${status}' == 'FAIL'
69 ${status} ${result} = Run Keyword And Ignore Error NetconfKeywords.Perform_Operation_On_Each_Device Check_Device_Deconfigured timeout=${timeout} log_response=False
70 Exit For Loop If '${status}' == 'FAIL'
71 ${maximum_devices} = Set Variable ${devices}
72 Run Keyword And Ignore Error CheckJVMResource.Get JVM Memory
73 NetconfKeywords.Stop_Testtool
75 [Teardown] Run Keywords NetconfKeywords.Stop_Testtool
76 ... AND Collect_Data_Points ${maximum_devices}
77 ... AND Run Keyword And Ignore Error CheckJVMResource.Get JVM Memory
81 [Arguments] ${devices}
82 [Documentation] Parse and Log relevant information when Scale test finishes
83 OperatingSystem.Append To File ${DEVICES_RESULT_FILE} Max Devices\n
84 OperatingSystem.Append To File ${DEVICES_RESULT_FILE} ${devices}\n
86 Issue_Requests_On_Devices
87 [Arguments] ${client_ip} ${expected_count} ${worker_count}
88 [Documentation] Spawn the specified count of worker threads to issue a GET request to each of the devices.
89 ${current_ssh_connection}= SSHLibrary.Get Connection
90 SSHLibrary.Open_Connection ${client_ip}
91 SSHKeywords.Flexible_Mininet_Login
92 SSHLibrary.Write python getter.py --odladdress=${ODL_SYSTEM_IP} --count=${expected_count} --name=${device_name_base} --workers=${worker_count}
93 FOR ${number} IN RANGE 1 ${expected_count}+1
94 Read_Python_Tool_Operation_Result ${number}
96 SSHLibrary.Read_Until_Prompt
97 SSHLibrary.Close_Connection
98 SSHKeywords.Restore Current SSH Connection From Index ${current_ssh_connection.index}
101 [Documentation] Setup everything needed for the test cases.
102 # Setup resources used by the suite.
103 RequestsLibrary.Create_Session operational http://${ODL_SYSTEM_IP}:${RESTCONFPORT}${OPERATIONAL_API} auth=${AUTH}
104 SSHLibrary.Set_Default_Configuration prompt=${TOOLS_SYSTEM_PROMPT}
105 SetupUtils.Setup_Utils_For_Setup_And_Teardown
106 NetconfKeywords.Setup_Netconf_Keywords
107 # Deploy testing tools.
108 SSHLibrary.Put_File ${CURDIR}/../../../../tools/netconf_tools/getter.py
109 SSHLibrary.Put_File ${CURDIR}/../../../libraries/AuthStandalone.py
110 ${device_type}= BuiltIn.Set_Variable_If ${USE_NETCONF_CONNECTOR}==${True} default ${device_type}
111 BuiltIn.Set_Suite_Variable ${device_type}
114 [Documentation] Teardown the test infrastructure, perform cleanup and release all resources.
115 RequestsLibrary.Delete_All_Sessions
116 NetconfKeywords.Stop_Testtool
119 [Arguments] ${current_name} ${log_response}=True
120 [Documentation] Operation for configuring the device.
121 KarafKeywords.Log_Message_To_Controller_Karaf Configuring device ${current_name} to Netconf
122 NetconfKeywords.Configure_Device_In_Netconf ${current_name} device_type=${device_type} device_port=${current_port}
123 KarafKeywords.Log_Message_To_Controller_Karaf Device ${current_name} configured
126 [Arguments] ${current_name} ${log_response}=True
127 [Documentation] Operation for waiting until the device is connected.
128 KarafKeywords.Log_Message_To_Controller_Karaf Waiting for device ${current_name} to connect
129 NetconfKeywords.Wait_Device_Connected ${current_name} period=0.5s timeout=300s log_response=${log_response}
130 KarafKeywords.Log_Message_To_Controller_Karaf Device ${current_name} connected
132 Read_Python_Tool_Operation_Result
133 [Arguments] ${number}
134 [Documentation] Read and process a report line emitted from the Python tool that corresponds to the device with the given number.
135 ${test}= SSHLibrary.Read_Until_Regexp \\n
136 ${test}= String.Split_String ${test} |
137 ${response}= Collections.Get_From_List ${test} 0
138 ${message}= Collections.Get_From_List ${test} 1
139 BuiltIn.Run_Keyword_If '${response}' == 'ERROR' Fail Error getting data: ${message}
140 ${start}= Collections.Get_From_List ${test} 1
141 ${stop}= Collections.Get_From_List ${test} 2
142 ${ellapsed}= Collections.Get_From_List ${test} 3
143 BuiltIn.Log DATA REQUEST RESULT: Device=${number} StartTime=${start} StopTime=${stop} EllapsedTime=${ellapsed}
144 ${data}= Collections.Get_From_List ${test} 4
145 ${expected}= BuiltIn.Set_Variable '<data xmlns="${ODL_NETCONF_NAMESPACE}"></data>'
146 BuiltIn.Should_Be_Equal_As_Strings ${data} ${expected}
149 [Arguments] ${current_name} ${log_response}=True
150 [Documentation] Operation for deconfiguring the device.
151 KarafKeywords.Log_Message_To_Controller_Karaf Deconfiguring device ${current_name}
152 NetconfKeywords.Remove_Device_From_Netconf ${current_name}
153 KarafKeywords.Log_Message_To_Controller_Karaf Device ${current_name} deconfigured
155 Check_Device_Deconfigured
156 [Arguments] ${current_name} ${log_response}=True
157 [Documentation] Operation for making sure the device is really deconfigured.
158 KarafKeywords.Log_Message_To_Controller_Karaf Waiting for device ${current_name} to disappear
159 NetconfKeywords.Wait_Device_Fully_Removed ${current_name} period=0.5s timeout=120s log_response=${log_response}
160 KarafKeywords.Log_Message_To_Controller_Karaf Device ${current_name} removed
162 Get Juniper Device Schemas
163 OperatingSystem.Run git clone https://github.com/Juniper/yang.git
164 OperatingSystem.Run mkdir /tmp/junos_19.4R1
165 OperatingSystem.Run find yang/19.4/19.4R1/junos -type f -name '*yang' -exec cp {} /tmp/junos_19.4R1/ \\;
166 OperatingSystem.Run cp yang/19.4/19.4R1/common/* /tmp/junos_19.4R1/
167 OperatingSystem.List Directory /tmp/junos_19.4R1/
168 [Return] /tmp/junos_19.4R1