blob: 9c41471e5565e749a7978c9f3b70e83b2b74a2ed [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
George Keishing4d6c1da2016-07-15 05:51:22 -05002Documentation This testsuites tests the autorestart policy for
3... OpenBMC project
Chris Austenb29d2e82016-06-07 12:25:35 -05004
George Keishing4d6c1da2016-07-15 05:51:22 -05005Resource ../lib/resource.txt
6Resource ../lib/connection_client.robot
George Keishingd55a4be2016-08-26 03:28:17 -05007Resource ../lib/openbmc_ffdc.robot
Chris Austenb29d2e82016-06-07 12:25:35 -05008
George Keishing4d6c1da2016-07-15 05:51:22 -05009Suite Setup Open Connection And Log In
10Suite Teardown Close All Connections
George Keishingd55a4be2016-08-26 03:28:17 -050011Test Teardown Log FFDC
Chris Austenb29d2e82016-06-07 12:25:35 -050012
13*** Test Cases ***
14Test OpenBMC Services Autorestart Policy
15 [Documentation] This testcases is for checking all the openbmc services
16 ... restart policy is set to active
George Keishingc4f06d732016-09-02 07:06:53 -050017 @{services}= Create List btbridged.service
Chris Austenb29d2e82016-06-07 12:25:35 -050018 ... host-ipmid.service
George Keishingc4f06d732016-09-02 07:06:53 -050019 ... inarp.service
20 ... network.service
21 ... network-update-dns.service
22 ... obmc-console.service
23 ... obmc-hwmon.service
Chris Austenb29d2e82016-06-07 12:25:35 -050024 ... obmc-phosphor-chassisd.service
25 ... obmc-phosphor-event.service
Chris Austenb29d2e82016-06-07 12:25:35 -050026 ... obmc-phosphor-fand.service
27 ... obmc-phosphor-flashd.service
28 ... obmc-phosphor-policyd.service
29 ... obmc-phosphor-sensord.service
30 ... obmc-phosphor-sysd.service
George Keishingc4f06d732016-09-02 07:06:53 -050031 ... obmc-phosphor-user.service
32 ... org.openbmc.buttons.Power.service
33 ... org.openbmc.buttons.reset.service
34 ... org.openbmc.control.BmcFlash.service
35 ... org.openbmc.control.Bmc.service
36 ... org.openbmc.control.Chassis.service
37 ... org.openbmc.control.Checkstop.service
38 ... org.openbmc.control.Fans.service
39 ... org.openbmc.control.Flash.service
40 ... org.openbmc.control.Host.service
41 ... org.openbmc.control.led.service
42 ... org.openbmc.control.Power.service
43 ... org.openbmc.examples.PythonService.service
44 ... org.openbmc.examples.SDBusService.service
45 ... org.openbmc.Inventory.service
46 ... org.openbmc.managers.Download.service
47 ... org.openbmc.managers.System.service
48 ... org.openbmc.ObjectMapper.service
49 ... org.openbmc.Sensors.service
50 ... org.openbmc.watchdog.Host.service
51 ... phosphor-rest.service
Chris Austenb29d2e82016-06-07 12:25:35 -050052 ... rest-dbus.service
George Keishingc4f06d732016-09-02 07:06:53 -050053 ... settings.service
Chris Austenb29d2e82016-06-07 12:25:35 -050054 : FOR ${SERVICE} IN @{services}
55 \ Check Service Autorestart ${SERVICE}
56
George Keishingc4f06d732016-09-02 07:06:53 -050057
Chris Austenb29d2e82016-06-07 12:25:35 -050058Test Restart Policy for openbmc service
59 [Documentation] This testcase will kill the service and make sure it
60 ... does restart after that
George Keishingc4f06d732016-09-02 07:06:53 -050061
62 ${MainPID}= Execute Restart Policy Command
63 ... systemctl -p MainPID show settings.service| cut -d = -f2
Chris Austenb29d2e82016-06-07 12:25:35 -050064 Should Not Be Equal 0 ${MainPID}
George Keishingc4f06d732016-09-02 07:06:53 -050065
66 Execute Restart Policy Command kill -9 ${MainPID}
67 Sleep 30s reason=Wait for service to restart properly
68
69 ${ActiveState}= Execute Restart Policy Command
70 ... systemctl -p ActiveState show settings.service| cut -d = -f2
Chris Austenb29d2e82016-06-07 12:25:35 -050071 Should Be Equal active ${ActiveState}
George Keishingc4f06d732016-09-02 07:06:53 -050072
73 ${MainPID}= Execute Restart Policy Command
74 ... systemctl -p MainPID show settings.service| cut -d = -f2
Chris Austenb29d2e82016-06-07 12:25:35 -050075 Should Not Be Equal 0 ${MainPID}
76
George Keishingc4f06d732016-09-02 07:06:53 -050077
Chris Austenb29d2e82016-06-07 12:25:35 -050078*** Keywords ***
George Keishingc4f06d732016-09-02 07:06:53 -050079
Chris Austenb29d2e82016-06-07 12:25:35 -050080Check Service Autorestart
81 [arguments] ${servicename}
George Keishingc4f06d732016-09-02 07:06:53 -050082 ${restart_policy}=
83 ... Execute Restart Policy Command
84 ... systemctl -p Restart show ${servicename} | cut -d = -f2
85 Should Be Equal always ${restart_policy}
86 ... msg=restart policy is not always for ${servicename}
Chris Austenb29d2e82016-06-07 12:25:35 -050087
George Keishingc4f06d732016-09-02 07:06:53 -050088
89Execute Restart Policy Command
Chris Austenb29d2e82016-06-07 12:25:35 -050090 [arguments] ${command}
George Keishingc4f06d732016-09-02 07:06:53 -050091 ${stdout} ${stderr} = Execute Command ${command} return_stderr=True
92 Should Be Empty ${stderr}
93 [Return] ${stdout}