Skip to content

Commit

Permalink
Store asic PCI ID in CHASSIS_STATE_DB and delete table at deinit()
Browse files Browse the repository at this point in the history
Signed-off-by: ngocdo <ngocdo@arista.com>
  • Loading branch information
ngoc-do committed May 19, 2021
1 parent 62a9ee6 commit fcc9c90
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sonic-chassisd/scripts/chassisd
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,15 @@ class ModuleUpdater(logger.Logger):
state_db = daemon_base.db_connect("STATE_DB")
self.chassis_table = swsscommon.Table(state_db, CHASSIS_INFO_TABLE)
self.module_table = swsscommon.Table(state_db, CHASSIS_MODULE_INFO_TABLE)
self.asic_table = swsscommon.Table(state_db, CHASSIS_ASIC_INFO_TABLE)
self.midplane_table = swsscommon.Table(state_db, CHASSIS_MIDPLANE_INFO_TABLE)
self.info_dict_keys = [CHASSIS_MODULE_INFO_NAME_FIELD,
CHASSIS_MODULE_INFO_DESC_FIELD,
CHASSIS_MODULE_INFO_SLOT_FIELD,
CHASSIS_MODULE_INFO_OPERSTATUS_FIELD]

chassis_state_db = daemon_base.db_connect("CHASSIS_STATE_DB")
self.asic_table = swsscommon.Table(chassis_state_db, CHASSIS_ASIC_INFO_TABLE)

self.midplane_initialized = try_get(chassis.init_midplane_switch, default=False)
if not self.midplane_initialized:
self.log_error("Chassisd midplane intialization failed")
Expand All @@ -190,6 +192,10 @@ class ModuleUpdater(logger.Logger):
if self.chassis_table is not None:
self.chassis_table._del(CHASSIS_INFO_KEY_TEMPLATE.format(1))

if self.asic_table is not None:
for key in self.asic_table.getKeys():
self.asic_table.delete(key)

def modules_num_update(self):
# Check if module list is populated
num_modules = self.chassis.get_num_modules()
Expand Down

0 comments on commit fcc9c90

Please sign in to comment.