Skip to content

Update SFP index definition#214

Merged
prgeor merged 1 commit intosonic-net:masterfrom
prgeor:sfp-index/master
Aug 26, 2021
Merged

Update SFP index definition#214
prgeor merged 1 commit intosonic-net:masterfrom
prgeor:sfp-index/master

Conversation

@prgeor
Copy link
Collaborator

@prgeor prgeor commented Aug 25, 2021

Signed-off-by: Prince George [email protected]

Description

SFP index on some platforms can start from non-zero index. Updated the comment to reflect the same.
Handle non existing SFP indices in chassis's _sfp_list[]

Motivation and Context

Updated the comment to avoid any confusion in future.
Platform can have 'None' for invalid SFP index in chassis's _sfp_list[], so handle the same in get_all_sfps() to return only valid SFP objects. With this change, platform need not override ChassisBase's get_all_sfp() and get_sfp() to handle case where SFP index starts from 1. This change can handle a case where the platform has "holes" in indices, for eg:-
valid port indices :1, 3, 5, 7
_sfp_list = [None, Sfp1, None, Sfp3, None, Sfp5, None, Sfp7]
get_all_sfps() = [Sfp1, Sfp3, Sfp5, Sfp7]
get_sfp() - There is now 1:1 mapping between the sfp_list[] index and port index

How Has This Been Tested?

Run SFP test in test_chassis.py

Additional Information (Optional)

Signed-off-by: Prince George <[email protected]>
@prgeor prgeor assigned prgeor and unassigned prgeor Aug 25, 2021
@prgeor
Copy link
Collaborator Author

prgeor commented Aug 25, 2021

@lguohan @andywongarista can you review?

@vdahiya12
Copy link
Contributor

@prgeor do we need to merge this in other branches ?

@andywongarista
Copy link
Contributor

LGTM.

@prgeor prgeor merged commit 7ca4f51 into sonic-net:master Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants