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

[action] [PR:512] Implement get/set_lpmode API for SFF8472 (#512) #520

Merged
merged 1 commit into from
Dec 5, 2024
Merged
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
23 changes: 22 additions & 1 deletion sonic_platform_base/sonic_xcvr/api/public/sff8472.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def get_transceiver_info(self):
if len > 0:
cable_len = len
cable_type = type

xcvr_info = {
"type": serial_id[consts.ID_FIELD],
"type_abbrv_name": serial_id[consts.ID_ABBRV_FIELD],
Expand Down Expand Up @@ -296,5 +296,26 @@ def get_lpmode_support(self):
def get_power_override_support(self):
return False

def get_lpmode(self):
'''
Retrieves low power mode status

Returns:
bool: True if module in low power else returns False.
'''
return False

def set_lpmode(self, lpmode):
'''
This function sets LPMode for the module.

Args:
lpmode (bool): False means LPMode Off, True means LPMode On

Returns:
bool: True if the provision succeeds, False if it fails
'''
return False

def is_copper(self):
return self.xcvr_eeprom.read(consts.SFP_CABLE_TECH_FIELD) == 'Passive Cable'
6 changes: 6 additions & 0 deletions tests/sonic_xcvr/test_sff8472.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,9 @@ def test_get_transceiver_bulk_status(self, mock_response, expected):
result = self.api.get_transceiver_bulk_status()
assert result == expected

def test_get_lpmode(self):
assert not self.api.get_lpmode()

def test_set_lpmode(self):
assert not self.api.set_lpmode(True)
assert not self.api.set_lpmode(False)
Loading