Fix IndexError and KeyError in test_buffer_pg for ports without 3-4 PG#23312
Open
XuChen-MSFT wants to merge 1 commit intosonic-net:masterfrom
Open
Fix IndexError and KeyError in test_buffer_pg for ports without 3-4 PG#23312XuChen-MSFT wants to merge 1 commit intosonic-net:masterfrom
XuChen-MSFT wants to merge 1 commit intosonic-net:masterfrom
Conversation
On some HW SKUs (e.g. Arista-7260CX3-C64), certain ports do not have
BUFFER_PG|{port}|3-4 configured in CONFIG_DB, and their PG entries
may be missing from COUNTERS_PG_NAME_MAP. This causes:
1. IndexError when accessing profile_in_pg[0] on empty result
2. KeyError when accessing pg_name_map[port:pg] for missing PGs
Fix by adding:
- Empty check for profile_in_pg before comparison
- Key existence check for pg_name_map before access (both admin-up
and admin-down paths)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Collaborator
|
/azp run |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of PR
Fix IndexError and KeyError in test_buffer_pg when ports don't have BUFFER_PG|{port}|3-4 configured.
Type of change
Back port request
Approach
What is the motivation for this PR?
On some HW SKUs (e.g. Arista-7260CX3-C64), certain ports do not have
BUFFER_PG|{port}|3-4configured in CONFIG_DB, and their PG entries may be missing fromCOUNTERS_PG_NAME_MAP. This causes:IndexError: list index out of rangewhen accessingprofile_in_pg[0]on an empty result (on internal branch withdut_asic.run_redis_cmd())KeyErrorwhen accessingpg_name_map[port:pg]for missing PG entriesKusto analysis shows this consistently fails on Arista-7260CX3-C64 (bjw2-can-7260-12, bjw-can-7260-8) and occasionally on NH-5010-F-O64.
How did you do it?
profile_in_pgbefore accessing its elementspg_name_mapbefore dictionary access (both admin-up and admin-down paths)How did you verify/test it?
Code review and Kusto analysis of failure patterns.
Any platform specific information?
Affects Arista-7260CX3-C64 and NH-5010-F-O64.
ADO PBI: #37230137