Skip to content

Commit

Permalink
Trying to please test_chassisd.py
Browse files Browse the repository at this point in the history
  • Loading branch information
rameshraghupathy committed Jun 5, 2024
1 parent 60cb8ed commit 4f9d602
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions sonic-chassisd/scripts/chassisd
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ class ModuleUpdater(logger.Logger):
super(ModuleUpdater, self).__init__(log_identifier)

self.chassis = chassis
self.smartswitch = self.chassis.is_smartswitch()
self.my_slot = my_slot
self.supervisor_slot = supervisor_slot
self.num_modules = self.chassis.get_num_modules()
Expand All @@ -203,7 +204,7 @@ class ModuleUpdater(logger.Logger):

self.chassis_state_db = daemon_base.db_connect("CHASSIS_STATE_DB")

if not self.chassis.is_smartswitch():
if not self.smartswitch:
if self._is_supervisor():
self.asic_table = swsscommon.Table(self.chassis_state_db,
CHASSIS_FABRIC_ASIC_INFO_TABLE)
Expand Down Expand Up @@ -305,7 +306,7 @@ class ModuleUpdater(logger.Logger):
prev_status = self.get_module_current_status(key)
self.module_table.set(key, fvs)

if not self.chassis.is_smartswitch():
if not self.smartswitch:
# Construct key for down_modules dict. Example down_modules key format: LINE-CARD0|<hostname>
fvs = self.hostname_table.get(key)
if isinstance(fvs, list) and fvs[0] is True:
Expand Down Expand Up @@ -349,7 +350,7 @@ class ModuleUpdater(logger.Logger):
(CHASSIS_ASIC_ID_IN_MODULE_FIELD, str(asic_id))])
self.asic_table.set(asic_key, asic_fvs)

if not self.chassis.is_smartswitch():
if not self.smartswitch:
# In line card push the hostname of the module and num_asics to the chassis state db.
# The hostname is used as key to access chassis app db entries
if not self._is_supervisor():
Expand Down Expand Up @@ -394,7 +395,7 @@ class ModuleUpdater(logger.Logger):
return module_info_dict

def _is_supervisor(self):
if self.chassis.is_smartswitch():
if self.smartswitch:
return False

if self.my_slot == self.supervisor_slot:
Expand Down Expand Up @@ -436,7 +437,7 @@ class ModuleUpdater(logger.Logger):
index += 1

# Skip for SmartSwitch
if not self.chassis.is_smartswitch():
if not self.smartswitch:
# Skip fabric cards
if module.get_type() == ModuleBase.MODULE_TYPE_FABRIC:
continue
Expand Down Expand Up @@ -556,7 +557,7 @@ class ModuleUpdater(logger.Logger):


def module_down_chassis_db_cleanup(self):
if self._is_supervisor() == False or self.chassis.is_smartswitch():
if self._is_supervisor() == False or self.smartswitch:
return
time_now = time.time()
for module in self.down_modules:
Expand Down Expand Up @@ -676,7 +677,7 @@ class ChassisdDaemon(daemon_base.DaemonBase):
self.log_error("Chassisd not supported for this platform")
sys.exit(CHASSIS_NOT_SUPPORTED)

smartswitch = self.module_updater.chassis.is_smartswitch()
smartswitch = self.module_updater.smartswitch
sup_slot = self.module_updater.supervisor_slot
my_slot = self.module_updater.my_slot

Expand Down

0 comments on commit 4f9d602

Please sign in to comment.