Skip to content

Commit

Permalink
[SFP-Refactor] Fix LP mode API issue (#247)
Browse files Browse the repository at this point in the history
* [SFP-Refactor] Fix LP mode API issue

* update API
  • Loading branch information
aravindmani-1 committed Nov 29, 2021
1 parent dba17c8 commit c2aac75
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions sonic_platform_base/sonic_xcvr/api/public/cmis.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,11 +898,18 @@ def set_lpmode(self, lpmode):
if lpmode_val is not None:
if lpmode is True:
lpmode_val = lpmode_val | (1 << 4)
self.xcvr_eeprom.write(consts.MODULE_LEVEL_CONTROL, lpmode_val)
time.sleep(0.1)
return self.get_lpmode()
else:
lpmode_val = lpmode_val & ~(1 << 4)
self.xcvr_eeprom.write(consts.MODULE_LEVEL_CONTROL, lpmode_val)
time.sleep(0.1)
return self.get_lpmode()
self.xcvr_eeprom.write(consts.MODULE_LEVEL_CONTROL, lpmode_val)
time.sleep(1)
lpmode = self.xcvr_eeprom.read(consts.TRANS_MODULE_STATUS_FIELD)
if lpmode is not None:
if lpmode.get('ModuleState') == 'ModuleReady':
return True
return False
return False

def get_loopback_capability(self):
Expand Down
2 changes: 1 addition & 1 deletion sonic_platform_base/sonic_xcvr/sfp_optoe_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def set_lpmode(self, lpmode):
vendors has to implement accordingly.
"""
api = self.get_xcvr_api()
return api.set_lp_mode(lpmode) if api is not None else None
return api.set_lpmode(lpmode) if api is not None else None

def set_optoe_write_max(self, write_max):
sys_path = self.get_eeprom_path()
Expand Down

0 comments on commit c2aac75

Please sign in to comment.