Skip to content

Commit

Permalink
Improving coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
rameshraghupathy committed Oct 1, 2024
1 parent 4b200c7 commit 49868a5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
5 changes: 1 addition & 4 deletions sonic-chassisd/scripts/chassisd
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ class ChassisdDaemon(daemon_base.DaemonBase):
self.log_warning("Caught unhandled signal '{}' - ignoring...".format(SIGNALS_TO_NAMES_DICT[sig]))

def set_initial_dpu_admin_state(self):
"""Send set_admit_state trigger once to modules those are UP."""
"""Send admin_state trigger once to modules those are powered up"""
lock = threading.Lock()
threads = []
for module_index in range(0, self.module_updater.num_modules):
Expand Down Expand Up @@ -975,15 +975,12 @@ class ChassisdDaemon(daemon_base.DaemonBase):

# Start configuration manager task on supervisor module
if self.smartswitch:
self.log_info("smartswitch loop")
config_manager = SmartSwitchConfigManagerTask()
config_manager.task_run()
elif self.module_updater.supervisor_slot == self.module_updater.my_slot:
self.log_info("Non smartswitch loop")
config_manager = ConfigManagerTask()
config_manager.task_run()
else:
self.log_info("None loop")
config_manager = None

# Start main loop
Expand Down
13 changes: 13 additions & 0 deletions sonic-chassisd/tests/test_chassisd.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,19 @@ def test_signal_handler():
def test_daemon_run_smartswitch():
# Test the chassisd run
chassis = MockSmartSwitchChassis()

#DPU0
index = 0
name = "DPU0"
desc = "DPU Module 0"
slot = 0
sup_slot = 0
serial = "DPU0-0000"
module_type = ModuleBase.MODULE_TYPE_DPU
module = MockModule(index, name, desc, module_type, slot, serial)
module.set_midplane_ip()
chassis.module_list.append(module)

daemon_chassisd = ChassisdDaemon(SYSLOG_IDENTIFIER)
daemon_chassisd.stop = MagicMock()
daemon_chassisd.stop.wait.return_value = True
Expand Down

0 comments on commit 49868a5

Please sign in to comment.