Skip to content

Commit

Permalink
400ZR not linking up with latest SONiC master image (#410)
Browse files Browse the repository at this point in the history
* 400ZR not linking up with latest SONiC master image

Signed-off-by: Mihir Patel <patelmi@microsoft.com>

* 400ZR not linking up with latest SONiC master image

Signed-off-by: Mihir Patel <patelmi@microsoft.com>

* Added testcase to improve code coverage

---------

Signed-off-by: Mihir Patel <patelmi@microsoft.com>
  • Loading branch information
mihirpat1 authored Dec 7, 2023
1 parent 502c0b6 commit 1c9b01d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions sonic-xcvrd/tests/test_xcvrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,20 @@ def test_DaemonXcvrd_run_with_exception(self, mock_task_join1, mock_task_join2,

class TestXcvrdScript(object):

from sonic_platform_base.sonic_xcvr.api.public.c_cmis import CCmisApi
from sonic_platform_base.sonic_xcvr.api.public.sff8636 import Sff8636Api
from sonic_platform_base.sonic_xcvr.api.public.sff8436 import Sff8436Api
@pytest.mark.parametrize("mock_class, expected_return_value", [
(CmisApi, True),
(CCmisApi, True),
(Sff8636Api, False),
(Sff8436Api, False)
])
def test_is_cmis_api(self, mock_class, expected_return_value):
mock_xcvr_api = MagicMock()
mock_xcvr_api.__class__ = mock_class
assert is_cmis_api(mock_xcvr_api) == expected_return_value

@patch('xcvrd.xcvrd._wrapper_get_sfp_type')
@patch('xcvrd.xcvrd_utilities.port_mapping.PortMapping.logical_port_name_to_physical_port_list', MagicMock(return_value=[0]))
@patch('xcvrd.xcvrd._wrapper_get_presence', MagicMock(return_value=True))
Expand Down
2 changes: 1 addition & 1 deletion sonic-xcvrd/xcvrd/xcvrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@


def is_cmis_api(api):
return type(api) == CmisApi
return isinstance(api, CmisApi)


def get_cmis_application_desired(api, host_lane_count, speed):
Expand Down

0 comments on commit 1c9b01d

Please sign in to comment.