blob: 19d211d413ee9b0f07af4c3bc809c86751ea5c45 [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
2
3Documentation This testsuite is for testing boot policy function.
4
George Keishing4d6c1da2016-07-15 05:51:22 -05005Resource ../lib/rest_client.robot
6Resource ../lib/ipmi_client.robot
7Resource ../lib/utils.robot
Sivas SRRe1143ae2016-08-26 22:31:02 -05008Resource ../lib/openbmc_ffdc.robot
Chris Austenb29d2e82016-06-07 12:25:35 -05009
George Keishing4d6c1da2016-07-15 05:51:22 -050010Suite Setup Open Connection And Log In
11Suite Teardown Close All Connections
Sivas SRRe1143ae2016-08-26 22:31:02 -050012Test Setup Initialize DBUS cmd "boot_policy"
Gunnar Millseac1af22016-11-14 15:30:09 -060013Test Teardown FFDC On Test Case Fail
Chris Austenb29d2e82016-06-07 12:25:35 -050014
15*** Variables ***
George Keishingec807372016-12-05 03:54:51 -060016${HOST_SETTINGS} ${SETTINGS_URI}host0
Chris Austenb29d2e82016-06-07 12:25:35 -050017
18*** Test Cases ***
19
George Keishingbc7cc582017-01-23 12:58:34 -060020Set Boot Policy To ONETIME via REST
21 [Documentation] Set boot policy to ONETIME using REST URI and verify
22 ... using ipmitool.
23 [Tags] Set_Boot_Policy_To_ONETIME_via_REST
George Keishing314cf852016-08-26 09:02:16 -050024
Chris Austenb29d2e82016-06-07 12:25:35 -050025 Set Boot Policy ONETIME
26
George Keishingec807372016-12-05 03:54:51 -060027 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050028 Should Be Equal ${boot} ONETIME
Sivas SRRe1143ae2016-08-26 22:31:02 -050029 ${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
30 Should Be Empty ${stderr}
31 Should Contain ${output} ONETIME
Chris Austenb29d2e82016-06-07 12:25:35 -050032
George Keishingbc7cc582017-01-23 12:58:34 -060033Set Boot Policy To PERMANENT via REST
34 [Documentation] Set boot policy to PERMANENT via REST URI and verify
35 ... using ipmitool.
36 [Tags] Set_Boot_Policy_To_PERMANENT_via_REST
Chris Austenb29d2e82016-06-07 12:25:35 -050037
38 Set Boot Policy PERMANENT
39
George Keishingec807372016-12-05 03:54:51 -060040 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050041 Should Be Equal ${boot} PERMANENT
Sivas SRRe1143ae2016-08-26 22:31:02 -050042 ${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
43 Should Be Empty ${stderr}
44 Should Contain ${output} PERMANENT
Chris Austenb29d2e82016-06-07 12:25:35 -050045
George Keishingbc7cc582017-01-23 12:58:34 -060046Set Boot Policy To ONETIME via IPMITOOL
47 [Documentation] Set boot policy to ONETIME via ipmitool and verify
48 ... using REST URI.
49 [Tags] Set_Boot_Policy_To_ONETIME_via_IPMITOOL
Chris Austenb29d2e82016-06-07 12:25:35 -050050
George Keishingbc7cc582017-01-23 12:58:34 -060051 Run IPMI command 0x0 0x8 0x05 0x80 0x00 0x00 0x00 0x00
George Keishingec807372016-12-05 03:54:51 -060052 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050053 Should Be Equal ${boot} ONETIME
Sivas SRRe1143ae2016-08-26 22:31:02 -050054 ${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
55 Should Be Empty ${stderr}
56 Should Contain ${output} ONETIME
George Keishing314cf852016-08-26 09:02:16 -050057
George Keishingbc7cc582017-01-23 12:58:34 -060058Set Boot Policy To PERMANENT via IPMITOOL
59 [Documentation] Set boot policy to PERMANENT via ipmitool and verify
60 ... using REST URI.
61 [Tags] Set_Boot_Policy_To_PERMANENT_via_IPMITOOL
Chris Austenb29d2e82016-06-07 12:25:35 -050062
63 Run IPMI command 0x0 0x8 0x05 0xC0 0x00 0x00 0x00 0x00
George Keishingec807372016-12-05 03:54:51 -060064 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050065 Should Be Equal ${boot} PERMANENT
Sivas SRRe1143ae2016-08-26 22:31:02 -050066 ${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
67 Should Be Empty ${stderr}
68 Should Contain ${output} PERMANENT
Chris Austenb29d2e82016-06-07 12:25:35 -050069
George Keishingbc7cc582017-01-23 12:58:34 -060070Test Boot Order via REST
71 [Documentation] Set boot policy to PERMANENT and boot device to CDROM
72 ... and verify that the order doesn't change post power on.
73 [Tags] chassisboot Test_Boot_Order_via_REST
Chris Austenb29d2e82016-06-07 12:25:35 -050074
root442f0ef2016-08-04 20:23:05 +000075 Initiate Power Off
Chris Austenb29d2e82016-06-07 12:25:35 -050076
77 Set Boot Policy PERMANENT
78
79 Set Boot Device CDROM
80
root442f0ef2016-08-04 20:23:05 +000081 Initiate Power On
Chris Austenb29d2e82016-06-07 12:25:35 -050082
George Keishingec807372016-12-05 03:54:51 -060083 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -050084 Should Be Equal ${boot} PERMANENT
85
George Keishingec807372016-12-05 03:54:51 -060086 ${flag}= Read Attribute ${HOST_SETTINGS} boot_flags
Chris Austenb29d2e82016-06-07 12:25:35 -050087 Should Be Equal ${flag} CDROM
88
George Keishingd3206882016-11-29 04:41:14 -060089Persist ONETIME Boot Policy After Reset
90 [Documentation] Verify ONETIME boot policy order does not change
91 ... on warm reset.
Sridevi Rameshb4e67952017-01-19 00:58:10 -060092 [Tags] chassisboot Persist_ONETIME_Boot_Policy_After_Reset
causten147f5752016-08-11 16:24:45 -050093
root442f0ef2016-08-04 20:23:05 +000094 Initiate Power On
Chris Austenb29d2e82016-06-07 12:25:35 -050095
96 Set Boot Policy ONETIME
97
98 Set Boot Device Network
99
100 Trigger Warm Reset
101
George Keishingec807372016-12-05 03:54:51 -0600102 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -0500103 Should Be Equal ${boot} ONETIME
104
George Keishingec807372016-12-05 03:54:51 -0600105 ${flag}= Read Attribute ${HOST_SETTINGS} boot_flags
Chris Austenb29d2e82016-06-07 12:25:35 -0500106 Should Be Equal ${flag} Network
107
George Keishingd3206882016-11-29 04:41:14 -0600108Persist PERMANENT Boot Policy After Reset
109 [Documentation] Verify PERMANENT boot policy order does not change
110 ... on warm reset.
111 [Tags] chassisboot Persist_PERMANENT_Boot_Policy_After_Reset
Chris Austenb29d2e82016-06-07 12:25:35 -0500112
root442f0ef2016-08-04 20:23:05 +0000113 Initiate Power On
Chris Austenb29d2e82016-06-07 12:25:35 -0500114
115 Set Boot Policy PERMANENT
116
117 Set Boot Device CDROM
118
119 Trigger Warm Reset
120
George Keishingec807372016-12-05 03:54:51 -0600121 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
Chris Austenb29d2e82016-06-07 12:25:35 -0500122 Should Be Equal ${boot} PERMANENT
123
George Keishingec807372016-12-05 03:54:51 -0600124 ${flag}= Read Attribute ${HOST_SETTINGS} boot_flags
Chris Austenb29d2e82016-06-07 12:25:35 -0500125 Should Be Equal ${flag} CDROM
George Keishing314cf852016-08-26 09:02:16 -0500126
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600127Set Boot Policy To Invalid Value
George Keishing5f62a4a2016-11-16 02:09:17 -0600128 [Documentation] This testcase verify that the boot policy doesn't get
129 ... updated with invalid policy supplied by user.
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600130 [Tags] Set_Boot_Policy_To_Invalid_Value
George Keishing314cf852016-08-26 09:02:16 -0500131
George Keishing5f62a4a2016-11-16 02:09:17 -0600132 Run Keyword and Ignore Error Set Boot Policy abc
Chris Austenb29d2e82016-06-07 12:25:35 -0500133
George Keishingec807372016-12-05 03:54:51 -0600134 ${boot}= Read Attribute ${HOST_SETTINGS} boot_policy
George Keishing314cf852016-08-26 09:02:16 -0500135 Should Not Be Equal ${boot} abc
136
Chris Austenb29d2e82016-06-07 12:25:35 -0500137*** Keywords ***
138
139Set Boot Policy
140 [Arguments] ${args}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600141 ${bootpolicy}= Set Variable ${args}
142 ${valueDict}= create dictionary data=${bootpolicy}
George Keishingec807372016-12-05 03:54:51 -0600143 Write Attribute ${HOST_SETTINGS} boot_policy data=${valueDict}
Chris Austenb29d2e82016-06-07 12:25:35 -0500144
145Set Boot Device
146 [Arguments] ${args}
George Keishingec807372016-12-05 03:54:51 -0600147 ${bootDevice} = Set Variable ${args}
148 ${valueDict} = create dictionary data=${bootDevice}
149 Write Attribute ${HOST_SETTINGS} boot_flags data=${valueDict}
Sivas SRRe1143ae2016-08-26 22:31:02 -0500150
151
152