Skip to content

SONiC Clear FDB CLI Design

Kebo Liu edited this page Jan 25, 2018 · 2 revisions

SONiC Clear FDB CLI Design

Rev 0.1

Revision

Rev Date Author Change Description
0.1 Liu Kebo Initial version

About This Manual

This document is intended to provide general information about the SONiC Clear FDB CLI implementation.

1. Functional Requirements

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.

2. CLI Design

Generally, this CLI will be implemented by the following approach:

  1. When CLI command executed, CLI utility will connect to APPL_DB and publish a notification via "FLUSHFDBREQUEST" channel.

  2. Add a NotificationConsumer to FdbOrch of Orchagent, which subscribe to a new notification channel "FLUSHFDBREQUEST" of APPL_DB. When FdbOrch received this notification it will call the flush FDB API which provided by sairedis.

  3. On the FDB flush event callback, syncd will update the ASIC_DB to remove all the FDB entries.

  4. On the FDB flush event callback, FdbOrch will update the internal data structure "m_entries".

2.1 FdbOrch extension for the new notification

  1. Add a new NotificationConsumer to FdbOrch

     auto consumer = new NotificationConsumer(db, "FLUSHFDBREQUEST")
     auto fdbNotification = new Notifier(consumer, this);
     Orch::addExecutor("", fdbNotification);
    
  2. Add a new doTask function to FdbOrch to handle this notification

     void FdbOrch::doTask(NotificationConsumer& consumer);
    
  3. In the "update" function of FdbOrch revise the handling for FLUSH event.

2.2 Syncd extension for the new notification

In function redisPutFdbEntryToAsicView, revise the handling of the FLUSH event, remove all the dynamic FDB entries from the ASIC_DB.

2.3 New "sonic-clear fdb" CLI command design

  1. Implement a new python script in "sonic-utilities/script" named "fdbclear", in this script will connect to the APPL_DB and send out notification.

  2. 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)
    

2.3 Flows

3. Open Questions

Clone this wiki locally