Skip to content

Commit

Permalink
Add a template function that returns list of asics on module (sonic-n…
Browse files Browse the repository at this point in the history
…et#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.
  • Loading branch information
ngoc-do authored Jun 21, 2021
1 parent 1e860c5 commit 4533f82
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion 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
# 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 @@ -461,4 +465,34 @@ def is_midplane_reachable(self):
Returns:
A bool value, should return True if module is reachable via midplane
"""
raise NotImplementedError
return NotImplementedError

##############################################
# ASIC methods
##############################################
def get_all_asics(self):
"""
Retrieves the list of all ASICs on the module that are visible in PCI domain.
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
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
the chassis). This number is used to find settings for the ASIC
from /usr/share/sonic/device/platform/hwsku/asic_instance_number/.
- ASIC PCI address: It is used by syncd to attach the correct ASIC.
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.
Item ('4', '0000:05:00.0') describes information about the first ASIC
in the module.
'4' means it is asic4 in the chassis. Settings for this ASIC is at
/usr/share/sonic/device/platform/hwsku/4/.
And '0000:05:00.0' is its PCI address.
"""
return self._asic_list

0 comments on commit 4533f82

Please sign in to comment.