CLEAR

Clear a memory table or counters

CLEAR

Clear counters, tables or SDK state.

Warning

clear dev and clear <TABLE> destroy state that syncd built and break the running switch. clear counters and clear stats also reset the hardware counters that SONiC reads, so its statistics jump.

Forms (keywords in full, any case):

clear counters [<pbmp>]

Zero the packet counters of the given ports (all if omitted). c is a synonym.

clear stats [<pbmp>]

Clear the BCM statistics of each port.

clear snmpstats [<pbmp>] [all]

Clear each SNMP statistic of each port, listing them. Not in the built-in help.

clear dev

Reset the unit’s BCM state.

clear sa

Empty the SDK’s software copy of the L2 table (sarl is a synonym).

clear [all] <TABLE> ...

Zero one or more tables. all clears every entry of a sorted table, not only the occupied ones.

Unvalidated — Zero the counters of two ports

drivshell> clear counters ce0,ce1
CLEAR snmpstats [<pbmp>] [all]

Clear the per-port SNMP statistics one by one, printing CLEAR: Statistics for Unit <u> port <name> per port.

Unvalidated

drivshell> clear snmpstats ce0
CLEAR dev

Reset the unit’s BCM state, removing the VLANs, routes, ACLs and other objects the SAI created, without telling the SAI. Never use it on a switch that is in service.

Unvalidated

drivshell> clear dev

Built-in help

clear counters [PBMP] | [ALL] <TABLE> ... | DEV | SA | stats [PBMP]
    counters - zeroes all or some internal packet counters
    <TABLE> - clears specified memory table
    ALL - when clearing a sorted table, overwrite all entries instead
          of just occupied ones (i.e. 1 through software-entry-count).
    DEV - Call bcm_clear on the unit to reset to known state
    SA - clears software ARL shadow table

Further reading

SDK-6.5.20 HSDK Getting Started Guide (GS-SDK6520-R), plus SDK-6.5.20/21/22 Release Notes (RN-SDK65xx-R), sonic-mgmt test suite files invoking bcmcmd (19 files), H3C S12500-F系列交换机 Probe命令参考(R100x系列)-6W100, 交换芯片Helix4 L2 L3功能验证.