summaryrefslogtreecommitdiff
path: root/tests/topotests/bgp_oad/test_bgp_oad.py
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2025-02-04 11:42:16 -0500
committerGitHub <noreply@github.com>2025-02-04 11:42:16 -0500
commite6228f7880037a0b4e17789180481a7d36b296f7 (patch)
tree54404ec659e4e252ff8288b6ca4e878951321672 /tests/topotests/bgp_oad/test_bgp_oad.py
parent24fa9eede452c70fcd1b0b546c0c85b843d9d022 (diff)
parentde90b70e65ac7750540a7a9d353d3b3bf4df6fe2 (diff)
Merge pull request #17896 from opensourcerouting/fix/bgp_oad_extended_communities
bgpd: Send non-transitive extended communities from/to OAD peers
Diffstat (limited to 'tests/topotests/bgp_oad/test_bgp_oad.py')
-rw-r--r--tests/topotests/bgp_oad/test_bgp_oad.py33
1 files changed, 33 insertions, 0 deletions
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:]