Skip to content

Commit c76d30a

Browse files
committed
Add a check for ensuring mirror session ACLs are programmed to ASIC
1 parent 556026c commit c76d30a

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

scripts/fast-reboot

Lines changed: 33 additions & 0 deletions
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
{
@@ -272,13 +273,45 @@ function backup_database()
272273
fi
273274
}
274275
276+
function check_mirror_session_acls()
277+
{
278+
ACL_ARP="missing"
279+
ACL_ND="missing"
280+
start_time=${SECONDS}
281+
elapsed_time=$((${SECONDS} - ${start_time}))
282+
while [[ ${elapsed_time} -lt 10 ]]; do
283+
ACL_ENTRIES=( $(redis-cli -n 1 KEYS "*" | grep SAI_OBJECT_TYPE_ACL_ENTRY) )
284+
ACL_COUNT=${#ACL_ENTRIES[@]}
285+
for ACL_ENTRY in ${ACL_ENTRIES[@]}; do
286+
ACL_PRIORITY=$(redis-cli -n 1 HGET ${ACL_ENTRY} SAI_ACL_ENTRY_ATTR_PRIORITY)
287+
if [[ ${ACL_PRIORITY} -eq 8888 ]]; then
288+
ACL_ARP="found"
289+
fi
290+
if [[ ${ACL_PRIORITY} -eq 8887 ]]; then
291+
ACL_ND="found"
292+
fi
293+
done
294+
if [[ "${ACL_ARP}" = "found" && "${ACL_ND}" = "found" ]]; then
295+
break
296+
fi
297+
sleep 0.1
298+
elapsed_time=$((${SECONDS} - ${start_time}))
299+
done
300+
if [[ "${ACL_ARP}" != "found" || "${ACL_ND}" != "found" ]]; then
301+
error "Failed to program mirror session ACLs on ASIC. ACLs: ARP=${ACL_ARP} ND=${ACL_ND}"
302+
exit ${EXIT_NO_MIRROR_SESSION_ACLS}
303+
fi
304+
debug "Mirror session ACLs (arp, nd) programmed to ASIC successfully"
305+
}
306+
275307
function setup_control_plane_assistant()
276308
{
277309
if [[ -n "${ASSISTANT_IP_LIST}" && -x ${ASSISTANT_SCRIPT} ]]; then
278310
# TH3 HW is not capable of VxLAN programming thus skipping TH3 platforms
279311
if [[ "${HWSKU}" != "DellEMC-Z9332f-M-O16C64" && "${HWSKU}" != "DellEMC-Z9332f-M-O16C64-lab" ]]; then
280312
debug "Setting up control plane assistant: ${ASSISTANT_IP_LIST} ..."
281313
${ASSISTANT_SCRIPT} -s ${ASSISTANT_IP_LIST} -m set
314+
check_mirror_session_acls
282315
else
283316
debug "${HWSKU} Not capable to support CPA. Skipping gracefully ..."
284317
fi

0 commit comments

Comments
 (0)