Commit 55a972220e for frr
commit 55a972220ef6490f9219d892aa8bda485bf46088
Author: Philippe Guibert <philippe.guibert@6wind.com>
Date: Mon Oct 12 15:43:59 2026 +0200
topotests: check aigp over confederation sessions in bgp_confed1
No test checks that the AIGP attribute is exchanged over a session
between two member ASes of a confederation, nor that it does not leave
the confederation over a regular eBGP session.
RFC 7311 section 3 says that AIGP_SESSION SHOULD be enabled by default
for EBGP sessions between members of the same confederation, and MUST be
disabled by default for the other EBGP sessions. AIGP_TRANSMIT_ALLOWED()
only blocks BGP_PEER_EBGP peers without the aigp flag, so a
BGP_PEER_CONFED session is enabled implicitly.
Fix this by setting an AIGP metric on the 203.0.113.16/28 prefix of r2,
without any "neighbor PEER aigp" command. Check that r3 receives it from
r2 over the confederation session, and that r4 receives the prefix
without the AIGP attribute over the eBGP session from r3.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
diff --git a/tests/topotests/bgp_confed1/r2/bgpd.conf b/tests/topotests/bgp_confed1/r2/bgpd.conf
index ba2da4160e..47cd1aee2a 100644
--- a/tests/topotests/bgp_confed1/r2/bgpd.conf
+++ b/tests/topotests/bgp_confed1/r2/bgpd.conf
@@ -10,10 +10,13 @@ router bgp 200
neighbor 192.0.2.18 remote-as 300
!
address-family ipv4 unicast
- network 203.0.113.16/28
+ network 203.0.113.16/28 route-map aigp
neighbor 192.0.2.1 route-map any in
neighbor 192.0.2.1 route-map any out
neighbor 192.0.2.18 default-originate
exit-address-family
!
route-map any permit 10
+!
+route-map aigp permit 10
+ set aigp-metric 20
diff --git a/tests/topotests/bgp_confed1/test_bgp_confed1.py b/tests/topotests/bgp_confed1/test_bgp_confed1.py
index 79590233e9..7b0ab58f37 100644
--- a/tests/topotests/bgp_confed1/test_bgp_confed1.py
+++ b/tests/topotests/bgp_confed1/test_bgp_confed1.py
@@ -10,6 +10,10 @@
"""
test_bgp_confed1.py: Test the FRR BGP confederations with AS member
same as confederation Id, verify BGP prefixes and path distribution
+
+r2 sets an AIGP metric on 203.0.113.16/28. Without "neighbor PEER aigp",
+r3 receives it over the confederation session, and r4 does not receive it
+over the eBGP session.
"""
import os
@@ -27,6 +31,7 @@ sys.path.append(os.path.join(CWD, "../"))
from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger
+from lib.common_config import retry
pytestmark = [pytest.mark.bgpd, pytest.mark.isisd]
@@ -141,6 +146,29 @@ def test_bgp_confed_ipv4_unicast():
assert res is None, assertmsg
+def test_bgp_confed_aigp():
+ tgen = get_topogen()
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ @retry(retry_timeout=60)
+ def check_aigp_metric(router, aigp):
+ output = json.loads(
+ router.vtysh_cmd("show bgp ipv4 unicast 203.0.113.16/28 json")
+ )
+ expected = {"paths": [{"valid": True, "aigpMetric": aigp}]}
+ result = topotest.json_cmp(output, expected)
+ if result is not None:
+ return "{}, {}".format(router.name, result)
+ return True
+
+ result = check_aigp_metric(tgen.gears["r3"], 20)
+ assert result is True, result
+
+ result = check_aigp_metric(tgen.gears["r4"], None)
+ assert result is True, result
+
+
if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]
sys.exit(pytest.main(args))