@@ -325,27 +325,13 @@ def convert_sfp_info_to_output_string(sfp_info_dict):
325
325
elif key == 'cable_length' :
326
326
pass
327
327
elif key == 'specification_compliance' :
328
- if sfp_info_dict ['type' ] == "QSFP-DD Double Density 8X Pluggable Transceiver" or \
329
- sfp_info_dict ['type' ] == "OSFP 8X Pluggable Transceiver" or \
330
- sfp_info_dict ['type' ] == "QSFP+ or later with CMIS" :
331
- output += '{}{}: {}\n ' .format (indent , QSFP_DD_DATA_MAP [key ], sfp_info_dict [key ])
332
- else :
333
- output += '{}{}:\n ' .format (indent , QSFP_DD_DATA_MAP ['specification_compliance' ])
334
-
335
- spec_compliance_dict = {}
336
- try :
337
- spec_compliance_dict = ast .literal_eval (sfp_info_dict ['specification_compliance' ])
338
- sorted_compliance_key_table = natsorted (spec_compliance_dict )
339
- for compliance_key in sorted_compliance_key_table :
340
- output += '{}{}: {}\n ' .format ((indent * 2 ), compliance_key , spec_compliance_dict [compliance_key ])
341
- except ValueError as e :
342
- output += '{}N/A\n ' .format ((indent * 2 ))
343
- elif key == 'application_advertisement' :
344
- pass
328
+ output += '{}{}: {}\n ' .format (indent , QSFP_DD_DATA_MAP [key ], sfp_info_dict [key ])
345
329
elif key == 'supported_max_tx_power' or key == 'supported_min_tx_power' :
346
- output += '{}{}: {}dBm\n ' .format (indent , QSFP_DD_DATA_MAP [key ], sfp_info_dict [key ])
330
+ if key in sfp_info_dict : # C-CMIS compliant / coherent modules
331
+ output += '{}{}: {}dBm\n ' .format (indent , QSFP_DD_DATA_MAP [key ], sfp_info_dict [key ])
347
332
elif key == 'supported_max_laser_freq' or key == 'supported_min_laser_freq' :
348
- output += '{}{}: {}GHz\n ' .format (indent , QSFP_DD_DATA_MAP [key ], sfp_info_dict [key ])
333
+ if key in sfp_info_dict : # C-CMIS compliant / coherent modules
334
+ output += '{}{}: {}GHz\n ' .format (indent , QSFP_DD_DATA_MAP [key ], sfp_info_dict [key ])
349
335
else :
350
336
try :
351
337
output += '{}{}: {}\n ' .format (indent , QSFP_DD_DATA_MAP [key ], sfp_info_dict [key ])
@@ -360,21 +346,16 @@ def convert_sfp_info_to_output_string(sfp_info_dict):
360
346
elif key == 'cable_length' :
361
347
pass
362
348
elif key == 'specification_compliance' :
363
- if sfp_info_dict ['type' ] == "QSFP-DD Double Density 8X Pluggable Transceiver" or \
364
- sfp_info_dict ['type' ] == "OSFP 8X Pluggable Transceiver" or \
365
- sfp_info_dict ['type' ] == "QSFP+ or later with CMIS" :
366
- output += '{}{}: {}\n ' .format (indent , QSFP_DATA_MAP [key ], sfp_info_dict [key ])
367
- else :
368
- output += '{}{}:\n ' .format (indent , QSFP_DATA_MAP ['specification_compliance' ])
369
-
370
- spec_compliance_dict = {}
371
- try :
372
- spec_compliance_dict = ast .literal_eval (sfp_info_dict ['specification_compliance' ])
373
- sorted_compliance_key_table = natsorted (spec_compliance_dict )
374
- for compliance_key in sorted_compliance_key_table :
375
- output += '{}{}: {}\n ' .format ((indent * 2 ), compliance_key , spec_compliance_dict [compliance_key ])
376
- except ValueError as e :
377
- output += '{}N/A\n ' .format ((indent * 2 ))
349
+ output += '{}{}:\n ' .format (indent , QSFP_DATA_MAP ['specification_compliance' ])
350
+
351
+ spec_compliance_dict = {}
352
+ try :
353
+ spec_compliance_dict = ast .literal_eval (sfp_info_dict ['specification_compliance' ])
354
+ sorted_compliance_key_table = natsorted (spec_compliance_dict )
355
+ for compliance_key in sorted_compliance_key_table :
356
+ output += '{}{}: {}\n ' .format ((indent * 2 ), compliance_key , spec_compliance_dict [compliance_key ])
357
+ except ValueError as e :
358
+ output += '{}N/A\n ' .format ((indent * 2 ))
378
359
else :
379
360
output += '{}{}: {}\n ' .format (indent , QSFP_DATA_MAP [key ], sfp_info_dict [key ])
380
361
0 commit comments