Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
43 changes: 42 additions & 1 deletion sonic_platform_base/chassis_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,48 @@ def get_change_event(self, timeout=0):
status='6' Bad cable.
"""
raise NotImplementedError


def get_elsfp_change_event(self, timeout=0):
"""
Returns a nested dictionary containing the ELSFPs which have
experienced a presence change at chassis level

This is the CPO (co-packaged optics) counterpart of get_change_event().
For a CPO port the optical engine is co-packaged and always present, so
the ELSFP is the only removable device. Since get_change_event() is a
single blocking event stream, ELSFP events are reported through this
separate stream so that the CPO and the traditional transceiver tasks
can each block on their own stream without consuming each other's
events. Implementations must therefore not report ELSFP events on

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@bgallagher-nexthop is the last statement a typo? "not report" ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This sentence is just saying that subclasses of ChassisBase should not report ELSFP events via get_change_event and only report ELSFP events in get_elsfp_change_event. Otherwise, SfpStateUpdateTask would react to the ELSFP events when it should not.

get_change_event().

An ELSFP may be associated with more than one physical port. In that
case the event is reported once for each of those physical ports.

Args:
timeout: Timeout in milliseconds (optional). If timeout == 0,
this method will block until a change is detected.

Returns:
(bool, dict):
- True if call successful, False if not;
- A nested dictionary where key is the device type 'elsfp',
value is a dictionary with key:value pairs in the format of
{'device_id':'device_event'},
where device_id is the physical port index the ELSFP is
associated with and device_event,
status='1' represents ELSFP inserted,
status='0' represents ELSFP removed.
Ex. {'elsfp':{'1':'1', '2':'1', '11':'0'}}
indicates that the ELSFP shared by physical ports 1 and 2
has been inserted and the ELSFP on physical port 11 has
been removed.
The error statuses defined for get_change_event() ('2' I2C bus
stuck, '3' Bad eeprom, '4' Unsupported cable, '5' High
Temperature, '6' Bad cable) apply here as well.
"""
raise NotImplementedError
Comment thread
bgallagher-nexthop marked this conversation as resolved.

def get_bmc(self):
"""
Get bmc device on this chassis
Expand Down
4 changes: 4 additions & 0 deletions tests/chassis_base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ def test_chassis_base(self):
[chassis.get_uid_led, [], {}],
[chassis.set_uid_led, ["COLOR"], {}],
[chassis.get_dpu_id, [], {"name": "DPU0"}],
[chassis.get_elsfp_change_event, [], {}],
[chassis.get_elsfp_change_event, [1000], {}],
Comment thread
bgallagher-nexthop marked this conversation as resolved.
[chassis.get_change_event, [], {}],
[chassis.get_change_event, [1000], {}],
Comment thread
bgallagher-nexthop marked this conversation as resolved.
[chassis.get_dataplane_state, [], {}],
[chassis.get_controlplane_state, [], {}],
]
Expand Down
Loading