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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 22 additions & 15 deletions tests/common/devices/sonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"orchagent": "swss",
"syncd": "syncd"
}
UNKNOWN_ASIC = "unknown"


class SonicHost(AnsibleHostBase):
Expand Down Expand Up @@ -1735,28 +1736,34 @@ def run_redis_cli_cmd(self, redis_cmd):
cmd = "/usr/bin/redis-cli {}".format(redis_cmd)
return self.command(cmd, verbose=False)

def _try_get_brcm_asic_name(self, output):
search_sets = {
"td2": {"b85", "BCM5685"},
"td3": {"b87", "BCM5687"},
"th": {"b96", "BCM5696"},
"th2": {"b97", "BCM5697"},
"th3": {"b98", "BCM5698"},
"th4": {"b99", "BCM5699"},
"th5": {"f90", "BCM7890"},
}
for asic in search_sets.keys():
for search_term in search_sets[asic]:
if search_term in output:
return asic
return UNKNOWN_ASIC

def get_asic_name(self):
asic = "unknown"
asic = UNKNOWN_ASIC
output = self.shell("lspci", module_ignore_errors=True)["stdout"]
if ("Broadcom Limited Device b960" in output or
"Broadcom Limited Broadcom BCM56960" in output):
asic = "th"
elif "Device b971" in output:
asic = "th2"
elif ("Broadcom Limited Device b850" in output or
"Broadcom Limited Broadcom BCM56850" in output or
"Broadcom Inc. and subsidiaries Broadcom BCM56850" in output):
asic = "td2"
elif ("Broadcom Limited Device b870" in output or
"Broadcom Inc. and subsidiaries Device b870" in output):
asic = "td3"
elif "Broadcom Limited Device b980" in output:
asic = "th3"
if "Broadcom" in output:
asic = self._try_get_brcm_asic_name(output)
elif "Cisco Systems Inc Device a001" in output:
asic = "gb"
elif "Mellanox Technologies" in output:
asic = "spc"

logger.info("asic: {}".format(asic))

return asic

def is_nvidia_platform(self):
Expand Down
Loading