@@ -680,30 +680,26 @@ def update_flag_metadata_tables(logical_port_name, physical_port_name, field_nam
680
680
return
681
681
682
682
found , db_flags_value_dict = flag_value_table .get (logical_port_name )
683
+ # Table is empty, this is the first update to the metadata tables (this also means that the transceiver was detected for the first time)
684
+ # Unless the flag (current_value) is set, initialize the change count to 0 and last set and clear times to 'never'
683
685
if not found :
684
- # Table is empty, this is the first update to the metadata tables (this also means that the transceiver was detected for the first time)
685
- if str (current_value ) == 'N/A' :
686
+ if str (current_value ).strip () == 'N/A' or not current_value :
686
687
flag_change_count_table .set (physical_port_name , swsscommon .FieldValuePairs ([(field_name , '0' )]))
687
688
flag_last_set_time_table .set (physical_port_name , swsscommon .FieldValuePairs ([(field_name , 'never' )]))
688
689
flag_last_clear_time_table .set (physical_port_name , swsscommon .FieldValuePairs ([(field_name , 'never' )]))
689
- return
690
690
else :
691
691
flag_change_count_table .set (physical_port_name , swsscommon .FieldValuePairs ([(field_name , '1' )]))
692
- if current_value :
693
- flag_last_set_time_table .set (physical_port_name , swsscommon .FieldValuePairs ([(field_name , flag_values_dict_update_time )]))
694
- flag_last_clear_time_table .set (physical_port_name , swsscommon .FieldValuePairs ([(field_name , 'never' )]))
695
- else :
696
- flag_last_set_time_table .set (physical_port_name , swsscommon .FieldValuePairs ([(field_name , 'never' )]))
697
- flag_last_clear_time_table .set (physical_port_name , swsscommon .FieldValuePairs ([(field_name , flag_values_dict_update_time )]))
698
- return
692
+ flag_last_set_time_table .set (physical_port_name , swsscommon .FieldValuePairs ([(field_name , flag_values_dict_update_time )]))
693
+ flag_last_clear_time_table .set (physical_port_name , swsscommon .FieldValuePairs ([(field_name , 'never' )]))
694
+ return
699
695
else :
700
696
db_flags_value_dict = dict (db_flags_value_dict )
701
697
702
698
# No metadata update required if the value is 'N/A'
703
- if str (current_value ) == 'N/A' :
699
+ if str (current_value ). strip () == 'N/A' :
704
700
return
705
701
706
- # Handle the case wherein the key is already in the db and the value of flag has changed from the previous value
702
+ # Update metadata if the value of flag has changed from the previous value
707
703
if field_name in db_flags_value_dict and db_flags_value_dict [field_name ] != str (current_value ):
708
704
found , db_change_count_dict = flag_change_count_table .get (physical_port_name )
709
705
if not found :
@@ -1793,6 +1789,7 @@ def _post_port_sfp_info_and_dom_thr_to_db_once(self, port_mapping, xcvr_table_he
1793
1789
rc = post_port_sfp_info_to_db (logical_port_name , port_mapping , xcvr_table_helper .get_intf_tbl (asic_index ), transceiver_dict , stop_event )
1794
1790
if rc != SFP_EEPROM_NOT_READY :
1795
1791
post_port_dom_threshold_info_to_db (logical_port_name , port_mapping , xcvr_table_helper .get_dom_threshold_tbl (asic_index ), stop_event )
1792
+ # Read the VDM thresholds and post them to the DB
1796
1793
post_port_vdm_non_real_values_to_db (logical_port_name , port_mapping , xcvr_table_helper ,
1797
1794
xcvr_table_helper .get_vdm_threshold_tbl ,
1798
1795
_wrapper_get_transceiver_vdm_thresholds , stop_event = stop_event )
0 commit comments