Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a check for ensuring mirror session ACLs are programmed to ASIC #3333

Merged
merged 5 commits into from
Jun 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions scripts/fast-reboot
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ EXIT_NO_CONTROL_PLANE_ASSISTANT=20
EXIT_SONIC_INSTALLER_VERIFY_REBOOT=21
EXIT_PLATFORM_FW_AU_FAILURE=22
EXIT_TEAMD_RETRY_COUNT_FAILURE=23
EXIT_NO_MIRROR_SESSION_ACLS=24

function error()
{
Expand Down Expand Up @@ -272,13 +273,55 @@ function backup_database()
fi
}

function check_mirror_session_acls()
{
debug "Checking if mirror session ACLs (arp, nd) programmed to ASIC successfully"
ACL_ARP="missing"
ryanzhu706 marked this conversation as resolved.
Show resolved Hide resolved
ACL_ND="missing"
start_time=${SECONDS}
elapsed_time=$((${SECONDS} - ${start_time}))
while [[ ${elapsed_time} -lt 10 ]]; do
CHECK_ACL_ENTRIES=0
ACL_OUTPUT=$(sonic-db-cli ASIC_DB KEYS "*" | grep SAI_OBJECT_TYPE_ACL_ENTRY) || CHECK_ACL_ENTRIES=$?
if [[ ${CHECK_ACL_ENTRIES} -ne 0 ]]; then
error "Failed to retrieve SAI_OBJECT_TYPE_ACL_ENTRY from redis"
exit ${EXIT_NO_MIRROR_SESSION_ACLS}
fi
ACL_ENTRIES=( ${ACL_OUTPUT} )
if [[ ${#ACL_ENTRIES[@]} -eq 0 ]]; then
error "NO SAI_OBJECT_TYPE_ACL_ENTRY objects found"
exit ${EXIT_NO_MIRROR_SESSION_ACLS}
fi
for ACL_ENTRY in ${ACL_ENTRIES[@]}; do
ACL_PRIORITY=$(sonic-db-cli ASIC_DB HGET ${ACL_ENTRY} SAI_ACL_ENTRY_ATTR_PRIORITY)
if [[ ${ACL_PRIORITY} -eq 8888 ]]; then
ACL_ARP="found"
fi
if [[ ${ACL_PRIORITY} -eq 8887 ]]; then
ACL_ND="found"
fi
done
if [[ "${ACL_ARP}" = "found" && "${ACL_ND}" = "found" ]]; then
break
fi
sleep 0.1
elapsed_time=$((${SECONDS} - ${start_time}))
done
if [[ "${ACL_ARP}" != "found" || "${ACL_ND}" != "found" ]]; then
debug "Failed to program mirror session ACLs on ASIC. ACLs: ARP=${ACL_ARP} ND=${ACL_ND}"
exit ${EXIT_NO_MIRROR_SESSION_ACLS}
fi
debug "Mirror session ACLs (arp, nd) programmed to ASIC successfully"
}

function setup_control_plane_assistant()
{
if [[ -n "${ASSISTANT_IP_LIST}" && -x ${ASSISTANT_SCRIPT} ]]; then
# TH3 HW is not capable of VxLAN programming thus skipping TH3 platforms
if [[ "${HWSKU}" != "DellEMC-Z9332f-M-O16C64" && "${HWSKU}" != "DellEMC-Z9332f-M-O16C64-lab" ]]; then
debug "Setting up control plane assistant: ${ASSISTANT_IP_LIST} ..."
${ASSISTANT_SCRIPT} -s ${ASSISTANT_IP_LIST} -m set
check_mirror_session_acls
else
debug "${HWSKU} Not capable to support CPA. Skipping gracefully ..."
fi
Expand Down
Loading