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

Fix multi-asic behaviour for watermarkstat #3060

Merged
merged 5 commits into from
Sep 17, 2024

Conversation

bktsim-arista
Copy link
Contributor

What I did

Added multi-asic support to watermarkstat, fixing watermark/persistent-watermark related commands. Previously, the following commands were not behaving correctly on multi-asic devices, as the '-n' namespace option was not available, and correct namespaces were not traversed on multi-asic devices.

  • show buffer_pool watermark/persistent-watermark
  • show headroom-pool watermark/persistent-watermark
  • show priority-group persistent-watermark/watermark
  • show queue persistent-watermark/watermark

This change fixes multi-asic behaviour of CLI commands that rely on watermarkstat as listed above.

This is a part of the set of changes being pushed for sonic-net/sonic-buildimage#15148

How I did it

Added namespace option -n and used multi_asic library to implement multi_asic behaviour. Added relevant unit tests to ensure functionality.

How to verify it

Run unit tests, or the commands as listed above.

wenyiz2021
wenyiz2021 previously approved these changes Apr 8, 2024
Copy link
Contributor

@wenyiz2021 wenyiz2021 left a comment

Choose a reason for hiding this comment

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

LGTM.
can you please provide proof that this change also works on single asic? I think there is UT that has run to prove

self.execute(['watermarkstat', '-t', 'headroom_pool', '-n', 'asic1'],
expected_result=show_hdrm_pool_wm_output)

def test_show_invalid_asic_masic(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

@bktsim-arista Few things -

  1. If no namespace specified, Will it show for all namespaces? if we specify, will it show for only that namespace ?
  2. Is this verified to be working fine on pizza box as well as chassis?

@vmittal-msft
Copy link
Contributor

@bktsim-arista Can you please upate sonic-net/sonic-buildimage#15148 on which PR is handling which command for easy tracking ?

@abdosi
Copy link
Contributor

abdosi commented Aug 7, 2024

@alpeshspatel : please help review

bktsim-arista and others added 3 commits September 13, 2024 11:14
…-watermark related commands.

Previously, the following commands were not behaving correctly on multi-asic devices,
as the '-n' namespace option was not available, and correct namespaces were not traversed
on multi-asic devices.

* show buffer_pool watermark/persistent-watermark
* show headroom-pool watermark/persistent-watermark
* show priority-group persistent-watermark/watermark
* show queue persistent-watermark/watermark

This change fixes multi-asic behaviour of CLI commands that rely on watermarkstat,
as listed above.
- Added multi-asic support to clear functionality
- Introduced a wrapper class for multi-asic
- Added tests for multi-asic
- Modified mock counters_db for tests
- Replaced argparse with click
- Fixed pre-commit formatting errors
@arista-hpandya
Copy link
Contributor

arista-hpandya commented Sep 13, 2024

The test failures are due to change in mock DB, will push a fix addressing it soon.

@arista-hpandya
Copy link
Contributor

Test snapshots from a mutli-asic T2 linecard:

Show on the specified asic: watermarkstat -t q_shared_uni -n asic0

show queue watermark unicast asic0

Show all asics when none specified:

show queue watermark unicast

Perform clear on a single asic and verify no other asic was modified

show clear and show
Screenshot from 2024-09-16 15-36-09

Copy link
Contributor

@wenyiz2021 wenyiz2021 left a comment

Choose a reason for hiding this comment

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

snapshot result :LGTM

@wenyiz2021 wenyiz2021 merged commit b4d27c4 into sonic-net:master Sep 17, 2024
7 checks passed
@bingwang-ms
Copy link
Contributor

@bktsim-arista Please raise another PR to 202405 to address cherry-pick conflict.

@arista-hpandya
Copy link
Contributor

arista-hpandya commented Sep 24, 2024

@bktsim-arista Please raise another PR to 202405 to address cherry-pick conflict.

You can ping me or @kenneth-arista for this PR going ahead. Because the change touches pgdropstat, can we please get #3058 cherry-picked to 202405 first, this change has an overlap with the test files introduced in #3058

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

7 participants