From f921a8d09ac352f843ef3551a0eb268f7dd17de3 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Tue, 3 Dec 2024 15:48:26 +0100 Subject: [PATCH] topotests: bmp, test that loc-rib peer up message is sent Add a test at startup to ensure that peer up message for loc-rib is correctly set. Signed-off-by: Philippe Guibert --- tests/topotests/bgp_bmp/bgpbmp.py | 15 ++++++++++----- tests/topotests/bgp_bmp/test_bgp_bmp_1.py | 2 +- tests/topotests/bgp_bmp/test_bgp_bmp_2.py | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/topotests/bgp_bmp/bgpbmp.py b/tests/topotests/bgp_bmp/bgpbmp.py index 41995e2b5e53..5e8b0d9be72d 100644 --- a/tests/topotests/bgp_bmp/bgpbmp.py +++ b/tests/topotests/bgp_bmp/bgpbmp.py @@ -216,11 +216,16 @@ def bmp_check_for_peer_message( ] # get the list of pairs (prefix, policy, seq) for the given message type - peers = [ - m["peer_ip"] - for m in messages - if "peer_ip" in m.keys() and m["bmp_log_type"] == bmp_log_type - ] + peers = [] + for m in messages: + if ( + "peer_ip" in m.keys() + and m["peer_ip"] != "0.0.0.0" + and m["bmp_log_type"] == bmp_log_type + ): + peers.append(m["peer_ip"]) + elif m["policy"] == "loc-rib" and m["bmp_log_type"] == bmp_log_type: + peers.append("0.0.0.0") # check for prefixes for ep in expected_peers: diff --git a/tests/topotests/bgp_bmp/test_bgp_bmp_1.py b/tests/topotests/bgp_bmp/test_bgp_bmp_1.py index 61428634414c..be3e07929a0f 100644 --- a/tests/topotests/bgp_bmp/test_bgp_bmp_1.py +++ b/tests/topotests/bgp_bmp/test_bgp_bmp_1.py @@ -192,7 +192,7 @@ def test_peer_up(): """ tgen = get_topogen() - peers = ["192.168.0.2", "192:168::2"] + peers = ["192.168.0.2", "192:168::2", "0.0.0.0"] logger.info("checking for BMP peers up messages") diff --git a/tests/topotests/bgp_bmp/test_bgp_bmp_2.py b/tests/topotests/bgp_bmp/test_bgp_bmp_2.py index b45452e7c475..e8f67515bd5d 100644 --- a/tests/topotests/bgp_bmp/test_bgp_bmp_2.py +++ b/tests/topotests/bgp_bmp/test_bgp_bmp_2.py @@ -200,7 +200,7 @@ def test_peer_up(): """ tgen = get_topogen() - peers = ["192.168.0.2", "192:168::2"] + peers = ["192.168.0.2", "192:168::2", "0.0.0.0"] logger.info("checking for BMP peers up messages")