@@ -41,6 +41,8 @@ EXIT_FILE_SYSTEM_FULL=3
4141EXIT_NEXT_IMAGE_NOT_EXISTS=4
4242EXIT_ORCHAGENT_SHUTDOWN=10
4343EXIT_SYNCD_SHUTDOWN=11
44+ EXIT_FAST_REBOOT_DUMP_FAILURE=12
45+ EXIT_FILTER_FDB_ENTRIES_FAILURE=13
4446EXIT_COUNTERPOLL_DELAY_FAILURE=14
4547EXIT_DB_INTEGRITY_FAILURE=15
4648EXIT_NO_CONTROL_PLANE_ASSISTANT=20
@@ -601,6 +603,28 @@ else
601603 load_kernel
602604fi
603605
606+ if [[ " $REBOOT_TYPE " = " fast-reboot" ]]; then
607+ # Dump the ARP and FDB tables to files also as default routes for both IPv4 and IPv6
608+ # into /host/fast-reboot
609+ DUMP_DIR=/host/fast-reboot
610+ mkdir -p $DUMP_DIR
611+ FAST_REBOOT_DUMP_RC=0
612+ /usr/local/bin/fast-reboot-dump.py -t $DUMP_DIR || FAST_REBOOT_DUMP_RC=$?
613+ if [[ FAST_REBOOT_DUMP_RC -ne 0 ]]; then
614+ error " Failed to run fast-reboot-dump.py. Exit code: $FAST_REBOOT_DUMP_RC "
615+ unload_kernel
616+ exit " ${EXIT_FAST_REBOOT_DUMP_FAILURE} "
617+ fi
618+ FILTER_FDB_ENTRIES_RC=0
619+ # Filter FDB entries using MAC addresses from ARP table
620+ /usr/local/bin/filter_fdb_entries -f $DUMP_DIR /fdb.json -a $DUMP_DIR /arp.json -c $CONFIG_DB_FILE || FILTER_FDB_ENTRIES_RC=$?
621+ if [[ FILTER_FDB_ENTRIES_RC -ne 0 ]]; then
622+ error " Failed to filter FDb entries. Exit code: $FILTER_FDB_ENTRIES_RC "
623+ unload_kernel
624+ exit " ${EXIT_FILTER_FDB_ENTRIES_FAILURE} "
625+ fi
626+ fi
627+
604628init_warm_reboot_states
605629
606630setup_control_plane_assistant
@@ -631,15 +655,6 @@ if [[ "$REBOOT_TYPE" = "fast-reboot" ]]; then
631655 unload_kernel
632656 exit " ${EXIT_COUNTERPOLL_DELAY_FAILURE} "
633657 fi
634-
635- # Clear all routes except of default routes for faster reconciliation time.
636- sonic-db-cli APPL_DB eval "
637- for _, k in ipairs(redis.call('keys', '*')) do
638- if string.match(k, 'ROUTE_TABLE:') and not string.match(k, 'ROUTE_TABLE:0.0.0.0/0') and not string.match(k, 'ROUTE_TABLE:::/0') then \
639- redis.call('del', k)
640- end
641- end
642- " 0 > /dev/null
643658fi
644659
645660# We are fully committed to reboot from this point on because critical
0 commit comments