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

Handle NotImplementedError exception while calling get_eeprom_path API #399

Closed
Closed
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
5 changes: 4 additions & 1 deletion sonic_platform_base/sonic_xcvr/sfp_optoe_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ def set_lpmode(self, lpmode):
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()
try:
sys_path = self.get_eeprom_path()
except NotImplementedError:
return
sys_path = sys_path.replace("eeprom", "write_max")
try:
with open(sys_path, mode='w') as f:
Expand Down
10 changes: 10 additions & 0 deletions tests/sonic_xcvr/test_sfp_optoe_base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from unittest.mock import patch
from mock import MagicMock
import pytest
from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase

class TestSfpOptoeBase(object):
optoebase = SfpOptoeBase()

def test_set_optoe_write_max_with_exception(self):
self.optoebase.set_optoe_write_max(1)
Loading