Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue in xcvrd - If port is missing in Config DB, don't need to handle changes in TRANSCEIVER_INFO table #5

Closed
wants to merge 7 commits into from
12 changes: 12 additions & 0 deletions sonic-xcvrd/xcvrd/xcvrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -2096,6 +2096,17 @@ def wait_for_port_config_done(self, namespace):
if key in ["PortConfigDone", "PortInitDone"]:
break

# remove ports from TRANSCEIVER_INFO table, if they don't exist in CONFIG DB
def remove_ports_from_transceiver_table(self, logical_ports_list):
for namespace in self.namespaces:
asic_id = multi_asic.get_asic_index_from_namespace(namespace)
transceiver_info_table = self.xcvr_table_helper.get_intf_tbl(asic_id)
ports_in_transceiver_only = list(set(transceiver_info_table.getKeys()) - set(logical_ports_list))

for trans_port in ports_in_transceiver_only:
transceiver_info_table._del(trans_port)
helper_logger.log_info("Port {} was removed from TRANSCEIVER_INFO table as it doesn't exist in Config DB".format(trans_port))

"""
Initialize NPU_SI_SETTINGS_SYNC_STATUS_KEY field in STATE_DB PORT_TABLE|<lport>
if not already present for a port.
Expand Down Expand Up @@ -2174,6 +2185,7 @@ def init(self):

self.log_notice("XCVRD INIT: After port config is done")
port_mapping_data = port_event_helper.get_port_mapping(self.namespaces)
self.remove_ports_from_transceiver_table(port_mapping_data.logical_port_list)

self.initialize_port_init_control_fields_in_port_table(port_mapping_data)

Expand Down
Loading