summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2025-01-21 21:25:14 +0200
committerDonatas Abraitis <donatas@opensourcerouting.org>2025-01-21 21:26:15 +0200
commitde90b70e65ac7750540a7a9d353d3b3bf4df6fe2 (patch)
tree534663dc26b7dbff61eb255bc36780438620bdd6
parentf2759c46ceda2a5f13b40213381baf71997b6b87 (diff)
tests: Check if OAD peers can exchange non-transitive extended communities
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
-rw-r--r--tests/topotests/bgp_oad/r3/frr.conf6
-rw-r--r--tests/topotests/bgp_oad/test_bgp_oad.py33
2 files changed, 39 insertions, 0 deletions
diff --git a/tests/topotests/bgp_oad/r3/frr.conf b/tests/topotests/bgp_oad/r3/frr.conf
index 02dd5adfe1..164267d74d 100644
--- a/tests/topotests/bgp_oad/r3/frr.conf
+++ b/tests/topotests/bgp_oad/r3/frr.conf
@@ -7,12 +7,14 @@ int r3-eth0
!
router bgp 65003
no bgp ebgp-requires-policy
+ no bgp network import-check
neighbor 192.168.2.2 remote-as external
neighbor 192.168.2.2 timers 1 3
neighbor 192.168.2.2 timers connect 1
neighbor 192.168.2.2 oad
!
address-family ipv4 unicast
+ network 10.10.10.20/32 route-map static
redistribute connected route-map connected
exit-address-family
!
@@ -20,3 +22,7 @@ route-map connected permit 10
set local-preference 123
set metric 123
!
+route-map static permit 10
+ set extcommunity bandwidth 100 non-transitive
+exit
+!
diff --git a/tests/topotests/bgp_oad/test_bgp_oad.py b/tests/topotests/bgp_oad/test_bgp_oad.py
index b2ea7e0f19..b397bc6372 100644
--- a/tests/topotests/bgp_oad/test_bgp_oad.py
+++ b/tests/topotests/bgp_oad/test_bgp_oad.py
@@ -56,6 +56,7 @@ def test_bgp_oad():
r2 = tgen.gears["r2"]
r3 = tgen.gears["r3"]
r4 = tgen.gears["r4"]
+ r5 = tgen.gears["r5"]
def _bgp_converge():
output = json.loads(r1.vtysh_cmd("show bgp ipv4 unicast 10.10.10.10/32 json"))
@@ -121,6 +122,38 @@ def test_bgp_oad():
_, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
assert result is None, "10.10.10.1/32 should not be advertised to r4 (not OAD peer)"
+ def _bgp_check_non_transitive_extended_community(
+ router, arg={"string": "LB:65003:12500000 (100.000 Mbps)"}
+ ):
+ output = json.loads(
+ router.vtysh_cmd("show bgp ipv4 unicast 10.10.10.20/32 json")
+ )
+ expected = {
+ "paths": [
+ {
+ "extendedCommunity": arg,
+ }
+ ]
+ }
+ return topotest.json_cmp(output, expected)
+
+ test_func = functools.partial(
+ _bgp_check_non_transitive_extended_community,
+ r4,
+ )
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
+ assert (
+ result is None
+ ), "10.10.10.20/32 should be received at r4 with non-transitive extended community"
+
+ test_func = functools.partial(
+ _bgp_check_non_transitive_extended_community, r5, None
+ )
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
+ assert (
+ result is None
+ ), "10.10.10.20/32 should NOT be received at r5 with non-transitive extended community"
+
if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]