Skip to content

Commit 4533f82

Browse files
authored
Add a template function that returns list of asics on module (#185)
Add a generic function that returns a list of asics on module. Vendors will implement their own for their platform. The function could be used for collecting fabric asic info in each module and populating into CHASSIS_STATE_DB (sonic-net/sonic-platform-daemons#175). To simplify the change, all fabric cards in system should be identical in terms of number of asics in a card.
1 parent 1e860c5 commit 4533f82

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

sonic_platform_base/module_base.py

+35-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ def __init__(self):
7171
# available on the module
7272
self._sfp_list = []
7373

74+
# List of ASIC-derived objects representing all ASICs
75+
# visibile in PCI domain on the module
76+
self._asic_list = []
77+
7478
def get_base_mac(self):
7579
"""
7680
Retrieves the base MAC address for the module
@@ -461,4 +465,34 @@ def is_midplane_reachable(self):
461465
Returns:
462466
A bool value, should return True if module is reachable via midplane
463467
"""
464-
raise NotImplementedError
468+
return NotImplementedError
469+
470+
##############################################
471+
# ASIC methods
472+
##############################################
473+
def get_all_asics(self):
474+
"""
475+
Retrieves the list of all ASICs on the module that are visible in PCI domain.
476+
When called from the Supervisor of modular system, the module could be
477+
fabric card, and the function returns all fabric ASICs on this module that
478+
appear in PCI domain of the Supervisor.
479+
480+
Returns:
481+
A list of ASICs. Index of an ASIC in the list is the index of the ASIC
482+
on the module. Index is 0 based.
483+
484+
An item in the list is a tuple that includes:
485+
- ASIC instance number (indexed globally across all modules of
486+
the chassis). This number is used to find settings for the ASIC
487+
from /usr/share/sonic/device/platform/hwsku/asic_instance_number/.
488+
- ASIC PCI address: It is used by syncd to attach the correct ASIC.
489+
490+
For example: [('4', '0000:05:00.0'), ('5', '0000:07:00.0')]
491+
In this example, from the output, we know the module has 2 ASICs.
492+
Item ('4', '0000:05:00.0') describes information about the first ASIC
493+
in the module.
494+
'4' means it is asic4 in the chassis. Settings for this ASIC is at
495+
/usr/share/sonic/device/platform/hwsku/4/.
496+
And '0000:05:00.0' is its PCI address.
497+
"""
498+
return self._asic_list

0 commit comments

Comments
 (0)