2 Documentation BGP performance of ingesting from 1 BGP application peer
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
10 ... Test suite performs basic BGP performance test cases for
11 ... BGP application peer. BGP application peer introduces routes -
12 ... using restconf - in two steps:
13 ... 1. introduces the ${PREFILL} number of routes in one POST request
14 ... 2. POSTs the rest of routes (up to the ${COUNT} number) one by one
15 ... Test suite checks that the prefixes are propagated to
16 ... IPv4 topology and announced to BGP peer via updates. Test case
17 ... where the BGP peer is disconnected and reconnected and all routes
18 ... are deleted by BGP application peer are performed as well.
19 ... Brief description how to configure BGP application peer and
20 ... how to use restconf application peer interface:
21 ... https://wiki.opendaylight.org/view/BGP_LS_PCEP:User_Guide#BGP_Application_Peer
22 ... https://wiki.opendaylight.org/view/BGP_LS_PCEP:Programmer_Guide#BGP
23 ... http://docs.opendaylight.org/en/stable-boron/user-guide/bgp-user-guide.html#bgp-peering
24 ... http://docs.opendaylight.org/en/stable-boron/user-guide/bgp-user-guide.html#application-peer-configuration
27 ... Bug 4689 - Not a reasonable duration of 1M prefix introduction from BGP application peer via restconf
28 ... Bug 4791 - BGPSessionImpl: Failed to send message Update logged even all UPDATE mesages received by iBGP peer
30 Library SSHLibrary timeout=10s
31 Library RequestsLibrary
32 Resource ../../../libraries/BGPcliKeywords.robot
33 Resource ../../../libraries/KarafKeywords.robot
34 Resource ../../../libraries/KillPythonTool.robot
35 Resource ../../../libraries/PrefixCounting.robot
36 Resource ../../../libraries/SetupUtils.robot
37 Resource ../../../libraries/SSHKeywords.robot
38 Resource ../../../libraries/TemplatedRequests.robot
39 Resource ../../../libraries/Utils.robot
40 Resource ../../../variables/Variables.robot
42 Suite Setup Setup_Everything
43 Suite Teardown Teardown_Everything
44 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
45 Test Teardown SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
51 ${BGP_VARIABLES_FOLDER} ${CURDIR}/../../../variables/bgpuser/
53 ${HOLDTIME_APP_PEER_PREFIX_COUNT} ${HOLDTIME}
56 ${COUNT_APP_PEER_PREFIX_COUNT} ${COUNT}
58 ${CHECK_PERIOD_APP_PEER_PREFIX_COUNT} ${CHECK_PERIOD}
59 ${REPETITIONS_APP_PEER_PREFIX_COUNT} 1
60 ${BGP_PEER_LOG_LEVEL} info
61 ${BGP_APP_PEER_LOG_LEVEL} info
63 ${ODL_BGP_LOG_LEVEL} DEFAULT
65 ... python3 play.py --amount 0 --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --peerport=${ODL_BGP_PORT} --${BGP_PEER_LOG_LEVEL}
66 ${BGP_PEER_OPTIONS} &>bgp_peer.log
67 ${BGP_APP_PEER_ID} 10.0.0.10
68 ${BGP_APP_PEER_INITIAL_COMMAND}
69 ... python3 bgp_app_peer.py --host ${ODL_SYSTEM_IP} --port ${RESTCONFPORT} --command post --count ${PREFILL} --prefix 8.0.0.0 --prefixlen 28 --${BGP_APP_PEER_LOG_LEVEL} --stream=${ODL_STREAM}
70 ${BGP_APP_PEER_PUT_COMMAND}
71 ... python3 bgp_app_peer.py --host ${ODL_SYSTEM_IP} --port ${RESTCONFPORT} --command put --count ${PREFILL} --prefix 8.0.0.0 --prefixlen 28 --${BGP_APP_PEER_LOG_LEVEL} --stream=${ODL_STREAM}
72 ${BGP_APP_PEER_DELETE_ALL_COMMAND}
73 ... python3 bgp_app_peer.py --host ${ODL_SYSTEM_IP} --port ${RESTCONFPORT} --command delete-all --${BGP_APP_PEER_LOG_LEVEL} --stream=${ODL_STREAM}
74 ${BGP_APP_PEER_GET_COMMAND}
75 ... python3 bgp_app_peer.py --host ${ODL_SYSTEM_IP} --port ${RESTCONFPORT} --command get --${BGP_APP_PEER_LOG_LEVEL} --stream=${ODL_STREAM}
76 ${BGP_APP_PEER_OPTIONS} &>bgp_app_peer.log
77 ${TEST_DURATION_MULTIPLIER} 30
78 ${last_prefix_count} -1
79 ${DEVICE_NAME} controller-config
80 ${BGP_PEER_NAME} example-bgp-peer
81 ${RIB_INSTANCE} example-bgp-rib
82 ${PROTOCOL_OPENCONFIG} ${RIB_INSTANCE}
86 Check_For_Empty_Ipv4_Topology_Before_Starting
87 [Documentation] Wait for example-ipv4-topology to come up and empty. Give large timeout for case when BGP boots slower than restconf.
88 BuiltIn.Wait_Until_Keyword_Succeeds 120s 1s PrefixCounting.Check_Ipv4_Topology_Is_Empty
90 Reconfigure_ODL_To_Accept_Connection
91 [Documentation] Configure BGP peer module with initiate-connection set to false.
92 &{mapping} Create Dictionary
93 ... DEVICE_NAME=${DEVICE_NAME}
94 ... BGP_NAME=${BGP_PEER_NAME}
95 ... IP=${TOOLS_SYSTEM_IP}
96 ... HOLDTIME=${HOLDTIME_APP_PEER_PREFIX_COUNT}
97 ... PEER_PORT=${BGP_TOOL_PORT}
99 ... BGP_RIB=${RIB_INSTANCE}
100 ... PASSIVE_MODE=true
101 ... BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
102 ... RIB_INSTANCE_NAME=${RIB_INSTANCE}
103 TemplatedRequests.Put_As_Xml_Templated ${BGP_VARIABLES_FOLDER}${/}bgp_peer mapping=${mapping}
105 Reconfigure_ODL_To_Accept_BGP_Application_Peer
106 [Documentation] Configure BGP application peer module.
107 &{mapping} Create Dictionary
108 ... DEVICE_NAME=${DEVICE_NAME}
109 ... NAME=example-bgp-peer-app
110 ... RIB_INSTANCE_NAME=${RIB_INSTANCE}
111 ... IP=${BGP_APP_PEER_ID}
112 ... BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
113 TemplatedRequests.Put_As_Xml_Templated ${BGP_VARIABLES_FOLDER}${/}bgp_application_peer mapping=${mapping}
116 [Documentation] Start BGP peer tool
117 SSHLibrary.Switch Connection bgp_peer_console
118 BGPcliKeywords.Start_Console_Tool ${BGP_PEER_COMMAND} ${BGP_PEER_OPTIONS}
119 BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen
121 BGP_Application_Peer_Prefill_Routes
122 [Documentation] Start BGP application peer tool and prefill routes.
123 SSHLibrary.Switch Connection bgp_app_peer_console
124 BGPcliKeywords.Start_Console_Tool ${BGP_APP_PEER_INITIAL_COMMAND} ${script_uri_opt} ${BGP_APP_PEER_OPTIONS}
125 BGPcliKeywords.Wait_Until_Console_Tool_Finish ${bgp_filling_timeout}
126 BGPcliKeywords.Store_File_To_Workspace bgp_app_peer.log bgp_app_peer_prefill.log
128 Wait_For_Ipv4_Topology_Is_Prefilled
129 [Documentation] Wait until example-ipv4-topology reaches the target prfix count.
130 BuiltIn.Wait Until Keyword Succeeds
131 ... ${bgp_filling_timeout}
133 ... PrefixCounting.Check_Ipv4_Topology_Count
136 Check_Bgp_Peer_Updates_For_Prefilled_Routes
137 [Documentation] Count the routes introduced by updates.
138 [Setup] SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
139 ${count} BuiltIn.Wait Until Keyword Succeeds
140 ... ${bgp_filling_timeout}
142 ... Check_For_String_In_File
144 ... total_received_nlri_prefix_counter: ${PREFILL}
147 BGP_Application_Peer_Introduce_Single_Routes
148 [Documentation] Start BGP application peer tool and introduce routes.
149 SSHLibrary.Switch Connection bgp_app_peer_console
150 BGPcliKeywords.Start_Console_Tool
151 ... python3 bgp_app_peer.py --host ${ODL_SYSTEM_IP} --port ${RESTCONFPORT} --command add --count ${remaining_prefixes} --prefix 12.0.0.0 --prefixlen 28 --${BGP_APP_PEER_LOG_LEVEL} --stream=${ODL_STREAM} ${script_uri_opt}
152 ... ${BGP_APP_PEER_OPTIONS}
153 BGPcliKeywords.Wait_Until_Console_Tool_Finish ${bgp_filling_timeout}
154 BGPcliKeywords.Store_File_To_Workspace bgp_app_peer.log bgp_app_peer_singles.log
156 Wait_For_Ipv4_Topology_Is_Filled
157 [Documentation] Wait until example-ipv4-topology reaches the target prfix count.
158 BuiltIn.Wait Until Keyword Succeeds
159 ... ${bgp_filling_timeout}
161 ... PrefixCounting.Check_Ipv4_Topology_Count
162 ... ${COUNT_APP_PEER_PREFIX_COUNT}
164 Check_Bgp_Peer_Updates_For_All_Routes
165 [Documentation] Count the routes introduced by updates.
166 [Setup] SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
167 BuiltIn.Wait Until Keyword Succeeds
168 ... ${bgp_filling_timeout}
170 ... Check_For_String_In_File
172 ... total_received_nlri_prefix_counter: ${COUNT_APP_PEER_PREFIX_COUNT}
175 [Documentation] Stop BGP peer tool
176 SSHLibrary.Switch Connection bgp_peer_console
177 BGPcliKeywords.Stop_Console_Tool
178 BGPcliKeywords.Store_File_To_Workspace bgp_peer.log bgp_peer_reconnect.log
181 [Documentation] Start BGP peer tool
182 SSHLibrary.Switch Connection bgp_peer_console
183 BGPcliKeywords.Start_Console_Tool ${BGP_PEER_COMMAND} ${BGP_PEER_OPTIONS}
184 BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen
186 Check_Bgp_Peer_Updates_For_Reintroduced_Routes
187 [Documentation] Count the routes introduced by updates.
188 [Setup] SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
189 BuiltIn.Wait Until Keyword Succeeds
190 ... ${bgp_filling_timeout}
192 ... Check_For_String_In_File
194 ... total_received_nlri_prefix_counter: ${COUNT_APP_PEER_PREFIX_COUNT}
196 BGP_Application_Peer_Delete_All_Routes
197 [Documentation] Start BGP application peer tool and delete all routes.
198 SSHLibrary.Switch Connection bgp_app_peer_console
199 BGPcliKeywords.Start_Console_Tool
200 ... ${BGP_APP_PEER_DELETE_ALL_COMMAND} --stream=${ODL_STREAM} ${script_uri_opt}
201 ... ${BGP_APP_PEER_OPTIONS}
202 BGPcliKeywords.Wait_Until_Console_Tool_Finish ${bgp_emptying_timeout}
203 BGPcliKeywords.Store_File_To_Workspace bgp_app_peer.log bgp_app_peer_delete_all.log
205 Wait_For_Stable_Topology_After_Deletion
206 [Documentation] Wait until example-ipv4-topology becomes stable again.
207 PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable
208 ... timeout=${bgp_emptying_timeout}
209 ... period=${CHECK_PERIOD_APP_PEER_PREFIX_COUNT}
210 ... repetitions=${REPETITIONS_APP_PEER_PREFIX_COUNT}
211 ... excluded_count=${COUNT_APP_PEER_PREFIX_COUNT}
213 Check_For_Empty_Ipv4_Topology_After_Deleting
214 [Documentation] Example-ipv4-topology should be empty now.
215 PrefixCounting.Check_Ipv4_Topology_Is_Empty
217 Check_Bgp_Peer_Updates_For_Prefix_Withdrawals
218 [Documentation] Count the routes withdrawn by updates.
219 [Setup] SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
220 BuiltIn.Wait Until Keyword Succeeds
221 ... ${bgp_emptying_timeout}
223 ... Check_For_String_In_File
225 ... total_received_withdrawn_prefix_counter: ${COUNT_APP_PEER_PREFIX_COUNT}
228 [Documentation] Stop BGP peer tool
229 SSHLibrary.Switch Connection bgp_peer_console
230 BGPcliKeywords.Stop_Console_Tool
231 BGPcliKeywords.Store_File_To_Workspace bgp_peer.log bgp_peer_reconnect.log
233 Delete_Bgp_Peer_Configuration
234 [Documentation] Revert the BGP configuration to the original state: without any configured peers.
235 &{mapping} BuiltIn.Create_Dictionary
236 ... DEVICE_NAME=${DEVICE_NAME}
237 ... BGP_NAME=${BGP_PEER_NAME}
238 ... IP=${TOOLS_SYSTEM_IP}
239 ... BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
240 TemplatedRequests.Delete_Templated ${BGP_VARIABLES_FOLDER}${/}bgp_peer mapping=${mapping}
242 Delete_Bgp_Application_Peer_Configuration
243 [Documentation] Revert the BGP configuration to the original state: without any configured peers.
244 &{mapping} BuiltIn.Create_Dictionary
245 ... DEVICE_NAME=${DEVICE_NAME}
246 ... NAME=example-bgp-peer-app
247 ... IP=${BGP_APP_PEER_ID}
248 ... BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
249 TemplatedRequests.Delete_Templated ${BGP_VARIABLES_FOLDER}${/}bgp_application_peer mapping=${mapping}
254 [Documentation] Setup imported resources, SSH-login to tools system,
255 ... create HTTP session, put Python tool to tools system.
256 SetupUtils.Setup_Utils_For_Setup_And_Teardown
257 TemplatedRequests.Create_Default_Session
258 PrefixCounting.PC_Setup
259 SSHLibrary.Set_Default_Configuration prompt=${TOOLS_SYSTEM_PROMPT}
260 RequestsLibrary.Create_Session
262 ... http://${ODL_SYSTEM_IP}:${RESTCONFPORT}
266 # TODO: Do not include slash in ${OPERATIONAL_TOPO_API}, having it typed here is more readable.
267 # TODO: Alternatively, create variable in Variables which starts with http.
268 # Both TODOs would probably need to update every suite relying on current Variables.
269 Open_BGP_Peer_Console
270 Open_BGP_Aplicationp_Peer_Console
271 SSHKeywords.Require_Python
272 SSHKeywords.Assure_Library_Ipaddr target_dir=.
273 SSHLibrary.Put_File ${CURDIR}/../../../../tools/fastbgp/play.py
274 SSHLibrary.Put_File ${CURDIR}/../../../../tools/fastbgp/bgp_app_peer.py
275 SSHLibrary.Put_File ${CURDIR}/../../../../tools/fastbgp/ipv4-routes-template.xml*
276 # Calculate the timeout value based on how many routes are going to be pushed.
277 # The offset (20) is set for keeping reasonable timeout for low COUNT values.
278 ${timeout} BuiltIn.Evaluate ${TEST_DURATION_MULTIPLIER} * ${COUNT_APP_PEER_PREFIX_COUNT} * 3.0 / 10000 + 20
279 Builtin.Set_Suite_Variable ${bgp_filling_timeout} ${timeout}
280 Builtin.Set_Suite_Variable ${bgp_emptying_timeout} ${bgp_filling_timeout*3.0/4}
281 ${result} BuiltIn.Evaluate str(int(${COUNT_APP_PEER_PREFIX_COUNT}) - int(${PREFILL}))
282 Builtin.Set_Suite_Variable ${remaining_prefixes} ${result}
283 KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set ${ODL_LOG_LEVEL}
284 KarafKeywords.Execute_Controller_Karaf_Command_On_Background
285 ... log:set ${ODL_BGP_LOG_LEVEL} org.opendaylight.bgpcep
286 KarafKeywords.Execute_Controller_Karaf_Command_On_Background
287 ... log:set ${ODL_BGP_LOG_LEVEL} org.opendaylight.protocol
288 ${script_uri_opt} Set Variable
289 ... --uri data/bgp-rib:application-rib=${BGP_APP_PEER_ID}/tables=bgp-types%3Aipv4-address-family,bgp-types%3Aunicast-subsequent-address-family
290 BuiltIn.Set_Suite_Variable ${script_uri_opt}
293 [Documentation] Make sure Python tool was killed and tear down imported Resources.
294 SSHLibrary.Switch Connection bgp_peer_console
295 KillPythonTool.Search_And_Kill_Remote_Python 'play\.py'
296 KillPythonTool.Search_And_Kill_Remote_Python 'bgp_app_peer\.py'
297 BuiltIn.Run_Keyword_And_Ignore_Error Utils.Get_Sysstat_Statistics
298 RequestsLibrary.Delete_All_Sessions
299 SSHLibrary.Close_All_Connections
301 Open_BGP_Peer_Console
302 [Documentation] Create a session for BGP peer.
303 SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP} alias=bgp_peer_console
304 SSHKeywords.Flexible_Mininet_Login
306 Open_BGP_Aplicationp_Peer_Console
307 [Documentation] Create a session for BGP peer.
308 SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP} alias=bgp_app_peer_console
309 SSHKeywords.Flexible_Mininet_Login
311 Check_For_String_In_File
312 [Documentation] Check file for ${string} and returns number of occurences
313 [Arguments] ${file_name} ${string} ${threshold}=2
314 ${matches} SSHLibrary.Execute_Command grep -c '${string}' '${file_name}'
315 ${count} Convert To Integer ${matches}
316 BuiltIn.Should_Be_True ${count} >= ${threshold}