@@ -301,28 +301,99 @@ def post_port_sfp_info_to_db(logical_port_name, port_mapping, table, transceiver
301
301
if port_info_dict is not None :
302
302
is_replaceable = _wrapper_is_replaceable (physical_port )
303
303
transceiver_dict [physical_port ] = port_info_dict
304
- fvs = swsscommon .FieldValuePairs (
305
- [('type' , port_info_dict ['type' ]),
306
- ('vendor_rev' , port_info_dict ['vendor_rev' ]),
307
- ('serial' , port_info_dict ['serial' ]),
308
- ('manufacturer' , port_info_dict ['manufacturer' ]),
309
- ('model' , port_info_dict ['model' ]),
310
- ('vendor_oui' , port_info_dict ['vendor_oui' ]),
311
- ('vendor_date' , port_info_dict ['vendor_date' ]),
312
- ('connector' , port_info_dict ['connector' ]),
313
- ('encoding' , port_info_dict ['encoding' ]),
314
- ('ext_identifier' , port_info_dict ['ext_identifier' ]),
315
- ('ext_rateselect_compliance' , port_info_dict ['ext_rateselect_compliance' ]),
316
- ('cable_type' , port_info_dict ['cable_type' ]),
317
- ('cable_length' , str (port_info_dict ['cable_length' ])),
318
- ('specification_compliance' , port_info_dict ['specification_compliance' ]),
319
- ('nominal_bit_rate' , str (port_info_dict ['nominal_bit_rate' ])),
320
- ('application_advertisement' , port_info_dict ['application_advertisement' ]
321
- if 'application_advertisement' in port_info_dict else 'N/A' ),
322
- ('is_replaceable' , str (is_replaceable )),
323
- ('dom_capability' , port_info_dict ['dom_capability' ]
324
- if 'dom_capability' in port_info_dict else 'N/A' ),
325
- ])
304
+ # if cmis is supported by the module
305
+ if 'cmis_rev' in port_info_dict :
306
+ fvs = swsscommon .FieldValuePairs (
307
+ [('type' , port_info_dict ['type' ]),
308
+ ('vendor_rev' , port_info_dict ['vendor_rev' ]),
309
+ ('serial' , port_info_dict ['serial' ]),
310
+ ('manufacturer' , port_info_dict ['manufacturer' ]),
311
+ ('model' , port_info_dict ['model' ]),
312
+ ('vendor_oui' , port_info_dict ['vendor_oui' ]),
313
+ ('vendor_date' , port_info_dict ['vendor_date' ]),
314
+ ('connector' , port_info_dict ['connector' ]),
315
+ ('encoding' , port_info_dict ['encoding' ]),
316
+ ('ext_identifier' , port_info_dict ['ext_identifier' ]),
317
+ ('ext_rateselect_compliance' , port_info_dict ['ext_rateselect_compliance' ]),
318
+ ('cable_type' , port_info_dict ['cable_type' ]),
319
+ ('cable_length' , str (port_info_dict ['cable_length' ])),
320
+ ('specification_compliance' , port_info_dict ['specification_compliance' ]),
321
+ ('nominal_bit_rate' , str (port_info_dict ['nominal_bit_rate' ])),
322
+ ('application_advertisement' , port_info_dict ['application_advertisement' ]
323
+ if 'application_advertisement' in port_info_dict else 'N/A' ),
324
+ ('is_replaceable' , str (is_replaceable )),
325
+ ('dom_capability' , port_info_dict ['dom_capability' ]
326
+ if 'dom_capability' in port_info_dict else 'N/A' ),
327
+ ('cmis_rev' , port_info_dict ['cmis_rev' ] if 'cmis_rev' in port_info_dict else 'N/A' ),
328
+ ('active_firmware' , port_info_dict ['active_firmware' ]
329
+ if 'active_firmware' in port_info_dict else 'N/A' ),
330
+ ('inactive_firmware' , port_info_dict ['inactive_firmware' ]
331
+ if 'inactive_firmware' in port_info_dict else 'N/A' ),
332
+ ('hardware_rev' , port_info_dict ['hardware_rev' ]
333
+ if 'hardware_rev' in port_info_dict else 'N/A' ),
334
+ ('media_interface_code' , port_info_dict ['media_interface_code' ]
335
+ if 'media_interface_code' in port_info_dict else 'N/A' ),
336
+ ('host_electrical_interface' , port_info_dict ['host_electrical_interface' ]
337
+ if 'host_electrical_interface' in port_info_dict else 'N/A' ),
338
+ ('host_lane_count' , str (port_info_dict ['host_lane_count' ])
339
+ if 'host_lane_count' in port_info_dict else 'N/A' ),
340
+ ('media_lane_count' , str (port_info_dict ['media_lane_count' ])
341
+ if 'media_lane_count' in port_info_dict else 'N/A' ),
342
+ ('host_lane_assignment_option' , str (port_info_dict ['host_lane_assignment_option' ])
343
+ if 'host_lane_assignment_option' in port_info_dict else 'N/A' ),
344
+ ('media_lane_assignment_option' , str (port_info_dict ['media_lane_assignment_option' ])
345
+ if 'media_lane_assignment_option' in port_info_dict else 'N/A' ),
346
+ ('active_apsel_hostlane1' , str (port_info_dict ['active_apsel_hostlane1' ])
347
+ if 'active_apsel_hostlane1' in port_info_dict else 'N/A' ),
348
+ ('active_apsel_hostlane2' , str (port_info_dict ['active_apsel_hostlane2' ])
349
+ if 'active_apsel_hostlane2' in port_info_dict else 'N/A' ),
350
+ ('active_apsel_hostlane3' , str (port_info_dict ['active_apsel_hostlane3' ])
351
+ if 'active_apsel_hostlane3' in port_info_dict else 'N/A' ),
352
+ ('active_apsel_hostlane4' , str (port_info_dict ['active_apsel_hostlane4' ])
353
+ if 'active_apsel_hostlane4' in port_info_dict else 'N/A' ),
354
+ ('active_apsel_hostlane5' , str (port_info_dict ['active_apsel_hostlane5' ])
355
+ if 'active_apsel_hostlane5' in port_info_dict else 'N/A' ),
356
+ ('active_apsel_hostlane6' , str (port_info_dict ['active_apsel_hostlane6' ])
357
+ if 'active_apsel_hostlane6' in port_info_dict else 'N/A' ),
358
+ ('active_apsel_hostlane7' , str (port_info_dict ['active_apsel_hostlane7' ])
359
+ if 'active_apsel_hostlane7' in port_info_dict else 'N/A' ),
360
+ ('active_apsel_hostlane8' , str (port_info_dict ['active_apsel_hostlane8' ])
361
+ if 'active_apsel_hostlane8' in port_info_dict else 'N/A' ),
362
+ ('media_interface_technology' , port_info_dict ['media_interface_technology' ]
363
+ if 'media_interface_technology' in port_info_dict else 'N/A' ),
364
+ ('supported_max_tx_power' , str (port_info_dict ['supported_max_tx_power' ])
365
+ if 'supported_max_tx_power' in port_info_dict else 'N/A' ),
366
+ ('supported_min_tx_power' , str (port_info_dict ['supported_min_tx_power' ])
367
+ if 'supported_min_tx_power' in port_info_dict else 'N/A' ),
368
+ ('supported_max_laser_freq' , str (port_info_dict ['supported_max_laser_freq' ])
369
+ if 'supported_max_laser_freq' in port_info_dict else 'N/A' ),
370
+ ('supported_min_laser_freq' , str (port_info_dict ['supported_min_laser_freq' ])
371
+ if 'supported_min_laser_freq' in port_info_dict else 'N/A' )
372
+ ])
373
+ # else cmis is not supported by the module
374
+ else :
375
+ fvs = swsscommon .FieldValuePairs ([
376
+ ('type' , port_info_dict ['type' ]),
377
+ ('vendor_rev' , port_info_dict ['vendor_rev' ]),
378
+ ('serial' , port_info_dict ['serial' ]),
379
+ ('manufacturer' , port_info_dict ['manufacturer' ]),
380
+ ('model' , port_info_dict ['model' ]),
381
+ ('vendor_oui' , port_info_dict ['vendor_oui' ]),
382
+ ('vendor_date' , port_info_dict ['vendor_date' ]),
383
+ ('connector' , port_info_dict ['connector' ]),
384
+ ('encoding' , port_info_dict ['encoding' ]),
385
+ ('ext_identifier' , port_info_dict ['ext_identifier' ]),
386
+ ('ext_rateselect_compliance' , port_info_dict ['ext_rateselect_compliance' ]),
387
+ ('cable_type' , port_info_dict ['cable_type' ]),
388
+ ('cable_length' , str (port_info_dict ['cable_length' ])),
389
+ ('specification_compliance' , port_info_dict ['specification_compliance' ]),
390
+ ('nominal_bit_rate' , str (port_info_dict ['nominal_bit_rate' ])),
391
+ ('application_advertisement' , port_info_dict ['application_advertisement' ]
392
+ if 'application_advertisement' in port_info_dict else 'N/A' ),
393
+ ('is_replaceable' , str (is_replaceable )),
394
+ ('dom_capability' , port_info_dict ['dom_capability' ]
395
+ if 'dom_capability' in port_info_dict else 'N/A' )
396
+ ])
326
397
table .set (port_name , fvs )
327
398
else :
328
399
return SFP_EEPROM_NOT_READY
0 commit comments