sonic-utilities icon indicating copy to clipboard operation
sonic-utilities copied to clipboard

[CLI] Fix the error of running "show storm-control interface"

Open PeterTSW-EC opened this issue 1 year ago • 0 comments

What I did

CLI shows an error when trying to show the storm control configuration. TypeError: interface() missing 2 required positional arguments: 'namespace' and 'display' This PR fixes the error of running "show storm-control interface".

How I did it

Added the default value for the arguments to fix this bug.

How to verify it

Execute the "show storm-control interface <interface_name>"

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

admin@sonic:~$ show storm-control interface Ethernet0
Traceback (most recent call last):
  File "/usr/local/bin/show", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
TypeError: interface() missing 2 required positional arguments: 'namespace' and 'display' 

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

admin@sonic:~$ show storm-control interface Ethernet0
+------------------+--------------+---------------+---------------------+
| Interface Name   | Storm Type   |   Rate (kbps) | Burst Size(kbits)   |
+==================+==============+===============+=====================+
| Ethernet0        | broadcast    |         10000 | default             |
+------------------+--------------+---------------+---------------------+

Which release branch to backport (provide reason below if selected)

  • [ ] 201811
  • [ ] 201911
  • [ ] 202006
  • [ ] 202012
  • [ ] 202106
  • [ ] 202111
  • [ ] 202205
  • [X] 202211: Feature storm control is supported, but CLI got the error.
  • [X] 202305: Feature storm control is supported, but CLI got the error.
  • [X] 202311: Feature storm control is supported, but CLI got the error.

PeterTSW-EC avatar Jul 05 '24 06:07 PeterTSW-EC