Skip to content

Commit d739102

Browse files
[sfp] Add media assignment options to Application Advertisement (#324)
* [sfp] Add media assignment options to Application Advertisement * Increase UT coverage
1 parent 644f8c2 commit d739102

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

sonic_platform_base/sonic_xcvr/api/public/cmis.py

+5
Original file line numberDiff line numberDiff line change
@@ -1929,6 +1929,11 @@ def get_application_advertisement(self):
19291929
break
19301930
buf['host_lane_assignment_options'] = val
19311931

1932+
key = "{}_{}".format(consts.MEDIA_LANE_ASSIGNMENT_OPTION, app)
1933+
val = dic.get(key)
1934+
if val is not None:
1935+
buf['media_lane_assignment_options'] = val
1936+
19321937
ret[app] = buf
19331938
return ret
19341939

tests/sonic_xcvr/test_cmis.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@ def test_get_module_fw_info(self, mock_response, expected):
10441044
if result['status'] == False: # Check 'result' when 'status' == False for distinguishing error type.
10451045
assert result['result'] == expected['result']
10461046
assert result['status'] == expected['status']
1047-
1047+
10481048
@pytest.mark.parametrize("input_param, mock_response, expected", [
10491049
(1, 1, (True, 'Module FW run: Success\n')),
10501050
(1, 64, (False, 'Module FW run: Fail\nFW_run_status 64\n')),
@@ -2006,7 +2006,8 @@ def test_get_application_advertisement(self):
20062006
consts.MODULE_MEDIA_INTERFACE_SM + "_1": "400GBASE-DR4 (Cl 124)",
20072007
consts.MEDIA_LANE_COUNT + "_1": 4,
20082008
consts.HOST_LANE_COUNT + "_1": 8,
2009-
consts.HOST_LANE_ASSIGNMENT_OPTION + "_1": 0x01
2009+
consts.HOST_LANE_ASSIGNMENT_OPTION + "_1": 0x01,
2010+
consts.MEDIA_LANE_ASSIGNMENT_OPTION + "_1": 0x02
20102011
},
20112012
Sff8024.MODULE_MEDIA_TYPE[2]
20122013
]
@@ -2018,6 +2019,7 @@ def test_get_application_advertisement(self):
20182019
assert result[1]['host_lane_count'] == 8
20192020
assert result[1]['media_lane_count'] == 4
20202021
assert result[1]['host_lane_assignment_options'] == 0x01
2022+
assert result[1]['media_lane_assignment_options'] == 0x02
20212023

20222024
def test_get_application_advertisement_non_support(self):
20232025
self.api.xcvr_eeprom.read = MagicMock(return_value = None)

0 commit comments

Comments
 (0)