-
Notifications
You must be signed in to change notification settings - Fork 850
Fix buffer queue cnt test to account for different BUFFER_QUEUE configs #19310
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
base: master
Are you sure you want to change the base?
Conversation
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as comments
@@ -31,7 +31,8 @@ | |||
|
|||
def load_new_cfg(duthost, data): | |||
duthost.copy(content=json.dumps(data, indent=4), dest=CFG_DB_PATH) | |||
config_reload(duthost, config_source='config_db', safe_reload=True, check_intf_up_ports=True, wait_for_bgp=True) | |||
config_reload(duthost, config_source='config_db', safe_reload=True, check_intf_up_ports=True, | |||
wait_for_bgp=True, yang_validate=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the yang_validate
to False intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, after modifying BUFFER_QUEUE and doing config reload, we will skip yang validation.
tests/telemetry/test_telemetry.py
Outdated
"""If all queues for that pool are in the same pool ex Ethernet0|0-9 | ||
We will modify to separate the first queue and the remaining such | ||
that we get a separate entry for Ethernet0|0 and Ethernet0|1-9""" | ||
single_key = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable name single_key
is misleading. It actually indicates whether we have a single queue (not a range). Consider renaming to is_single_queue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed and changed.
We will modify to separate the first queue and the remaining such | ||
that we get a separate entry for Ethernet0|0 and Ethernet0|1-9""" | ||
single_key = False | ||
bq_entry = interface_buffer_queues[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a check to ensure interface_buffer_queues
is not empty before accessing interface_buffer_queues[0]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
del data['BUFFER_QUEUE'][bq_entry] | ||
bq_entry = single_queue_entry | ||
else: | ||
pytest.skip("Invalid buffer queue range") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the logic here is pretty useful for other use cases too. Wanna split the logic out into a helper func to make it more readable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can take this effort in some future PR.
tests/telemetry/test_telemetry.py
Outdated
= "true" | ||
load_new_cfg(duthost, data) | ||
pytest_assert(wait_until(120, 20, 0, check_buffer_queues_cnt_cmd_output, ptfhost, gnxi_path, | ||
dut_ip, interface_to_check, env.gnmi_port), "Unable to get map data") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you make the failure message more specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR ensures the buffer‐queue count test correctly handles configurations where all queues for an interface are defined in a single range (e.g., Ethernet0|0-9
) by splitting that range before removal, and adds a parameter to disable YANG validation on reload.
- Pass
yang_validate=False
intoconfig_reload
to skip YANG validation during test config loads. - Before removing a buffer‐queue entry, detect and split grouped queue ranges into a single‐queue entry and a remaining range.
- Wrap the removal and assertions in a
try/finally
to restore the original configuration regardless of test outcome.
Comments suppressed due to low confidence (1)
tests/telemetry/test_telemetry.py:34
- [nitpick] Add a brief inline comment explaining why
yang_validate=False
is required here (e.g., to bypass YANG schema checks for test changes).
config_reload(duthost, config_source='config_db', safe_reload=True, check_intf_up_ports=True,
"""If all queues for that pool are in the same pool ex Ethernet0|0-9 | ||
We will modify to separate the first queue and the remaining such | ||
that we get a separate entry for Ethernet0|0 and Ethernet0|1-9""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] This triple-quoted string is a hanging literal used as a comment. Replace it with standard #
comments to avoid leaving unused string literals in the function body.
"""If all queues for that pool are in the same pool ex Ethernet0|0-9 | |
We will modify to separate the first queue and the remaining such | |
that we get a separate entry for Ethernet0|0 and Ethernet0|1-9""" | |
# If all queues for that pool are in the same pool, e.g., Ethernet0|0-9, | |
# we will modify to separate the first queue and the remaining such | |
# that we get a separate entry for Ethernet0|0 and Ethernet0|1-9. |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description of PR
Summary:
Fixes #19201
MSADO: 33479698
Type of change
Back port request
Approach
What is the motivation for this PR?
Currently this test does not account for BUFFER_QUEUE configs to have only entry for an interface.
In some SKU's and config
BUFFER_QUEUE may have config such as
or even
The test works fine for the above configs.
However if the BUFFER_QUEUE was configured such as
When we delete Ethernet0|0-9 as part of del data['BUFFER_QUEUE'][ interface_buffer_queues[0] ] we end up deleting all queues for that interface from COUNTERS_QUEUE_NAME_MAP which causes check_buffer_queues_cnt_cmd_output to always return false.
This test checks for such edge case and we split the BUFFER_QUEUE config such that we can delete an entry without deleting all entries in the map.
How did you do it?
Code change
How did you verify/test it?
Test on 20241110
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation