Skip to content

Commit 584c448

Browse files
abdosimssonicbld
authored andcommitted
[chassisd]: Updated the API get_platform_info() to return running/detected ASIC's count (#16539)
previously, get_num_asics() returns the maximum number of asics. however, the asic_count should be actual number of asics populated which can be get from get_asic_presence_list(). ADO: 25158825 Signed-off-by: Abhishek Dosi <[email protected]>
1 parent 503cb55 commit 584c448

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/sonic-py-common/sonic_py_common/device_info.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,15 +479,18 @@ def get_platform_info(config_db=None):
479479
if hw_info_dict:
480480
return hw_info_dict
481481

482-
from .multi_asic import get_num_asics
482+
from .multi_asic import get_asic_presence_list
483483

484484
version_info = get_sonic_version_info()
485485

486486
hw_info_dict['platform'] = get_platform()
487487
hw_info_dict['hwsku'] = get_hwsku()
488488
if version_info:
489489
hw_info_dict['asic_type'] = version_info.get('asic_type')
490-
hw_info_dict['asic_count'] = get_num_asics()
490+
try:
491+
hw_info_dict['asic_count'] = len(get_asic_presence_list())
492+
except:
493+
hw_info_dict['asic_count'] = 'N/A'
491494

492495
try:
493496
# TODO: enforce caller to provide config_db explicitly and remove its default value

src/sonic-py-common/sonic_py_common/multi_asic.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,4 +483,7 @@ def get_asic_presence_list():
483483
for asic in asics_presence_list:
484484
# asic is asid id: asic0, asic1.... asicN. Get the numeric value.
485485
asics_list.append(int(get_asic_id_from_name(asic)))
486+
else:
487+
# This is not multi-asic, all asics should be present.
488+
asics_list = list(range(0, get_num_asics()))
486489
return asics_list

0 commit comments

Comments
 (0)