From f72955787c43e3432aa47c26861c5df55d0f516a Mon Sep 17 00:00:00 2001 From: Brian Gallagher Date: Thu, 6 Aug 2026 18:35:02 +0000 Subject: [PATCH 1/2] Add get_elsfp_change_event to ChassisBase Signed-off-by: Brian Gallagher --- sonic_platform_base/chassis_base.py | 43 ++++++++++++++++++++++++++++- tests/chassis_base_test.py | 2 ++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/sonic_platform_base/chassis_base.py b/sonic_platform_base/chassis_base.py index db865e753..d368b2278 100644 --- a/sonic_platform_base/chassis_base.py +++ b/sonic_platform_base/chassis_base.py @@ -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 + 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 + def get_bmc(self): """ Get bmc device on this chassis diff --git a/tests/chassis_base_test.py b/tests/chassis_base_test.py index 685eacd81..8446cc5cb 100644 --- a/tests/chassis_base_test.py +++ b/tests/chassis_base_test.py @@ -34,6 +34,8 @@ 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], {}], [chassis.get_dataplane_state, [], {}], [chassis.get_controlplane_state, [], {}], ] From f563a8831a34a9c788e6767790119414554da41b Mon Sep 17 00:00:00 2001 From: Brian Gallagher Date: Mon, 10 Aug 2026 18:23:19 +0000 Subject: [PATCH 2/2] Add get_change_event to not implemented test case Signed-off-by: Brian Gallagher --- tests/chassis_base_test.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/chassis_base_test.py b/tests/chassis_base_test.py index 8446cc5cb..eb3266499 100644 --- a/tests/chassis_base_test.py +++ b/tests/chassis_base_test.py @@ -36,6 +36,8 @@ def test_chassis_base(self): [chassis.get_dpu_id, [], {"name": "DPU0"}], [chassis.get_elsfp_change_event, [], {}], [chassis.get_elsfp_change_event, [1000], {}], + [chassis.get_change_event, [], {}], + [chassis.get_change_event, [1000], {}], [chassis.get_dataplane_state, [], {}], [chassis.get_controlplane_state, [], {}], ]