]>
git.proxmox.com Git - mirror_frr.git/blob - tests/topotests/bgp_unique_rid/test_bgp_unique_rid.py
2 # SPDX-License-Identifier: ISC
5 # Copyright (c) 2022 by VMware, Inc. ("VMware")
6 # Used Copyright (c) 2018 by Network Device Education Foundation,
7 # Inc. ("NetDEF") in this file.
15 from copy
import deepcopy
17 # Save the Current Working Directory to find configuration files.
18 CWD
= os
. path
. dirname ( os
. path
. realpath ( __file__
))
19 sys
. path
. append ( os
. path
. join ( CWD
, "../" ))
20 sys
. path
. append ( os
. path
. join ( CWD
, "../lib/" ))
22 """Following tests are covered to test bgp unique rid functionality.
23 1. Verify eBGP session when same and different router ID is configured.
24 2. Verify iBGP session when same and different router ID is configured.
25 3. Verify two different eBGP sessions initiated with same router ID.
26 4. Chaos - Verify bgp unique rid functionality in chaos scenarios.
27 5. Chaos - Verify bgp unique rid functionality when router reboots with same loopback id.
28 6. Chaos - Verify bgp unique rid functionality when router reboots without any ip addresses.
31 #################################
33 #################################
44 | iBGP +-------+ eBGP +-------+
45 +---------- | R3 |========= | R4 |
57 # pylint: disable=C0413
58 # Import topogen and topotest helpers
59 from lib
. topogen
import Topogen
, get_topogen
60 from lib
. topojson
import build_config_from_json
61 from lib
. topolog
import logger
63 pytestmark
= [ pytest
. mark
. bgpd
, pytest
. mark
. ospfd
, pytest
. mark
. staticd
]
65 # Required to instantiate the topology builder class.
66 from lib
. common_config
import (
73 reset_config_on_routers
,
80 from lib
. topolog
import logger
82 verify_bgp_convergence
,
89 bgp_convergence
= False
109 bgp_convergence
= False
110 ADDR_TYPES
= check_address_types ()
111 routerid
= { "ipv4" : "10.10.10.14" , "ipv6" : "fd00:0:0:3::2" }
114 def setup_module ( mod
):
117 Set up the pytest environment
121 testsuite_run_time
= time
. asctime ( time
. localtime ( time
. time ()))
122 logger
. info ( "Testsuite start time: {}" . format ( testsuite_run_time
))
123 logger
. info ( "=" * 40 )
125 logger
. info ( "Running setup_module to create topology" )
127 # This function initiates the topology build with Topogen...
128 json_file
= "{}/bgp_unique_rid.json" . format ( CWD
)
129 tgen
= Topogen ( json_file
, mod
.__ name
__ )
131 topo
= tgen
. json_topo
132 # ... and here it calls Mininet initialization functions.
134 # Starting topology, create tmp files which are loaded to routers
135 # to start daemons and then start routers
138 # Creating configuration from JSON
139 build_config_from_json ( tgen
, topo
)
141 # Checking BGP convergence
142 global bgp_convergence
145 # Don't run this test if we have any failure.
146 if tgen
. routers_have_failure ():
147 pytest
. skip ( tgen
. errors
)
149 # Api call verify whether BGP is converged
150 bgp_convergence
= verify_bgp_convergence ( tgen
, topo
)
151 assert bgp_convergence
is True , "setup_module :Failed \n Error:" " {}" . format (
154 logger
. info ( "Running setup_module() done" )
157 def teardown_module ():
158 """Teardown the pytest environment"""
160 logger
. info ( "Running teardown_module to delete topology" )
164 # Stop toplogy and Remove tmp files
168 "Testsuite end time: {}" . format ( time
. asctime ( time
. localtime ( time
. time ())))
170 logger
. info ( "=" * 40 )
173 #####################################################
175 #####################################################
178 def test_bgp_unique_rid_ebgp_p0 ():
181 Verify eBGP session when same and different router ID is configured.
184 global bgp_convergence
186 if bgp_convergence
is not True :
187 pytest
. skip ( "skipped because of BGP Convergence failure" )
190 tc_name
= inspect
. stack ()[ 0 ][ 3 ]
191 write_test_header ( tc_name
)
192 if tgen
. routers_have_failure ():
193 check_router_status ( tgen
)
195 step ( "Configure base config as per the topology" )
196 reset_config_on_routers ( tgen
)
199 "Base config should be up, verify using BGP convergence on all \
200 the routers for IPv4 and IPv6 nbrs"
203 result
= verify_bgp_convergence ( tgen
, topo
)
204 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
206 step ( "Configure the same router id between R4 and R3 10.10.10.10" )
208 "r3" : { "bgp" : { "router_id" : "10.10.10.10" }},
209 "r4" : { "bgp" : { "router_id" : "10.10.10.10" }},
211 result
= create_router_bgp ( tgen
, topo
, input_dict
)
212 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
214 step ( "Verify neighbours are in ESTAB state." )
215 result
= verify_bgp_convergence ( tgen
, topo
)
216 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
218 step ( "Configure the same router id between R5 and R3 (10.10.10.10)" )
220 "r3" : { "bgp" : { "router_id" : "10.10.10.10" }},
221 "r5" : { "bgp" : { "router_id" : "10.10.10.10" }},
223 result
= create_router_bgp ( tgen
, topo
, input_dict
)
224 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
226 step ( "Verify neighbours are in ESTAB state." )
227 result
= verify_bgp_convergence ( tgen
, topo
)
228 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
230 step ( "modify the router id on r3 to different router id (11.11.11.11)" )
231 input_dict
= { "r3" : { "bgp" : { "router_id" : "11.11.11.11" }}}
232 result
= create_router_bgp ( tgen
, topo
, input_dict
)
233 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
235 step ( "Verify neighbours are in ESTAB state." )
236 result
= verify_bgp_convergence ( tgen
, topo
)
237 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
239 step ( "Reset bgp process" )
240 step ( "Verify neighbours are in ESTAB state." )
242 result
= clear_bgp_and_verify ( tgen
, topo
, dut
)
243 assert result
is True , "Testcase {} : Failed \n Error: {}" . format ( tc_name
, result
)
245 step ( "Clear ip bgp process with *" )
246 step ( "Verify neighbours are in ESTAB state." )
247 result
= clear_bgp_and_verify ( tgen
, topo
, dut
)
248 assert result
is True , "Testcase {} : Failed \n Error: {}" . format ( tc_name
, result
)
250 step ( "Configure neighbours between R3 and R4 in EVPN address family." )
258 "ipv4" : { "unicast" : {}},
259 "ipv6" : { "unicast" : {}},
272 "ipv4" : { "unicast" : {}},
273 "ipv6" : { "unicast" : {}},
281 result
= create_router_bgp ( tgen
, topo
, input_dict
)
282 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
284 step ( "Verify neighbours are in ESTAB state." )
285 result
= clear_bgp_and_verify ( tgen
, topo
, dut
)
286 assert result
is True , "Testcase {} : Failed \n Error: {}" . format ( tc_name
, result
)
288 write_test_footer ( tc_name
)
291 def test_bgp_unique_rid_ibgp_p0 ():
294 Verify iBGP session when same and different router ID is configured.
297 global bgp_convergence
299 if bgp_convergence
is not True :
300 pytest
. skip ( "skipped because of BGP Convergence failure" )
303 tc_name
= inspect
. stack ()[ 0 ][ 3 ]
304 write_test_header ( tc_name
)
305 if tgen
. routers_have_failure ():
306 check_router_status ( tgen
)
308 step ( "Configure base config as per the topology" )
309 reset_config_on_routers ( tgen
)
312 "Base config should be up, verify using BGP convergence on all \
313 the routers for IPv4 and IPv6 nbrs"
316 result
= verify_bgp_convergence ( tgen
, topo
)
317 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
319 step ( "Configure the same router id between R1 and R3 (10.10.10.10)" )
321 "r3" : { "bgp" : { "router_id" : "10.10.10.10" }},
322 "r1" : { "bgp" : { "router_id" : "10.10.10.10" }},
324 result
= create_router_bgp ( tgen
, topo
, input_dict
)
325 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
327 step ( "Verify neighbours are in idle state." )
328 result
= verify_bgp_convergence ( tgen
, topo
, expected
= False )
329 assert result
is not True , "Testcase {} :Failed \n Error: {}" . format (
333 step ( "Configure the same router id between R2 and R3 (10.10.10.10)" )
335 "r3" : { "bgp" : { "router_id" : "10.10.10.10" }},
336 "r2" : { "bgp" : { "router_id" : "10.10.10.10" }},
338 result
= create_router_bgp ( tgen
, topo
, input_dict
)
339 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
341 step ( "Verify neighbours are in idle state." )
342 result
= verify_bgp_convergence ( tgen
, topo
, expected
= False )
343 assert result
is not True , "Testcase {} :Failed \n Error: {}" . format (
347 step ( "modify the router id on r3 to different router id (11.11.11.11)" )
348 input_dict
= { "r3" : { "bgp" : { "router_id" : "11.11.11.11" }}}
349 result
= create_router_bgp ( tgen
, topo
, input_dict
)
350 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
352 step ( "Verify neighbours are in ESTAB state." )
353 result
= verify_bgp_convergence ( tgen
, topo
, dut
= "r3" )
354 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
356 step ( "Reset bgp process" )
357 step ( "Verify neighbours are in ESTAB state." )
359 result
= clear_bgp_and_verify ( tgen
, topo
, dut
)
360 assert result
is True , "Testcase {} : Failed \n Error: {}" . format ( tc_name
, result
)
362 step ( "Clear ip bgp process with *" )
363 result
= clear_bgp_and_verify ( tgen
, topo
, dut
)
364 assert result
is True , "Testcase {} : Failed \n Error: {}" . format ( tc_name
, result
)
366 write_test_footer ( tc_name
)
369 def test_bgp_unique_rid_multi_bgp_nbrs_p0 ():
372 3. Verify two different eBGP sessions initiated with same router ID
376 global bgp_convergence
, topo
378 if bgp_convergence
is not True :
379 pytest
. skip ( "skipped because of BGP Convergence failure" )
382 tc_name
= inspect
. stack ()[ 0 ][ 3 ]
383 write_test_header ( tc_name
)
384 if tgen
. routers_have_failure ():
385 check_router_status ( tgen
)
387 step ( "Configure base config as per the topology" )
388 reset_config_on_routers ( tgen
)
391 "Base config should be up, verify using BGP convergence on all \
392 the routers for IPv4 and IPv6 nbrs"
395 result
= verify_bgp_convergence ( tgen
, topo
)
396 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
398 step ( "Configure the same router id between R3, R4 and R5 (10.10.10.10)" )
400 "r3" : { "bgp" : { "router_id" : "10.10.10.10" }},
401 "r4" : { "bgp" : { "router_id" : "10.10.10.10" }},
402 "r5" : { "bgp" : { "router_id" : "10.10.10.10" }},
404 result
= create_router_bgp ( tgen
, topo
, input_dict
)
405 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
407 step ( "Verify neighbours are in ESTAB state." )
408 result
= verify_bgp_convergence ( tgen
, topo
)
409 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
412 "Configure the same IP address on on R4 and R5 loopback address and \
413 change the neighborship to loopback neighbours between R3 to R4 \
414 and R3 to R5 respectively."
417 topo1
= deepcopy ( topo
)
419 for rtr
in [ "r4" , "r5" ]:
420 topo1
[ "routers" ][ rtr
][ "links" ][ "lo" ][ "ipv4" ] = "192.168.1.1/32"
422 topo1
[ "routers" ][ "r3" ][ "links" ][ "lo" ][ "ipv4" ] = "192.168.1.3/32"
423 build_config_from_json ( tgen
, topo1
, save_bkup
= False )
426 "change the neighborship to loopback neighbours between R3 to R4 and R3 to R5 respectively."
428 for rtr
in [ "r4" , "r5" ]:
429 configure_bgp_on_rtr
= {
434 "unicast" : { "neighbor" : { rtr
: { "dest_link" : { "lo" : {}}}}}
440 result
= create_router_bgp ( tgen
, topo1
, configure_bgp_on_rtr
)
441 assert result
is True , "Testcase {} : Failed \n Error: {}" . format (
445 bgp_convergence
= verify_bgp_convergence ( tgen
, topo1
, dut
= "r3" )
446 assert bgp_convergence
is True , "Testcase {} : Failed \n Error: {}" . format (
447 tc_name
, bgp_convergence
450 step ( "Change the IP address on the R4 loopback." )
451 topo1
[ "routers" ][ "r4" ][ "links" ][ "lo" ][ "ipv4" ] = "192.168.1.4/32"
452 build_config_from_json ( tgen
, topo1
, save_bkup
= False )
454 step ( "Verify neighbours should be again in ESTAB state. (show ip bgp neighbours)" )
455 bgp_convergence
= verify_bgp_convergence ( tgen
, topo1
, dut
= "r3" )
456 assert bgp_convergence
is True , "Testcase {} : Failed \n Error: {}" . format (
457 tc_name
, bgp_convergence
460 step ( "Clear ip bgp process with *" )
461 result
= clear_bgp_and_verify ( tgen
, topo
, router
= "r3" )
462 assert result
is True , "Testcase {} : Failed \n Error: {}" . format ( tc_name
, result
)
464 write_test_footer ( tc_name
)
467 def test_bgp_unique_rid_chaos1_p2 ():
470 4. Chaos - Verify bgp unique rid functionality in chaos scenarios.
474 global bgp_convergence
476 if bgp_convergence
is not True :
477 pytest
. skip ( "skipped because of BGP Convergence failure" )
480 tc_name
= inspect
. stack ()[ 0 ][ 3 ]
481 write_test_header ( tc_name
)
482 if tgen
. routers_have_failure ():
483 check_router_status ( tgen
)
485 step ( "Configure base config as per the topology" )
486 reset_config_on_routers ( tgen
)
489 "Base config should be up, verify using BGP convergence on all \
490 the routers for IPv4 and IPv6 nbrs"
493 result
= verify_bgp_convergence ( tgen
, topo
)
494 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
496 step ( "Configure the same router id between R3, R4 and R5 (10.10.10.10)" )
498 "r3" : { "bgp" : { "router_id" : "10.10.10.10" }},
499 "r4" : { "bgp" : { "router_id" : "10.10.10.10" }},
500 "r5" : { "bgp" : { "router_id" : "10.10.10.10" }},
502 result
= create_router_bgp ( tgen
, topo
, input_dict
)
503 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
505 step ( "Verify neighbours are in ESTAB state." )
506 result
= verify_bgp_convergence ( tgen
, topo
)
507 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
510 "Verify eBGP session when same router ID is configured and bgpd process is restarted"
513 # restart bgpd router and verify
514 kill_router_daemons ( tgen
, "r3" , [ "bgpd" ])
515 start_router_daemons ( tgen
, "r3" , [ "bgpd" ])
518 "The session should be established between R3 & R4. "
519 "Once after restart bgp, neighbor should come back up ."
522 bgp_convergence
= verify_bgp_convergence ( tgen
, topo
)
523 assert bgp_convergence
is True , "Testcase {} : Failed \n Error: {}" . format (
524 tc_name
, bgp_convergence
528 "Verify eBGP session when same router ID is configured and neighbor shutdown is issued and again no shutdown."
541 "r3-link1" : { "shutdown" : True },
542 "r3-link2" : { "shutdown" : True },
543 "r3-link3" : { "shutdown" : True },
544 "r3-link4" : { "shutdown" : True },
545 "r3-link5" : { "shutdown" : True },
546 "r3-link6" : { "shutdown" : True },
547 "r3-link7" : { "shutdown" : True },
550 "r5" : { "dest_link" : { "r3" : { "shutdown" : True }}},
559 "r3-link1" : { "shutdown" : True },
560 "r3-link2" : { "shutdown" : True },
561 "r3-link3" : { "shutdown" : True },
562 "r3-link4" : { "shutdown" : True },
563 "r3-link5" : { "shutdown" : True },
564 "r3-link6" : { "shutdown" : True },
565 "r3-link7" : { "shutdown" : True },
568 "r5" : { "dest_link" : { "r3" : { "shutdown" : True }}},
576 result
= create_router_bgp ( tgen
, topo
, input_dict
)
577 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
589 "r3-link1" : { "shutdown" : False },
590 "r3-link2" : { "shutdown" : False },
591 "r3-link3" : { "shutdown" : False },
592 "r3-link4" : { "shutdown" : False },
593 "r3-link5" : { "shutdown" : False },
594 "r3-link6" : { "shutdown" : False },
595 "r3-link7" : { "shutdown" : False },
598 "r5" : { "dest_link" : { "r3" : { "shutdown" : False }}},
607 "r3-link1" : { "shutdown" : False },
608 "r3-link2" : { "shutdown" : False },
609 "r3-link3" : { "shutdown" : False },
610 "r3-link4" : { "shutdown" : False },
611 "r3-link5" : { "shutdown" : False },
612 "r3-link6" : { "shutdown" : False },
613 "r3-link7" : { "shutdown" : False },
616 "r5" : { "dest_link" : { "r3" : { "shutdown" : False }}},
624 result
= create_router_bgp ( tgen
, topo
, input_dict
)
625 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
628 "The session should be established between R3 & R4. "
629 "Once after restart bgp, neighbor should come back up ."
632 bgp_convergence
= verify_bgp_convergence ( tgen
, topo
)
633 assert bgp_convergence
is True , "Testcase {} : Failed \n Error: {}" . format (
634 tc_name
, bgp_convergence
638 "Verify eBGP session when same router ID is configured and neighbor config is deleted & reconfigured."
660 "r5" : { "dest_link" : { "r3" : {}}},
678 "r5" : { "dest_link" : { "r3" : {}}},
686 result
= create_router_bgp ( tgen
, topo
, input_dict
)
687 assert result
is True , "Testcase {} :Failed \n Error: {}" . format ( tc_name
, result
)
690 "The session should be established between R3 & R4. "
691 "Once after restart bgp, neighbor should come back up ."
694 bgp_convergence
= verify_bgp_convergence ( tgen
, topo
)
695 assert bgp_convergence
is True , "Testcase {} : Failed \n Error: {}" . format (
696 tc_name
, bgp_convergence
700 "Verify eBGP session when same router ID is configured and FRR router is restarted."
702 stop_router ( tgen
, "r3" )
703 start_router ( tgen
, "r3" )
706 "The session should be established between R3 & R4. "
707 "Once after restart bgp, neighbor should come back up ."
710 bgp_convergence
= verify_bgp_convergence ( tgen
, topo
)
711 assert bgp_convergence
is True , "Testcase {} : Failed \n Error: {}" . format (
712 tc_name
, bgp_convergence
716 "Verify eBGP session when same router ID is configured and zebra process is restarted"
719 kill_router_daemons ( tgen
, "r3" , [ "zebra" ])
720 start_router_daemons ( tgen
, "r3" , [ "zebra" ])
723 "The session should be established between R3 & R4. "
724 "Once after restart bgp, neighbor should come back up ."
727 bgp_convergence
= verify_bgp_convergence ( tgen
, topo
)
728 assert bgp_convergence
is True , "Testcase {} : Failed \n Error: {}" . format (
729 tc_name
, bgp_convergence
732 write_test_footer ( tc_name
)
735 def test_bgp_unique_rid_chaos3_p2 ():
738 4. Chaos - Verify bgp unique rid functionality when router reboots with same loopback id.
742 global bgp_convergence
744 if bgp_convergence
is not True :
745 pytest
. skip ( "skipped because of BGP Convergence failure" )
748 tc_name
= inspect
. stack ()[ 0 ][ 3 ]
749 write_test_header ( tc_name
)
750 if tgen
. routers_have_failure ():
751 check_router_status ( tgen
)
753 step ( "Configure base config as per the topology" )
754 reset_config_on_routers ( tgen
)
757 topo1
= deepcopy ( topo
)
759 for rtr
in topo
[ "routers" ]. keys ():
760 topo1
[ "routers" ][ rtr
][ "links" ][ "lo" ][ "ipv4" ] = "192.168.1.1/32"
762 topo1
[ "routers" ][ "r3" ][ "links" ][ "lo" ][ "ipv4" ] = "192.168.1.3/32"
763 build_config_from_json ( tgen
, topo1
, save_bkup
= False )
765 step ( "verify bgp convergence before starting test case" )
767 bgp_convergence
= verify_bgp_convergence ( tgen
, topo1
)
768 assert bgp_convergence
is True , "Testcase {} : Failed \n Error: {}" . format (
769 tc_name
, bgp_convergence
773 "Configure loopback on R1 to R5 with IP address 1.1.1.1 on all the routers. Change neighborship on all the routers using loopback neighborship ids."
775 for rtr
in [ "r1" , "r2" , "r4" , "r5" ]:
776 configure_bgp_on_rtr
= {
781 "unicast" : { "neighbor" : { rtr
: { "dest_link" : { "lo" : {}}}}}
787 result
= create_router_bgp ( tgen
, topo1
, configure_bgp_on_rtr
)
788 assert result
is True , "Testcase {} : Failed \n Error: {}" . format (
792 bgp_convergence
= verify_bgp_convergence ( tgen
, topo1
, dut
= "r3" )
793 assert bgp_convergence
is True , "Testcase {} : Failed \n Error: {}" . format (
794 tc_name
, bgp_convergence
797 step ( "Reboot the router (restart frr) or using watch frr." )
798 stop_router ( tgen
, "r3" )
799 start_router ( tgen
, "r3" )
801 step ( "Neighbors between R3, R4 and R3 to R5 should be in ESTB state." )
802 bgp_convergence
= verify_bgp_convergence ( tgen
, topo1
, dut
= "r3" )
803 assert bgp_convergence
is True , "Testcase {} : Failed \n Error: {}" . format (
804 tc_name
, bgp_convergence
807 step ( "Clear bgp process." )
808 clear_bgp_and_verify ( tgen
, topo
, "r3" )
810 step ( "Neighbors between R3, R4 and R3 to R5 should be in ESTB state." )
811 bgp_convergence
= verify_bgp_convergence ( tgen
, topo1
, dut
= "r3" )
812 assert bgp_convergence
is True , "Testcase {} : Failed \n Error: {}" . format (
813 tc_name
, bgp_convergence
816 write_test_footer ( tc_name
)
819 def test_bgp_unique_rid_chaos4_p2 ():
822 6. Chaos - Verify bgp unique rid functionality when router reboots without any ip addresses.
826 global bgp_convergence
828 if bgp_convergence
is not True :
829 pytest
. skip ( "skipped because of BGP Convergence failure" )
832 tc_name
= inspect
. stack ()[ 0 ][ 3 ]
833 write_test_header ( tc_name
)
834 if tgen
. routers_have_failure ():
835 check_router_status ( tgen
)
837 reset_config_on_routers ( tgen
)
840 topo1
= deepcopy ( topo
)
841 topo2
= deepcopy ( topo
)
844 "Configure base config as per the topology without loopback as well as Ip address on any of the interface."
846 for rtr
in topo
[ "routers" ]. keys ():
847 for intf
in topo
[ "routers" ][ rtr
][ "links" ]. keys ():
848 topo1
[ "routers" ][ rtr
][ "links" ][ intf
]. pop ( "ipv4" )
849 topo1
[ "routers" ][ rtr
][ "links" ][ intf
]. pop ( "ipv6" )
851 topo1
[ "routers" ][ rtr
][ "links" ][ intf
]. pop ( "ipv4" )
853 build_config_from_json ( tgen
, topo1
, save_bkup
= False )
855 bgp_convergence
= verify_bgp_convergence ( tgen
, topo
)
856 assert bgp_convergence
is True , "Testcase {} : Failed \n Error: {}" . format (
857 tc_name
, bgp_convergence
860 step ( "Configure the ip addresses on the physical interfaces" )
861 build_config_from_json ( tgen
, topo2
, save_bkup
= False )
863 step ( "All the neighbors should be in ESTAB state." )
864 bgp_convergence
= verify_bgp_convergence ( tgen
, topo
)
865 assert bgp_convergence
is True , "Testcase {} : Failed \n Error: {}" . format (
866 tc_name
, bgp_convergence
869 step ( "Configure loopback addresses with higher IP address " )
870 build_config_from_json ( tgen
, topo
, save_bkup
= False )
872 step ( "All the neighbors should be in ESTAB state." )
873 bgp_convergence
= verify_bgp_convergence ( tgen
, topo
)
874 assert bgp_convergence
is True , "Testcase {} : Failed \n Error: {}" . format (
875 tc_name
, bgp_convergence
878 step ( "Reboot the router (restart frr) or using watch frr." )
879 stop_router ( tgen
, "r3" )
880 start_router ( tgen
, "r3" )
882 step ( "Neighbors between R3, R4 and R3 to R5 should be in ESTB state." )
883 bgp_convergence
= verify_bgp_convergence ( tgen
, topo
, dut
= "r3" )
884 assert bgp_convergence
is True , "Testcase {} : Failed \n Error: {}" . format (
885 tc_name
, bgp_convergence
888 write_test_footer ( tc_name
)
891 if __name__
== "__main__" :
892 args
= [ "-s" ] + sys
. argv
[ 1 :]
893 sys
. exit ( pytest
. main ( args
))