summaryrefslogtreecommitdiffstats
path: root/tests/topotests/bgp_bmp
diff options
context:
space:
mode:
authorLouis Scalbert <louis.scalbert@6wind.com>2024-10-24 15:35:35 +0200
committerLouis Scalbert <louis.scalbert@6wind.com>2024-10-25 14:17:20 +0200
commit771284474d3660e5b7808b4f81038307bc63b585 (patch)
tree0298ea3ec6f501ac721407b40d7fc828af9efb40 /tests/topotests/bgp_bmp
parenttests: factorize code in bgp_bmp_vrf (diff)
downloadfrr-771284474d3660e5b7808b4f81038307bc63b585.tar.xz
frr-771284474d3660e5b7808b4f81038307bc63b585.zip
tests: fix bgp_bmp race condition
The bgp_bmp topotest is randomly failing with similar messages: > 2024-10-24 16:59:03,037 ERROR: topo: test failed at "bgp_bmp.test_bgp_bmp/test_bmp_bgp_unicast": Checking the updated prefixes has failed ! Generated JSON diff error report: > > $->pre-policy->update: expected has key '172.31.0.15/32' which is not present in output It is particularly unsuccessful when run with valgrind: > python3 -m pytest -vvss --valgrind-leak-kinds=all --valgrind-extra --valgrind-memleaks bgp_bmp bgp_bmp is configuring a BMP policy on r1 and then some static BGP prefixes on r2. If for some reasons, the BGP UPDATE arrives to r1 before the BMP configuration is operational, the UPDATE is not sent to the BMP server and the test fails. Pre-configure the BMP policies at startup to avoid this race condition. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Diffstat (limited to 'tests/topotests/bgp_bmp')
-rw-r--r--tests/topotests/bgp_bmp/r1/bgpd.conf14
-rw-r--r--tests/topotests/bgp_bmp/test_bgp_bmp.py18
2 files changed, 13 insertions, 19 deletions
diff --git a/tests/topotests/bgp_bmp/r1/bgpd.conf b/tests/topotests/bgp_bmp/r1/bgpd.conf
index 24505de4a..485c21709 100644
--- a/tests/topotests/bgp_bmp/r1/bgpd.conf
+++ b/tests/topotests/bgp_bmp/r1/bgpd.conf
@@ -7,6 +7,18 @@ router bgp 65501
!
bmp targets bmp1
bmp connect 192.0.2.10 port 1789 min-retry 100 max-retry 10000
+ bmp monitor ipv4 unicast pre-policy
+ bmp monitor ipv6 unicast pre-policy
+ bmp monitor ipv4 vpn pre-policy
+ bmp monitor ipv6 vpn pre-policy
+ bmp monitor ipv4 unicast post-policy
+ bmp monitor ipv6 unicast post-policy
+ bmp monitor ipv4 vpn post-policy
+ bmp monitor ipv6 vpn post-policy
+ bmp monitor ipv4 unicast loc-rib
+ bmp monitor ipv6 unicast loc-rib
+ bmp monitor ipv4 vpn loc-rib
+ bmp monitor ipv6 vpn loc-rib
exit
!
address-family ipv4 vpn
@@ -28,7 +40,7 @@ router bgp 65501
neighbor 192:168::2 soft-reconfiguration inbound
exit-address-family
!
-router bgp 65502 vrf vrf1
+router bgp 65501 vrf vrf1
bgp router_id 192.168.0.1
bgp log-neighbor-changes
address-family ipv4 unicast
diff --git a/tests/topotests/bgp_bmp/test_bgp_bmp.py b/tests/topotests/bgp_bmp/test_bgp_bmp.py
index cb12c544f..658ad2b99 100644
--- a/tests/topotests/bgp_bmp/test_bgp_bmp.py
+++ b/tests/topotests/bgp_bmp/test_bgp_bmp.py
@@ -336,22 +336,6 @@ def check_for_peer_message(expected_peers, bmp_log_type):
return True
-def set_bmp_policy(tgen, node, asn, target, safi, policy, vrf=None):
- """
- Configure the bmp policy.
- """
- vrf = " vrf {}" if vrf else ""
- cmd = [
- "con t\n",
- "router bgp {}{}\n".format(asn, vrf),
- "bmp targets {}\n".format(target),
- "bmp monitor ipv4 {} {}\n".format(safi, policy),
- "bmp monitor ipv6 {} {}\n".format(safi, policy),
- "end\n",
- ]
- tgen.gears[node].vtysh_cmd("".join(cmd))
-
-
def configure_prefixes(tgen, node, asn, safi, prefixes, vrf=None, update=True):
"""
Configure the bgp prefixes.
@@ -381,8 +365,6 @@ def _test_prefixes(policy, vrf=None, step=0):
safi = "vpn" if vrf else "unicast"
- set_bmp_policy(tgen, "r1", 65501, "bmp1", safi, policy)
-
prefixes = ["172.31.0.15/32", "2001::1111/128"]
for type in ("update", "withdraw"):