Skip to content

Commit 4add1be

Browse files
yxiecavmittal-msft
authored andcommitted
[crm] only set ARP cache limit setting when needed (sonic-net#3389)
What is the motivation for this PR? SONiC already set ARP cache limit quit high, test shouldn't need to increase according to its needs unless the threshold is actually lower then needed. How did you do it? Skip ARP cache limit setting if the current limit is higher than requested limit. How did you verify/test it? Run crm test and watch ARP limit never changes during tests. Signed-off-by: Ying Xie ying.xie@microsoft.com
1 parent bbcf886 commit 4add1be

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

tests/crm/test_crm.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,21 @@ def increase_arp_cache(duthost, max_value, ip_ver, test_name):
339339
res = duthost.shell(get_cmd.format(ip_ver, thresh_id))
340340
if res["rc"] != 0:
341341
logger.warning("Unable to get kernel ARP cache size: \n{}".format(res))
342-
else:
343-
# Add cleanup step to restore ARP cache
344-
RESTORE_CMDS[test_name].append("sysctl -w " + res["stdout"].replace(" ", ""))
342+
continue
343+
344+
try:
345+
# Sample output: net.ipv4.neigh.default.gc_thresh1 = 1024
346+
cur_th = int(res["stdout"].split()[-1])
347+
except ValueError:
348+
logger.warning("Unable to determine kernel ARP cache size: \n{}".format(res))
349+
continue
350+
351+
if cur_th >= max_value + 100:
352+
logger.info("Skipping setting ARP cache size to {}, current {}".format(max_value, res['stdout']))
353+
continue
354+
355+
# Add cleanup step to restore ARP cache
356+
RESTORE_CMDS[test_name].append("sysctl -w " + res["stdout"].replace(" ", ""))
345357
cmd = set_cmd.format(ip_ver, thresh_id, max_value + 100)
346358
duthost.shell(cmd)
347359
logger.info("{}".format(cmd))

0 commit comments

Comments
 (0)