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

Updated the API get_platform_info() to return running/detected ASIC's count #16539

Merged
merged 20 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
7a3d7e5
Fix the Loopback0 IPv6 address of LC's in chassis not reachable from
abdosi Aug 3, 2023
b5b08cf
Merge remote-tracking branch 'upstream/master'
abdosi Aug 17, 2023
8d9dbb6
Added change to have flag
abdosi Aug 17, 2023
d04bc54
Merge remote-tracking branch 'upstream/master'
abdosi Aug 23, 2023
264d912
Merge remote-tracking branch 'upstream/master'
abdosi Aug 25, 2023
957cd71
Merge remote-tracking branch 'upstream/master'
abdosi Aug 31, 2023
4e8b101
Assign the metric vaule for Ipv6 default route learnt via RA message to
abdosi Aug 31, 2023
05ec92a
Merge remote-tracking branch 'upstream/master'
abdosi Sep 8, 2023
fcbd38d
Add alternate name for bridge interface on supversior in chassis systrem
abdosi Sep 8, 2023
76019a7
Merge remote-tracking branch 'upstream/master'
abdosi Sep 8, 2023
311c639
Revert "Add alternate name for bridge interface on supversior in chas…
abdosi Sep 13, 2023
2109e03
ASIC Count is updated to the running numbers of ASIC's and not max
abdosi Sep 13, 2023
ced57e2
Merge remote-tracking branch 'upstream/master' into chassis
abdosi Sep 26, 2023
3cf4697
Enable Seding BGP Community over internal neighbors over iBGP Session
abdosi Sep 26, 2023
8ee1472
Revert "Enable Seding BGP Community over internal neighbors over iBGP…
abdosi Sep 26, 2023
b1b8013
Address Review comment
abdosi Sep 26, 2023
ac0bfcb
Address review comment
abdosi Sep 26, 2023
84cf43f
In Chassis TSA mode Loopback0 Ip's of each should be advertise
abdosi Sep 27, 2023
a0bee0e
Address Review Comment
abdosi Sep 28, 2023
661b971
Revert "In Chassis TSA mode Loopback0 Ip's of each should be advertise"
abdosi Sep 28, 2023
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
7 changes: 5 additions & 2 deletions src/sonic-py-common/sonic_py_common/device_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,15 +479,18 @@ def get_platform_info(config_db=None):
if hw_info_dict:
return hw_info_dict

from .multi_asic import get_num_asics
from .multi_asic import get_asic_presence_list
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain the reason for this change? why get_num_asics does not work, but get_asic_presence_list?

what is the scenario that was broken?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lguohan
In Chassis for supervisor running asic count can be <= max asic possible.
get_num_asics() return max asic count that can be present based on static file eg:

. However in supervisor max_asic represnt number of asic where all Fabric cards are populated. However most of the time we have less than that inserted. get_asic_presence_list() returns how many asics are detected on Supervisor and for LC/Multi-asic system it still return max asic count


version_info = get_sonic_version_info()

hw_info_dict['platform'] = get_platform()
hw_info_dict['hwsku'] = get_hwsku()
if version_info:
hw_info_dict['asic_type'] = version_info.get('asic_type')
hw_info_dict['asic_count'] = get_num_asics()
try:
hw_info_dict['asic_count'] = len(get_asic_presence_list())
except:
hw_info_dict['asic_count'] = 'N/A'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this compatiable with single asic? previously for single asic, the get_num_asics() return 1, in this case, it returns
"N/A" now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lguohan yes this change was breaking single asic as it was returning 0. Have fixed API get_asic_presence_list() to work for single asic.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the multi-asic case, what is in the asics_list? is that 0,1,2 or something else? @abdosi

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lguohan : yes it 0,1,2


try:
# TODO: enforce caller to provide config_db explicitly and remove its default value
Expand Down
3 changes: 3 additions & 0 deletions src/sonic-py-common/sonic_py_common/multi_asic.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,4 +483,7 @@ def get_asic_presence_list():
for asic in asics_presence_list:
# asic is asid id: asic0, asic1.... asicN. Get the numeric value.
asics_list.append(int(get_asic_id_from_name(asic)))
else:
# This is not multi-asic, all asics should be present.
asics_list = list(range(0, get_num_asics()))
return asics_list