Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CLI for route flow counter feature #2031

Merged
merged 9 commits into from
Apr 18, 2022

Conversation

Junchao-Mellanox
Copy link
Collaborator

@Junchao-Mellanox Junchao-Mellanox commented Jan 24, 2022

HLD: sonic-net/SONiC#908
Command reference PR: #2069

What I did

Add CLIs for route flow counter feature

How I did it

  1. Add show command show flowcnt-route config and command group show flowcnt-route stats
  2. Add config command group config flowcnt-route pattern
  3. Add clear command group sonic-clear flowcnt-route

How to verify it

  1. Full unit test cover
  2. Manual test
  3. sonic-mgmt test cases

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

Enable/disable configuration:

counterpoll flowcnt-route  <enable | disable>
Example:
admin@sonic:~$ counterpoll flowcnt-route enable

Polling interval configuration:

counterpoll flowcnt-route interval <time_in_msec> // default - 1000ms
Example:
admin@sonic:~$ counterpoll flowcnt-route interval 2000

Show configuration:

counterpoll show
Example:
admin@sonic:~$ counterpoll show
Type                              Interval (in ms)          Status
--------------------------        ------------------        --------
FLOW_CNT_ROUTE_STAT               default(10000)            disable

Config route pattern:

config flowcnt-route pattern <add | remove> [--vrf <vrf>] [--max <route-max>] <prefix-pattern>    // configure route pattern
Example:
admin@sonic:~$ config flowcnt-route pattern add --vrf Vrf_1 --max 50 2.2.0.0/16
Route Pattern Flow Counter configuration is successful

admin@sonic:~$ config flowcnt-route pattern remove --vrf Vrf_1 2.2.0.0/16
Route Pattern Flow Counter configuration is successful

Show configuration:

show flowcnt-route config
Example:
admin@sonic:~$ show flowcnt-route config
Route pattern          VRF                 Max
-----------------------------------------------
3.3.0.0/16             default             50

Show counters value:

show flowcnt-route stats   // show statistics of all route flow counters
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


show flowcnt-route stats pattern [<prefix-pattern> [ --vrf <vrf>] ]   // show statistics of all routes matching the configured 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

show flowcnt-route stats route [<prefix> [ --vrf <vrf>] ]             // show statistics of the specific route matching the configured route pattern
Example:
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

Clear counters:

sonic-clear flowcnt-route    // clear all route flow counters
Example:
admin@sonic:~$ sonic-clear flowcnt-route
Route Flow Counters were successfully cleared

sonic-clear flowcnt-route pattern  [<prefix-pattern> [ --vrf <vrf>] ]   // clear flow counters of all routes matching the configured 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

sonic-clear flowcnt-route route [<prefix> [ --vrf <vrf>] ]  // clear flow counters of the specific route matching the configured 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

@lgtm-com
Copy link

lgtm-com bot commented Jan 24, 2022

This pull request introduces 4 alerts when merging 0ec2252 into 01dfb9c - view on LGTM.com

new alerts:

  • 3 for Unused import
  • 1 for Module is imported with 'import' and 'import from'

@lgtm-com
Copy link

lgtm-com bot commented Jan 24, 2022

This pull request introduces 1 alert when merging ffd14087fdb2b1b059daa2108433cb8b5359338c into 01dfb9c - view on LGTM.com

new alerts:

  • 1 for Unused import

@Junchao-Mellanox
Copy link
Collaborator Author

/azpw run Azure.sonic-utilities

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-utilities

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@lgtm-com
Copy link

lgtm-com bot commented Jan 25, 2022

This pull request introduces 1 alert when merging 7c498a40e20a7a4d6d34cddc459f6c546f66affa into 01dfb9c - view on LGTM.com

new alerts:

  • 1 for Unused import

@dgsudharsan
Copy link
Collaborator

@Junchao-Mellanox Can you please update the description to include the output of the new show commands introduced? Please also update the command reference

flow_counter_util/route.py Outdated Show resolved Hide resolved
config/flow_counters.py Outdated Show resolved Hide resolved
scripts/flow_counters_stat Show resolved Hide resolved
utilities_common/cli.py Show resolved Hide resolved
tests/mock_tables/state_db.json Show resolved Hide resolved
tests/mock_tables/counters_db.json Outdated Show resolved Hide resolved
tests/mock_tables/asic1/counters_db.json Outdated Show resolved Hide resolved
tests/mock_tables/asic0/counters_db.json Outdated Show resolved Hide resolved
tests/counterpoll_input/config_db.json Outdated Show resolved Hide resolved
tests/flow_counter_stats_test.py Show resolved Hide resolved
tests/flow_counter_stats_test.py Show resolved Hide resolved
tests/flow_counter_stats_test.py Outdated Show resolved Hide resolved
@Junchao-Mellanox
Copy link
Collaborator Author

@Junchao-Mellanox Can you please update the description to include the output of the new show commands introduced? Please also update the command reference

Updated description. There is another PR which updated the command reference.

@lgtm-com
Copy link

lgtm-com bot commented Jan 26, 2022

This pull request introduces 1 alert when merging 8674385d6b5c9a0935381a295f0f2d49c1cb7a92 into 01dfb9c - view on LGTM.com

new alerts:

  • 1 for Unused import

dgsudharsan
dgsudharsan previously approved these changes Jan 26, 2022
@dgsudharsan
Copy link
Collaborator

@Junchao-Mellanox Can you please update the description to include the output of the new show commands introduced? Please also update the command reference

Updated description. There is another PR which updated the command reference.

Please add the link here.

@Junchao-Mellanox
Copy link
Collaborator Author

/azpw run Azure.sonic-utilities

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-utilities

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@lgtm-com
Copy link

lgtm-com bot commented Jan 26, 2022

This pull request introduces 1 alert when merging 2b91d783b95f686cd729d6b2b35e0cb552b52a71 into 01dfb9c - view on LGTM.com

new alerts:

  • 1 for Unused import

@Junchao-Mellanox
Copy link
Collaborator Author

/azpw run Azure.sonic-utilities

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-utilities

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Junchao-Mellanox
Copy link
Collaborator Author

/azpw run Azure.sonic-utilities

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-utilities

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Junchao-Mellanox
Copy link
Collaborator Author

/azpw run Azure.sonic-utilities

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Junchao-Mellanox
Copy link
Collaborator Author

/azpw run Azure.sonic-utilities

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-utilities

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Junchao-Mellanox
Copy link
Collaborator Author

/azpw run Azure.sonic-utilities

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-utilities

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@lgtm-com
Copy link

lgtm-com bot commented Mar 2, 2022

This pull request introduces 1 alert when merging c826391 into d440df7 - view on LGTM.com

new alerts:

  • 1 for Unused import

@Junchao-Mellanox
Copy link
Collaborator Author

/azpw run Azure.sonic-utilities

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-utilities

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

keboliu
keboliu previously approved these changes Mar 2, 2022
dgsudharsan
dgsudharsan previously approved these changes Mar 2, 2022
qiluo-msft pushed a commit that referenced this pull request Mar 11, 2022
…watermark counters (#2091)

This is to backport the changes in #2082

#2031 updated the flex counter polling interval to 60s for watermark counters but the show command wasn't updated to reflect the correct default value

#### What I did
Display the correct poll interval for watermark related counters in the 'counterpoll show' command

#### How I did it
Update the default interval to be the same as the one updated by the Orchs

#### How to verify it
Issue "counterpoll show", the queue, pg and buffer pool watermark should show default 60s
Updated the counterpoll unit tests to reflect the same
@lgtm-com
Copy link

lgtm-com bot commented Apr 12, 2022

This pull request introduces 2 alerts when merging 5ed1006 into 576c9ef - view on LGTM.com

new alerts:

  • 2 for Unused import

@Junchao-Mellanox Junchao-Mellanox dismissed stale reviews from dgsudharsan and keboliu via 7383b62 April 14, 2022 02:11
@lgtm-com
Copy link

lgtm-com bot commented Apr 14, 2022

This pull request introduces 1 alert when merging 7383b62 into 23e9398 - view on LGTM.com

new alerts:

  • 1 for Unused import

@lgtm-com
Copy link

lgtm-com bot commented Apr 14, 2022

This pull request introduces 1 alert when merging 4cb17e9 into 23e9398 - view on LGTM.com

new alerts:

  • 1 for Unused import

@liat-grozovik liat-grozovik merged commit 3732ac5 into sonic-net:master Apr 18, 2022
liat-grozovik pushed a commit that referenced this pull request Apr 25, 2022
- What I did
Add CLIs document for route flow counter feature, CLI PR: #2031

- How I did it
Add CLIs document for route flow counter feature

- How to verify it
Run build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants