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

[counterpoll] make the 'eni' command functional only on the DPU #3679

Merged
merged 1 commit into from
Dec 24, 2024

Conversation

Yakiv-Huryk
Copy link
Contributor

What I did

To make the 'eni' command only appear in the list of commands when the 'switch_type' is 'dpu'.
This way the "counterpoll --help" output shows only what is supported on the system.

Current output (contains "eni" while the switch_type is not "dpu"):

admin@sonic:~$ counterpoll
Usage: counterpoll [OPTIONS] COMMAND [ARGS]...

  SONiC Static Counter Poll configurations

Options:
  --help  Show this message and exit.

Commands:
  acl               ACL counter commands
  config-db         Config DB counter commands
  eni               ENI counter commands
  flowcnt-route     Route flow counter commands
  flowcnt-trap      Trap flow counter commands
  pg-drop           Ingress PG drop counter commands
  port              Port counter commands
  port-buffer-drop  Port buffer drop counter commands
  queue             Queue counter commands
  rif               RIF counter commands
  show              Show the counter configuration
  tunnel            Tunnel counter commands
  watermark         Watermark counter commands

Output after this change:

admin@sonic:~$ counterpoll
Usage: counterpoll [OPTIONS] COMMAND [ARGS]...

  SONiC Static Counter Poll configurations

Options:
  --help  Show this message and exit.

Commands:
  acl               ACL counter commands
  config-db         Config DB counter commands
  flowcnt-route     Route flow counter commands
  flowcnt-trap      Trap flow counter commands
  pg-drop           Ingress PG drop counter commands
  port              Port counter commands
  port-buffer-drop  Port buffer drop counter commands
  queue             Queue counter commands
  rif               RIF counter commands
  show              Show the counter configuration
  tunnel            Tunnel counter commands
  watermark         Watermark counter commands

How I did it

Added a register_dynamic_commands() to dynamically add the 'eni' command.
Updated the unit tests.

How to verify it

Run the counterpoll_test.py test

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)

@mssonicbld
Copy link
Collaborator

/azp run

@Yakiv-Huryk Yakiv-Huryk requested a review from vivekrnv December 13, 2024 14:36
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

This is to make the 'eni' command only appear in the list of commands
when the 'switch_type' is 'dpu'.
This way the "counterpoll --help" output shows only what is supported on the system.

Signed-off-by: Yakiv Huryk <[email protected]>
@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@651477787
Copy link

fine, approve

Copy link

@651477787 651477787 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved

@liat-grozovik liat-grozovik merged commit 34d2c8c into sonic-net:master Dec 24, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants