2 Documentation BGP performance of ingesting from 1 iBGP peer, data change counter is used.
4 ... Copyright (c) 2015 Cisco Systems, 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 ... This suite uses play.py as single iBGP peer.
12 ... The suite only looks at example-ipv4-topology, so RIB is not examined.
14 ... This suite requires odl-bgpcep-data-change-counter to be installed so
15 ... make sure it is added to "install-features" of any jobs that are going
18 ... The suite consists of two halves, differing on which side initiates BGP connection.
19 ... Data change counter is a lightweight way to detect "work is being done".
20 ... WaitUtils provide a nice Keyword to wait for stability, but it needs
21 ... initial value, that is why Store_Change_Count appears just before work-inducing action.
22 ... The time for Wait_For_Stable_* cases to finish is the main performance metric.
23 ... After waiting for stability is done, full check on number of prefixes present is performed.
25 ... Brief description how to configure BGP peer can be found here:
26 ... https://wiki.opendaylight.org/view/BGP_LS_PCEP:User_Guide#BGP_Peer
27 ... http://docs.opendaylight.org/en/stable-boron/user-guide/bgp-user-guide.html#bgp-peering
29 ... TODO: Currently, if a bug causes zero increase of data changes,
30 ... affected test cases will wait for max time. Reconsider.
31 ... If zero increase is allowed as stable, higher number of repetitions should be required.
33 ... Additionally this test suite is not compatible with Helium and Hydrogen
34 ... releases as they don't include data change counter feature.
35 ... Use the other version of the suite (singlepeer_prefixcount.robot) to test them.
37 Library SSHLibrary timeout=10s
38 Library RequestsLibrary
39 Resource ../../../libraries/BGPSpeaker.robot
40 Resource ../../../libraries/ChangeCounter.robot
41 Resource ../../../libraries/FailFast.robot
42 Resource ../../../libraries/KillPythonTool.robot
43 Resource ../../../libraries/PrefixCounting.robot
44 Resource ../../../libraries/SetupUtils.robot
45 Resource ../../../libraries/SSHKeywords.robot
46 Resource ../../../libraries/TemplatedRequests.robot
47 Resource ../../../libraries/Utils.robot
48 Resource ../../../variables/Variables.robot
50 Suite Setup Setup_Everything
51 Suite Teardown Teardown_Everything
52 Test Setup SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
53 Test Teardown SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
57 ${BGP_TOOL_LOG_LEVEL} info
58 ${BGP_VARIABLES_FOLDER} ${CURDIR}/../../../variables/bgpuser/
60 ${CHECK_PERIOD_CHANGE_COUNT} ${CHECK_PERIOD}
61 ${CHECK_PERIOD_CHANGE_COUNT_SINGLE} ${CHECK_PERIOD_CHANGE_COUNT}
63 ${COUNT_CHANGE_COUNT} ${COUNT}
64 ${COUNT_CHANGE_COUNT_SINGLE} ${COUNT_CHANGE_COUNT}
66 ${HOLDTIME_CHANGE_COUNT} ${HOLDTIME}
67 ${HOLDTIME_CHANGE_COUNT_SINGLE} ${HOLDTIME_CHANGE_COUNT}
71 ${REPETITIONS_CHANGE_COUNT} ${REPETITIONS}
72 ${REPETITIONS_CHANGE_COUNT_SINGLE} ${REPETITIONS_CHANGE_COUNT}
73 ${RESULTS_FILE_NAME} bgp.csv
74 ${TEST_DURATION_MULTIPLIER} 1
75 ${TEST_DURATION_MULTIPLIER_CHANGE_COUNT} ${TEST_DURATION_MULTIPLIER}
76 ${TEST_DURATION_MULTIPLIER_CHANGE_COUNT_SINGLE} ${TEST_DURATION_MULTIPLIER_CHANGE_COUNT}
79 ${RIB_INSTANCE} example-bgp-rib
80 ${PROTOCOL_OPENCONFIG} ${RIB_INSTANCE}
81 ${DEVICE_NAME} controller-config
82 ${BGP_PEER_NAME} example-bgp-peer
83 # TODO: Option names can be better.
84 ${last_change_count_single} 1
88 Check_For_Empty_Ipv4_Topology_Before_Talking
89 [Documentation] Wait for example-ipv4-topology to come up and empty. Give large timeout for case when BGP boots slower than restconf.
91 # TODO: Choose which tags to assign and make sure they are assigned correctly.
92 BuiltIn.Wait_Until_Keyword_Succeeds 120s 1s PrefixCounting.Check_Ipv4_Topology_Is_Empty
94 Reconfigure_ODL_To_Accept_Connection
95 [Documentation] Configure BGP peer module with initiate-connection set to false.
96 &{mapping} Create Dictionary
97 ... DEVICE_NAME=${DEVICE_NAME}
98 ... BGP_NAME=${BGP_PEER_NAME}
99 ... IP=${TOOLS_SYSTEM_IP}
100 ... HOLDTIME=${HOLDTIME_CHANGE_COUNT_SINGLE}
101 ... PEER_PORT=${BGP_TOOL_PORT}
103 ... BGP_RIB=${RIB_INSTANCE}
104 ... PASSIVE_MODE=true
105 ... BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
106 ... RIB_INSTANCE_NAME=${RIB_INSTANCE}
107 TemplatedRequests.Put_As_Xml_Templated ${BGP_VARIABLES_FOLDER}${/}bgp_peer mapping=${mapping}
109 Reconfigure_Data_Change_Counter
110 [Documentation] Configure data change counter to count transactions in example-ipv4-topology instead of example-linkstate-topology.
111 ChangeCounter.Reconfigure_Topology_Name example-ipv4-topology
113 Verify_Data_Change_Counter_Ready
114 [Documentation] Data change counter might have been slower to start than ipv4 topology, wait for it.
115 BuiltIn.Wait_Until_Keyword_Succeeds 5x 1s ChangeCounter.Get_Change_Count
117 Start_Talking_BGP_Speaker
118 [Documentation] Start Python speaker to connect to ODL.
120 # Myport value is needed for checking whether connection at precise port was established.
121 BGPSpeaker.Start_BGP_Speaker
122 ... --amount ${COUNT_CHANGE_COUNT_SINGLE} --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --peerport=${ODL_BGP_PORT} --insert=${INSERT} --withdraw=${WITHDRAW} --prefill ${PREFILL} --update ${UPDATE} --${BGP_TOOL_LOG_LEVEL} --results ${RESULTS_FILE_NAME}
124 Wait_For_Stable_Talking_Ipv4_Topology
125 [Documentation] Wait until example-ipv4-topology becomes stable. This is done by checking the change counter.
126 ChangeCounter.Wait_For_Change_Count_To_Become_Stable
127 ... timeout=${bgp_filling_timeout}
128 ... period=${CHECK_PERIOD_CHANGE_COUNT_SINGLE}
129 ... repetitions=${REPETITIONS_CHANGE_COUNT_SINGLE}
130 ... count_to_overcome=${last_change_count_single}
132 Check_Talking_Ipv4_Topology_Count
133 [Documentation] Count the routes in example-ipv4-topology and fail if the count is not correct.
135 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
136 PrefixCounting.Check_Ipv4_Topology_Count ${COUNT_CHANGE_COUNT_SINGLE}
138 Kill_Talking_BGP_Speaker
139 [Documentation] Abort the Python speaker. Also, attempt to stop failing fast.
141 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
143 BGPSpeaker.Kill_BGP_Speaker
144 FailFast.Do_Not_Fail_Fast_From_Now_On
145 # NOTE: It is still possible to remain failing fast, if both previous and this test have failed.
146 [Teardown] SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
148 Store_Results_For_Talking_BGP_Speaker
149 [Documentation] Store results for plotting
150 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
151 Store_File_To_Workspace totals-${RESULTS_FILE_NAME} totals-${RESULTS_FILE_NAME}
152 Store_File_To_Workspace performance-${RESULTS_FILE_NAME} performance-${RESULTS_FILE_NAME}
153 Store_File_To_Workspace totals-${RESULTS_FILE_NAME} changecount-talking-totals-${RESULTS_FILE_NAME}
154 Store_File_To_Workspace performance-${RESULTS_FILE_NAME} changecount-talking-performance-${RESULTS_FILE_NAME}
156 Wait_For_Stable_Ipv4_Topology_After_Talking
157 [Documentation] Wait until example-ipv4-topology becomes stable again.
159 ChangeCounter.Wait_For_Change_Count_To_Become_Stable
160 ... timeout=${bgp_emptying_timeout}
161 ... period=${CHECK_PERIOD_CHANGE_COUNT_SINGLE}
162 ... repetitions=${REPETITIONS_CHANGE_COUNT_SINGLE}
163 ... count_to_overcome=${last_change_count_single}
165 Check_For_Empty_Ipv4_Topology_After_Talking
166 [Documentation] Example-ipv4-topology should be empty now.
168 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
169 PrefixCounting.Check_Ipv4_Topology_Is_Empty
171 Start_Listening_BGP_Speaker
172 [Documentation] Start Python speaker in listening mode.
173 BGPSpeaker.Start_BGP_Speaker
174 ... --amount ${COUNT_CHANGE_COUNT_SINGLE} --listen --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --insert=${INSERT} --withdraw=${WITHDRAW} --prefill ${PREFILL} --update ${UPDATE} --${BGP_TOOL_LOG_LEVEL} --results ${RESULTS_FILE_NAME}
176 Reconfigure_ODL_To_Initiate_Connection
177 [Documentation] Replace BGP peer config module, now with initiate-connection set to true.
179 &{mapping} Create Dictionary
180 ... DEVICE_NAME=${DEVICE_NAME}
181 ... BGP_NAME=${BGP_PEER_NAME}
182 ... IP=${TOOLS_SYSTEM_IP}
183 ... HOLDTIME=${HOLDTIME_CHANGE_COUNT_SINGLE}
184 ... PEER_PORT=${BGP_TOOL_PORT}
186 ... BGP_RIB=${RIB_INSTANCE}
187 ... PASSIVE_MODE=false
188 ... BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
189 ... RIB_INSTANCE_NAME=${RIB_INSTANCE}
190 TemplatedRequests.Put_As_Xml_Templated ${BGP_VARIABLES_FOLDER}${/}bgp_peer mapping=${mapping}
192 Wait_For_Stable_Listening_Ipv4_Topology
193 [Documentation] Wait until example-ipv4-topology becomes stable.
194 ChangeCounter.Wait_For_Change_Count_To_Become_Stable
195 ... timeout=${bgp_filling_timeout}
196 ... period=${CHECK_PERIOD_CHANGE_COUNT_SINGLE}
197 ... repetitions=${REPETITIONS_CHANGE_COUNT_SINGLE}
198 ... count_to_overcome=${last_change_count_single}
200 Check_Listening_Ipv4_Topology_Count
201 [Documentation] Count the routes in example-ipv4-topology and fail if the count is not correct.
203 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
204 PrefixCounting.Check_Ipv4_Topology_Count ${COUNT_CHANGE_COUNT_SINGLE}
206 Kill_Listening_BGP_Speaker
207 [Documentation] Abort the Python speaker. Also, attempt to stop failing fast.
209 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
211 BGPSpeaker.Kill_BGP_Speaker
212 FailFast.Do_Not_Fail_Fast_From_Now_On
213 # NOTE: It is still possible to remain failing fast, if both previous and this test have failed.
214 [Teardown] SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
216 Store_Results_For_Listening_BGP_Speaker
217 [Documentation] Store results for plotting
218 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
219 Store_File_To_Workspace totals-${RESULTS_FILE_NAME} totals-${RESULTS_FILE_NAME}
220 Store_File_To_Workspace performance-${RESULTS_FILE_NAME} performance-${RESULTS_FILE_NAME}
221 Store_File_To_Workspace totals-${RESULTS_FILE_NAME} changecount-listening-totals-${RESULTS_FILE_NAME}
222 Store_File_To_Workspace
223 ... performance-${RESULTS_FILE_NAME}
224 ... changecount-listening-performance-${RESULTS_FILE_NAME}
226 Wait_For_Stable_Ipv4_Topology_After_Listening
227 [Documentation] Wait until example-ipv4-topology becomes stable again.
229 ChangeCounter.Wait_For_Change_Count_To_Become_Stable
230 ... timeout=${bgp_emptying_timeout}
231 ... period=${CHECK_PERIOD_CHANGE_COUNT_SINGLE}
232 ... repetitions=${REPETITIONS_CHANGE_COUNT_SINGLE}
233 ... count_to_overcome=${last_change_count_single}
235 Check_For_Empty_Ipv4_Topology_After_Listening
236 [Documentation] Example-ipv4-topology should be empty now.
238 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
239 PrefixCounting.Check_Ipv4_Topology_Is_Empty
241 Restore_Data_Change_Counter_Configuration
242 [Documentation] Configure data change counter back to count transactions affecting example-linkstate-topology.
243 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
244 ChangeCounter.Reconfigure_Topology_Name example-linkstate-topology
246 Delete_Bgp_Peer_Configuration
247 [Documentation] Revert the BGP configuration to the original state: without any configured peers.
248 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
249 &{mapping} BuiltIn.Create_Dictionary
250 ... DEVICE_NAME=${DEVICE_NAME}
251 ... BGP_NAME=${BGP_PEER_NAME}
252 ... IP=${TOOLS_SYSTEM_IP}
253 ... BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
254 TemplatedRequests.Delete_Templated ${BGP_VARIABLES_FOLDER}${/}bgp_peer mapping=${mapping}
259 [Documentation] Setup imported resources, SSH-login to tools system,
260 ... create HTTP session, put Python tool to tools system.
261 SetupUtils.Setup_Utils_For_Setup_And_Teardown
262 TemplatedRequests.Create_Default_Session
263 ChangeCounter.CC_Setup
264 PrefixCounting.PC_Setup
265 RequestsLibrary.Create_Session
267 ... http://${ODL_SYSTEM_IP}:${RESTCONFPORT}
271 # TODO: Do not include slash in ${OPERATIONAL_TOPO_API}, having it typed here is more readable.
272 # TODO: Alternatively, create variable in Variables which starts with http.
273 # Both TODOs would probably need to update every suite relying on current Variables.
274 SSHLibrary.Set_Default_Configuration prompt=${TOOLS_SYSTEM_PROMPT}
275 SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP}
276 SSHKeywords.Flexible_Mininet_Login
277 SSHKeywords.Require_Python
278 SSHKeywords.Assure_Library_Ipaddr target_dir=.
279 SSHLibrary.Put_File ${CURDIR}/../../../../tools/fastbgp/play.py
280 # Calculate the timeout value based on how many routes are going to be pushed
281 # TODO: Unify formulas with other suites in this directory.
282 ${timeout} BuiltIn.Evaluate
283 ... ${TEST_DURATION_MULTIPLIER_CHANGE_COUNT_SINGLE} * (${COUNT_CHANGE_COUNT_SINGLE} * 9.0 / 10000 + 20)
284 Builtin.Set_Suite_Variable ${bgp_filling_timeout} ${timeout}
285 Builtin.Set_Suite_Variable ${bgp_emptying_timeout} ${bgp_filling_timeout*3.0/4}
288 [Documentation] Make sure Python tool was killed and tear down imported Resources.
289 # Environment issue may have dropped the SSH connection, but we do not want Teardown to fail.
290 BuiltIn.Run_Keyword_And_Ignore_Error KillPythonTool.Search_And_Kill_Remote_Python 'play\.py'
291 BuiltIn.Run_Keyword_And_Ignore_Error Utils.Get_Sysstat_Statistics
292 RequestsLibrary.Delete_All_Sessions
293 SSHLibrary.Close_All_Connections
296 [Documentation] Get the count of changes from BGP change counter. Ignore error or store the value.
297 ${status} ${count} BuiltIn.Run_Keyword_And_Ignore_Error ChangeCounter.Get_Change_Count
298 IF '${status}' == 'PASS'
299 BuiltIn.Set_Suite_Variable ${last_change_count_single} ${count}
302 Store_File_To_Workspace
303 [Documentation] Store the provided file from the SSH client to workspace.
304 [Arguments] ${src_file_name} ${dst_file_name}
305 ${files} SSHLibrary.List Files In Directory .
306 ${output_log} SSHLibrary.Execute_Command cat ${src_file_name}
307 BuiltIn.Log ${output_log}
308 Create File ${dst_file_name} ${output_log}