From aa0135a5e795aa6fbe74b88a3291a7371a02b868 Mon Sep 17 00:00:00 2001 From: noaOrMlnx Date: Wed, 6 Nov 2024 18:41:45 +0200 Subject: [PATCH] Remove ports from TRANSCEIVER_INFO table, if they don't exist in Config DB --- sonic-xcvrd/xcvrd/xcvrd.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sonic-xcvrd/xcvrd/xcvrd.py b/sonic-xcvrd/xcvrd/xcvrd.py index 3fb5293e1..4277cad47 100644 --- a/sonic-xcvrd/xcvrd/xcvrd.py +++ b/sonic-xcvrd/xcvrd/xcvrd.py @@ -2178,6 +2178,15 @@ def init(self): self.log_notice("XCVRD INIT: After port config is done") port_mapping_data = port_event_helper.get_port_mapping(self.namespaces) + # remove ports from TRANSCEIVER_INFO table, if they don't exist in CONFIG DB + logical_ports_list = port_mapping_data.logical_port_list + asic_id = multi_asic.get_asic_index_from_namespace(self.namespaces) + + transceiver_info_table = self.xcvr_table_helper.get_intf_tbl(asic_id) + + ports_in_transceiver_only = list(set(transceiver_info_table.get_keys()) - set(logical_ports_list)) + for trans_port in ports_in_transceiver_only: + transceiver_info_table._del(trans_port) self.initialize_port_init_control_fields_in_port_table(port_mapping_data)