Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
George Keishing | ede3000 | 2017-02-02 09:33:07 -0600 | [diff] [blame] | 2 | Documentation Verify Auto Restart policy for set of mission critical |
| 3 | ... services needed for functioning on BMC. |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 4 | |
George Keishing | 4422e2b | 2019-11-27 03:55:53 -0600 | [diff] [blame] | 5 | Resource ../../lib/resource.robot |
| 6 | Resource ../../lib/connection_client.robot |
| 7 | Resource ../../lib/openbmc_ffdc.robot |
| 8 | Resource ../../lib/utils.robot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 9 | |
George Keishing | ede3000 | 2017-02-02 09:33:07 -0600 | [diff] [blame] | 10 | Suite Setup Open Connection And Log In |
| 11 | Suite Teardown Close All Connections |
| 12 | Test Teardown FFDC On Test Case Fail |
| 13 | |
| 14 | *** Variables *** |
| 15 | ${LOG_SERVICE} xyz.openbmc_project.Logging.service |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 16 | |
| 17 | *** Test Cases *** |
George Keishing | ede3000 | 2017-02-02 09:33:07 -0600 | [diff] [blame] | 18 | |
| 19 | Verify OpenBMC Services Auto Restart Policy |
| 20 | [Documentation] Kill active services and expect auto restart. |
| 21 | [Tags] Verify_OpenBMC_Services_Auto_Restart_Policy |
Gunnar Mills | 917ba1a | 2018-04-08 16:42:12 -0500 | [diff] [blame] | 22 | # The services listed below restart policy should be "always" |
George Keishing | ede3000 | 2017-02-02 09:33:07 -0600 | [diff] [blame] | 23 | # 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 Singh | a125de8 | 2020-06-30 13:36:52 -0500 | [diff] [blame] | 32 | FOR ${SERVICE} IN @{services} |
| 33 | Check Service Autorestart ${SERVICE} |
| 34 | END |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 35 | |
George Keishing | c4f06d73 | 2016-09-02 07:06:53 -0500 | [diff] [blame] | 36 | |
George Keishing | ede3000 | 2017-02-02 09:33:07 -0600 | [diff] [blame] | 37 | Kill Services And Expect Service Restart |
| 38 | [Documentation] Kill the service and it must restart. |
| 39 | [Tags] Kill_Services_And_Expect_Service_Restart |
George Keishing | c4f06d73 | 2016-09-02 07:06:53 -0500 | [diff] [blame] | 40 | |
George Keishing | ede3000 | 2017-02-02 09:33:07 -0600 | [diff] [blame] | 41 | # 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 Keishing | c4f06d73 | 2016-09-02 07:06:53 -0500 | [diff] [blame] | 45 | |
George Keishing | ede3000 | 2017-02-02 09:33:07 -0600 | [diff] [blame] | 46 | ${ActiveState}= Get Service Attribute ActiveState ${LOG_SERVICE} |
| 47 | Should Be Equal active ${ActiveState} |
| 48 | ... msg=Logging Service not in active state. |
George Keishing | c4f06d73 | 2016-09-02 07:06:53 -0500 | [diff] [blame] | 49 | |
Joy Onyerikwu | b992261 | 2018-05-14 12:36:57 -0500 | [diff] [blame] | 50 | BMC Execute Command kill -9 ${MainPID} |
George Keishing | ede3000 | 2017-02-02 09:33:07 -0600 | [diff] [blame] | 51 | Sleep 10s reason=Wait for service to restart. |
George Keishing | c4f06d73 | 2016-09-02 07:06:53 -0500 | [diff] [blame] | 52 | |
George Keishing | ede3000 | 2017-02-02 09:33:07 -0600 | [diff] [blame] | 53 | ${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 Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 60 | |
George Keishing | c4f06d73 | 2016-09-02 07:06:53 -0500 | [diff] [blame] | 61 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 62 | *** Keywords *** |
George Keishing | c4f06d73 | 2016-09-02 07:06:53 -0500 | [diff] [blame] | 63 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 64 | Check Service Autorestart |
George Keishing | ede3000 | 2017-02-02 09:33:07 -0600 | [diff] [blame] | 65 | [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} |