Commit fb18bc7cd6 for frr
commit fb18bc7cd6ea3e2a6a577290c06a5646dce22b70
Author: Philippe Guibert <philippe.guibert@6wind.com>
Date: Mon Oct 12 14:15:30 2026 +0200
topotests: check that aigp is not sent to an ebgp peer in bgp_aigp
The r1 -> r8 session is an eBGP session without "neighbor PEER aigp".
The test checks the MED that r8 receives, but not that the AIGP
attribute is absent.
AIGP_TRANSMIT_ALLOWED() only allows AIGP on such a session when the
aigp flag is set on the peer, so r1 must strip it before sending to r8.
Fix this by checking that aigpMetric is absent on r8.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
diff --git a/tests/topotests/bgp_aigp/test_bgp_aigp.py b/tests/topotests/bgp_aigp/test_bgp_aigp.py
index a4517882c0..e2dac8e65e 100644
--- a/tests/topotests/bgp_aigp/test_bgp_aigp.py
+++ b/tests/topotests/bgp_aigp/test_bgp_aigp.py
@@ -19,6 +19,9 @@ r1 receives routes with aigp-metric TLV 81, 91 and 82, 92 respectively.
r1 advertises MED from IGP protocol (set metric igp) to r8.
r1 advertises MED from AIGP (set metric aigp) to r8.
+
+r8 does not receive the AIGP attribute, as r1 -> r8 is an eBGP session
+without "neighbor PEER aigp".
"""
import os
@@ -154,12 +157,18 @@ def test_bgp_aigp():
def _bgp_check_received_med():
output = json.loads(
- r8.vtysh_cmd("show bgp ipv4 unicast 10.0.0.64/28 longer-prefixes json")
+ r8.vtysh_cmd(
+ "show bgp ipv4 unicast 10.0.0.64/28 longer-prefixes json detail"
+ )
)
expected = {
"routes": {
- "10.0.0.71/32": [{"valid": True, "metric": 10}],
- "10.0.0.72/32": [{"valid": True, "metric": 92}],
+ "10.0.0.71/32": {
+ "paths": [{"valid": True, "metric": 10, "aigpMetric": None}]
+ },
+ "10.0.0.72/32": {
+ "paths": [{"valid": True, "metric": 92, "aigpMetric": None}]
+ },
}
}
return topotest.json_cmp(output, expected)
@@ -288,7 +297,7 @@ def test_bgp_aigp():
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
assert (
result is None
- ), "MED attribute values are not derived from `set metric [a]igp`"
+ ), "MED is not derived from `set metric [a]igp`, or AIGP is received"
if __name__ == "__main__":