mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-27 05:28:51 +00:00
topotests: bgp_bmp, add peer message test when RD changes
Add a test to control the peer up and down message sent when the route distinguisher is updated. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
parent
7da91a8fb9
commit
e4bbe12c17
@ -193,6 +193,7 @@ def bmp_check_for_peer_message(
|
|||||||
bmp_log_file,
|
bmp_log_file,
|
||||||
is_rd_instance=False,
|
is_rd_instance=False,
|
||||||
peer_bgp_id=None,
|
peer_bgp_id=None,
|
||||||
|
peer_distinguisher=None,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Check for the presence of a peer up message for the peer
|
Check for the presence of a peer up message for the peer
|
||||||
@ -214,6 +215,8 @@ def bmp_check_for_peer_message(
|
|||||||
for m in messages:
|
for m in messages:
|
||||||
if is_rd_instance and m["peer_distinguisher"] == "0:0":
|
if is_rd_instance and m["peer_distinguisher"] == "0:0":
|
||||||
continue
|
continue
|
||||||
|
if peer_distinguisher and m["peer_distinguisher"] != peer_distinguisher:
|
||||||
|
continue
|
||||||
if peer_bgp_id and m["peer_bgp_id"] != peer_bgp_id:
|
if peer_bgp_id and m["peer_bgp_id"] != peer_bgp_id:
|
||||||
continue
|
continue
|
||||||
if (
|
if (
|
||||||
|
@ -339,6 +339,82 @@ def test_bgp_routerid_changed():
|
|||||||
), "Checking the BMP peer up LOC-RIB message with router-id set to 192.168.1.77 failed !."
|
), "Checking the BMP peer up LOC-RIB message with router-id set to 192.168.1.77 failed !."
|
||||||
|
|
||||||
|
|
||||||
|
def test_reconfigure_route_distinguisher_vrf1():
|
||||||
|
"""
|
||||||
|
Checking for BMP peers down messages
|
||||||
|
"""
|
||||||
|
tgen = get_topogen()
|
||||||
|
|
||||||
|
bmp_update_seq(
|
||||||
|
tgen.gears["bmp1vrf"], os.path.join(tgen.logdir, "bmp1vrf", "bmp.log")
|
||||||
|
)
|
||||||
|
peers = ["0.0.0.0"]
|
||||||
|
|
||||||
|
tgen.gears["r1vrf"].vtysh_cmd(
|
||||||
|
"""
|
||||||
|
configure terminal
|
||||||
|
router bgp 65501 vrf vrf1
|
||||||
|
address-family ipv4 unicast
|
||||||
|
rd vpn export 666:22
|
||||||
|
exit-address-family
|
||||||
|
address-family ipv6 unicast
|
||||||
|
rd vpn export 666:22
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
logger.info(
|
||||||
|
"checking for BMP peer down LOC-RIB message with route-distinguisher set to 444:1"
|
||||||
|
)
|
||||||
|
test_func = partial(
|
||||||
|
bmp_check_for_peer_message,
|
||||||
|
peers,
|
||||||
|
"peer down",
|
||||||
|
tgen.gears["bmp1vrf"],
|
||||||
|
os.path.join(tgen.logdir, "bmp1vrf", "bmp.log"),
|
||||||
|
is_rd_instance=True,
|
||||||
|
peer_distinguisher="444:1",
|
||||||
|
)
|
||||||
|
success, _ = topotest.run_and_expect(test_func, True, count=30, wait=1)
|
||||||
|
assert (
|
||||||
|
success
|
||||||
|
), "Checking the BMP peer down LOC-RIB message with route-distinguisher set to 444:1 failed !."
|
||||||
|
|
||||||
|
logger.info(
|
||||||
|
"checking for BMP peer up LOC-RIB messages with route-distinguisher set to 666:22"
|
||||||
|
)
|
||||||
|
test_func = partial(
|
||||||
|
bmp_check_for_peer_message,
|
||||||
|
peers,
|
||||||
|
"peer up",
|
||||||
|
tgen.gears["bmp1vrf"],
|
||||||
|
os.path.join(tgen.logdir, "bmp1vrf", "bmp.log"),
|
||||||
|
is_rd_instance=True,
|
||||||
|
peer_bgp_id="192.168.1.77",
|
||||||
|
peer_distinguisher="666:22",
|
||||||
|
)
|
||||||
|
success, _ = topotest.run_and_expect(test_func, True, count=30, wait=1)
|
||||||
|
assert (
|
||||||
|
success
|
||||||
|
), "Checking the BMP peer up LOC-RIB message with route-distinguisher set to 666:22 failed !."
|
||||||
|
|
||||||
|
logger.info(
|
||||||
|
"checking for BMP peer up messages with route-distinguisher set to 666:22"
|
||||||
|
)
|
||||||
|
peers = ["192.168.0.2", "192:168::2"]
|
||||||
|
test_func = partial(
|
||||||
|
bmp_check_for_peer_message,
|
||||||
|
peers,
|
||||||
|
"peer up",
|
||||||
|
tgen.gears["bmp1vrf"],
|
||||||
|
os.path.join(tgen.logdir, "bmp1vrf", "bmp.log"),
|
||||||
|
is_rd_instance=True,
|
||||||
|
peer_distinguisher="666:22",
|
||||||
|
)
|
||||||
|
success, _ = topotest.run_and_expect(test_func, True, count=30, wait=1)
|
||||||
|
assert (
|
||||||
|
success
|
||||||
|
), "Checking the BMP peer up messages with route-distinguisher set to 666:22 failed !."
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
args = ["-s"] + sys.argv[1:]
|
args = ["-s"] + sys.argv[1:]
|
||||||
sys.exit(pytest.main(args))
|
sys.exit(pytest.main(args))
|
||||||
|
Loading…
Reference in New Issue
Block a user