blob: 3b72fe104898426269ca0150df88b2987983910f [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
George Keishingede30002017-02-02 09:33:07 -06002Documentation Verify Auto Restart policy for set of mission critical
3... services needed for functioning on BMC.
Chris Austenb29d2e82016-06-07 12:25:35 -05004
George Keishing4422e2b2019-11-27 03:55:53 -06005Resource ../../lib/resource.robot
6Resource ../../lib/connection_client.robot
7Resource ../../lib/openbmc_ffdc.robot
8Resource ../../lib/utils.robot
Chris Austenb29d2e82016-06-07 12:25:35 -05009
George Keishingede30002017-02-02 09:33:07 -060010Suite Setup Open Connection And Log In
11Suite Teardown Close All Connections
12Test Teardown FFDC On Test Case Fail
13
14*** Variables ***
15${LOG_SERVICE} xyz.openbmc_project.Logging.service
Chris Austenb29d2e82016-06-07 12:25:35 -050016
17*** Test Cases ***
George Keishingede30002017-02-02 09:33:07 -060018
19Verify OpenBMC Services Auto Restart Policy
20 [Documentation] Kill active services and expect auto restart.
21 [Tags] Verify_OpenBMC_Services_Auto_Restart_Policy
Gunnar Mills917ba1a2018-04-08 16:42:12 -050022 # The services listed below restart policy should be "always"
George Keishingede30002017-02-02 09:33:07 -060023 # Command output:
24 # systemctl -p Restart show xyz.openbmc_project.Logging.service | cat
25 # Restart=always
26 @{services}=
27 ... Create List xyz.openbmc_project.Logging.service
28 ... xyz.openbmc_project.ObjectMapper.service
29 ... xyz.openbmc_project.State.BMC.service
30 ... xyz.openbmc_project.State.Chassis.service
31 ... xyz.openbmc_project.State.Host.service
Sushil Singha125de82020-06-30 13:36:52 -050032 FOR ${SERVICE} IN @{services}
33 Check Service Autorestart ${SERVICE}
34 END
Chris Austenb29d2e82016-06-07 12:25:35 -050035
George Keishingc4f06d732016-09-02 07:06:53 -050036
George Keishingede30002017-02-02 09:33:07 -060037Kill Services And Expect Service Restart
38 [Documentation] Kill the service and it must restart.
39 [Tags] Kill_Services_And_Expect_Service_Restart
George Keishingc4f06d732016-09-02 07:06:53 -050040
George Keishingede30002017-02-02 09:33:07 -060041 # Get the MainPID and service state.
42 ${MainPID}= Get Service Attribute MainPID ${LOG_SERVICE}
43 Should Not Be Equal ${0} ${MainPID}
44 ... msg=Logging service not restarted.
George Keishingc4f06d732016-09-02 07:06:53 -050045
George Keishingede30002017-02-02 09:33:07 -060046 ${ActiveState}= Get Service Attribute ActiveState ${LOG_SERVICE}
47 Should Be Equal active ${ActiveState}
48 ... msg=Logging Service not in active state.
George Keishingc4f06d732016-09-02 07:06:53 -050049
Joy Onyerikwub9922612018-05-14 12:36:57 -050050 BMC Execute Command kill -9 ${MainPID}
George Keishingede30002017-02-02 09:33:07 -060051 Sleep 10s reason=Wait for service to restart.
George Keishingc4f06d732016-09-02 07:06:53 -050052
George Keishingede30002017-02-02 09:33:07 -060053 ${MainPID}= Get Service Attribute MainPID ${LOG_SERVICE}
54 Should Not Be Equal ${0} ${MainPID}
55 ... msg=Logging service not restarted.
56
57 ${ActiveState}= Get Service Attribute ActiveState ${LOG_SERVICE}
58 Should Be Equal active ${ActiveState}
59 ... msg=Logging service not in active state.
Chris Austenb29d2e82016-06-07 12:25:35 -050060
George Keishingc4f06d732016-09-02 07:06:53 -050061
Chris Austenb29d2e82016-06-07 12:25:35 -050062*** Keywords ***
George Keishingc4f06d732016-09-02 07:06:53 -050063
Chris Austenb29d2e82016-06-07 12:25:35 -050064Check Service Autorestart
George Keishingede30002017-02-02 09:33:07 -060065 [Documentation] Check if given policy is "always".
66 [Arguments] ${servicename}
67 # servicename Qualified service name
68 ${restart_policy}= Get Service Attribute Restart ${servicename}
69 Should Be Equal always ${restart_policy}
70 ... msg=Incorrect policy for ${servicename}