blob: 8c42028162765f42036e57c9afe19c2174ea9589 [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 Keishing7949e472016-09-22 11:35:05 -050017 ... Disabling this test as use case is not well define and
18 ... developement point of view this may keep changing. So
19 ... untill then, this remains commented piece of test.
20 [Tags] Test_OpenBMC_Services_Autorestart_Policy
George Keishingc4f06d732016-09-02 07:06:53 -050021 @{services}= Create List btbridged.service
Chris Austenb29d2e82016-06-07 12:25:35 -050022 ... host-ipmid.service
George Keishingc4f06d732016-09-02 07:06:53 -050023 ... inarp.service
24 ... network.service
25 ... network-update-dns.service
26 ... obmc-console.service
27 ... obmc-hwmon.service
Chris Austenb29d2e82016-06-07 12:25:35 -050028 ... obmc-phosphor-chassisd.service
29 ... obmc-phosphor-event.service
Chris Austenb29d2e82016-06-07 12:25:35 -050030 ... obmc-phosphor-fand.service
31 ... obmc-phosphor-flashd.service
32 ... obmc-phosphor-policyd.service
33 ... obmc-phosphor-sensord.service
34 ... obmc-phosphor-sysd.service
George Keishingc4f06d732016-09-02 07:06:53 -050035 ... obmc-phosphor-user.service
36 ... org.openbmc.buttons.Power.service
37 ... org.openbmc.buttons.reset.service
38 ... org.openbmc.control.BmcFlash.service
39 ... org.openbmc.control.Bmc.service
40 ... org.openbmc.control.Chassis.service
41 ... org.openbmc.control.Checkstop.service
42 ... org.openbmc.control.Fans.service
43 ... org.openbmc.control.Flash.service
44 ... org.openbmc.control.Host.service
45 ... org.openbmc.control.led.service
46 ... org.openbmc.control.Power.service
47 ... org.openbmc.examples.PythonService.service
48 ... org.openbmc.examples.SDBusService.service
49 ... org.openbmc.Inventory.service
50 ... org.openbmc.managers.Download.service
51 ... org.openbmc.managers.System.service
52 ... org.openbmc.ObjectMapper.service
53 ... org.openbmc.Sensors.service
54 ... org.openbmc.watchdog.Host.service
55 ... phosphor-rest.service
Chris Austenb29d2e82016-06-07 12:25:35 -050056 ... rest-dbus.service
George Keishingc4f06d732016-09-02 07:06:53 -050057 ... settings.service
Chris Austenb29d2e82016-06-07 12:25:35 -050058 : FOR ${SERVICE} IN @{services}
59 \ Check Service Autorestart ${SERVICE}
60
George Keishingc4f06d732016-09-02 07:06:53 -050061
Chris Austenb29d2e82016-06-07 12:25:35 -050062Test Restart Policy for openbmc service
63 [Documentation] This testcase will kill the service and make sure it
64 ... does restart after that
George Keishingc4f06d732016-09-02 07:06:53 -050065
66 ${MainPID}= Execute Restart Policy Command
67 ... systemctl -p MainPID show settings.service| cut -d = -f2
Chris Austenb29d2e82016-06-07 12:25:35 -050068 Should Not Be Equal 0 ${MainPID}
George Keishingc4f06d732016-09-02 07:06:53 -050069
70 Execute Restart Policy Command kill -9 ${MainPID}
71 Sleep 30s reason=Wait for service to restart properly
72
73 ${ActiveState}= Execute Restart Policy Command
74 ... systemctl -p ActiveState show settings.service| cut -d = -f2
Chris Austenb29d2e82016-06-07 12:25:35 -050075 Should Be Equal active ${ActiveState}
George Keishingc4f06d732016-09-02 07:06:53 -050076
77 ${MainPID}= Execute Restart Policy Command
78 ... systemctl -p MainPID show settings.service| cut -d = -f2
Chris Austenb29d2e82016-06-07 12:25:35 -050079 Should Not Be Equal 0 ${MainPID}
80
George Keishingc4f06d732016-09-02 07:06:53 -050081
Chris Austenb29d2e82016-06-07 12:25:35 -050082*** Keywords ***
George Keishingc4f06d732016-09-02 07:06:53 -050083
Chris Austenb29d2e82016-06-07 12:25:35 -050084Check Service Autorestart
85 [arguments] ${servicename}
George Keishingc4f06d732016-09-02 07:06:53 -050086 ${restart_policy}=
87 ... Execute Restart Policy Command
88 ... systemctl -p Restart show ${servicename} | cut -d = -f2
89 Should Be Equal always ${restart_policy}
90 ... msg=restart policy is not always for ${servicename}
Chris Austenb29d2e82016-06-07 12:25:35 -050091
George Keishingc4f06d732016-09-02 07:06:53 -050092
93Execute Restart Policy Command
Chris Austenb29d2e82016-06-07 12:25:35 -050094 [arguments] ${command}
George Keishingc4f06d732016-09-02 07:06:53 -050095 ${stdout} ${stderr} = Execute Command ${command} return_stderr=True
96 Should Be Empty ${stderr}
97 [Return] ${stdout}