@@ -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+
12141268if __name__ == "__main__" :
12151269 args = ["-s" ] + sys .argv [1 :]
12161270 sys .exit (pytest .main (args ))
0 commit comments