Skip to content

Commit ca6ab94

Browse files
byu343andywongarista
authored andcommitted
Implement get/set_lpmode API for SFF8472 (#512)
* Add get/set_lpmode API for SFF8472 The lpmode is not supported by SFF8472 * Add unittest for get/set_lpmode for SFF8472 --------- Co-authored-by: Andy Wong <andywong@arista.com>
1 parent 7700003 commit ca6ab94

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

sonic_platform_base/sonic_xcvr/api/public/sff8472.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def get_transceiver_info(self):
3737
if len > 0:
3838
cable_len = len
3939
cable_type = type
40-
40+
4141
xcvr_info = {
4242
"type": serial_id[consts.ID_FIELD],
4343
"type_abbrv_name": serial_id[consts.ID_ABBRV_FIELD],
@@ -296,5 +296,26 @@ def get_lpmode_support(self):
296296
def get_power_override_support(self):
297297
return False
298298

299+
def get_lpmode(self):
300+
'''
301+
Retrieves low power mode status
302+
303+
Returns:
304+
bool: True if module in low power else returns False.
305+
'''
306+
return False
307+
308+
def set_lpmode(self, lpmode):
309+
'''
310+
This function sets LPMode for the module.
311+
312+
Args:
313+
lpmode (bool): False means LPMode Off, True means LPMode On
314+
315+
Returns:
316+
bool: True if the provision succeeds, False if it fails
317+
'''
318+
return False
319+
299320
def is_copper(self):
300321
return self.xcvr_eeprom.read(consts.SFP_CABLE_TECH_FIELD) == 'Passive Cable'

tests/sonic_xcvr/test_sff8472.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,3 +290,9 @@ def test_get_transceiver_bulk_status(self, mock_response, expected):
290290
result = self.api.get_transceiver_bulk_status()
291291
assert result == expected
292292

293+
def test_get_lpmode(self):
294+
assert not self.api.get_lpmode()
295+
296+
def test_set_lpmode(self):
297+
assert not self.api.set_lpmode(True)
298+
assert not self.api.set_lpmode(False)

0 commit comments

Comments
 (0)