-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_bootpolicy.robot
154 lines (111 loc) · 5.71 KB
/
test_bootpolicy.robot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
*** Settings ***
Documentation This testsuite is for testing boot policy function.
Resource ../lib/rest_client.robot
Resource ../lib/ipmi_client.robot
Resource ../lib/utils.robot
Suite Setup Open Connection And Log In
Suite Teardown Close All Connections
*** Variables ***
${dbuscmd} = dbus-send --system --print-reply --dest=org.openbmc.settings.Host /org/openbmc/settings/host0 org.freedesktop.DBus.Properties.Get string:"org.openbmc.settings.Host" string:"boot_policy"
*** Test Cases ***
Set Onetime boot policy using REST
[Documentation] This testcase is to set onetime boot policy using REST
... URI and then verify using REST API and ipmitool.\n
Set Boot Policy ONETIME
${boot} = Read Attribute /org/openbmc/settings/host0 boot_policy
Should Be Equal ${boot} ONETIME
# ${output} = Run IPMI Standard command chassis bootparam get 5
Run IPMI command 0x00 0x09 0x05 0x00 0x00
${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
Should Be Empty ${stderr}
Log to Console \n ${output}
Should Contain ${output} ONETIME
Set Permanent boot policy using REST
[Documentation] This testcase is to set permanent boot policy using REST
... URI and then verify using REST API and ipmitool.\n
Set Boot Policy PERMANENT
${boot} = Read Attribute /org/openbmc/settings/host0 boot_policy
Should Be Equal ${boot} PERMANENT
# ${output} = Run IPMI Standard command chassis bootparam get 5
# Should Contain ${output} Options apply to all future boots
Run IPMI command 0x00 0x09 0x05 0x00 0x00
${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
Should Be Empty ${stderr}
Log to Console \n ${output}
Should Contain ${output} PERMANENT
Set Onetime boot policy using IPMITOOL
[Documentation] This testcase is to set boot policy to onetime boot using ipmitool
... and then verify using REST URI and ipmitool.\n
Run IPMI command 0x0 0x8 0x05 0x80 0x00 0x00 0x00 0x00
${boot} = Read Attribute /org/openbmc/settings/host0 boot_policy
Should Be Equal ${boot} ONETIME
# ${output} = Run IPMI Standard command chassis bootparam get 5
# Should Contain ${output} Options apply to only next boot
Run IPMI command 0x00 0x09 0x05 0x00 0x00
${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
Should Be Empty ${stderr}
Log to Console \n ${output}
Should Contain ${output} ONETIME
Set Permanent boot policy using IPMITOOL
[Documentation] This testcase is to set boot policy to permanent using ipmitool
... and then verify using REST URI and ipmitool.
Run IPMI command 0x0 0x8 0x05 0xC0 0x00 0x00 0x00 0x00
${boot} = Read Attribute /org/openbmc/settings/host0 boot_policy
Should Be Equal ${boot} PERMANENT
# ${output} = Run IPMI Standard command chassis bootparam get 5
# Should Contain ${output} Options apply to all future boots
Run IPMI command 0x00 0x09 0x05 0x00 0x00
${output} ${stderr}= Execute Command ${dbuscmd} return_stderr=True
Should Be Empty ${stderr}
Log to Console \n ${output}
Should Contain ${output} PERMANENT
Boot order with permanent boot policy
[Documentation] This testcase is to verify that boot order does not change
... after first boot when boot policy set to permanent
Power Off Host
Set Boot Policy PERMANENT
Set Boot Device CDROM
Power On Host
${boot} = Read Attribute /org/openbmc/settings/host0 boot_policy
Should Be Equal ${boot} PERMANENT
${flag} = Read Attribute /org/openbmc/settings/host0 boot_flags
Should Be Equal ${flag} CDROM
Onetime boot order after warm reset
[Documentation] This testcase is to verify that boot policy and order does not change
... after warm reset on a system with onetime boot policy.
Power On Host
Set Boot Policy ONETIME
Set Boot Device Network
Trigger Warm Reset
${boot} = Read Attribute /org/openbmc/settings/host0 boot_policy
Should Be Equal ${boot} ONETIME
${flag} = Read Attribute /org/openbmc/settings/host0 boot_flags
Should Be Equal ${flag} Network
Permanent boot order after warm reset
[Documentation] This testcase is to verify that boot policy and order does not change
... after warm reset on a system with permanent boot policy.
Power On Host
Set Boot Policy PERMANENT
Set Boot Device CDROM
Trigger Warm Reset
${boot} = Read Attribute /org/openbmc/settings/host0 boot_policy
Should Be Equal ${boot} PERMANENT
${flag} = Read Attribute /org/openbmc/settings/host0 boot_flags
Should Be Equal ${flag} CDROM
Set boot policy to invalid value
[Documentation] This testcase is to verify that proper error message is prompted
... when invalid value to provided to boot policy.
Set Boot Policy abc
${boot} = Read Attribute /org/openbmc/settings/host0 boot_policy
Should Not Be Equal ${boot} abc
*** Keywords ***
Set Boot Policy
[Arguments] ${args}
${bootpolicy} = Set Variable ${args}
${valueDict} = create dictionary data=${bootpolicy}
Write Attribute /org/openbmc/settings/host0 boot_policy data=${valueDict}
Set Boot Device
[Arguments] ${args}
${bootDevice} = Set Variable ${args}
${valueDict} = create dictionary data=${bootDevice}
Write Attribute /org/openbmc/settings/host0 boot_flags data=${valueDict}