-
Notifications
You must be signed in to change notification settings - Fork 1.2k
SONiC Clear FDB CLI Design
Rev | Date | Author | Change Description |
---|---|---|---|
0.1 | Liu Kebo | Initial version |
This document is intended to provide general information about the SONiC Clear FDB CLI implementation.
The SONiC Clear FDB CLI shall provide a user interface to clear All the dynamic FDB entries in the SONiC system, including the FDB table inside SDK/HW and ASIC_DB of sairedis.
Generally, this CLI will be implemented by the following approach:
-
Make syncd subscribe to a new notification channel "FLUSHFDBREQUEST" of ASIC_DB, in the main loop of syncd add a branch to handle this notification. On receiving this notification syncd will call related SAI API to flush the FDB.
-
When cli executed, cli utility will connect to ASIC_DB and publish the notification via "FLUSHFDBREQUEST" channel.
-
Add a new notification channel in ASIC_DB
std::shared_ptr<swss::NotificationConsumer> flushfdbRequest = std::make_shared<swss::NotificationConsumer>(dbAsic.get(), "FLUSHFDBREQUEST");
-
Make syncd listen to this channel
s.addSelectable(flushfdbRequest.get());
-
In the main loop of syncd handle this notification accordingly
else if (sel == flushfdbRequest.get()) { handleFlushfdbRequest(*flushfdbRequest); }
-
In this handler related SAI API will be called to trigger the FDB flush
sai_attribute_t attr; attr.id = SAI_FDB_FLUSH_ATTR_ENTRY_TYPE; attr.value.s32 = SAI_FDB_FLUSH_ENTRY_TYPE_DYNAMIC; sai_metadata_sai_fdb_api->flush_fdb_entries(0, 1, &attr);
-
Function redisPutFdbEntryToAsicView which to update fdb entries of ASIC_DB on receiving fdb_event callback will be revised for a bug in the hadnling SAI_FDB_EVENT_FLUSHED event.
-
Implement a new python script in "sonic-utilities/script" named "fdbclear", in this script will connect to the ASIC_DB and send out notification.
-
clear fdb CLI interface
this command will extend current "sonic-clear" command line by adding a new subcommand:
SONiC:# sonic-clear ? Usage: sonic-clear [OPTIONS] COMMAND [ARGS]... SONiC command line - 'Clear' command Options: -?, -h, --help Show this message and exit. Commands: arp Clear IP ARP table counters Clear counters ip Clear IP ipv6 Clear IPv6 information fdb Clear FDB /*new added sub command*/
the "sonic-clear fdb" command can support to clear all FDB in the system or clear per port and per vlan.
SONiC# sonic-clear fdb ? Usage: sonic-clear fdb [OPTIONS] COMMAND [ARGS]... Clear FDB table Options: -?, -h, --help Show this message and exit. Commands: all Clear All FDB entries port Clear FDB For a Certain Port /*will be supported later*/ vlan Clear FDB for a Certain Vlan /*will be supported later*/
In the implementation of the new sub command, python code will be like following:
command = “fdbclear” run_command(command)
-
For Users
-
For Developers
-
Subgroups/Working Groups
-
Presentations
-
Join Us