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

[chassis] Add chassis support for CLI "config qos reload" #3233

Merged
merged 5 commits into from
Mar 21, 2024

Conversation

wenyiz2021
Copy link
Contributor

@wenyiz2021 wenyiz2021 commented Mar 21, 2024

Fix issue: #3232

command "sudo config qos reload --ports Ethernetxx" fail on any chassis.
The difference comes because chassis config db has more entries:
e.g.

admin@chassis-lc1-1:/etc/sonic$ sudo grep -ir "ethernet88|0" config*
config_db0.json:        "Ethernet88|0": {
config_db0.json:        "lc1-1|asic0|Ethernet88|0-2": {
config_db0.json:        "lc2-1|asic0|Ethernet88|0-2": {
config_db0.json:        "lc3-1|asic0|Ethernet88|0-2": {
config_db0.json:        "lc1-1|asic0|Ethernet88|0": {
...

while a single-dut only has such key in the table:

admin@8111-06:/etc/sonic$ sudo grep -ir "ethernet88|0" config*
        "Ethernet88|0": {
        "Ethernet88|0-2": {
        "Ethernet88|0": {

What I did

How I did it

How to verify it

Before:

admin@chassis-lc7-1:~$ sudo config qos reload --ports Ethernet80
Traceback (most recent call last):
  File "/usr/local/bin/config", line 8, in <module>
    sys.exit(config())
  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)
  File "/usr/local/lib/python3.9/dist-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/config/main.py", line 2518, in reload
    _qos_update_ports(ctx, ports, dry_run, json_data)
  File "/usr/local/lib/python3.9/dist-packages/config/main.py", line 2659, in _qos_update_ports
    port, _ = key
ValueError: too many values to unpack (expected 2)

After:
command pass without any error.
In the device's config db, the entry for corresponding port was set to empty after command run:

(Pdb) config_db.get_entry(table_name, '|'.join(key))
{'profile': 'ingress_lossy_profile'}

(Pdb) '|'.join(key)
'Ethernet80|0'
(Pdb) key
('Ethernet80', '0')
(Pdb) table_name
'BUFFER_PG'
(Pdb) n

/usr/local/lib/python3.9/dist-packages/config/main.py(2658)_qos_update_ports()
-> for key in entries:
(Pdb) config_db.get_entry(table_name, '|'.join(key))
{}

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)

@wenyiz2021 wenyiz2021 merged commit c149e48 into sonic-net:master Mar 21, 2024
5 checks passed
Copy link
Contributor

@arlakshm arlakshm left a comment

Choose a reason for hiding this comment

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

Please add unit tests for this

wenyiz2021 added a commit that referenced this pull request Mar 22, 2024
@wenyiz2021
Copy link
Contributor Author

Please add unit tests for this

@arlakshm added in #3234

arfeigin pushed a commit to arfeigin/sonic-utilities that referenced this pull request Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants