4 # Copyright (c) 2021 by VMware, Inc. ("VMware")
5 # Used Copyright (c) 2018 by Network Device Education Foundation, Inc.
6 # ("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 """RFC5549 Automation."""
29 from copy
import deepcopy
31 # Save the Current Working Directory to find configuration files.
32 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
33 sys
.path
.append(os
.path
.join(CWD
, "../"))
34 sys
.path
.append(os
.path
.join(CWD
, "../../"))
36 # pylint: disable=C0413
37 # Import topogen and topotest helpers
38 from lib
.topogen
import Topogen
, get_topogen
40 from lib
.common_config
import (
48 reset_config_on_routers
,
51 get_frr_ipv6_linklocal
,
53 from lib
.topolog
import logger
55 verify_bgp_convergence
,
59 from lib
.topojson
import build_config_from_json
73 "ipv6": ["1::1/128", "1::2/128", "1::3/128", "1::4/128", "1::5/128"],
75 MASK
= {"ipv4": "32", "ipv6": "128"}
77 "ipv4": ["10.0.0.1", "10.0.1.1", "10.0.2.1", "10.0.3.1", "10.0.4.1"],
78 "ipv6": ["Null0", "Null0", "Null0", "Null0", "Null0"],
80 NETWORK_CMD_IP
= "1.0.1.17/32"
83 Please view in a fixed-width font such as Courier.
92 +----+ 5links +----+ +--+-+ +----+
93 |R0 +----------+ R1 | | R2 | ipv6 nbr |R3 |
94 | +----------+ +------------+ +-------------+ |
95 +----+ +----+ ipv6 nbr +----+ +----+
99 1. Verify IPv4 and IPv6 routes advertise using "redistribute static"
100 and "network command" are received on IBGP peer with IPv6 nexthop
101 2. Verify IPv4 routes are advertised and withdrawn when IPv6 IBGP session
102 established using loopback interface
103 3. Verify IPv4 routes are advertised to peer when static routes are
104 configured with ADMIN distance and tag option
105 4. Verify IPv4 routes advertised to peer when BGP session established
106 using link-local address
110 def setup_module(mod
):
111 """Set up the pytest environment."""
114 testsuite_run_time
= time
.asctime(time
.localtime(time
.time()))
115 logger
.info("Testsuite start time: {}".format(testsuite_run_time
))
116 logger
.info("=" * 40)
118 logger
.info("Running setup_module to create topology")
120 # This function initiates the topology build with Topogen...
121 json_file
= "{}/rfc5549_ibgp_nbr.json".format(CWD
)
122 tgen
= Topogen(json_file
, mod
.__name
__)
124 topo
= tgen
.json_topo
126 # Starting topology, create tmp files which are loaded to routers
127 # to start deamons and then start routers
130 # Creating configuration from JSON
131 build_config_from_json(tgen
, topo
)
132 # Don't run this test if we have any failure.
133 if tgen
.routers_have_failure():
134 pytest
.skip(tgen
.errors
)
136 BGP_CONVERGENCE
= verify_bgp_convergence(tgen
, topo
)
137 assert BGP_CONVERGENCE
is True, "setup_module :Failed \n Error:" " {}".format(
140 logger
.info("Running setup_module() done")
143 def teardown_module():
144 """Teardown the pytest environment."""
145 logger
.info("Running teardown_module to delete topology")
149 # Stop toplogy and Remove tmp files
153 def get_llip(onrouter
, intf
):
155 API to get the link local ipv6 address of a perticular interface
159 * `fromnode`: Source node
160 * `tonode` : interface for which link local ip needs to be returned.
164 result = get_llip('r1', 'r2-link0')
168 1) link local ipv6 address from the interface.
169 2) errormsg - when link local ip not found.
172 intf
= topo
["routers"][onrouter
]["links"][intf
]["interface"]
173 llip
= get_frr_ipv6_linklocal(tgen
, onrouter
, intf
)
176 logger
.info("llip ipv6 address to be set as NH is %s", llip
)
181 def get_glipv6(onrouter
, intf
):
183 API to get the global ipv6 address of a perticular interface
187 * `onrouter`: Source node
188 * `intf` : interface for which link local ip needs to be returned.
192 result = get_glipv6('r1', 'r2-link0')
196 1) global ipv6 address from the interface.
197 2) errormsg - when link local ip not found.
199 glipv6
= (topo
["routers"][onrouter
]["links"][intf
]["ipv6"]).split("/")[0]
201 logger
.info("Global ipv6 address to be set as NH is %s", glipv6
)
206 # ##################################
207 # Test cases start here.
208 # ##################################
211 def test_ext_nh_cap_red_static_network_ibgp_peer_p1(request
):
214 Test extended capability nexthop with ibgp peer.
216 Verify IPv4 and IPv6 routes advertise using "redistribute static"
217 and "network command" are received on IBGP peer with IPv6 nexthop
219 tc_name
= request
.node
.name
220 write_test_header(tc_name
)
222 # Don't run this test if we have any failure.
223 if tgen
.routers_have_failure():
224 pytest
.skip(tgen
.errors
)
225 reset_config_on_routers(tgen
)
227 "Configure IPv6 EBGP session between R1 and R2 with global IPv6"
228 " address Enable capability extended-nexthop on the nbr from both"
232 "Change ebgp to ibgp nbrs between r1 and r2 , Activate same IPv6"
233 " nbr from IPv4 unicast family "
237 " Configure 5 IPv4 static routes"
238 " on R1 nexthop for static route exists on different link of R0"
241 for rte
in range(0, NO_OF_RTES
):
242 # Create Static routes
247 "network": NETWORK
["ipv4"][rte
],
249 "next_hop": NEXT_HOP
["ipv4"][rte
],
254 result
= create_static_routes(tgen
, input_dict
)
255 assert result
is True, "Testcase {} : Failed \n Error: {}".format(
259 "Advertise static routes from IPv4 unicast family and IPv6 unicast"
260 " family respectively from R1.Configure loopback on R1 with IPv4 addr"
261 " & Advertise loopback from IPv4 unicast family using network cmd "
264 # this test case needs ipv6 routes to be configured
265 configure_bgp_on_r1
= {
271 "redistribute": [{"redist_type": "static"}],
272 "advertise_networks": [
273 {"network": NETWORK_CMD_IP
, "no_of_network": 1}
277 "ipv6": {"unicast": {"redistribute": [{"redist_type": "static"}]}},
282 result
= create_router_bgp(tgen
, topo
, configure_bgp_on_r1
)
283 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
285 glip
= get_llip("r1", "r2-link0")
286 assert glip
is not None, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
289 "IPv4 and IPv6 routes advertised using static & network command are"
290 "received on R2 BGP and routing table , verify using show ip bgp"
291 "show ip route for IPv4 routes and show bgp, show ipv6 routes"
297 # verify the routes with nh as ext_nh
298 verify_nh_for_static_rtes
= {
302 "network": NETWORK
["ipv4"][0],
303 "no_of_ip": NO_OF_RTES
,
309 bgp_rib
= verify_bgp_rib(
310 tgen
, "ipv4", dut
, verify_nh_for_static_rtes
, next_hop
=glip
312 assert bgp_rib
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, bgp_rib
)
314 tgen
, "ipv4", dut
, verify_nh_for_static_rtes
, next_hop
=glip
, protocol
=protocol
316 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
319 "Verify IPv4 routes are installed with IPv6 global nexthop of R1"
320 "R1 to R2 connected link"
322 verify_nh_for_nw_cmd_rtes
= {
326 "network": NETWORK_CMD_IP
,
333 bgp_rib
= verify_bgp_rib(
334 tgen
, "ipv4", dut
, verify_nh_for_nw_cmd_rtes
, next_hop
=glip
336 assert bgp_rib
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, bgp_rib
)
338 tgen
, "ipv4", dut
, verify_nh_for_nw_cmd_rtes
, next_hop
=glip
, protocol
=protocol
340 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
342 write_test_footer(tc_name
)
345 def test_ext_nh_cap_admin_dist_tag_ibgp_peer_p1(request
):
348 Test extended capability nexthop with admin distance and route tag.
350 Verify IPv4 routes are advertised to peer when static routes
351 are configured with ADMIN distance and tag option
353 tc_name
= request
.node
.name
354 write_test_header(tc_name
)
356 # Don't run this test if we have any failure.
357 if tgen
.routers_have_failure():
358 pytest
.skip(tgen
.errors
)
359 reset_config_on_routers(tgen
)
361 "Configure IPv6 EBGP session between R1 and R2 with global IPv6"
362 " address Enable capability extended-nexthop on the nbr from both"
366 "Change ebgp to ibgp nbrs between r1 and r2 , Activate same IPv6"
367 " nbr from IPv4 unicast family "
370 " Configure 5 IPv4 static routes"
371 " on R1 nexthop for static route exists on different link of R0"
374 for rte
in range(0, NO_OF_RTES
):
376 # Create Static routes
381 "network": NETWORK
["ipv4"][rte
],
383 "next_hop": NEXT_HOP
["ipv4"][rte
],
384 "admin_distance": 100 + count
,
390 result
= create_static_routes(tgen
, input_dict
)
391 assert result
is True, "Testcase {} : Failed \n Error: {}".format(
395 "Advertise static routes from IPv4 unicast family & IPv6 unicast"
396 " family respectively from R1.Configure loopback on R1 with IPv4 "
397 "address & Advertise loopback from IPv4 unicast family "
398 "using network cmd from R1"
400 configure_bgp_on_r1
= {
404 "ipv4": {"unicast": {"redistribute": [{"redist_type": "static"}]}}
409 result
= create_router_bgp(tgen
, topo
, configure_bgp_on_r1
)
410 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
412 glip
= get_llip("r1", "r2-link0")
413 assert glip
is not None, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
416 "IPv4 and IPv6 routes advertised using static & network cmd are"
417 "received on R2 BGP and routing table , verify using show ip bgp"
418 "show ip route for IPv4 routes and show bgp, show ipv6 routes"
425 # verify the routes with nh as ext_nh
426 verify_nh_for_static_rtes
= {
430 "network": NETWORK
["ipv4"][0],
431 "no_of_ip": NO_OF_RTES
,
433 "admin_distance": 100 + count
,
439 bgp_rib
= verify_bgp_rib(
440 tgen
, "ipv4", dut
, verify_nh_for_static_rtes
, next_hop
=glip
442 assert bgp_rib
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, bgp_rib
)
444 tgen
, "ipv4", dut
, verify_nh_for_static_rtes
, next_hop
=glip
, protocol
=protocol
446 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
448 for rte
in range(0, NO_OF_RTES
):
458 "network": NETWORK
["ipv4"][rte
],
465 result
= create_prefix_lists(tgen
, input_dict_2
)
466 assert result
is True, "Testcase {} : Failed \n " "Error: {}".format(
474 "rmap_match_tag_1_{}".format("ipv4"): [
478 "ipv4": {"prefix_lists": "pf_list_1_{}".format("ipv4")}
485 result
= create_route_maps(tgen
, input_dict_6
)
486 assert result
is True, "Testcase {} : Failed \n Error: {}".format(
490 # Configure neighbor for route map
503 "name": "rmap_match_tag_1_ipv4",
518 result
= create_router_bgp(tgen
, topo
, input_dict_7
)
519 assert result
is True, "Testcase {} : Failed \n Error: {}".format(
523 write_test_footer(tc_name
)
526 def test_ibgp_loopback_nbr_p1(request
):
528 Verify Extended capability nexthop with loopback interface.
530 Verify IPv4 routes are advertised and withdrawn when IPv6 IBGP
531 session established using loopback interface
533 tc_name
= request
.node
.name
534 write_test_header(tc_name
)
536 # Don't run this test if we have any failure.
537 if tgen
.routers_have_failure():
538 pytest
.skip(tgen
.errors
)
540 topo1
= deepcopy(topo
)
541 reset_config_on_routers(tgen
)
542 step("Configure IPv6 global address between R1 and R2")
544 "Configure loopback on R1 and R2 and establish EBGP session "
545 "between R1 and R2 over loopback global ip"
547 step("Configure static route on R1 and R2 for loopback reachability")
548 step("Enable cap ext nh on r1 and r2 and activate in ipv4 addr family")
550 for routerN
in ["r1", "r2"]:
551 for addr_type
in ["ipv6"]:
552 for bgp_neighbor
in topo1
["routers"][routerN
]["bgp"]["address_family"][
554 ]["unicast"]["neighbor"].keys():
555 # Adding ['source_link'] = 'lo' key:value pair
556 if bgp_neighbor
== "r1" or bgp_neighbor
== "r2":
557 topo1
["routers"][routerN
]["bgp"]["address_family"][addr_type
][
559 ]["neighbor"][bgp_neighbor
]["dest_link"] = {
563 "capability": "extended-nexthop",
567 # Creating configuration from JSON
568 build_config_from_json(tgen
, topo1
, save_bkup
=False)
570 configure_bgp_on_r1
= {
578 "dest_link": {"r1-link0": {"deactivate": "ipv6"}}
587 result
= create_router_bgp(tgen
, topo1
, configure_bgp_on_r1
)
588 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
590 configure_bgp_on_r2
= {
598 "dest_link": {"r2-link0": {"deactivate": "ipv6"}}
607 result
= create_router_bgp(tgen
, topo1
, configure_bgp_on_r2
)
608 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
610 configure_bgp_on_r1
= {
618 "dest_link": {"r1-link0": {"deactivate": "ipv4"}}
627 result
= create_router_bgp(tgen
, topo1
, configure_bgp_on_r1
)
628 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
630 configure_bgp_on_r2
= {
638 "dest_link": {"r2-link0": {"deactivate": "ipv4"}}
647 result
= create_router_bgp(tgen
, topo1
, configure_bgp_on_r2
)
648 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
649 r2_lo_v4
= topo
["routers"]["r2"]["links"]["lo"]["ipv4"]
650 r2_lo_v6
= topo
["routers"]["r2"]["links"]["lo"]["ipv6"]
651 r1_lo_v4
= topo
["routers"]["r1"]["links"]["lo"]["ipv4"]
652 r1_lo_v6
= topo
["routers"]["r1"]["links"]["lo"]["ipv6"]
653 r1_r2_intf
= topo
["routers"]["r1"]["links"]["r2-link0"]["interface"]
654 r2_r1_intf
= topo
["routers"]["r2"]["links"]["r1-link0"]["interface"]
656 r1_r2_v6_nh
= topo
["routers"]["r1"]["links"]["r2-link0"]["ipv6"].split("/")[0]
657 r2_r1_v6_nh
= topo
["routers"]["r2"]["links"]["r1-link0"]["ipv6"].split("/")[0]
659 ipv4_list
= [("r1", r1_r2_intf
, [r2_lo_v4
]), ("r2", r2_r1_intf
, [r1_lo_v4
])]
662 ("r1", r1_r2_intf
, [r2_lo_v6
], r2_r1_v6_nh
),
663 ("r2", r2_r1_intf
, [r1_lo_v6
], r1_r2_v6_nh
),
666 for dut
, intf
, loop_addr
in ipv4_list
:
667 result
= addKernelRoute(tgen
, dut
, intf
, loop_addr
)
668 # assert result is True, "Testcase {}:Failed \n Error: {}". \
669 # format(tc_name, result)
671 for dut
, intf
, loop_addr
, next_hop
in ipv6_list
:
672 result
= addKernelRoute(tgen
, dut
, intf
, loop_addr
, next_hop
)
673 # assert result is True, "Testcase {}:Failed \n Error: {}". \
674 # format(tc_name, result)
676 r2_lo_v4
= topo
["routers"]["r2"]["links"]["lo"]["ipv4"]
677 r2_lo_v6
= topo
["routers"]["r2"]["links"]["lo"]["ipv6"]
678 r1_lo_v4
= topo
["routers"]["r1"]["links"]["lo"]["ipv4"]
679 r1_lo_v6
= topo
["routers"]["r1"]["links"]["lo"]["ipv6"]
680 r1_r2_intf
= topo
["routers"]["r1"]["links"]["r2-link0"]["interface"]
681 r2_r1_intf
= topo
["routers"]["r2"]["links"]["r1-link0"]["interface"]
683 r1_r2_v6_nh
= topo
["routers"]["r1"]["links"]["r2-link0"]["ipv6"].split("/")[0]
684 r2_r1_v6_nh
= topo
["routers"]["r2"]["links"]["r1-link0"]["ipv6"].split("/")[0]
686 r1_r2_v4_nh
= topo
["routers"]["r1"]["links"]["r2-link0"]["ipv4"].split("/")[0]
687 r2_r1_v4_nh
= topo
["routers"]["r2"]["links"]["r1-link0"]["ipv4"].split("/")[0]
692 {"network": r2_lo_v4
, "next_hop": r2_r1_v4_nh
},
693 {"network": r2_lo_v6
, "next_hop": r2_r1_v6_nh
},
698 {"network": r1_lo_v4
, "next_hop": r1_r2_v4_nh
},
699 {"network": r1_lo_v6
, "next_hop": r1_r2_v6_nh
},
703 result
= create_static_routes(tgen
, input_dict
)
704 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
706 # Api call verify whether BGP is converged
707 result
= verify_bgp_convergence(tgen
, topo1
)
708 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
710 step("Enable cap ext nh on r1 and r2 and activate in ipv4 addr family")
711 configure_bgp_on_r1
= {
713 "default_ipv4_unicast": False,
723 "capability": "extended-nexthop",
734 result
= create_router_bgp(tgen
, topo1
, configure_bgp_on_r1
)
735 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
737 configure_bgp_on_r2
= {
739 "default_ipv4_unicast": False,
749 "capability": "extended-nexthop",
760 result
= create_router_bgp(tgen
, topo1
, configure_bgp_on_r2
)
761 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
763 step("Verify bgp convergence.")
764 bgp_convergence
= verify_bgp_convergence(tgen
, topo1
)
765 assert bgp_convergence
is True, "Testcase {} : Failed \n Error: {}".format(
766 tc_name
, bgp_convergence
769 step("Configure 2 IPv4 static" " routes on R1, Nexthop as different links of R0")
771 for rte
in range(0, NO_OF_RTES
):
772 # Create Static routes
777 "network": NETWORK
["ipv4"][rte
],
779 "next_hop": NEXT_HOP
["ipv4"][rte
],
784 result
= create_static_routes(tgen
, input_dict
)
785 assert result
is True, "Testcase {} : Failed \n Error: {}".format(
790 "Advertise static routes from IPv4 unicast family and IPv6 "
791 "unicast family respectively from R1 using red static cmd "
792 "Advertise loopback from IPv4 unicast family using network command "
796 configure_bgp_on_r1
= {
802 "redistribute": [{"redist_type": "static"}],
803 "advertise_networks": [
804 {"network": NETWORK_CMD_IP
, "no_of_network": 1}
812 result
= create_router_bgp(tgen
, topo1
, configure_bgp_on_r1
)
813 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
816 "IPv4 routes advertised using static and network command are "
817 " received on R2 BGP and routing table , "
818 "verify using show ip bgp, show ip route for IPv4 routes ."
821 gllip
= (topo1
["routers"]["r1"]["links"]["lo"]["ipv6"].split("/")[0]).lower()
822 assert gllip
is not None, "Testcase {} : Failed \n Error: {}".format(
828 verify_nh_for_static_rtes
= {
832 "network": NETWORK
["ipv4"][0],
833 "no_of_ip": NO_OF_RTES
,
839 bgp_rib
= verify_bgp_rib(
840 tgen
, "ipv4", dut
, verify_nh_for_static_rtes
, next_hop
=gllip
842 assert bgp_rib
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, bgp_rib
)
844 tgen
, "ipv4", dut
, verify_nh_for_static_rtes
, next_hop
=gllip
, protocol
=protocol
846 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
848 verify_nh_for_nw_rtes
= {
851 {"network": NETWORK_CMD_IP
, "no_of_ip": 1, "next_hop": gllip
}
855 bgp_rib
= verify_bgp_rib(tgen
, "ipv4", dut
, verify_nh_for_nw_rtes
, next_hop
=gllip
)
856 assert bgp_rib
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, bgp_rib
)
858 tgen
, "ipv4", dut
, verify_nh_for_nw_rtes
, next_hop
=gllip
, protocol
=protocol
860 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
863 "Remove IPv4 routes advertised using network command"
864 " from R1 and advertise again"
867 configure_bgp_on_r1
= {
873 "redistribute": [{"redist_type": "static"}],
874 "advertise_networks": [
876 "network": NETWORK_CMD_IP
,
887 result
= create_router_bgp(tgen
, topo1
, configure_bgp_on_r1
)
888 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
890 configure_bgp_on_r1
= {
896 "redistribute": [{"redist_type": "static"}],
897 "advertise_networks": [
899 "network": NETWORK_CMD_IP
,
909 result
= create_router_bgp(tgen
, topo1
, configure_bgp_on_r1
)
910 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
912 "After removing IPv4 routes from network command , routes which are "
913 "advertised using redistribute static are still present in the on "
914 "R2 , verify using show ip bgp and show ip route"
917 verify_nh_for_nw_rtes
= {
920 {"network": NETWORK_CMD_IP
, "no_of_ip": 1, "next_hop": gllip
}
924 bgp_rib
= verify_bgp_rib(tgen
, "ipv4", dut
, verify_nh_for_nw_rtes
, next_hop
=gllip
)
925 assert bgp_rib
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, bgp_rib
)
927 tgen
, "ipv4", dut
, verify_nh_for_nw_rtes
, next_hop
=gllip
, protocol
=protocol
929 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
932 "Remove IPv4 routes advertised using redistribute static"
933 " command from R1 and advertise again"
936 configure_bgp_on_r1
= {
942 "redistribute": [{"redist_type": "static", "delete": True}]
949 result
= create_router_bgp(tgen
, topo1
, configure_bgp_on_r1
)
950 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
952 configure_bgp_on_r1
= {
956 "ipv4": {"unicast": {"redistribute": [{"redist_type": "static"}]}}
961 result
= create_router_bgp(tgen
, topo1
, configure_bgp_on_r1
)
962 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
964 "After removing IPv4 routes from redistribute static , routes which"
965 " are advertised using network are still present in the on R2 , "
966 "verify using show ip bgp and show ip route"
969 verify_nh_for_nw_rtes
= {
972 {"network": NETWORK_CMD_IP
, "no_of_ip": 1, "next_hop": gllip
}
976 bgp_rib
= verify_bgp_rib(tgen
, "ipv4", dut
, verify_nh_for_nw_rtes
, next_hop
=gllip
)
977 assert bgp_rib
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, bgp_rib
)
979 tgen
, "ipv4", dut
, verify_nh_for_nw_rtes
, next_hop
=gllip
, protocol
=protocol
981 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
982 write_test_footer(tc_name
)
985 if __name__
== "__main__":
986 args
= ["-s"] + sys
.argv
[1:]
987 sys
.exit(pytest
.main(args
))