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

[action] [PR:529] [PMON][psud] Fix the repeated NOTICE log message on Chassis platform (#529) #561

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sonic-psud/scripts/psud
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ class PsuChassisInfo(logger.Logger):
'PSU supplied power warning: {}W supplied-power less than {}W consumed-power'.format(
self.total_supplied_power, self.total_consumed_power)
)
if self.first_run:
self.first_run = False

return set_led

Expand Down
13 changes: 11 additions & 2 deletions sonic-psud/tests/test_PsuChassisInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ def test_update_master_status(self):

# Test good values while in good state
ret = chassis_info.update_master_status()
assert ret == True
assert ret == False
assert chassis_info.master_status_good == True

# Test unknown total_supplied_power (0.0)
chassis_info.total_supplied_power = 0.0
chassis_info.master_status_good = False
ret = chassis_info.update_master_status()
assert ret == True
assert ret == False
assert chassis_info.master_status_good == False

# Test bad values while in good state
Expand Down Expand Up @@ -282,6 +282,15 @@ def test_first_run(self):
assert ret == True
assert psud.Psu.get_status_master_led() == MockPsu.STATUS_LED_COLOR_RED

# first time with good power usage
chassis_info = psud.PsuChassisInfo(SYSLOG_IDENTIFIER, chassis)
chassis_info.total_supplied_power = 510.0
chassis_info.total_consumed_power = 350.0
ret = chassis_info.update_master_status()
assert ret == True
assert psud.Psu.get_status_master_led() == MockPsu.STATUS_LED_COLOR_GREEN

chassis_info = psud.PsuChassisInfo(SYSLOG_IDENTIFIER, chassis)
chassis_info.total_supplied_power = 510.0
chassis_info.total_consumed_power = 350.0
chassis_info.master_status_good = True
Expand Down
Loading