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

[action] [PR:15297] Fix asic identification #15522

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

mssonicbld
Copy link
Collaborator

Description of PR

ASIC identification is (mostly) done by matching entire lines from the output of the lspci command. This is prone to failure over time, if the output lines change for whatever reason. A more robust approach is to match only those tokens which can
be considered reliable in identifying and distinguishing the ASICs, as opposed to matching whole lines of output. This change implements the token-based approach.

Additionally, this PR introduces the token matching for the TH4 and TH5 asics.

Summary:
Fixes # (issue)

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 202012
  • 202205
  • 202305
  • 202311
  • 202405

Approach

What is the motivation for this PR?

test_everflow_per_interface.py was failing due to misidentified asic (i.e. asic was "unknown"), causing the test to execute a different code path than intended.

How did you do it?

Updated the matching logic to compare on the pertinent information returned from the lspci command, rather than entire portions of the returned lines.

How did you verify/test it?

Ran the test_everflow_per_interface.py against TH2, TH4, and TH5-based Arista DUTs and confirmed that the tests passed.

@mssonicbld mssonicbld mentioned this pull request Nov 13, 2024
8 tasks
@mssonicbld
Copy link
Collaborator Author

Original PR: #15297

* sonic-mgmt: improve asic identification

Device ASIC identification is achieved by
whole line matches from the output of lspci,
which is excessive and subject to fail due to
unforeseeable changes in such output.

This change reduces the string matching to
specific unique differentiators in the output
from lspci, while also future-proofing against
similar changes in the lspci that could
foreseeably occur.

* sonic-mgmt: add th4/th5 asic identification

Add token matches for identifying the TH4 and TH5
ASICs from the output of lspci.

* sonic-mgmt: fix pre-commit issue

Fix pre-commit error introduced within the prior
two commits.
@mssonicbld mssonicbld merged commit 57c4b2d into sonic-net:202405 Nov 15, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants