From c560c91c942e6095a6a117a4f31d86f243a6aa56 Mon Sep 17 00:00:00 2001 From: junchao Date: Wed, 19 Jan 2022 16:12:25 +0800 Subject: [PATCH 1/2] [Command-Reference] Add CLI docs for route flow counter --- doc/Command-Reference.md | 112 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 111 insertions(+), 1 deletion(-) diff --git a/doc/Command-Reference.md b/doc/Command-Reference.md index b1846d1551..f66c651063 100644 --- a/doc/Command-Reference.md +++ b/doc/Command-Reference.md @@ -57,6 +57,7 @@ * [Flow Counters](#flow-counters) * [Flow Counters show commands](#flow-counters-show-commands) * [Flow Counters clear commands](#flow-counters-clear-commands) + * [Flow Counters config commands](#flow-counters-config-commands) * [Gearbox](#gearbox) * [Gearbox show commands](#gearbox-show-commands) * [Interfaces](#interfaces) @@ -3133,9 +3134,10 @@ Go Back To [Beginning of the document](#) or [Beginning of this section](#featur ## Flow Counters -This section explains all the Flow Counters show commands and clear commands that are supported in SONiC. Flow counters are usually used for debugging, troubleshooting and performance enhancement processes. Flow counters supports case like: +This section explains all the Flow Counters show commands, clear commands and config commands that are supported in SONiC. Flow counters are usually used for debugging, troubleshooting and performance enhancement processes. Flow counters supports case like: - Host interface traps (number of received traps per Trap ID) + - Routes matching the configured prefix pattern (number of hits and number of bytes) ### Flow Counters show commands @@ -3165,6 +3167,50 @@ Because clear (see below) is handled on a per-user basis different users may see asic1 dhcp 200 3,000 45.25/s ``` +**show flowcnt-route stats** + +This command is used to show the current statistics for route flow patterns. + +Because clear (see below) is handled on a per-user basis different users may see different counts. + +- Usage: + ``` + show flowcnt-route stats + show flowcnt-route stats pattern [--vrf ] + show flowcnt-route stats route [--vrf ] + ``` + +- Example: + ``` + admin@sonic:~$ show flowcnt-route stats + Route pattern VRF Matched routes Packets Bytes + -------------------------------------------------------------------------------------- + 3.3.0.0/16 default 3.3.1.0/24 100 4543 + 3.3.2.3/32 3443 929229 + 3.3.0.0/16 0 0 + 2000::/64 default 2000::1/128 100 4543 + ``` + +The "pattern" subcommand is used to display the route flow counter statistics by route pattern. + +- Example: + ``` + admin@sonic:~$ show flowcnt-route stats pattern 3.3.0.0/16 + Route pattern VRF Matched routes Packets Bytes + -------------------------------------------------------------------------------------- + 3.3.0.0/16 default 3.3.1.0/24 100 4543 + 3.3.2.3/32 3443 929229 + 3.3.0.0/16 0 0 + ``` + +The "route" subcommand is used to display the route flow counter statistics by route prefix. + ``` + admin@sonic:~$ show flowcnt-route stats route 3.3.3.2/32 --vrf Vrf_1 + Route VRF Route Pattern Packets Bytes + ----------------------------------------------------------------------------------------- + 3.3.3.2/32 Vrf_1 3.3.0.0/16 100 4543 + ``` + ### Flow Counters clear commands **sonic-clear flowcnt-trap** @@ -3182,6 +3228,70 @@ This command is used to clear the current statistics for the registered host int Trap Flow Counters were successfully cleared ``` +**sonic-clear flowcnt-route** + +This command is used to clear the current statistics for the route flow counter. This is done on a per-user basis. + +- Usage: + ``` + sonic-clear flowcnt-route + sonic-clear flowcnt-route pattern [--vrf ] + sonic-clear flowcnt-route route [--vrf ] + ``` + +- Example: + ``` + admin@sonic:~$ sonic-clear flowcnt-route + Route Flow Counters were successfully cleared + ``` + +The "pattern" subcommand is used to clear the route flow counter statistics by route pattern. + +- Example: + ``` + admin@sonic:~$ sonic-clear flowcnt-route pattern 3.3.0.0/16 --vrf Vrf_1 + Flow Counters of all routes matching the configured route pattern were successfully cleared + ``` + +The "route" subcommand is used to clear the route flow counter statistics by route prefix. + +- Example: + ``` + admin@sonic:~$ sonic-clear flowcnt-route route 3.3.3.2/32 --vrf Vrf_1 + Flow Counters of the specified route were successfully cleared + ``` + +### Flow Counters config commands + +**config flowcnt-route pattern add** + +This command is used to add or update the route pattern which is used by route flow counter to match route entries. + +- Usage: + ``` + config flowcnt-route pattern add [--vrf ] [--max ] + ``` + +- Example: + ``` + admin@sonic:~$ config flowcnt-route pattern add --vrf Vrf_1 --max 50 2.2.0.0/16 + ``` + +**config flowcnt-route pattern remove** + +This command is used to remove the route pattern which is used by route flow counter to match route entries. + +- Usage: + ``` + config flowcnt-route pattern remove [--vrf ] + ``` + +- Example: + ``` + admin@sonic:~$ config flowcnt-route pattern remove --vrf Vrf_1 2.2.0.0/16 + ``` + + Go Back To [Beginning of the document](#) or [Beginning of this section](#flow-counters) ## Gearbox From 577285749ccf8b04d5e24684ada0c748a05b5e30 Mon Sep 17 00:00:00 2001 From: junchao Date: Mon, 25 Apr 2022 09:01:31 +0800 Subject: [PATCH 2/2] Fix review comment --- doc/Command-Reference.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/Command-Reference.md b/doc/Command-Reference.md index f66c651063..3d89dfa980 100644 --- a/doc/Command-Reference.md +++ b/doc/Command-Reference.md @@ -3274,7 +3274,7 @@ This command is used to add or update the route pattern which is used by route f - Example: ``` - admin@sonic:~$ config flowcnt-route pattern add --vrf Vrf_1 --max 50 2.2.0.0/16 + admin@sonic:~$ config flowcnt-route pattern add 2.2.0.0/16 --vrf Vrf_1 --max 50 ``` **config flowcnt-route pattern remove** @@ -3288,7 +3288,7 @@ This command is used to remove the route pattern which is used by route flow cou - Example: ``` - admin@sonic:~$ config flowcnt-route pattern remove --vrf Vrf_1 2.2.0.0/16 + admin@sonic:~$ config flowcnt-route pattern remove 2.2.0.0/16 --vrf Vrf_1 ```