Skip to content

Commit 676ebe4

Browse files
authored
Add a check for ensuring mirror session ACLs are programmed to ASIC (#3333)
Description Add a check for ensuring mirror session ACLs are programmed to ASIC What is the issue? This fix is to address an issue where an ACL is added to CONFIG_DB, but before it could be programmed to ASIC, Orchagent is paused. This leads to APPLY_VIEW failure when base image OA could not process this ACL entry and target image's OA still creates it. The issue has an image fix available at sonic-net/sonic-sairedis#1240 This issue is very rare, and has been caught by upgrade path tests only once in thousands of iterations. What is this fix? A new logic is added to check if mirror session ACLs for arp and nd are added to ASIC.. ACLs are looked into ASIC_DB and matched using SAI_ACL_ENTRY_ATTR_PRIORITY attribute. SAI_ACL_ENTRY_ATTR_PRIORITY for arp ACL is 8888 and for nd is 8887 If one of the ACLs is found missing then warmboot is aborted. Tested on physical testbed running 202311 and master
1 parent b518ab4 commit 676ebe4

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

scripts/fast-reboot

+43
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ EXIT_NO_CONTROL_PLANE_ASSISTANT=20
5050
EXIT_SONIC_INSTALLER_VERIFY_REBOOT=21
5151
EXIT_PLATFORM_FW_AU_FAILURE=22
5252
EXIT_TEAMD_RETRY_COUNT_FAILURE=23
53+
EXIT_NO_MIRROR_SESSION_ACLS=24
5354

5455
function error()
5556
{
@@ -283,13 +284,55 @@ function backup_database()
283284
fi
284285
}
285286
287+
function check_mirror_session_acls()
288+
{
289+
debug "Checking if mirror session ACLs (arp, nd) programmed to ASIC successfully"
290+
ACL_ARP="missing"
291+
ACL_ND="missing"
292+
start_time=${SECONDS}
293+
elapsed_time=$((${SECONDS} - ${start_time}))
294+
while [[ ${elapsed_time} -lt 10 ]]; do
295+
CHECK_ACL_ENTRIES=0
296+
ACL_OUTPUT=$(sonic-db-cli ASIC_DB KEYS "*" | grep SAI_OBJECT_TYPE_ACL_ENTRY) || CHECK_ACL_ENTRIES=$?
297+
if [[ ${CHECK_ACL_ENTRIES} -ne 0 ]]; then
298+
error "Failed to retrieve SAI_OBJECT_TYPE_ACL_ENTRY from redis"
299+
exit ${EXIT_NO_MIRROR_SESSION_ACLS}
300+
fi
301+
ACL_ENTRIES=( ${ACL_OUTPUT} )
302+
if [[ ${#ACL_ENTRIES[@]} -eq 0 ]]; then
303+
error "NO SAI_OBJECT_TYPE_ACL_ENTRY objects found"
304+
exit ${EXIT_NO_MIRROR_SESSION_ACLS}
305+
fi
306+
for ACL_ENTRY in ${ACL_ENTRIES[@]}; do
307+
ACL_PRIORITY=$(sonic-db-cli ASIC_DB HGET ${ACL_ENTRY} SAI_ACL_ENTRY_ATTR_PRIORITY)
308+
if [[ ${ACL_PRIORITY} -eq 8888 ]]; then
309+
ACL_ARP="found"
310+
fi
311+
if [[ ${ACL_PRIORITY} -eq 8887 ]]; then
312+
ACL_ND="found"
313+
fi
314+
done
315+
if [[ "${ACL_ARP}" = "found" && "${ACL_ND}" = "found" ]]; then
316+
break
317+
fi
318+
sleep 0.1
319+
elapsed_time=$((${SECONDS} - ${start_time}))
320+
done
321+
if [[ "${ACL_ARP}" != "found" || "${ACL_ND}" != "found" ]]; then
322+
debug "Failed to program mirror session ACLs on ASIC. ACLs: ARP=${ACL_ARP} ND=${ACL_ND}"
323+
exit ${EXIT_NO_MIRROR_SESSION_ACLS}
324+
fi
325+
debug "Mirror session ACLs (arp, nd) programmed to ASIC successfully"
326+
}
327+
286328
function setup_control_plane_assistant()
287329
{
288330
if [[ -n "${ASSISTANT_IP_LIST}" && -x ${ASSISTANT_SCRIPT} ]]; then
289331
# TH3 HW is not capable of VxLAN programming thus skipping TH3 platforms
290332
if [[ "${HWSKU}" != "DellEMC-Z9332f-M-O16C64" && "${HWSKU}" != "DellEMC-Z9332f-M-O16C64-lab" ]]; then
291333
debug "Setting up control plane assistant: ${ASSISTANT_IP_LIST} ..."
292334
${ASSISTANT_SCRIPT} -s ${ASSISTANT_IP_LIST} -m set
335+
check_mirror_session_acls
293336
else
294337
debug "${HWSKU} Not capable to support CPA. Skipping gracefully ..."
295338
fi

0 commit comments

Comments
 (0)