@@ -304,17 +304,23 @@ function check_mirror_session_acls()
304
304
ACL_ND=" missing"
305
305
start_time=${SECONDS}
306
306
elapsed_time=$(( ${SECONDS} - ${start_time} ))
307
+ retry_count=0
307
308
while [[ ${elapsed_time} -lt 10 ]]; do
308
309
CHECK_ACL_ENTRIES=0
310
+ retry_count=$(( retry_count + 1 ))
309
311
ACL_OUTPUT=$( sonic-db-cli ASIC_DB KEYS " *" | grep SAI_OBJECT_TYPE_ACL_ENTRY) || CHECK_ACL_ENTRIES=$?
310
312
if [[ ${CHECK_ACL_ENTRIES} -ne 0 ]]; then
311
- error " Failed to retrieve SAI_OBJECT_TYPE_ACL_ENTRY from redis"
312
- exit ${EXIT_NO_MIRROR_SESSION_ACLS}
313
+ debug " Failed to retrieve SAI_OBJECT_TYPE_ACL_ENTRY from redis, retrying... (Attempt: ${retry_count} )"
314
+ sleep 0.1
315
+ elapsed_time=$(( ${SECONDS} - ${start_time} ))
316
+ continue
313
317
fi
314
318
ACL_ENTRIES=( ${ACL_OUTPUT} )
315
319
if [[ ${# ACL_ENTRIES[@]} -eq 0 ]]; then
316
- error " NO SAI_OBJECT_TYPE_ACL_ENTRY objects found"
317
- exit ${EXIT_NO_MIRROR_SESSION_ACLS}
320
+ debug " NO SAI_OBJECT_TYPE_ACL_ENTRY objects found, retrying... (Attempt: ${retry_count} )"
321
+ sleep 0.1
322
+ elapsed_time=$(( ${SECONDS} - ${start_time} ))
323
+ continue
318
324
fi
319
325
for ACL_ENTRY in ${ACL_ENTRIES[@]} ; do
320
326
ACL_PRIORITY=$( sonic-db-cli ASIC_DB HGET ${ACL_ENTRY} SAI_ACL_ENTRY_ATTR_PRIORITY)
@@ -332,7 +338,7 @@ function check_mirror_session_acls()
332
338
elapsed_time=$(( ${SECONDS} - ${start_time} ))
333
339
done
334
340
if [[ " ${ACL_ARP} " != " found" || " ${ACL_ND} " != " found" ]]; then
335
- debug " Failed to program mirror session ACLs on ASIC. ACLs: ARP=${ACL_ARP} ND=${ACL_ND} "
341
+ error " Failed to program mirror session ACLs on ASIC. ACLs: ARP=${ACL_ARP} ND=${ACL_ND} "
336
342
exit ${EXIT_NO_MIRROR_SESSION_ACLS}
337
343
fi
338
344
debug " Mirror session ACLs (arp, nd) programmed to ASIC successfully"
0 commit comments