4 # Copyright (c) 2020 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 -Verify static route ECMP functionality with 2 next hop
26 -Verify static route functionality with 2 next hop and different AD
29 -Verify RIB status when same route advertise via BGP and static route
38 # Save the Current Working Directory to find configuration files.
39 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
40 sys
.path
.append(os
.path
.join(CWD
, "../"))
41 sys
.path
.append(os
.path
.join(CWD
, "../lib/"))
42 # pylint: disable=C0413
43 # Import topogen and topotest helpers
44 from lib
.topogen
import Topogen
, get_topogen
45 from lib
.topotest
import version_cmp
47 # Import topoJson from lib, to create topology and initial configuration
48 from lib
.common_config
import (
52 reset_config_on_routers
,
57 shutdown_bringup_interface
,
61 from lib
.topolog
import logger
62 from lib
.bgp
import verify_bgp_convergence
, create_router_bgp
, verify_bgp_rib
63 from lib
.topojson
import build_config_from_json
65 pytestmark
= [pytest
.mark
.bgpd
, pytest
.mark
.staticd
]
68 BGP_CONVERGENCE
= False
69 ADDR_TYPES
= check_address_types()
70 NETWORK
= {"ipv4": ["11.0.20.1/32", "11.0.20.2/32"], "ipv6": ["2::1/128", "2::2/128"]}
71 NETWORK2
= {"ipv4": "11.0.20.1/32", "ipv6": "2::1/128"}
73 PREFIX1
= {"ipv4": "110.0.20.1/32", "ipv6": "20::1/128"}
76 def setup_module(mod
):
79 Set up the pytest environment.
83 testsuite_run_time
= time
.asctime(time
.localtime(time
.time()))
84 logger
.info("Testsuite start time: {}".format(testsuite_run_time
))
87 logger
.info("Running setup_module to create topology")
89 # This function initiates the topology build with Topogen...
90 json_file
= "{}/static_routes_topo1_ibgp.json".format(CWD
)
91 tgen
= Topogen(json_file
, mod
.__name
__)
94 # ... and here it calls Mininet initialization functions.
96 # Starting topology, create tmp files which are loaded to routers
97 # to start daemons and then start routers
100 # Creating configuration from JSON
101 build_config_from_json(tgen
, topo
)
103 if version_cmp(platform
.release(), "4.19") < 0:
105 'These tests will not run. (have kernel "{}", '
106 "requires kernel >= 4.19)".format(platform
.release())
108 pytest
.skip(error_msg
)
110 # Checking BGP convergence
111 global BGP_CONVERGENCE
114 # Don't run this test if we have any failure.
115 if tgen
.routers_have_failure():
116 pytest
.skip(tgen
.errors
)
117 # Api call verify whether BGP is converged
118 BGP_CONVERGENCE
= verify_bgp_convergence(tgen
, topo
)
119 assert BGP_CONVERGENCE
is True, "setup_module :Failed \n Error: {}".format(
123 logger
.info("Running setup_module() done")
126 def teardown_module(mod
):
128 Teardown the pytest environment
133 logger
.info("Running teardown_module to delete topology")
137 # Stop toplogy and Remove tmp files
141 "Testsuite end time: {}".format(time
.asctime(time
.localtime(time
.time())))
143 logger
.info("=" * 40)
149 "ipv4": topo
["routers"]["r1"]["links"]["r2-link0"]["ipv4"].split("/")[0],
150 "ipv6": topo
["routers"]["r1"]["links"]["r2-link0"]["ipv6"].split("/")[0],
153 "ipv4": topo
["routers"]["r1"]["links"]["r2-link1"]["ipv4"].split("/")[0],
154 "ipv6": topo
["routers"]["r1"]["links"]["r2-link1"]["ipv6"].split("/")[0],
160 #####################################################
164 #####################################################
167 def test_static_route_2nh_p0_tc_1_ibgp(request
):
169 Verify static route ECMP functionality with 2 next hop
172 tc_name
= request
.node
.name
173 write_test_header(tc_name
)
175 # Don't run this test if we have any failure.
176 if tgen
.routers_have_failure():
177 pytest
.skip(tgen
.errors
)
179 reset_config_on_routers(tgen
)
180 NEXT_HOP_IP
= populate_nh()
183 "Configure IPv4 static route (10.1.1.1) in R2 with next hop N1"
184 "(28.1.1.2 ) and N2 (29.1.1.2) , Static route next-hop present on"
187 step("ex :- ip route 10.1.1.1/24 28.1.1.2 & ip route 10.1.1.1/24 29.1.1.1")
188 for addr_type
in ADDR_TYPES
:
193 "network": NETWORK
[addr_type
],
194 "next_hop": NEXT_HOP_IP
["nh1"][addr_type
],
197 "network": NETWORK
[addr_type
],
198 "next_hop": NEXT_HOP_IP
["nh2"][addr_type
],
204 logger
.info("Configure static routes")
205 result
= create_static_routes(tgen
, input_dict_4
)
206 assert result
is True, "Testcase {} : Failed \n Error: {}".format(
211 "On R2, static route installed in RIB using show ip route"
212 " with 2 ECMP next hop "
214 nh
= [NEXT_HOP_IP
["nh1"][addr_type
], NEXT_HOP_IP
["nh2"][addr_type
]]
218 tgen
, addr_type
, dut
, input_dict_4
, next_hop
=nh
, protocol
=protocol
222 ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name
)
224 step("Configure IBGP IPv4 peering between R2 and R3 router.")
225 step("Configure redistribute static in BGP on R2 router")
232 "unicast": {"redistribute": [{"redist_type": "static"}]}
238 result
= create_router_bgp(tgen
, topo
, input_dict_2
)
239 assert result
is True, "Testcase {} : Failed \n Error: {}".format(
243 step("Remove the static route configured with nexthop N1 from running config")
248 "network": NETWORK
[addr_type
],
249 "next_hop": NEXT_HOP_IP
["nh1"][addr_type
],
255 logger
.info("Configure static routes")
256 result
= create_static_routes(tgen
, input_dict_4
)
257 assert result
is True, "Testcase {} : Failed \n Error: {}".format(
262 "On R2, after removing the static route with N1 , "
263 "route become active with nexthop N2 and vice versa."
265 nh
= NEXT_HOP_IP
["nh1"][addr_type
]
277 ), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format(
281 nh
= [NEXT_HOP_IP
["nh2"][addr_type
]]
283 tgen
, addr_type
, dut
, input_dict_4
, next_hop
=nh
, protocol
=protocol
287 ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name
)
289 step("Configure the static route with nexthop N1")
295 "network": NETWORK
[addr_type
],
296 "next_hop": NEXT_HOP_IP
["nh1"][addr_type
],
302 logger
.info("Configure static routes")
303 result
= create_static_routes(tgen
, input_dict_4
)
304 assert result
is True, "Testcase {} : Failed \n Error: {}".format(
308 step("Remove the static route configured with nexthop N2 from running config")
314 "network": NETWORK
[addr_type
],
315 "next_hop": NEXT_HOP_IP
["nh2"][addr_type
],
322 logger
.info("Configure static routes")
323 result
= create_static_routes(tgen
, input_dict_4
)
324 assert result
is True, "Testcase {} : Failed \n Error: {}".format(
329 "On R2, after removing the static route with N2 , "
330 "route become active with nexthop N1 and vice versa."
332 nh
= NEXT_HOP_IP
["nh2"][addr_type
]
344 ), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format(
348 nh
= [NEXT_HOP_IP
["nh1"][addr_type
]]
350 tgen
, addr_type
, dut
, input_dict_4
, next_hop
=nh
, protocol
=protocol
354 ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name
)
356 step("Configure the static route with nexthop N2")
361 "network": NETWORK
[addr_type
],
362 "next_hop": NEXT_HOP_IP
["nh2"][addr_type
],
368 logger
.info("Configure static routes")
369 result
= create_static_routes(tgen
, input_dict_4
)
370 assert result
is True, "Testcase {} : Failed \n Error: {}".format(
374 step("Shut nexthop interface N1")
375 intf
= topo
["routers"]["r2"]["links"]["r1-link0"]["interface"]
377 shutdown_bringup_interface(tgen
, dut
, intf
, False)
379 step("Only one the nexthops should be active in RIB.")
381 nh
= NEXT_HOP_IP
["nh2"][addr_type
]
383 tgen
, addr_type
, dut
, input_dict_4
, next_hop
=nh
, protocol
=protocol
387 ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name
)
389 nh
= NEXT_HOP_IP
["nh1"][addr_type
]
401 ), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format(
406 result
= verify_bgp_rib(
407 tgen
, addr_type
, dut
, input_dict_4
, next_hop
=nh
, expected
=False
411 ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format(
426 ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format(
431 nh
= [NEXT_HOP_IP
["nh2"][addr_type
]]
433 tgen
, addr_type
, dut
, input_dict_4
, next_hop
=nh
, protocol
=protocol
437 ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name
)
440 result
= verify_bgp_rib(tgen
, addr_type
, dut
, input_dict_4
)
443 ), "Testcase {} : Failed \nError: Route is" " missing in RIB".format(tc_name
)
446 tgen
, addr_type
, dut
, input_dict_4
, protocol
=protocol
, expected
=False
450 ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format(
455 step("No shut the nexthop interface N1")
456 shutdown_bringup_interface(tgen
, dut
, intf
, True)
459 "after shut of nexthop N1 , route become active "
460 "with nexthop N2 and vice versa."
462 nh
= [NEXT_HOP_IP
["nh1"][addr_type
], NEXT_HOP_IP
["nh2"][addr_type
]]
465 tgen
, addr_type
, dut
, input_dict_4
, next_hop
=nh
, protocol
=protocol
469 ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name
)
471 step("Shut nexthop interface N2")
472 intf
= topo
["routers"]["r2"]["links"]["r1-link1"]["interface"]
474 shutdown_bringup_interface(tgen
, dut
, intf
, False)
477 " after shut of nexthop N1 , route become active with "
478 "nexthop N2 and vice versa."
480 nh
= NEXT_HOP_IP
["nh2"][addr_type
]
493 ), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format(
497 nh
= [NEXT_HOP_IP
["nh1"][addr_type
]]
501 tgen
, addr_type
, dut
, input_dict_4
, next_hop
=nh
, protocol
=protocol
505 ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name
)
508 result
= verify_bgp_rib(tgen
, addr_type
, dut
, input_dict_4
)
511 ), "Testcase {} : Failed \nError: Route is" " missing in RIB".format(tc_name
)
514 tgen
, addr_type
, dut
, input_dict_4
, protocol
=protocol
, expected
=False
518 ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format(
522 step("No shut nexthop interface N2")
524 shutdown_bringup_interface(tgen
, dut
, intf
, True)
527 "after shut of nexthop N1 , route become active "
528 "with nexthop N2 and vice versa."
530 nh
= [NEXT_HOP_IP
["nh1"][addr_type
], NEXT_HOP_IP
["nh2"][addr_type
]]
533 tgen
, addr_type
, dut
, input_dict_4
, next_hop
=nh
, protocol
=protocol
537 ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name
)
540 result
= verify_bgp_rib(tgen
, addr_type
, dut
, input_dict_4
)
543 ), "Testcase {} : Failed \nError: Route is" " missing in RIB".format(tc_name
)
546 tgen
, addr_type
, dut
, input_dict_4
, protocol
=protocol
, expected
=False
550 ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format(
554 step("Reload the FRR router")
555 # stop/start -> restart FRR router and verify
556 stop_router(tgen
, "r2")
558 start_router(tgen
, "r2")
562 "After reload of FRR router , static route installed"
563 " in RIB and FIB properly ."
566 tgen
, addr_type
, dut
, input_dict_4
, next_hop
=nh
, protocol
=protocol
570 ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name
)
573 result
= verify_bgp_rib(tgen
, addr_type
, dut
, input_dict_4
)
576 ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format(
581 tgen
, addr_type
, dut
, input_dict_4
, protocol
=protocol
, expected
=False
585 ), "Testcase {} : Failed \nError: Route is" " still present in RIB".format(
589 write_test_footer(tc_name
)
592 def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request
):
594 Verify static route functionality with 2 next hop & different AD value
597 tc_name
= request
.node
.name
598 write_test_header(tc_name
)
600 # Don't run this test if we have any failure.
601 if tgen
.routers_have_failure():
602 pytest
.skip(tgen
.errors
)
604 reset_config_on_routers(tgen
)
605 NEXT_HOP_IP
= populate_nh()
607 "Configure IPv4 static route (10.1.1.1) in R2 with next hop N1"
608 "(28.1.1.2 ) AD 10 and N2 (29.1.1.2) AD 20 , Static route next-hop"
609 "present on R1 \n ex :- ip route 10.1.1.1/24 28.1.1.2 10 & "
610 "ip route 10.1.1.1/24 29.1.1.2 20"
613 reset_config_on_routers(tgen
)
614 NEXT_HOP_IP
= populate_nh()
615 for addr_type
in ADDR_TYPES
:
620 "network": NETWORK2
[addr_type
],
621 "next_hop": NEXT_HOP_IP
["nh1"][addr_type
],
622 "admin_distance": 10,
625 "network": NETWORK2
[addr_type
],
626 "next_hop": NEXT_HOP_IP
["nh2"][addr_type
],
627 "admin_distance": 20,
632 logger
.info("Configure static routes")
633 result
= create_static_routes(tgen
, input_dict_4
)
634 assert result
is True, "Testcase {} : Failed \n Error: {}".format(
639 "On R2, static route installed in RIB using "
640 "show ip route with 2 next hop , lowest AD nexthop is active "
646 "network": NETWORK2
[addr_type
],
647 "next_hop": NEXT_HOP_IP
["nh1"][addr_type
],
648 "admin_distance": 10,
653 nh
= [NEXT_HOP_IP
["nh1"][addr_type
]]
657 tgen
, addr_type
, dut
, rte1_nh1
, next_hop
=nh
, protocol
=protocol
, fib
=True
661 ), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name
)
667 "network": NETWORK2
[addr_type
],
668 "next_hop": NEXT_HOP_IP
["nh2"][addr_type
],
669 "admin_distance": 20,
674 nh
= [NEXT_HOP_IP
["nh2"][addr_type
]]
689 ), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name
)
691 step("Configure IBGP IPv4 peering between R2 and R3 router.")
692 step("Explicit route is added in R3 for R2 nexthop rechability")
697 "network": NEXT_HOP_IP
["nh1"][addr_type
] + "/32",
698 "next_hop": topo
["routers"]["r2"]["links"]["r3"][addr_type
],
701 "network": NEXT_HOP_IP
["nh2"][addr_type
] + "/32",
702 "next_hop": topo
["routers"]["r2"]["links"]["r3"][addr_type
],
707 logger
.info("Configure static routes")
708 result
= create_static_routes(tgen
, rt3_rtes
)
709 assert result
is True, "Testcase {} : Failed \n Error: {}".format(
712 step("Configure redistribute static in BGP on R2 router")
719 "unicast": {"redistribute": [{"redist_type": "static"}]}
725 result
= create_router_bgp(tgen
, topo
, input_dict_2
)
726 assert result
is True, "Testcase {} : Failed \n Error: {}".format(
730 step("Remove the static route configured with nexthop N1 from running config")
735 "network": NETWORK
[addr_type
],
736 "next_hop": NEXT_HOP_IP
["nh1"][addr_type
],
737 "admin_distance": 10,
744 logger
.info("Configure static routes")
745 result
= create_static_routes(tgen
, rt1_nh1
)
746 assert result
is True, "Testcase {} : Failed \n Error: {}".format(
751 "On R2, after removing the static route with N1 , "
752 "route become active with nexthop N2 and vice versa."
758 "network": NETWORK2
[addr_type
],
759 "next_hop": NEXT_HOP_IP
["nh1"][addr_type
],
760 "admin_distance": 10,
765 nh
= [NEXT_HOP_IP
["nh1"][addr_type
]]
780 ), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name
)
786 "network": NETWORK2
[addr_type
],
787 "next_hop": NEXT_HOP_IP
["nh2"][addr_type
],
788 "admin_distance": 20,
793 nh
= [NEXT_HOP_IP
["nh2"][addr_type
]]
795 tgen
, addr_type
, dut
, rte2_nh2
, next_hop
=nh
, protocol
=protocol
, fib
=True
799 ), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name
)
801 step("Configure the static route with nexthop N1")
806 "network": NETWORK
[addr_type
],
807 "next_hop": NEXT_HOP_IP
["nh1"][addr_type
],
808 "admin_distance": 10,
813 logger
.info("Configure static routes")
814 result
= create_static_routes(tgen
, rte1_nh1
)
815 assert result
is True, "Testcase {} : Failed \n Error: {}".format(
819 step("Remove the static route configured with nexthop N2 from running config")
824 "network": NETWORK
[addr_type
],
825 "next_hop": NEXT_HOP_IP
["nh2"][addr_type
],
826 "admin_distance": 20,
832 logger
.info("Configure static routes")
833 result
= create_static_routes(tgen
, rte2_nh2
)
834 assert result
is True, "Testcase {} : Failed \n Error: {}".format(
839 "On R2, after removing the static route with N2 , "
840 "route become active with nexthop N1 and vice versa."
842 nh
= NEXT_HOP_IP
["nh2"][addr_type
]
854 ), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format(
858 nh
= [NEXT_HOP_IP
["nh1"][addr_type
]]
860 tgen
, addr_type
, dut
, rte1_nh1
, next_hop
=nh
, protocol
=protocol
864 ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name
)
866 step("Configure the static route with nexthop N2")
871 "network": NETWORK
[addr_type
],
872 "next_hop": NEXT_HOP_IP
["nh2"][addr_type
],
873 "admin_distance": 20,
879 logger
.info("Configure static routes")
880 result
= create_static_routes(tgen
, rte2_nh2
)
881 assert result
is True, "Testcase {} : Failed \n Error: {}".format(
885 step("Shut nexthop interface N1")
886 intf
= topo
["routers"]["r2"]["links"]["r1-link0"]["interface"]
888 shutdown_bringup_interface(tgen
, dut
, intf
, False)
890 step("after shut of nexthop N1 , route become active with nexthop N2")
892 nh
= NEXT_HOP_IP
["nh1"][addr_type
]
904 ), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format(
908 nh
= [NEXT_HOP_IP
["nh2"][addr_type
]]
910 tgen
, addr_type
, dut
, rte2_nh2
, next_hop
=nh
, protocol
=protocol
, fib
=True
914 ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name
)
916 step("No shut the nexthop interface N1")
917 shutdown_bringup_interface(tgen
, dut
, intf
, True)
920 "after shut of nexthop N1 , route become active "
921 "with nexthop N2 and vice versa."
923 nh
= [NEXT_HOP_IP
["nh1"][addr_type
]]
926 tgen
, addr_type
, dut
, rte1_nh1
, next_hop
=nh
, protocol
=protocol
, fib
=True
930 ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name
)
932 step("Shut nexthop interface N2")
933 intf
= topo
["routers"]["r2"]["links"]["r1-link1"]["interface"]
935 shutdown_bringup_interface(tgen
, dut
, intf
, False)
938 " after shut of nexthop N1 , route become active with "
939 "nexthop N2 and vice versa."
941 nh
= NEXT_HOP_IP
["nh2"][addr_type
]
954 ), "Testcase {} : Failed \nError: Routes is" " still present in RIB".format(
958 nh
= [NEXT_HOP_IP
["nh1"][addr_type
]]
960 tgen
, addr_type
, dut
, rte1_nh1
, next_hop
=nh
, protocol
=protocol
964 ), "Testcase {} : Failed \nError: Routes is" " missing in RIB".format(tc_name
)
966 step("No shut nexthop interface N2")
967 shutdown_bringup_interface(tgen
, dut
, intf
, True)
970 "after shut of nexthop N1 , route become active "
971 "with nexthop N2 and vice versa."
977 "network": NETWORK2
[addr_type
],
978 "next_hop": NEXT_HOP_IP
["nh1"][addr_type
],
979 "admin_distance": 10,
984 nh
= [NEXT_HOP_IP
["nh1"][addr_type
]]
988 tgen
, addr_type
, dut
, rte1_nh1
, next_hop
=nh
, protocol
=protocol
, fib
=True
992 ), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name
)
998 "network": NETWORK2
[addr_type
],
999 "next_hop": NEXT_HOP_IP
["nh2"][addr_type
],
1000 "admin_distance": 20,
1005 nh
= [NEXT_HOP_IP
["nh2"][addr_type
]]
1008 result
= verify_rib(
1020 ), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name
)
1025 result
= verify_rib(
1037 ), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name
)
1040 step("Reload the FRR router")
1041 # stop/start -> restart FRR router and verify
1042 stop_router(tgen
, "r2")
1044 start_router(tgen
, "r2")
1047 "After reload of FRR router , static route installed"
1048 " in RIB and FIB properly ."
1054 "network": NETWORK2
[addr_type
],
1055 "next_hop": NEXT_HOP_IP
["nh1"][addr_type
],
1056 "admin_distance": 10,
1061 nh
= [NEXT_HOP_IP
["nh1"][addr_type
]]
1064 result
= verify_rib(
1065 tgen
, addr_type
, dut
, rte1_nh1
, next_hop
=nh
, protocol
=protocol
, fib
=True
1069 ), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name
)
1073 result
= verify_bgp_rib(tgen
, addr_type
, dut
, rte1_nh1
, next_hop
=nh
)
1076 ), "Testcase {} : Failed \nError: Routes is" "missing in RIB".format(tc_name
)
1082 "network": NETWORK2
[addr_type
],
1083 "next_hop": NEXT_HOP_IP
["nh2"][addr_type
],
1084 "admin_distance": 20,
1089 nh
= [NEXT_HOP_IP
["nh2"][addr_type
]]
1092 result
= verify_rib(
1104 ), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name
)
1108 result
= verify_bgp_rib(tgen
, addr_type
, dut
, rte2_nh2
, next_hop
=nh
)
1111 ), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name
)
1113 result
= verify_rib(
1125 ), "Testcase {} : Failed \nError: Routes is" "not active in RIB".format(tc_name
)
1127 write_test_footer(tc_name
)
1130 if __name__
== "__main__":
1131 args
= ["-s"] + sys
.argv
[1:]
1132 sys
.exit(pytest
.main(args
))