@@ -1211,6 +1211,58 @@ 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 (f"4294967295:4294967295:{ 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+
1238+ try :
1239+ output = router .vtysh_cmd (
1240+ f"""
1241+ configure terminal
1242+ route-map LARGE_COMM_150 permit 10
1243+ set large-community { large_comm_str }
1244+ """
1245+ )
1246+ step ("Successfully applied configuration" )
1247+ except Exception as e :
1248+ step (f"Configuration failed (may indicate buffer limit issue): { e } " )
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+ ), f"Test case { tc_name } : Failed - route-map not found in configuration"
1258+ assert (
1259+ "4294967295:4294967295" in output
1260+ ), f"Test case { tc_name } : Failed - large communities not found in configuration"
1261+
1262+ step ("Test passed: Successfully configured 150 large communities (~4770 bytes)" )
1263+ write_test_footer (tc_name )
1264+
1265+
12141266if __name__ == "__main__" :
12151267 args = ["-s" ] + sys .argv [1 :]
12161268 sys .exit (pytest .main (args ))
0 commit comments