[Mellanox] Refactor SFP to use new APIs. (#10317)
- Why I did it Refactor SFP code to remove code duplication and to be able to use the latest features available in new APIs. - How I did it Refactor SFP code to remove code duplication and to be able to use the latest features available in new APIs. - How to verify it Run sonic-mgmt/platform_tests/sfp tests
This commit is contained in:
parent
9451a9d43e
commit
9565ef7a9a
File diff suppressed because it is too large
Load Diff
@ -166,7 +166,6 @@ class TestChassis:
|
||||
@mock.patch('sonic_platform.sfp_event.sfp_event.check_sfp_status', MagicMock())
|
||||
@mock.patch('sonic_platform.sfp_event.sfp_event.__init__', MagicMock(return_value=None))
|
||||
@mock.patch('sonic_platform.sfp_event.sfp_event.initialize', MagicMock())
|
||||
@mock.patch('sonic_platform.sfp.SFP.reinit', MagicMock())
|
||||
@mock.patch('sonic_platform.device_data.DeviceDataManager.get_sfp_count', MagicMock(return_value=3))
|
||||
def test_change_event(self):
|
||||
from sonic_platform.sfp_event import sfp_event
|
||||
@ -185,7 +184,6 @@ class TestChassis:
|
||||
assert status is True
|
||||
assert 'sfp' in event_dict and event_dict['sfp'][1] == '1'
|
||||
assert len(chassis._sfp_list) == 3
|
||||
assert SFP.reinit.call_count == 1
|
||||
|
||||
# Call get_change_event with timeout=1.0
|
||||
return_port_dict = {}
|
||||
|
@ -49,7 +49,7 @@ class TestSfp:
|
||||
assert sfp.sdk_index == 1
|
||||
assert sfp.index == 5
|
||||
|
||||
@mock.patch('sonic_platform.sfp.SFP._read_eeprom_specific_bytes', mock.MagicMock(return_value=None))
|
||||
@mock.patch('sonic_platform.sfp.SFP.read_eeprom', mock.MagicMock(return_value=None))
|
||||
@mock.patch('sonic_platform.sfp.SFP._get_error_code')
|
||||
@mock.patch('sonic_platform.chassis.Chassis.get_num_sfps', mock.MagicMock(return_value=2))
|
||||
def test_sfp_get_error_status(self, mock_get_error_code):
|
||||
|
Reference in New Issue
Block a user