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

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

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

PeterTSW-EC
Copy link

What I did

CLI shows an error when trying to show the storm control configuration.
This PR is to fix the error of running "show storm-control interface".

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             |
+------------------+--------------+---------------+---------------------+

CLI shows an error when trying to show the storm control configuration.
This PR is to fix the error of running "show storm-control interface".

```shell
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'
```

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

@CharlieChenEC @vincentchiang-ec @PJHsieh
Please help to review this PR.
Thanks.

@PeterTSW-EC PeterTSW-EC changed the title Fix the error of running "show storm-control interface" [CLI] Fix the error of running "show storm-control interface" Jul 5, 2024
@PeterTSW-EC
Copy link
Author

Link to PR: sonic-net/sonic-utilities#3401

@PJHsieh PJHsieh merged commit 276f648 into edge-core:202311.X Jul 8, 2024
1 check passed
chiourung pushed a commit to chiourung/sonic-utilities-ec that referenced this pull request Jul 8, 2024
…aidump_by_route_size (#2972)

* * [saidump]
•	Saidump for DNX-SAI sonic-net/sonic-buildimage#13561

Solution and modification:
To use the redis-db SAVE option to save the snapshot of DB each time and recover later, instead of looping through each entry in the table and saving it.

(1) Updated sonic-buildimage/build_debian.sh, to install Python library rdbtools into the host.
(2) Updated sonic-buildimage/src/sonic-sairedis/saidump/saidump.cpp, add a new option -r, which updates the rdbtools's output-JSON files' format.
(3) Add a new script file: files/scripts/saidump.sh, to do the below steps
  For each ASIC0, such as ASIC0,

  edge-core#1. Save the Redis data.
  sudo sonic-db-cli -n asic$1 SAVE > /dev/null

  edge-core#2. Move dump files to /var/run/redisX/
  docker exec database$1 sh -c "mv /var/lib/redis/dump.rdb /var/run/redis$1/"

  edge-core#3. Run rdb command to convert the dump files into JSON files
  sudo python /usr/local/bin/rdb --command json  /var/run/redis$1/dump.rdb | sudo tee /var/run/redis$1/dump.json > /dev/null

  edge-core#4. Run saidump -r to update the JSON files' format as same as the saidump before. Then we can get the saidump result in standard output.
  docker exec syncd$1 sh -c "saidump -r /var/run/redis$1/dump.json"

  edge-core#5. clear
  sudo rm -f /var/run/redis$1/dump.rdb
  sudo rm -f /var/run/redis$1/dump.json

(4) Update sonic-buildimage/src/sonic-utilities/scripts/generate_dump, replace saidump with saidump.sh
* * [saidump]
•	Saidump for DNX-SAI sonic-net/sonic-buildimage#13561
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.

2 participants