From 6cb3bba2f7232a3cd8eb7b684a3ab9966a51e091 Mon Sep 17 00:00:00 2001 From: prem-nokia <122470020+prem-nokia@users.noreply.github.com> Date: Wed, 15 Mar 2023 22:05:43 -0400 Subject: [PATCH] [Supervisor][fabric] Modify the deinit function not to remove CHASSIS_FABRIC_ASIC_TABLE when supervisorctl stop chassisd (#340) Code changes are implemented in deinit function such that it does not remove entries in CHASSI_FABRIC_ASIC_TABLE when supervisorctl stop chassisd is triggered. --- sonic-chassisd/scripts/chassisd | 7 ++++--- sonic-chassisd/tests/test_chassisd.py | 6 ++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/sonic-chassisd/scripts/chassisd b/sonic-chassisd/scripts/chassisd index d465c0209..c0cc4c23a 100644 --- a/sonic-chassisd/scripts/chassisd +++ b/sonic-chassisd/scripts/chassisd @@ -208,9 +208,10 @@ class ModuleUpdater(logger.Logger): self.chassis_table._del(CHASSIS_INFO_KEY_TEMPLATE.format(1)) if self.asic_table is not None: - asics = list(self.asic_table.getKeys()) - for asic in asics: - self.asic_table._del(asic) + if not self._is_supervisor(): + asics = list(self.asic_table.getKeys()) + for asic in asics: + self.asic_table._del(asic) def modules_num_update(self): # Check if module list is populated diff --git a/sonic-chassisd/tests/test_chassisd.py b/sonic-chassisd/tests/test_chassisd.py index 484fe34a4..80655c50c 100644 --- a/sonic-chassisd/tests/test_chassisd.py +++ b/sonic-chassisd/tests/test_chassisd.py @@ -444,10 +444,8 @@ def verify_fabric_asic(asic_name, asic_pci_address, module_name, asic_id_in_modu midplane_table = module_updater.midplane_table fvs = midplane_table.get(name) assert fvs == None - fvs = fabric_asic_table.get("asic4") - assert fvs == None - fvs = fabric_asic_table.get("asic5") - assert fvs == None + verify_fabric_asic("asic4", "0000:04:00.0", name, "0") + verify_fabric_asic("asic5", "0000:05:00.0", name, "1") def test_signal_handler(): exit_code = 0