2 Documentation Functional test for bgp - evpn
4 ... Copyright (c) 2016 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 ... This suite tests advertising and receiveing routes with evpn content.
11 ... It uses play.py and odl as bgp peers. Routes advertized from odl
12 ... are configured via application peer. Routes advertised from play.py are
13 ... stored in *.hex files. These files are used also as expected data which
14 ... is recevied from odl.
15 Suite Setup Start_Suite
16 Suite Teardown Stop_Suite
17 Test Setup Run Keywords SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
18 ... AND Verify Test Preconditions
19 Library RequestsLibrary
21 Variables ${CURDIR}/../../../variables/Variables.py
22 Resource ${CURDIR}/../../../libraries/Utils.robot
23 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
24 Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
25 Library ${CURDIR}/../../../libraries/BgpRpcClient.py ${TOOLS_SYSTEM_IP}
26 Resource ${CURDIR}/../../../libraries/BGPcliKeywords.robot
27 Resource ${CURDIR}/../../../libraries/BGPSpeaker.robot
28 Resource ${CURDIR}/../../../libraries/SSHKeywords.robot
32 ${DEVICE_NAME} controller-config
33 ${BGP_PEER_NAME} example-bgp-peer
34 ${RIB_INSTANCE} example-bgp-rib
35 ${APP_PEER_NAME} example-bgp-peer-app
36 ${CMD} env exabgp.tcp.port=1790 exabgp --debug
37 ${BGP_VARIABLES_FOLDER} ${CURDIR}/../../../variables/bgpfunctional
38 ${DEFAUTL_RPC_CFG} exa.cfg
39 ${CONFIG_SESSION} config-session
40 ${EVPN_VARIABLES_DIR} ${CURDIR}/../../../variables/bgpfunctional/l2vpn_evpn
41 ${BGP_TOOL_LOG_LEVEL} debug
42 ${PLAY_SCRIPT} ${CURDIR}/../../../../tools/fastbgp/play.py
43 ${EVPN_CONF_URL} /restconf/config/bgp-rib:application-rib/example-app-rib/tables/odl-bgp-evpn:l2vpn-address-family/odl-bgp-evpn:evpn-subsequent-address-family/odl-bgp-evpn:evpn-routes/
44 ${EVPN_RIB_OPER_URL} /restconf/operational/bgp-rib:bgp-rib/rib/example-bgp-rib/loc-rib/tables/odl-bgp-evpn:l2vpn-address-family/odl-bgp-evpn:evpn-subsequent-address-family/odl-bgp-evpn:evpn-routes
45 ${LOC_RIB_URL} /restconf/operational/bgp-rib:bgp-rib/rib/example-bgp-rib/loc-rib/tables/odl-bgp-evpn:l2vpn-address-family/odl-bgp-evpn:evpn-subsequent-address-family/odl-bgp-evpn:evpn-routes
49 [Documentation] Configures bgp application peer
50 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
51 &{mapping} BuiltIn.Create_Dictionary DEVICE_NAME=${DEVICE_NAME} APP_PEER_NAME=${APP_PEER_NAME} RIB_INSTANCE_NAME=${RIB_INSTANCE} APP_PEER_ID=${ODL_SYSTEM_IP}
52 TemplatedRequests.Put_As_Xml_Templated ${BGP_VARIABLES_FOLDER}/app_peer mapping=${mapping} session=${CONFIG_SESSION}
54 Reconfigure_ODL_To_Accept_Connection
55 [Documentation] Configures BGP peer module with initiate-connection set to false.
56 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
57 &{mapping} BuiltIn.Create_Dictionary DEVICE_NAME=${DEVICE_NAME} BGP_NAME=${BGP_PEER_NAME} IP=${TOOLS_SYSTEM_IP} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT}
58 ... INITIATE=false RIB_INSTANCE_NAME=${RIB_INSTANCE}
59 TemplatedRequests.Put_As_Xml_Templated ${BGP_VARIABLES_FOLDER}/bgp_peer mapping=${mapping} session=${CONFIG_SESSION}
62 [Documentation] Start Python speaker to connect to ODL. We need to do WUKS until odl really starts to accept incomming bgp connection. The failure happens if the incomming connection comes too quickly after configuring the peer in the previous test case.
63 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
64 BuiltIn.Wait_Until_Keyword_Succeeds 3x 1s Start Bgp Peer
66 Odl_To_Play_route_es_arb
67 [Template] Odl_To_Play_Template
70 Play_To_Odl_route_es_arb
71 [Template] Play_To_Odl_Template
74 Odl_To_Play_route_es_as
75 [Template] Odl_To_Play_Template
78 Play_To_Odl_route_es_as
79 [Template] Play_To_Odl_Template
82 Odl_To_Play_route_es_lacp
83 [Template] Odl_To_Play_Template
86 Play_To_Odl_route_es_lacp
87 [Template] Play_To_Odl_Template
90 Odl_To_Play_route_es_lan
91 [Template] Odl_To_Play_Template
94 Play_To_Odl_route_es_lan
95 [Template] Play_To_Odl_Template
98 Odl_To_Play_route_es_mac
99 [Template] Odl_To_Play_Template
102 Play_To_Odl_route_es_mac
103 [Template] Play_To_Odl_Template
106 Odl_To_Play_route_es_rou
107 [Template] Odl_To_Play_Template
110 Play_To_Odl_route_es_rou
111 [Template] Play_To_Odl_Template
114 Odl_To_Play_route_eth_arb
115 [Template] Odl_To_Play_Template
118 Play_To_Odl_route_eth_arb
119 [Template] Play_To_Odl_Template
122 Odl_To_Play_route_eth_as
123 [Template] Odl_To_Play_Template
126 Play_To_Odl_route_eth_as
127 [Template] Play_To_Odl_Template
130 Odl_To_Play_route_eth_lacp
131 [Template] Odl_To_Play_Template
134 Play_To_Odl_route_eth_lacp
135 [Template] Play_To_Odl_Template
138 Odl_To_Play_route_eth_lacp_extdef
139 [Template] Odl_To_Play_Template
140 route_eth_lacp_extdef
142 Play_To_Odl_route_eth_lacp_extdef
143 [Template] Play_To_Odl_Template
144 route_eth_lacp_extdef
146 Odl_To_Play_route_eth_lacp_extesilab
147 [Template] Odl_To_Play_Template
148 route_eth_lacp_extesilab
150 Play_To_Odl_route_eth_lacp_extesilab
151 [Template] Play_To_Odl_Template
152 route_eth_lacp_extesilab
154 Odl_To_Play_route_eth_lacp_extesr
155 [Template] Odl_To_Play_Template
156 route_eth_lacp_extesr
158 Play_To_Odl_route_eth_lacp_extesr
159 [Template] Play_To_Odl_Template
160 route_eth_lacp_extesr
162 Odl_To_Play_route_eth_lacp_extl2
163 [Template] Odl_To_Play_Template
166 Play_To_Odl_route_eth_lacp_extl2
167 [Template] Play_To_Odl_Template
170 Odl_To_Play_route_eth_lacp_extmac
171 [Template] Odl_To_Play_Template
172 route_eth_lacp_extmac
174 Play_To_Odl_route_eth_lacp_extmac
175 [Template] Play_To_Odl_Template
176 route_eth_lacp_extmac
178 Odl_To_Play_route_eth_lan
179 [Template] Odl_To_Play_Template
182 Play_To_Odl_route_eth_lan
183 [Template] Play_To_Odl_Template
186 Odl_To_Play_route_eth_mac
187 [Template] Odl_To_Play_Template
190 Play_To_Odl_route_eth_mac
191 [Template] Play_To_Odl_Template
194 Odl_To_Play_route_eth_rou
195 [Template] Odl_To_Play_Template
198 Play_To_Odl_route_eth_rou
199 [Template] Play_To_Odl_Template
202 Odl_To_Play_route_inc_arb
203 [Template] Odl_To_Play_Template
206 Play_To_Odl_route_inc_arb
207 [Template] Play_To_Odl_Template
210 Odl_To_Play_route_inc_as
211 [Template] Odl_To_Play_Template
214 Play_To_Odl_route_inc_as
215 [Template] Play_To_Odl_Template
218 Odl_To_Play_route_inc_lacp
219 [Template] Odl_To_Play_Template
222 Play_To_Odl_route_inc_lacp
223 [Template] Play_To_Odl_Template
226 Odl_To_Play_route_inc_lan
227 [Template] Odl_To_Play_Template
230 Play_To_Odl_route_inc_lan
231 [Template] Play_To_Odl_Template
234 Odl_To_Play_route_inc_mac
235 [Template] Odl_To_Play_Template
238 Play_To_Odl_route_inc_mac
239 [Template] Play_To_Odl_Template
242 Odl_To_Play_route_inc_rou
243 [Template] Odl_To_Play_Template
246 Play_To_Odl_route_inc_rou
247 [Template] Play_To_Odl_Template
250 Odl_To_Play_route_mac_arb
251 [Template] Odl_To_Play_Template
254 Play_To_Odl_route_mac_arb
255 [Template] Play_To_Odl_Template
258 Odl_To_Play_route_mac_as
259 [Template] Odl_To_Play_Template
262 Play_To_Odl_route_mac_as
263 [Template] Play_To_Odl_Template
266 Odl_To_Play_route_mac_lacp
267 [Template] Odl_To_Play_Template
270 Play_To_Odl_route_mac_lacp
271 [Template] Play_To_Odl_Template
274 Odl_To_Play_route_mac_lan
275 [Template] Odl_To_Play_Template
278 Play_To_Odl_route_mac_lan
279 [Template] Play_To_Odl_Template
282 Odl_To_Play_route_mac_mac
283 [Template] Odl_To_Play_Template
286 Play_To_Odl_route_mac_mac
287 [Template] Play_To_Odl_Template
290 Odl_To_Play_route_mac_rou
291 [Template] Odl_To_Play_Template
294 Play_To_Odl_route_mac_rou
295 [Template] Play_To_Odl_Template
298 Kill_Talking_BGP_Speaker
299 [Documentation] Abort the Python speaker
300 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
301 BGPSpeaker.Kill_BGP_Speaker
303 Delete_Bgp_Peer_Configuration
304 [Documentation] Revert the BGP configuration to the original state: without any configured peers.
305 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
306 &{mapping} Create Dictionary DEVICE_NAME=${DEVICE_NAME} BGP_NAME=${BGP_PEER_NAME}
307 TemplatedRequests.Delete_Templated ${BGP_VARIABLES_FOLDER}/bgp_peer mapping=${mapping} session=${CONFIG_SESSION}
310 [Documentation] Revert the BGP configuration to the original state: without application peer
311 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
312 &{mapping} Create Dictionary DEVICE_NAME=${DEVICE_NAME} APP_PEER_NAME=${APP_PEER_NAME}
313 TemplatedRequests.Delete_Templated ${BGP_VARIABLES_FOLDER}/app_peer mapping=${mapping} session=${CONFIG_SESSION}
317 [Documentation] Initialize SetupUtils. Suite setup keyword.
318 SetupUtils.Setup_Utils_For_Setup_And_Teardown
319 ${mininet_conn_id}= SSHLibrary.Open Connection ${TOOLS_SYSTEM_IP} prompt=${DEFAULT_LINUX_PROMPT} timeout=6s
320 Builtin.Set Suite Variable ${mininet_conn_id}
321 Utils.Flexible Mininet Login ${TOOLS_SYSTEM_USER}
322 RequestsLibrary.Create Session ${CONFIG_SESSION} http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
323 SSHLibrary.Put File ${PLAY_SCRIPT} .
324 SSHKeywords.Assure_Library_Ipaddr target_dir=.
327 [Documentation] Suite teardown keyword
328 SSHLibrary.Close_All_Connections
329 RequestsLibrary.Delete_All_Sessions
332 [Documentation] Starts bgp peer and verifies that the peer runs.
333 BGPSpeaker.Start_BGP_Speaker --amount 0 --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --peerport=${ODL_BGP_PORT} --${BGP_TOOL_LOG_LEVEL} --evpn --wfr 1
334 BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen
337 [Arguments] ${totest}
338 ${data_xml}= OperatingSystem.Get_File ${EVPN_VARIABLES_DIR}/${totest}.xml
339 ${data_json}= OperatingSystem.Get_File ${EVPN_VARIABLES_DIR}/${totest}.json
340 ${announce_hex}= OperatingSystem.Get_File ${EVPN_VARIABLES_DIR}/announce_${totest}.hex
341 ${withdraw_hex}= OperatingSystem.Get_File ${EVPN_VARIABLES_DIR}/withdraw_${totest}.hex
342 BuiltIn.Log ${data_xml}
343 BuiltIn.Log ${data_json}
344 BuiltIn.Log ${announce_hex}
345 BuiltIn.Log ${withdraw_hex}
346 BgpRpcClient.play_clean
347 ${resp}= RequestsLibrary.Post_Request ${CONFIG_SESSION} ${EVPN_CONF_URL} data=${data_xml} headers=${HEADERS_XML}
348 BuiltIn.Should_Be_Equal_As_Numbers ${resp.status_code} 204
349 ${resp}= RequestsLibrary.Get_Request ${CONFIG_SESSION} ${EVPN_CONF_URL} headers=${HEADERS_XML}
350 BuiltIn.Log ${resp.content}
351 ${aupdate}= BuiltIn.Wait_Until_Keyword_Succeeds 4x 2s Get_Update_Content
352 BuiltIn.Log ${aupdate}
353 BuiltIn.Should_Be_Equal_As_Strings ${aupdate} ${announce_hex}
354 BgpRpcClient.play_clean
355 Remove_Configured_Routes
356 ${wupdate}= BuiltIn.Wait_Until_Keyword_Succeeds 4x 2s Get_Update_Content
357 BuiltIn.Log ${wupdate}
358 BuiltIn.Should Be Equal As Strings ${wupdate} ${withdraw_hex}
359 [Teardown] Remove_Configured_Routes
362 [Arguments] ${totest}
363 ${data_xml}= OperatingSystem.Get_File ${EVPN_VARIABLES_DIR}/${totest}.xml
364 ${data_json}= OperatingSystem.Get_File ${EVPN_VARIABLES_DIR}/${totest}.json
365 ${announce_hex}= OperatingSystem.Get_File ${EVPN_VARIABLES_DIR}/announce_${totest}.hex
366 ${withdraw_hex}= OperatingSystem.Get_File ${EVPN_VARIABLES_DIR}/withdraw_${totest}.hex
367 ${empty_routes}= OperatingSystem.Get_File ${EVPN_VARIABLES_DIR}/empty_routes.json
368 BuiltIn.Set_Suite_Variable ${withdraw_hex}
369 BuiltIn.Set_Suite_Variable ${empty_routes}
370 BuiltIn.Log ${data_xml}
371 BuiltIn.Log ${data_json}
372 BuiltIn.Log ${announce_hex}
373 BuiltIn.Log ${withdraw_hex}
374 BuiltIn.Log ${empty_routes}
375 BgpRpcClient.play_clean
376 BgpRpcClient.play_send ${announce_hex}
377 BuiltIn.Wait_Until_Keyword_Succeeds 4x 2s Loc_Rib_Presnece ${data_json}
378 BgpRpcClient.play_send ${withdraw_hex}
379 BuiltIn.Wait_Until_Keyword_Succeeds 4x 2s Loc_Rib_Presnece ${empty_routes}
380 [Teardown] Withdraw_Route_And_Verify ${withdraw_hex}
382 Verify_Test_Preconditions
383 ${resp}= RequestsLibrary.Get_Request ${CONFIG_SESSION} ${EVPN_CONF_URL}
384 BuiltIn.Should_Be_Equal_As_Numbers ${resp.status_code} 404
385 ${empty_routes}= OperatingSystem.Get_File ${EVPN_VARIABLES_DIR}/empty_routes.json
386 Loc_Rib_Presnece ${empty_routes}
388 Remove_Configured_Routes
389 [Documentation] Removes the route if present. First GET is for debug purposes.
390 ${rsp}= RequestsLibrary.Get_Request ${CONFIG_SESSION} ${LOC_RIB_URL} headers=${HEADERS}
392 ${rsp}= RequestsLibrary.Get_Request ${CONFIG_SESSION} ${EVPN_CONF_URL} headers=${HEADERS}
394 BuiltIn.Return_From_Keyword_If "${rsp.status_code}"=="404"
395 ${resp}= RequestsLibrary.Delete_Request ${CONFIG_SESSION} ${EVPN_CONF_URL}
396 BuiltIn.Should_Be_Equal_As_Numbers ${resp.status_code} 200
398 Withdraw_Route_And_Verify
399 [Arguments] ${withdraw_hex}
400 [Documentation] Sends withdraw update message from exabgp and verifies route removal from odl's rib
401 BgpRpcClient.play_send ${withdraw_hex}
402 BuiltIn.Wait_Until_Keyword_Succeeds 3x 2s Loc Rib Presnece ${empty_routes}
405 [Documentation] Gets received data from odl's peer
406 ${resp}= RequestsLibrary.Get_Request ${CONFIG_SESSION} ${EVPN_RIB_OPER_URL} headers=${HEADERS_XML}
407 BuiltIn.Log ${resp.content}
408 ${update}= BgpRpcClient.play_get
409 BuiltIn.Should_Not_Be_Equal ${update} ${Empty}
413 [Arguments] ${exp_content}
414 [Documentation] Verifies if loc-rib contains expected data
415 ${rsp}= RequestsLibrary.Get_Request ${CONFIG_SESSION} ${LOC_RIB_URL} headers=${HEADERS}
416 TemplatedRequests.Normalize_Jsons_And_Compare ${exp_content} ${rsp.content}