Skip to content

Commit 7977800

Browse files
tests: Add large community buffer limit test for 150 communities
Test that 150 large communities with max-sized values can be configured in a route-map, exceeding the old 4096 byte limit and requiring the 8192 byte buffer increase. Signed-off-by: Rajasekar Raja <[email protected]>
1 parent 872e648 commit 7977800

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

tests/topotests/bgp_large_community/test_bgp_large_community_topo_1.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,60 @@ def test_large_community_after_clear_bgp(request):
12111211
write_test_footer(tc_name)
12121212

12131213

1214+
def test_large_community_buffer_limit(request):
1215+
"""
1216+
Verify that setting 150 large communities with maximum sized values
1217+
(approximately 4770 bytes) works properly. This tests the buffer limit
1218+
increase from 4096 to 8192 bytes.
1219+
"""
1220+
tc_name = request.node.name
1221+
write_test_header(tc_name)
1222+
tgen = get_topogen()
1223+
1224+
if tgen.routers_have_failure():
1225+
pytest.skip(tgen.errors)
1226+
1227+
# Generate 150 large communities with maximum sized values (4294967295:4294967295:4294967XXX)
1228+
# Each community is approximately 31 bytes, total ~4770 bytes
1229+
large_comm_values = []
1230+
for i in range(1, 151):
1231+
large_comm_values.append("4294967295:4294967295:{}".format(4294967000 + i))
1232+
1233+
large_comm_str = " ".join(large_comm_values)
1234+
1235+
step("Configuring route-map with 150 large communities (~4770 bytes)")
1236+
router = tgen.gears["r1"]
1237+
cmd = "configure terminal\n"
1238+
cmd += "route-map LARGE_COMM_150 permit 10\n"
1239+
cmd += "set large-community {}\n".format(large_comm_str)
1240+
cmd += "exit\n"
1241+
1242+
try:
1243+
output = router.vtysh_cmd(cmd)
1244+
step("Successfully applied configuration")
1245+
except Exception as e:
1246+
step(
1247+
"Configuration failed (may indicate buffer limit issue): {}".format(str(e))
1248+
)
1249+
pytest.fail(
1250+
"Failed to configure 150 large communities - buffer limit may be too small"
1251+
)
1252+
1253+
step("Verifying route-map configuration with 150 large communities")
1254+
output = router.vtysh_cmd("show running-config")
1255+
assert (
1256+
"route-map LARGE_COMM_150 permit 10" in output
1257+
), "Test case {} : Failed - route-map not found in configuration".format(tc_name)
1258+
assert (
1259+
"4294967295:4294967295" in output
1260+
), "Test case {} : Failed - large communities not found in configuration".format(
1261+
tc_name
1262+
)
1263+
1264+
step("Test passed: Successfully configured 150 large communities (~4770 bytes)")
1265+
write_test_footer(tc_name)
1266+
1267+
12141268
if __name__ == "__main__":
12151269
args = ["-s"] + sys.argv[1:]
12161270
sys.exit(pytest.main(args))

0 commit comments

Comments
 (0)