4 # Copyright (c) 2021 by VMware, Inc. ("VMware")
5 # Used Copyright (c) 2018 by Network Device Education Foundation,
6 # Inc. ("NetDEF") in this file.
8 # Permission to use, copy, modify, and/or distribute this software
9 # for any purpose with or without fee is hereby granted, provided
10 # that the above copyright notice and this permission notice appear
13 # THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES
14 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR
16 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
17 # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18 # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
19 # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
24 Following tests are covered to test BGP Multi-VRF Dynamic Route Leaking:
25 1. Verify recursive import among Tenant VRFs.
26 2. Verify that dynamic import works fine between two different Tenant VRFs.
27 When next-hop IPs are same across all VRFs.
28 When next-hop IPs are different across all VRFs.
29 3. Verify that with multiple tenant VRFs, dynamic import works fine between
30 Tenant VRFs to default VRF.
31 When next-hop IPs and prefixes are same across all VRFs.
32 When next-hop IPs and prefixes are different across all VRFs.
40 from time
import sleep
42 # Save the Current Working Directory to find configuration files.
43 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
44 sys
.path
.append(os
.path
.join(CWD
, "../"))
45 sys
.path
.append(os
.path
.join(CWD
, "../lib/"))
47 # Required to instantiate the topology builder class.
49 # pylint: disable=C0413
50 # Import topogen and topotest helpers
51 from lib
.topogen
import Topogen
, get_topogen
52 from lib
.topotest
import version_cmp
54 from lib
.common_config
import (
59 reset_config_on_routers
,
65 create_bgp_community_lists
,
66 get_frr_ipv6_linklocal
,
69 from lib
.topolog
import logger
71 verify_bgp_convergence
,
76 from lib
.topojson
import build_config_from_json
78 pytestmark
= [pytest
.mark
.bgpd
, pytest
.mark
.staticd
]
81 NETWORK1_1
= {"ipv4": "11.11.11.1/32", "ipv6": "11:11::1/128"}
82 NETWORK1_2
= {"ipv4": "11.11.11.11/32", "ipv6": "11:11::11/128"}
83 NETWORK1_3
= {"ipv4": "10.10.10.1/32", "ipv6": "10:10::1/128"}
84 NETWORK1_4
= {"ipv4": "10.10.10.100/32", "ipv6": "10:10::100/128"}
85 NETWORK1_5
= {"ipv4": "110.110.110.1/32", "ipv6": "110:110::1/128"}
86 NETWORK1_6
= {"ipv4": "110.110.110.100/32", "ipv6": "110:110::100/128"}
88 NETWORK2_1
= {"ipv4": "22.22.22.2/32", "ipv6": "22:22::2/128"}
89 NETWORK2_2
= {"ipv4": "22.22.22.22/32", "ipv6": "22:22::22/128"}
90 NETWORK2_3
= {"ipv4": "20.20.20.20/32", "ipv6": "20:20::20/128"}
91 NETWORK2_4
= {"ipv4": "20.20.20.200/32", "ipv6": "20:20::200/128"}
92 NETWORK2_5
= {"ipv4": "220.220.220.20/32", "ipv6": "220:220::20/128"}
93 NETWORK2_6
= {"ipv4": "220.220.220.200/32", "ipv6": "220:220::200/128"}
95 NETWORK3_1
= {"ipv4": "30.30.30.3/32", "ipv6": "30:30::3/128"}
96 NETWORK3_2
= {"ipv4": "30.30.30.30/32", "ipv6": "30:30::30/128"}
99 "ipv4": ["11.11.11.1", "22.22.22.2", "22.22.22.22"],
100 "ipv6": ["11:11::1", "22:22::2", "22:22::22"],
102 PREFERRED_NEXT_HOP
= "global"
103 VRF_LIST
= ["RED", "BLUE", "GREEN"]
104 COMM_VAL_1
= "100:100"
105 COMM_VAL_2
= "500:500"
106 COMM_VAL_3
= "600:600"
109 def setup_module(mod
):
111 Sets up the pytest environment
116 testsuite_run_time
= time
.asctime(time
.localtime(time
.time()))
117 logger
.info("Testsuite start time: {}".format(testsuite_run_time
))
118 logger
.info("=" * 40)
120 logger
.info("Running setup_module to create topology")
122 # This function initiates the topology build with Topogen...
123 json_file
= "{}/bgp_vrf_dynamic_route_leak_topo4.json".format(CWD
)
124 tgen
= Topogen(json_file
, mod
.__name
__)
126 topo
= tgen
.json_topo
127 # ... and here it calls Mininet initialization functions.
129 # Starting topology, create tmp files which are loaded to routers
130 # to start daemons and then start routers
133 # Run these tests for kernel version 4.19 or above
134 if version_cmp(platform
.release(), "4.19") < 0:
136 "BGP vrf dynamic route leak tests will not run "
137 '(have kernel "{}", but it requires >= 4.19)'.format(platform
.release())
139 pytest
.skip(error_msg
)
141 # Creating configuration from JSON
142 build_config_from_json(tgen
, topo
)
144 global BGP_CONVERGENCE
146 ADDR_TYPES
= check_address_types()
148 BGP_CONVERGENCE
= verify_bgp_convergence(tgen
, topo
)
149 assert BGP_CONVERGENCE
is True, "setup_module : Failed \n Error: {}".format(
153 logger
.info("Running setup_module() done")
156 def teardown_module():
157 """Teardown the pytest environment"""
159 logger
.info("Running teardown_module to delete topology")
163 # Stop toplogy and Remove tmp files
167 "Testsuite end time: {}".format(time
.asctime(time
.localtime(time
.time())))
169 logger
.info("=" * 40)
172 #####################################################
176 #####################################################
179 def test_dynamic_import_routes_between_tenant_to_default_vrf_p0(request
):
181 Verify that with multiple tenant VRFs, dynamic import works fine between
182 Tenant VRFs to default VRF.
184 When next-hop IPs and prefixes are same across all VRFs.
185 When next-hop IPs and prefixes are different across all VRFs.
189 tc_name
= request
.node
.name
190 write_test_header(tc_name
)
191 reset_config_on_routers(tgen
)
192 if tgen
.routers_have_failure():
193 pytest
.skip(tgen
.errors
)
196 "Configure static routes on R3 for each vrf and redistribute in "
197 "respective BGP instance"
200 for vrf_name
, network
in zip(VRF_LIST
, [NETWORK1_1
, NETWORK2_1
, NETWORK3_1
]):
201 step("Configure static route for VRF : {}".format(vrf_name
))
202 for addr_type
in ADDR_TYPES
:
207 "network": [network
[addr_type
]],
208 "next_hop": "blackhole",
215 result
= create_static_routes(tgen
, static_routes
)
216 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
220 step("Redistribute static route on BGP VRF : {}".format(vrf_name
))
222 for addr_type
in ADDR_TYPES
:
224 {addr_type
: {"unicast": {"redistribute": [{"redist_type": "static"}]}}}
228 "r3": {"bgp": [{"vrf": vrf_name
, "local_as": 3, "address_family": temp
}]}
231 result
= create_router_bgp(tgen
, topo
, redist_dict
)
232 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
236 for vrf_name
, network
in zip(VRF_LIST
, [NETWORK1_1
, NETWORK2_1
, NETWORK3_1
]):
238 "Verify that R3 has installed redistributed routes in respective "
239 "vrfs: {}".format(vrf_name
)
241 for addr_type
in ADDR_TYPES
:
246 "network": [network
[addr_type
]],
247 "next_hop": "blackhole",
254 result
= verify_rib(tgen
, addr_type
, "r3", static_routes
)
255 assert result
is True, "Testcase {} : Failed \n Error {}".format(
259 step("Import all tenant vrfs(GREEN+BLUE+RED) in default vrf on R3")
261 for vrf_name
in ["RED", "BLUE", "GREEN"]:
263 for addr_type
in ADDR_TYPES
:
264 temp
.update({addr_type
: {"unicast": {"import": {"vrf": vrf_name
}}}})
266 redist_dict
= {"r3": {"bgp": [{"local_as": 3, "address_family": temp
}]}}
268 result
= create_router_bgp(tgen
, topo
, redist_dict
)
269 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
274 "Verify on R3 that it installs all the routes(imported from tenant "
275 "VRFs) in default vrf. Additionally, verify that R1 & R2 also "
276 "receive these routes from R3 and install in default vrf, next-hop "
280 for vrf_name
, network
in zip(VRF_LIST
, [NETWORK1_1
, NETWORK2_1
, NETWORK3_1
]):
281 for addr_type
in ADDR_TYPES
:
286 "network": [network
[addr_type
]],
287 "next_hop": "blackhole",
293 for dut
in ["r2", "r1"]:
294 next_hop_val
= topo
["routers"]["r3"]["links"]["{}-link4".format(dut
)][
298 result
= verify_bgp_rib(
299 tgen
, addr_type
, dut
, static_routes
, next_hop
=next_hop_val
301 assert result
is True, "Testcase {} : Failed \n Error {}".format(
306 tgen
, addr_type
, dut
, static_routes
, next_hop
=next_hop_val
308 assert result
is True, "Testcase {} : Failed \n Error {}".format(
312 result
= verify_bgp_rib(tgen
, addr_type
, "r3", static_routes
)
313 assert result
is True, "Testcase {} : Failed \n Error {}".format(
317 result
= verify_rib(tgen
, addr_type
, "r3", static_routes
)
318 assert result
is True, "Testcase {} : Failed \n Error {}".format(
322 for action
, value
, status
in zip(
323 ["Remove", "Add"], [True, False], ["withdraw", "re-install"]
326 "{} import vrf GREEN/BLUE/RED/all command from default vrf "
327 "instance on R3".format(action
)
329 for vrf_name
in ["RED", "BLUE", "GREEN"]:
331 for addr_type
in ADDR_TYPES
:
335 "unicast": {"import": {"vrf": vrf_name
, "delete": value
}}
340 import_dict
= {"r3": {"bgp": [{"local_as": 3, "address_family": temp
}]}}
342 result
= create_router_bgp(tgen
, topo
, import_dict
)
343 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
348 "Verify that R1,R2 & R3 {} imported routes from GREEN/BLUE/RED/all"
349 " in default vrf's RIB".format(status
)
351 for dut
in ["r1", "r2", "r3"]:
352 for addr_type
in ADDR_TYPES
:
358 NETWORK1_1
[addr_type
],
359 NETWORK2_1
[addr_type
],
360 NETWORK3_1
[addr_type
],
362 "next_hop": "blackhole",
369 result
= verify_bgp_rib(
370 tgen
, addr_type
, dut
, static_routes
, expected
=False
374 ), "Testcase {} : Failed \nError {}\n" "Routes {} still in BGP table".format(
377 static_routes
[dut
]["static_routes"][0]["network"],
381 tgen
, addr_type
, dut
, static_routes
, expected
=False
385 ), "Testcase {} : Failed \nError {}\n" "Routes {} still in BGP table".format(
388 static_routes
[dut
]["static_routes"][0]["network"],
391 result
= verify_bgp_rib(tgen
, addr_type
, dut
, static_routes
)
392 assert result
is True, "Testcase {} : Failed \n Error {}".format(
396 result
= verify_rib(tgen
, addr_type
, dut
, static_routes
)
397 assert result
is True, "Testcase {} : Failed \n Error {}".format(
401 for action
, value
in zip(["Shut", "No shut"], [True, False]):
403 "{} the neighborship between R1-R3 and R1-R2 for vrf RED, GREEN "
404 "and BLUE".format(action
)
406 bgp_disable
= {"r3": {"bgp": []}}
407 for vrf_name
in ["RED", "GREEN", "BLUE"]:
409 for addr_type
in ADDR_TYPES
:
416 "dest_link": {"r3-link4": {"shutdown": value
}}
419 "dest_link": {"r3-link4": {"shutdown": value
}}
427 bgp_disable
["r3"]["bgp"].append(
428 {"vrf": vrf_name
, "local_as": 3, "address_family": temp
}
430 result
= create_router_bgp(tgen
, topo
, bgp_disable
)
431 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
436 "Verify that when peering is shutdown for tenant vrfs, it "
437 "doesn't impact the RIB/FIB of default vrf on router R1 and R2"
439 for dut
in ["r1", "r2"]:
440 step("Verify RIB/FIB for default vrf on {}".format(dut
))
441 for addr_type
in ADDR_TYPES
:
447 NETWORK1_1
[addr_type
],
448 NETWORK2_1
[addr_type
],
449 NETWORK3_1
[addr_type
],
451 "next_hop": "blackhole",
456 result
= verify_bgp_rib(tgen
, addr_type
, dut
, static_routes
)
457 assert result
is True, "Testcase {} : Failed \n Error {}".format(
461 result
= verify_rib(tgen
, addr_type
, dut
, static_routes
)
462 assert result
is True, "Testcase {} : Failed \n Error {}".format(
466 for action
, value
, status
in zip(
467 ["Shut", "No shut"], [True, False], ["Withdraw", "Reinstall"]
470 "{} the neighborship between R1-R3 and R2-R3 for default vrf".format(action
)
473 for addr_type
in ADDR_TYPES
:
479 "r1": {"dest_link": {"r3-link4": {"shutdown": value
}}},
480 "r2": {"dest_link": {"r3-link4": {"shutdown": value
}}},
487 bgp_disable
= {"r3": {"bgp": [{"local_as": 3, "address_family": temp
}]}}
488 result
= create_router_bgp(tgen
, topo
, bgp_disable
)
489 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
494 "Verify that R1 and R2 {} all the routes from default vrf's RIB"
495 " and FIB".format(status
)
497 for dut
in ["r1", "r2"]:
498 step("Verify RIB/FIB for default vrf on {}".format(dut
))
499 for addr_type
in ADDR_TYPES
:
505 NETWORK1_1
[addr_type
],
506 NETWORK2_1
[addr_type
],
507 NETWORK3_1
[addr_type
],
509 "next_hop": "blackhole",
516 result
= verify_bgp_rib(
517 tgen
, addr_type
, dut
, static_routes
, expected
=False
521 ), "Testcase {} : Failed \nError {}\n" "Routes {} still in BGP table".format(
524 static_routes
[dut
]["static_routes"][0]["network"],
528 tgen
, addr_type
, dut
, static_routes
, expected
=False
532 ), "Testcase {} : Failed Error {}" "Routes {} still in Route table".format(
535 static_routes
[dut
]["static_routes"][0]["network"],
538 result
= verify_bgp_rib(tgen
, addr_type
, dut
, static_routes
)
539 assert result
is True, "Testcase {} : Failed \n Error {}".format(
543 result
= verify_rib(tgen
, addr_type
, dut
, static_routes
)
544 assert result
is True, "Testcase {} : Failed \n Error {}".format(
548 step("Remove import command from router R3 and configure the same on R2")
550 for vrf_name
in VRF_LIST
:
551 for addr_type
in ADDR_TYPES
:
553 {addr_type
: {"unicast": {"import": {"vrf": vrf_name
, "delete": True}}}}
556 import_dict
= {"r3": {"bgp": [{"local_as": 3, "address_family": temp
}]}}
558 result
= create_router_bgp(tgen
, topo
, import_dict
)
559 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
564 "Verify that once import commands are removed from R3, all imported "
565 "routes are withdrawn from RIB/FIB of default vrf on R1/R2/R3"
568 for dut
in ["r1", "r2", "r3"]:
569 step("Verify RIB/FIB for default vrf on {}".format(dut
))
570 for addr_type
in ADDR_TYPES
:
576 NETWORK1_1
[addr_type
],
577 NETWORK2_1
[addr_type
],
578 NETWORK3_1
[addr_type
],
580 "next_hop": "blackhole",
585 result
= verify_bgp_rib(tgen
, addr_type
, dut
, static_routes
, expected
=False)
586 assert result
is not True, (
587 "Testcase {} : Failed \nError {}\n"
588 "Routes {} still in BGP table".format(
589 tc_name
, result
, static_routes
[dut
]["static_routes"][0]["network"]
593 result
= verify_rib(tgen
, addr_type
, dut
, static_routes
, expected
=False)
594 assert result
is not True, "Testcase {} : Failed \n Error {}".format(
598 for vrf_name
, network
in zip(VRF_LIST
, [NETWORK1_1
, NETWORK2_1
, NETWORK3_1
]):
599 step("Configure static route for VRF : {} on r2".format(vrf_name
))
600 for addr_type
in ADDR_TYPES
:
605 "network": [network
[addr_type
]],
606 "next_hop": "blackhole",
613 result
= create_static_routes(tgen
, static_routes
)
614 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
618 step("Redistribute static route on BGP VRF : {}".format(vrf_name
))
620 for addr_type
in ADDR_TYPES
:
622 {addr_type
: {"unicast": {"redistribute": [{"redist_type": "static"}]}}}
626 "r2": {"bgp": [{"vrf": vrf_name
, "local_as": 2, "address_family": temp
}]}
629 result
= create_router_bgp(tgen
, topo
, redist_dict
)
630 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
634 step("Remove redistribute static route on BGP VRF : {} on r3".format(vrf_name
))
636 for addr_type
in ADDR_TYPES
:
641 "redistribute": [{"redist_type": "static", "delete": True}]
648 "r3": {"bgp": [{"vrf": vrf_name
, "local_as": 3, "address_family": temp
}]}
651 result
= create_router_bgp(tgen
, topo
, redist_dict
)
652 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
656 for vrf_name
in ["RED", "BLUE", "GREEN"]:
658 for addr_type
in ADDR_TYPES
:
659 temp
.update({addr_type
: {"unicast": {"import": {"vrf": vrf_name
}}}})
661 import_dict
= {"r2": {"bgp": [{"local_as": 2, "address_family": temp
}]}}
663 result
= create_router_bgp(tgen
, topo
, import_dict
)
664 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
669 "Verify after import commands are re-configured on R2's vrf RED, all "
670 "those routes are installed again in default vrf of R1,R2,R3"
672 for dut
in ["r1", "r2", "r3"]:
673 step("Verify RIB/FIB for vrf RED on {}".format(dut
))
674 for addr_type
in ADDR_TYPES
:
680 NETWORK1_1
[addr_type
],
681 NETWORK2_1
[addr_type
],
682 NETWORK3_1
[addr_type
],
684 "next_hop": "blackhole",
689 result
= verify_bgp_rib(tgen
, addr_type
, dut
, static_routes
)
690 assert result
is True, "Testcase {} : Failed \n Error {}".format(
694 result
= verify_rib(tgen
, addr_type
, dut
, static_routes
)
695 assert result
is True, "Testcase {} : Failed \n Error {}".format(
699 step("Remove import vrf RED/GREEN/BLUE/all one by one from default vrf" " on R2")
700 for vrf_name
in ["RED", "BLUE", "GREEN"]:
702 for addr_type
in ADDR_TYPES
:
704 {addr_type
: {"unicast": {"import": {"vrf": vrf_name
, "delete": True}}}}
707 import_dict
= {"r2": {"bgp": [{"local_as": 2, "address_family": temp
}]}}
709 result
= create_router_bgp(tgen
, topo
, import_dict
)
710 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
715 "Verify that R1, R2 and R3 withdraws imported routes from default "
718 for dut
in ["r1", "r2", "r3"]:
719 for addr_type
in ADDR_TYPES
:
725 NETWORK1_1
[addr_type
],
726 NETWORK2_1
[addr_type
],
727 NETWORK3_1
[addr_type
],
729 "next_hop": "blackhole",
734 result
= verify_bgp_rib(tgen
, addr_type
, dut
, static_routes
, expected
=False)
735 assert result
is not True, (
736 "Testcase {} : Failed \nError {}\n"
737 "Routes {} still in BGP table".format(
738 tc_name
, result
, static_routes
[dut
]["static_routes"][0]["network"]
742 result
= verify_rib(tgen
, addr_type
, dut
, static_routes
, expected
=False)
743 assert result
is not True, "Testcase {} : Failed \n Error {}".format(
747 step("Add import vrf RED/GREEN/BLUE/all one by one from default vrf on R2")
748 for vrf_name
in ["RED", "BLUE", "GREEN"]:
750 for addr_type
in ADDR_TYPES
:
751 temp
.update({addr_type
: {"unicast": {"import": {"vrf": vrf_name
}}}})
753 import_dict
= {"r2": {"bgp": [{"local_as": 2, "address_family": temp
}]}}
755 result
= create_router_bgp(tgen
, topo
, import_dict
)
756 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
760 for dut
in ["r1", "r2", "r3"]:
761 step("Verify that {} reinstall imported routes from vrf RED's RIB".format(dut
))
762 for addr_type
in ADDR_TYPES
:
768 NETWORK1_1
[addr_type
],
769 NETWORK2_1
[addr_type
],
770 NETWORK3_1
[addr_type
],
772 "next_hop": "blackhole",
777 result
= verify_bgp_rib(tgen
, addr_type
, dut
, static_routes
)
778 assert result
is True, "Testcase {} : Failed \n Error {}".format(
782 result
= verify_rib(tgen
, addr_type
, dut
, static_routes
)
783 assert result
is True, "Testcase {} : Failed \n Error {}".format(
787 for action
, value
in zip(["Shut", "No shut"], [True, False]):
789 "{} the neighborship between R2-R3 for vrf GREEN, BLUE and RED".format(
793 bgp_disable
= {"r2": {"bgp": []}}
794 for vrf_name
in ["GREEN", "BLUE", "RED"]:
796 for addr_type
in ADDR_TYPES
:
803 "dest_link": {"r2-link4": {"shutdown": value
}}
811 bgp_disable
["r2"]["bgp"].append(
812 {"vrf": vrf_name
, "local_as": 2, "address_family": temp
}
814 result
= create_router_bgp(tgen
, topo
, bgp_disable
)
815 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
819 step("Verify RIB/FIB of vrf RED will be unchanged on all 3 routers")
820 for dut
in ["r1", "r2", "r3"]:
821 step("Verify RIB/FIB for vrf RED on {}".format(dut
))
822 for addr_type
in ADDR_TYPES
:
828 NETWORK1_1
[addr_type
],
829 NETWORK2_1
[addr_type
],
830 NETWORK3_1
[addr_type
],
832 "next_hop": "blackhole",
838 result
= verify_bgp_rib(tgen
, addr_type
, dut
, static_routes
)
839 assert result
is True, "Testcase {} : Failed \n Error {}".format(
843 result
= verify_rib(tgen
, addr_type
, dut
, static_routes
)
844 assert result
is True, "Testcase {} : Failed \n Error {}".format(
848 for action
, value
, status
in zip(
849 ["Shut", "No shut"], [True, False], ["Withdraw", "Reinstall"]
851 step("{} the neighborship between R2-R3 for default vrf".format(action
))
853 for addr_type
in ADDR_TYPES
:
859 "r3": {"dest_link": {"r2-link4": {"shutdown": value
}}}
866 bgp_disable
= {"r2": {"bgp": [{"local_as": 2, "address_family": temp
}]}}
867 result
= create_router_bgp(tgen
, topo
, bgp_disable
)
868 assert result
is True, "Testcase {} :Failed \n Error: {}".format(
873 "Verify that R1 and R2 {} all the routes from default vrfs RIB and"
874 " FIB".format(status
)
876 for dut
in ["r1", "r3"]:
877 step("Verify RIB/FIB for default vrf on {}".format(dut
))
878 for addr_type
in ADDR_TYPES
:
884 NETWORK1_1
[addr_type
],
885 NETWORK2_1
[addr_type
],
886 NETWORK3_1
[addr_type
],
888 "next_hop": "blackhole",
895 result
= verify_bgp_rib(
896 tgen
, addr_type
, dut
, static_routes
, expected
=False
900 ), "Testcase {} : Failed \nError {}\n" "Routes {} still in BGP table".format(
903 static_routes
[dut
]["static_routes"][0]["network"],
907 tgen
, addr_type
, dut
, static_routes
, expected
=False
911 ), "Testcase {} : Failed Error {}" "Routes {} still in Route table".format(
914 static_routes
[dut
]["static_routes"][0]["network"],
917 result
= verify_bgp_rib(tgen
, addr_type
, dut
, static_routes
)
918 assert result
is True, "Testcase {} : Failed \n Error {}".format(
922 result
= verify_rib(tgen
, addr_type
, dut
, static_routes
)
923 assert result
is True, "Testcase {} : Failed \n Error {}".format(
927 write_test_footer(tc_name
)
930 if __name__
== "__main__":
931 args
= ["-s"] + sys
.argv
[1:]
932 sys
.exit(pytest
.main(args
))