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

Add a template function that returns list of asics on module #185

Merged
merged 3 commits into from
Jun 21, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 34 additions & 0 deletions sonic_platform_base/module_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ def __init__(self):
# available on the module
self._sfp_list = []

# List of Asic-derived objects representing all asics
ngoc-do marked this conversation as resolved.
Show resolved Hide resolved
# visibile in PCI domain on the module
self._asic_list = []

def get_base_mac(self):
"""
Retrieves the base MAC address for the module
Expand Down Expand Up @@ -462,3 +466,33 @@ def is_midplane_reachable(self):
A bool value, should return True if module is reachable via midplane
"""
return NotImplementedError

##############################################
# Asic methods
##############################################
def get_all_asics(self):
"""
Retrieves the list of all asics on the module that are visible in PCI domain.
ngoc-do marked this conversation as resolved.
Show resolved Hide resolved
When called from the Supervisor of modular system, the module could be
fabric card, and the function returns all fabric asics on this module that
appear in PCI domain of the Supervisor.

Returns:
A list of asics. Index of an asic in the list is the index of the asic
ngoc-do marked this conversation as resolved.
Show resolved Hide resolved
on the module. Index is 0 based.

An item in the list is a tuple that includes:
- Asic instance number (indexed globally across all modules of
ngoc-do marked this conversation as resolved.
Show resolved Hide resolved
ngoc-do marked this conversation as resolved.
Show resolved Hide resolved
the chassis). This number is used to find settings for the asic
ngoc-do marked this conversation as resolved.
Show resolved Hide resolved
from /usr/share/sonic/device/platform/hwsku/asic_instance_number/.
- Asic PCI address: It is used by syncd to attach the correct asic.
ngoc-do marked this conversation as resolved.
Show resolved Hide resolved

For example: [('4', '0000:05:00.0'), ('5', '0000:07:00.0')]
In this example, from the output, we know the module has 2 asics.
ngoc-do marked this conversation as resolved.
Show resolved Hide resolved
Item ('4', '0000:05:00.0') describes information about the first asic
ngoc-do marked this conversation as resolved.
Show resolved Hide resolved
in the module.
'4' means it is asic4 in the chassis. Settings for this asic is at
ngoc-do marked this conversation as resolved.
Show resolved Hide resolved
/usr/share/sonic/device/platform/hwsku/4/.
And '0000:05:00.0' is its PCI address.
"""
return self._asic_list