2 # SPDX-License-Identifier: ISC
4 # Copyright (c) 2019 by VMware, Inc. ("VMware")
5 # Used Copyright (c) 2018 by Network Device Education Foundation, Inc. ("NetDEF")
10 Following tests are covered to test BGP Graceful Restart functionality.
11 Basic Common Test steps for all the test case below :
12 - Create topology (setup module)
13 Creating 7 routers topology
15 - Verify for bgp to converge
16 - Configure BGP Graceful Restart on both the routers.
19 Verify that EOR message is sent out only after initial convergence
20 Verify whether EOR message is received from all the peers after restart
22 Verify the selection deferral timer functionality when EOR is not sent
25 Verify that selection-deferral timer sets the maximum time to
26 avoid deadlock during which the best-path
28 Test Objective : Test GR scenarios on helper router by enabling
29 Graceful Restart for multiple address families.
31 Test Objective : Test GR scenarios by enabling Graceful Restart
32 for multiple address families..
34 Test Objective : Verify BGP-GR feature when restarting node
35 is a transit router for it's iBGP peers.
37 Test Objective : Verify that GR helper router deletes stale routes
38 received from restarting node, if GR capability is not present in
40 Test Objective : Verify that GR routers keeps all the routes
41 received from restarting node if both the routers are
43 Test Objective : Test GR scenarios on helper router by enabling
44 Graceful Restart for multiple address families.
46 Test Objective : Verify if helper node goes down before restarting
47 node comes up online, helper node sets the R-bit to avoid dead-lock
49 Test Objective : Change timers on the fly, and
50 verify if it takes immediate effect.
52 Test Objective : Helper router receives same prefixes from two
53 different routers (GR-restarting and GR-disabled). Keeps the
55 Test Objective : Restarting node doesn't preserve forwarding
56 state, helper router should not keep the stale entries.
58 Test Objective : Restarting node doesn't preserve the forwarding
59 state verify the behaviour on helper node, if it still keeps the
61 Test Objective : Restarting node is connected to multiple helper
62 nodes, one of them doesn't send EOR to restarting router. Verify
64 Test Objective : Verify if helper node restarts before sending the
65 EOR message, restarting node doesn't wait until stale path timer
67 Test Objective : Restarting node removes stale routes from Zebra
68 after receiving an EOR from helper router.
70 These tests have been broken up into 4 sub python scripts because
71 the totality of run time for this script was greater than 10 minutes
78 from time
import sleep
80 # Save the Current Working Directory to find configuration files.
81 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
82 sys
.path
.append(os
.path
.join("../"))
83 sys
.path
.append(os
.path
.join("../lib/"))
85 # pylint: disable=C0413
86 # Import topogen and topotest helpers
87 from lib
.topogen
import Topogen
, get_topogen
88 from lib
.topolog
import logger
90 # Required to instantiate the topology builder class.
92 # Import topoJson from lib, to create topology and initial configuration
93 from lib
.topojson
import build_config_from_json
97 verify_graceful_restart
,
102 verify_bgp_convergence
,
103 verify_gr_address_family
,
104 modify_bgp_config_when_bgpd_down
,
105 verify_graceful_restart_timers
,
106 verify_bgp_convergence_from_running_config
,
109 from lib
.common_config
import (
111 reset_config_on_routers
,
114 start_router_daemons
,
120 get_frr_ipv6_linklocal
,
121 required_linux_kernel_version
,
124 pytestmark
= [pytest
.mark
.bgpd
]
128 BGP_CONVERGENCE
= False
130 GR_SELECT_DEFER_TIMER
= 5
131 GR_STALEPATH_TIMER
= 5
132 PREFERRED_NEXT_HOP
= "link_local"
133 NEXT_HOP_4
= ["192.168.1.1", "192.168.4.2"]
134 NEXT_HOP_6
= ["fd00:0:0:1::1", "fd00:0:0:4::2"]
137 def setup_module(mod
):
139 Sets up the pytest environment
144 # Required linux kernel version for this suite to run.
145 result
= required_linux_kernel_version("4.16")
146 if result
is not True:
147 pytest
.skip("Kernel requirements are not met, kernel version should be >=4.16")
151 testsuite_run_time
= time
.asctime(time
.localtime(time
.time()))
152 logger
.info("Testsuite start time: {}".format(testsuite_run_time
))
153 logger
.info("=" * 40)
155 logger
.info("Running setup_module to create topology")
157 # This function initiates the topology build with Topogen...
158 json_file
= "{}/bgp_gr_topojson_topo2.json".format(CWD
)
159 tgen
= Topogen(json_file
, mod
.__name
__)
161 topo
= tgen
.json_topo
162 # ... and here it calls Mininet initialization functions.
164 # Starting topology, create tmp files which are loaded to routers
165 # to start daemons and then start routers
168 # Creating configuration from JSON
169 build_config_from_json(tgen
, topo
)
171 # Api call verify whether BGP is converged
172 ADDR_TYPES
= check_address_types()
174 for addr_type
in ADDR_TYPES
:
175 BGP_CONVERGENCE
= verify_bgp_convergence(tgen
, topo
)
176 assert BGP_CONVERGENCE
is True, "setup_module : Failed \n Error:" " {}".format(
180 logger
.info("Running setup_module() done")
183 def teardown_module(mod
):
185 Teardown the pytest environment
190 logger
.info("Running teardown_module to delete topology")
194 # Stop toplogy and Remove tmp files
198 "Testsuite end time: {}".format(time
.asctime(time
.localtime(time
.time())))
200 logger
.info("=" * 40)
203 def configure_gr_followed_by_clear(tgen
, topo
, input_dict
, tc_name
, dut
, peer
):
205 This function groups the repetitive function calls into one function.
208 logger
.info("configure_gr_followed_by_clear: dut %s peer %s", dut
, peer
)
210 result
= create_router_bgp(tgen
, topo
, input_dict
)
211 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
213 for addr_type
in ADDR_TYPES
:
214 neighbor
= topo
["routers"][peer
]["links"][dut
][addr_type
].split("/")[0]
215 clear_bgp(tgen
, addr_type
, dut
, neighbor
=neighbor
)
217 for addr_type
in ADDR_TYPES
:
218 neighbor
= topo
["routers"][dut
]["links"][peer
][addr_type
].split("/")[0]
219 clear_bgp(tgen
, addr_type
, peer
, neighbor
=neighbor
)
221 result
= verify_bgp_convergence_from_running_config(tgen
)
222 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
227 def next_hop_per_address_family(tgen
, dut
, peer
, addr_type
, next_hop_dict
):
229 This function returns link_local or global next_hop per address-family
232 intferface
= topo
["routers"][peer
]["links"]["{}-link1".format(dut
)]["interface"]
233 if addr_type
== "ipv6" and "link_local" in PREFERRED_NEXT_HOP
:
234 next_hop
= get_frr_ipv6_linklocal(tgen
, peer
, intf
=intferface
)
236 next_hop
= next_hop_dict
[addr_type
]
241 def test_BGP_GR_TC_23_p1(request
):
243 Verify that helper routers are deleting stale routes after stale route
244 timer's expiry. If all the routes are not received from restating node
249 tc_name
= request
.node
.name
250 write_test_header(tc_name
)
252 # Check router status
253 check_router_status(tgen
)
255 # Don't run this test if we have any failure.
256 if tgen
.routers_have_failure():
257 pytest
.skip(tgen
.errors
)
259 # Creating configuration from JSON
260 reset_config_on_routers(tgen
)
263 "Verify Stale Routes are deleted on helper: BGP_GR_TC_23 >> "
264 "BGP GR [Helper Mode]R1-----R2[Restart Mode] "
267 # Configure graceful-restart
271 "graceful-restart": {"timer": {"stalepath-time": GR_STALEPATH_TIMER
}},
278 "r1": {"graceful-restart-helper": True}
289 "r1": {"graceful-restart-helper": True}
300 "graceful-restart": {
301 "graceful-restart": True,
302 "preserve-fw-state": True,
308 "r1": {"dest_link": {"r2": {"graceful-restart": True}}}
315 "r1": {"dest_link": {"r2": {"graceful-restart": True}}}
324 configure_gr_followed_by_clear(tgen
, topo
, input_dict
, tc_name
, dut
="r1", peer
="r2")
326 for addr_type
in ADDR_TYPES
:
327 result
= verify_graceful_restart(
328 tgen
, topo
, addr_type
, input_dict
, dut
="r1", peer
="r2"
330 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
332 # Verifying BGP RIB routes received from router R1
334 input_dict_1
= {key
: topo
["routers"][key
] for key
in ["r2"]}
335 result
= verify_bgp_rib(tgen
, addr_type
, dut
, input_dict_1
)
336 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
338 # Verifying RIB routes
339 result
= verify_rib(tgen
, addr_type
, dut
, input_dict_1
)
340 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
342 logger
.info("R2 goes for reload")
343 kill_router_daemons(tgen
, "r2", ["bgpd"])
345 # Modify configuration to delete routes and include disable-eor
346 input_dict_3
= {"r2": {"bgp": {"graceful-restart": {"disable-eor": True}}}}
348 result
= modify_bgp_config_when_bgpd_down(tgen
, topo
, input_dict_3
)
350 # Modify configuration to delete routes and include disable-eor
351 network
= {"ipv4": "102.0.20.1/32", "ipv6": "2::1/128"}
352 for addr_type
in ADDR_TYPES
:
359 "advertise_networks": [
361 "network": network
[addr_type
],
373 result
= modify_bgp_config_when_bgpd_down(tgen
, topo
, input_dict_3
)
374 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
376 logger
.info("BGPd comes up for r2")
377 start_router_daemons(tgen
, "r2", ["bgpd"])
379 # Wait for stalepath timer
380 logger
.info("Waiting for stalepath timer({} sec..)".format(GR_STALEPATH_TIMER
))
381 sleep(GR_STALEPATH_TIMER
)
383 for addr_type
in ADDR_TYPES
:
384 clear_bgp(tgen
, addr_type
, "r2")
386 # Verifying RIB routes
388 network
= {"ipv4": "102.0.20.4/32", "ipv6": "2::4/128"}
389 for addr_type
in ADDR_TYPES
:
396 "advertise_networks": [
397 {"network": network
[addr_type
], "no_of_network": 2}
406 # Verify EOR on helper router
408 tgen
, topo
, addr_type
, input_dict
, dut
="r1", peer
="r2", expected
=False
410 assert result
is not True, (
411 "Testcase {} : Failed \n "
412 "Expected: EOR should not be set to True in r2\n"
413 "Found: {}".format(tc_name
, result
)
416 # Verifying BGP RIB routes received from router R1
418 result
= verify_bgp_rib(tgen
, addr_type
, dut
, input_dict_1
)
419 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
421 write_test_footer(tc_name
)
424 def test_BGP_GR_20_p1(request
):
426 Test Objective : Verify that GR routers delete all the routes
427 received from a node if both the routers are configured as GR
432 tc_name
= request
.node
.name
433 write_test_header(tc_name
)
435 # Check router status
436 check_router_status(tgen
)
438 # Don't run this test if we have any failure.
439 if tgen
.routers_have_failure():
440 pytest
.skip(tgen
.errors
)
442 # Creating configuration from JSON
443 reset_config_on_routers(tgen
)
446 "[Step 1] : Test Setup " "[Restart Mode]R3-----R1[Restart Mode] Initialized"
449 # Configure graceful-restart
459 "r1": {"graceful-restart-helper": True}
470 "r1": {"graceful-restart-helper": True}
487 "r3": {"graceful-restart-helper": True}
498 "r3": {"graceful-restart-helper": True}
509 configure_gr_followed_by_clear(tgen
, topo
, input_dict
, tc_name
, dut
="r1", peer
="r3")
511 for addr_type
in ADDR_TYPES
:
512 result
= verify_graceful_restart(
513 tgen
, topo
, addr_type
, input_dict
, dut
="r1", peer
="r3"
515 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
517 # Verifying BGP RIB routes
519 input_dict_1
= {key
: topo
["routers"][key
] for key
in ["r1"]}
520 result
= verify_bgp_rib(tgen
, addr_type
, dut
, input_dict_1
)
521 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
523 # Verifying RIB routes before shutting down BGPd daemon
524 result
= verify_rib(tgen
, addr_type
, dut
, input_dict_1
)
525 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
527 # Kill BGPd daemon on R1
528 kill_router_daemons(tgen
, "r1", ["bgpd"])
530 for addr_type
in ADDR_TYPES
:
531 # Verifying BGP RIB routes
533 input_dict_1
= {key
: topo
["routers"][key
] for key
in ["r1"]}
534 result
= verify_bgp_rib(tgen
, addr_type
, dut
, input_dict_1
, expected
=False)
535 assert result
is not True, (
536 "Testcase {} : Failed \n "
537 "Expected: Routes should not be present in {} BGP RIB \n "
538 "Found: {}".format(tc_name
, dut
, result
)
541 # Verifying RIB routes before shutting down BGPd daemon
542 result
= verify_rib(tgen
, addr_type
, dut
, input_dict_1
, expected
=False)
543 assert result
is not True, (
544 "Testcase {} : Failed \n "
545 "Expected: Routes should not be present in {} FIB \n "
546 "Found: {}".format(tc_name
, dut
, result
)
549 # Start BGPd daemon on R1
550 start_router_daemons(tgen
, "r1", ["bgpd"])
552 for addr_type
in ADDR_TYPES
:
553 result
= verify_bgp_convergence(tgen
, topo
)
554 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
556 # Verifying BGP RIB routes
558 input_dict_1
= {key
: topo
["routers"][key
] for key
in ["r1"]}
559 result
= verify_bgp_rib(tgen
, addr_type
, dut
, input_dict_1
)
560 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
562 # Verifying RIB routes before shutting down BGPd daemon
563 result
= verify_rib(tgen
, addr_type
, dut
, input_dict_1
)
564 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
566 write_test_footer(tc_name
)
569 def test_BGP_GR_21_p2(request
):
571 Test Objective : VVerify BGP-GR feature when helper node is
572 a transit router for it's eBGP peers.
576 tc_name
= request
.node
.name
577 write_test_header(tc_name
)
579 # Check router status
580 check_router_status(tgen
)
582 # Don't run this test if we have any failure.
583 if tgen
.routers_have_failure():
584 pytest
.skip(tgen
.errors
)
586 # Creating configuration from JSON
587 reset_config_on_routers(tgen
)
590 "[Step 1] : Test Setup " "[Helper Mode]R6-----R1[Restart Mode] Initialized"
593 # Configure graceful-restart
603 "r1": {"graceful-restart-disable": True}
614 "r1": {"graceful-restart-disable": True}
631 "r6": {"graceful-restart-helper": True}
642 "r6": {"graceful-restart-helper": True}
653 configure_gr_followed_by_clear(tgen
, topo
, input_dict
, tc_name
, dut
="r1", peer
="r6")
655 for addr_type
in ADDR_TYPES
:
656 result
= verify_graceful_restart(
657 tgen
, topo
, addr_type
, input_dict
, dut
="r1", peer
="r6"
659 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
662 "[Step 2] : Test Setup "
663 "[Restart Mode]R2-----[Helper Mode]R1[Disable Mode]"
664 "--------R6[Helper Mode] Initialized"
667 # Configure graceful-restart
677 "r1": {"graceful-restart-helper": True}
688 "r1": {"graceful-restart-helper": True}
699 "graceful-restart": {
700 "graceful-restart": True,
706 configure_gr_followed_by_clear(tgen
, topo
, input_dict
, tc_name
, dut
="r1", peer
="r2")
708 for addr_type
in ADDR_TYPES
:
709 result
= verify_graceful_restart(
710 tgen
, topo
, addr_type
, input_dict
, dut
="r1", peer
="r2"
712 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
714 # Verifying BGP RIB routes
716 input_dict_1
= {key
: topo
["routers"][key
] for key
in ["r1"]}
717 result
= verify_bgp_rib(tgen
, addr_type
, dut
, input_dict_1
)
718 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
720 # Verifying RIB routes before shutting down BGPd daemon
721 result
= verify_rib(tgen
, addr_type
, dut
, input_dict_1
)
722 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
724 # Verifying BGP RIB routes
726 input_dict_2
= {key
: topo
["routers"][key
] for key
in ["r2"]}
727 result
= verify_bgp_rib(tgen
, addr_type
, dut
, input_dict_2
)
728 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
730 # Verifying RIB routes before shutting down BGPd daemon
731 result
= verify_rib(tgen
, addr_type
, dut
, input_dict_2
)
732 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
734 # Kill BGPd daemon on R1
735 kill_router_daemons(tgen
, "r2", ["bgpd"])
737 for addr_type
in ADDR_TYPES
:
738 # Verifying BGP RIB routes
740 input_dict_1
= {key
: topo
["routers"][key
] for key
in ["r1"]}
741 result
= verify_bgp_rib(tgen
, addr_type
, dut
, input_dict_1
)
742 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
744 # Verifying RIB routes before shutting down BGPd daemon
745 result
= verify_rib(tgen
, addr_type
, dut
, input_dict_1
)
746 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
748 # Verifying BGP RIB routes
750 input_dict_2
= {key
: topo
["routers"][key
] for key
in ["r2"]}
751 result
= verify_bgp_rib(tgen
, addr_type
, dut
, input_dict_2
)
752 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
754 # Verifying RIB routes before shutting down BGPd daemon
755 result
= verify_rib(tgen
, addr_type
, dut
, input_dict_2
)
756 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
758 # Start BGPd daemon on R1
759 start_router_daemons(tgen
, "r2", ["bgpd"])
761 for addr_type
in ADDR_TYPES
:
762 result
= verify_bgp_convergence(tgen
, topo
)
763 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
765 # Verifying BGP RIB routes
767 input_dict_1
= {key
: topo
["routers"][key
] for key
in ["r1"]}
768 result
= verify_bgp_rib(tgen
, addr_type
, dut
, input_dict_1
)
769 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
771 # Verifying RIB routes after bringing up BGPd daemon
772 result
= verify_rib(tgen
, addr_type
, dut
, input_dict_1
)
773 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
775 # Verifying BGP RIB routes
777 input_dict_2
= {key
: topo
["routers"][key
] for key
in ["r2"]}
778 result
= verify_bgp_rib(tgen
, addr_type
, dut
, input_dict_2
)
779 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
781 # Verifying RIB routes before shutting down BGPd daemon
782 result
= verify_rib(tgen
, addr_type
, dut
, input_dict_2
)
783 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
785 write_test_footer(tc_name
)
788 def test_BGP_GR_22_p2(request
):
790 Test Objective : Verify BGP-GR feature when helper node
791 is a transit router for it's iBGP peers.
795 tc_name
= request
.node
.name
796 write_test_header(tc_name
)
798 # Check router status
799 check_router_status(tgen
)
801 # Don't run this test if we have any failure.
802 if tgen
.routers_have_failure():
803 pytest
.skip(tgen
.errors
)
805 # Creating configuration from JSON
806 reset_config_on_routers(tgen
)
809 "[Step 1] : Test Setup " "[Helper Mode]R3-----R1[Restart Mode] Initialized"
812 # Configure graceful-restart
823 "graceful-restart-disable": True,
824 "next_hop_self": True,
837 "graceful-restart-disable": True,
838 "next_hop_self": True,
856 "r3": {"graceful-restart-helper": True}
867 "r3": {"graceful-restart-helper": True}
878 configure_gr_followed_by_clear(tgen
, topo
, input_dict
, tc_name
, dut
="r1", peer
="r3")
880 for addr_type
in ADDR_TYPES
:
881 result
= verify_graceful_restart(
882 tgen
, topo
, addr_type
, input_dict
, dut
="r1", peer
="r3"
884 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
887 "[Step 2] : Test Setup "
888 "[Restart Mode]R2-----[Helper Mode]R1[Disable Mode]"
889 "--------R3[Helper Mode] Initialized"
892 # Configure graceful-restart
902 "r1": {"graceful-restart-helper": True}
913 "r1": {"graceful-restart-helper": True}
922 "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}},
925 configure_gr_followed_by_clear(tgen
, topo
, input_dict
, tc_name
, dut
="r1", peer
="r2")
927 for addr_type
in ADDR_TYPES
:
928 result
= verify_graceful_restart(
929 tgen
, topo
, addr_type
, input_dict
, dut
="r1", peer
="r2"
931 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
933 # Verifying BGP RIB routes
935 input_dict_1
= {key
: topo
["routers"][key
] for key
in ["r1"]}
936 result
= verify_bgp_rib(tgen
, addr_type
, dut
, input_dict_1
)
937 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
939 # Verifying RIB routes before shutting down BGPd daemon
940 result
= verify_rib(tgen
, addr_type
, dut
, input_dict_1
)
941 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
943 # Verifying BGP RIB routes
945 input_dict_2
= {key
: topo
["routers"][key
] for key
in ["r2"]}
946 result
= verify_bgp_rib(tgen
, addr_type
, dut
, input_dict_2
)
947 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
949 # Verifying RIB routes before shutting down BGPd daemon
950 result
= verify_rib(tgen
, addr_type
, dut
, input_dict_2
)
951 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
953 # Kill BGPd daemon on R1
954 kill_router_daemons(tgen
, "r2", ["bgpd"])
956 for addr_type
in ADDR_TYPES
:
957 # Verifying BGP RIB routes
959 input_dict_1
= {key
: topo
["routers"][key
] for key
in ["r1"]}
960 result
= verify_bgp_rib(tgen
, addr_type
, dut
, input_dict_1
)
961 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
963 # Verifying RIB routes before shutting down BGPd daemon
964 result
= verify_rib(tgen
, addr_type
, dut
, input_dict_1
)
965 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
967 # Verifying BGP RIB routes
969 input_dict_2
= {key
: topo
["routers"][key
] for key
in ["r2"]}
970 result
= verify_bgp_rib(tgen
, addr_type
, dut
, input_dict_2
)
971 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
973 # Verifying RIB routes before shutting down BGPd daemon
974 result
= verify_rib(tgen
, addr_type
, dut
, input_dict_2
)
975 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
977 # Start BGPd daemon on R1
978 start_router_daemons(tgen
, "r2", ["bgpd"])
980 for addr_type
in ADDR_TYPES
:
981 result
= verify_bgp_convergence(tgen
, topo
)
982 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
984 # Verifying BGP RIB routes
986 input_dict_1
= {key
: topo
["routers"][key
] for key
in ["r1"]}
987 result
= verify_bgp_rib(tgen
, addr_type
, dut
, input_dict_1
)
988 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
990 # Verifying RIB routes before shutting down BGPd daemon
991 result
= verify_rib(tgen
, addr_type
, dut
, input_dict_1
)
992 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
994 # Verifying BGP RIB routes
996 input_dict_2
= {key
: topo
["routers"][key
] for key
in ["r2"]}
997 result
= verify_bgp_rib(tgen
, addr_type
, dut
, input_dict_2
)
998 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
1000 # Verifying RIB routes before shutting down BGPd daemon
1001 result
= verify_rib(tgen
, addr_type
, dut
, input_dict_2
)
1002 assert result
is True, "Testcase {} :Failed \n Error {}".format(tc_name
, result
)
1004 write_test_footer(tc_name
)
1007 if __name__
== "__main__":
1008 args
= ["-s"] + sys
.argv
[1:]
1009 sys
.exit(pytest
.main(args
))