Skip to content

Commit 49d145c

Browse files
authored
[xcvrd] Fix bailing out on platforms that do not support QSFP-DD (sonic-net#78)
Merge of QSFP-DD support via PR# sonic-net#66 is making xcvrd to bail out on platforms that do not support new key/attribute. Fix is to ignore new key/attribute if not present/supported yet. Fix takes changes done as part of PR#sonic-net#76 which can be closed once this gets merged Verified manually xcvrd running fine after above changes. also command show interface transceiver is showing correct o/p Signed-off-by: Abhishek Dosi <[email protected]>
1 parent c935325 commit 49d145c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

sonic-xcvrd/scripts/xcvrd

+10-2
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,14 @@ def _wrapper_get_transceiver_change_event(timeout):
171171
pass
172172
return platform_sfputil.get_transceiver_change_event(timeout)
173173

174+
def _wrapper_get_sfp_type(physical_port):
175+
if platform_chassis:
176+
try:
177+
return platform_chassis.get_sfp(physical_port).sfp_type
178+
except (NotImplementedError, AttributeError):
179+
pass
180+
return None
181+
174182
# Remove unnecessary unit from the raw data
175183
def beautify_dom_info_dict(dom_info_dict):
176184
dom_info_dict['temperature'] = strip_unit_and_beautify(dom_info_dict['temperature'], TEMP_UNIT)
@@ -257,7 +265,7 @@ def post_port_sfp_info_to_db(logical_port_name, table, transceiver_dict,
257265
('cable_length',port_info_dict['cable_length']),
258266
('specification_compliance',port_info_dict['specification_compliance']),
259267
('nominal_bit_rate',port_info_dict['nominal_bit_rate']),
260-
('application_advertisement',port_info_dict['application_advertisement'])])
268+
('application_advertisement',port_info_dict['application_advertisement'] if 'application_advertisement' in port_info_dict else 'N/A')])
261269
table.set(port_name, fvs)
262270
else:
263271
return SFP_EEPROM_NOT_READY
@@ -353,7 +361,7 @@ def post_port_dom_info_to_db(logical_port_name, table, stop_event=threading.Even
353361
dom_info_dict = _wrapper_get_transceiver_dom_info(physical_port)
354362
if dom_info_dict is not None:
355363
beautify_dom_info_dict(dom_info_dict)
356-
if platform_chassis.get_sfp(physical_port).sfp_type == 'QSFP_DD':
364+
if _wrapper_get_sfp_type(physical_port) == 'QSFP_DD':
357365
fvs = swsscommon.FieldValuePairs(
358366
[('temperature', dom_info_dict['temperature']),
359367
('voltage', dom_info_dict['voltage']),

0 commit comments

Comments
 (0)