sonic-buildimage/platform/marvell-arm64/sonic-platform-nokia/7215/scripts/cpu_wdt.py
Pavan-Nokia d4ca86bf9d
[Nokia-7215-A1]Update Nokia-7215-A1 Platform (#18147)
1) Update Nokia-7215-A1 platform to address UT and OC test failures
2) Enable watchdog service
3) EZB files for SAI upgrade
2024-03-04 10:53:00 -08:00

47 lines
984 B
Python
Executable File

#!/usr/bin/python
from sonic_platform.chassis import Chassis
from sonic_py_common import logger
import time
import os
import signal
import sys
TIMEOUT=180
KEEPALIVE=60
sonic_logger = logger.Logger('Watchdog')
sonic_logger.set_min_log_priority_info()
time.sleep(60)
chassis = Chassis()
watchdog = chassis.get_watchdog()
def stopWdtService(signal, frame):
watchdog._disablewatchdog()
sonic_logger.log_notice("CPUWDT Disabled: watchdog armed=%s" % watchdog.is_armed() )
sys.exit()
def main():
signal.signal(signal.SIGHUP, signal.SIG_IGN)
signal.signal(signal.SIGINT, stopWdtService)
signal.signal(signal.SIGTERM, stopWdtService)
watchdog.arm(TIMEOUT)
sonic_logger.log_notice("CPUWDT Enabled: watchdog armed=%s" % watchdog.is_armed() )
while True:
time.sleep(KEEPALIVE)
watchdog._keepalive()
sonic_logger.log_info("CPUWDT keepalive")
done
stopWdtService
return
if __name__ == '__main__':
main()