blob: 880283b589f237b3a0faeef8b4f12a2370c94f12 [file] [log] [blame]
Rahul Maheshwari07d91d22019-07-31 01:12:05 -05001*** Settings ***
2
3Documentation Module to test IPMI chassis functionality.
4Resource ../lib/ipmi_client.robot
5Resource ../lib/openbmc_ffdc.robot
George Keishing6f395fd2021-08-18 02:18:53 -05006Resource ../lib/boot_utils.robot
Rahul Maheshwarif724a002020-02-21 05:17:02 -06007Library ../lib/ipmi_utils.py
chithragf4595402022-03-30 16:35:03 +00008Variables ../data/ipmi_raw_cmd_table.py
Rahul Maheshwari07d91d22019-07-31 01:12:05 -05009
George Keishing2d0edad2021-08-18 11:44:10 -050010Suite Setup Redfish.Login
11Suite Teardown Redfish.Logout
chithragf4595402022-03-30 16:35:03 +000012Test Teardown Test Teardown Execution
13
Rahul Maheshwari07d91d22019-07-31 01:12:05 -050014
15*** Test Cases ***
16
17IPMI Chassis Status On
18 [Documentation] This test case verfies system power on status
19 ... using IPMI Get Chassis status command.
20 [Tags] IPMI_Chassis_Status_On
21
22 Redfish Power On stack_mode=skip quiet=1
23 ${resp}= Run IPMI Standard Command chassis status
24 ${power_status}= Get Lines Containing String ${resp} System Power
25 Should Contain ${power_status} on
26
27IPMI Chassis Status Off
28 [Documentation] This test case verfies system power off status
29 ... using IPMI Get Chassis status command.
30 [Tags] IPMI_Chassis_Status_Off
31
32 Redfish Power Off stack_mode=skip quiet=1
33 ${resp}= Run IPMI Standard Command chassis status
34 ${power_status}= Get Lines Containing String ${resp} System Power
35 Should Contain ${power_status} off
Sushma M M1cc21272020-01-05 23:47:46 -060036
37Verify Host PowerOff Via IPMI
38 [Documentation] Verify host power off operation using external IPMI command.
39 [Tags] Verify_Host_PowerOff_Via_IPMI
40
41 IPMI Power Off
42 ${ipmi_state}= Get Host State Via External IPMI
43 Valid Value ipmi_state ['off']
44
45Verify Host PowerOn Via IPMI
46 [Documentation] Verify host power on operation using external IPMI command.
47 [Tags] Verify_Host_PowerOn_Via_IPMI
48
49 IPMI Power On
50 ${ipmi_state}= Get Host State Via External IPMI
Rahul Maheshwari460778d2020-02-23 22:37:22 -060051 Valid Value ipmi_state ['on']
52
53
54Verify Soft Shutdown
55 [Documentation] Verify host OS shutdown softly via IPMI command.
George Keishingfba5ad92021-11-08 02:52:35 -060056 [Tags] Verify_Soft_Shutdown
Rahul Maheshwari460778d2020-02-23 22:37:22 -060057
58 Redfish Power On stack_mode=skip
59 Run IPMI Standard Command chassis power soft
60 Wait Until Keyword Succeeds 3 min 10 sec Is Host Off Via IPMI
61
Rahul Maheshwarif724a002020-02-21 05:17:02 -060062
chithragf4595402022-03-30 16:35:03 +000063Verify Chassis Power Cycle And Check Chassis Status Via IPMI
64 [Documentation] Verify chassis power Cycle operation and check the Chassis Power Status using external IPMI command.
65 [Tags] Verify_Chassis_Power_Cycle_And_Check_Chassis_Status_Via_IPMI
66
67 # Chassis power cycle command via IPMI
68 IPMI Power Cycle
69 ${ipmi_state}= Get Host State Via External IPMI
70 Valid Value ipmi_state ['on']
71
72
73Verify Chassis Power Reset And Check Chassis Status Via IPMI
74 [Documentation] Verify chassis power Reset operation and check the Chassis Power Status using external IPMI command.
75 [Tags] Verify_Chassis_Power_Reset_And_Check_Chassis_Status_Via_IPMI
76
77 # Chassis power reset command via IPMI
78 IPMI Power Reset
79 ${ipmi_state}= Get Host State Via External IPMI
80 Valid Value ipmi_state ['on']
81
82
Rahul Maheshwarif724a002020-02-21 05:17:02 -060083Verify Chassis Power Policy
84 [Documentation] Verify setting chassis power policy via IPMI command.
85 [Tags] Verify_Chassis_Power_Policy
86 [Setup] Test Setup Execution
87 [Teardown] Run Keywords FFDC On Test Case Fail AND
88 ... Run IPMI Standard Command chassis policy ${initial_power_policy}
89 [Template] Set Chassis Power Policy Via IPMI And Verify
90
91 # power_policy
92 always-off
93 always-on
94 previous
95
96
chithragf4595402022-03-30 16:35:03 +000097Verify Chassis Status Via IPMI
98 [Documentation] Verify Chassis Status via IPMI command.
99 [Tags] Verify_Chassis_Status_Via_IPMI
100 [Setup] Test Setup Execution
101 [Teardown] Run Keywords FFDC On Test Case Fail AND
102 ... Run IPMI Standard Command chassis policy ${initial_power_policy}
103 [Template] Check Chassis Status Via IPMI
104
105 # power_policy
106 always-off
107 always-on
108 previous
109
110
Rahul Maheshwarif724a002020-02-21 05:17:02 -0600111*** Keywords ***
112
113Set Chassis Power Policy Via IPMI And Verify
114 [Documentation] Set chasiss power policy via IPMI and verify.
115 [Arguments] ${power_policy}
116
117 # Description of argument(s):
118 # power_policy Chassis power policy to be set(e.g. "always-off", "always-on").
119
120 Run IPMI Standard Command chassis policy ${power_policy}
121 ${resp}= Get Chassis Status
122 Valid Value resp['power_restore_policy'] ['${power_policy}']
123
124
chithragf4595402022-03-30 16:35:03 +0000125Check Chassis Status Via IPMI
126 [Documentation] Set Chassis Status via IPMI and verify and verify chassis status.
127 [Arguments] ${power_policy}
128
129 # Sets power policy according to requested policy
130 Set Chassis Power Policy Via IPMI And Verify ${power_policy}
131
132 # Gets chassis status via IPMI raw command and validate byte 1
133 ${status}= Run External IPMI Raw Command ${IPMI_RAW_CMD['Chassis_status']['get'][0]}
134 ${status}= Split String ${status}
135 ${state}= Convert To Binary ${status[0]} base=16
136 ${state}= Zfill Data ${state} 8
137
138 # Last bit corresponds whether Power is on
139 Should Be Equal As Strings ${state[-1]} 1
140 # bit 1-2 corresponds to power restore policy
141 ${policy}= Set Variable ${state[1:3]}
142
143 # condition to verify each power policy
144 IF '${power_policy}' == 'always-off'
145 Should Be Equal As Strings ${policy} 00
146 ELSE IF '${power_policy}' == 'always-on'
147 Should Be Equal As Strings ${policy} 10
148 ELSE IF '${power_policy}' == 'previous'
149 Should Be Equal As Strings ${policy} 01
150 ELSE
151 Log Power Restore Policy is Unknown
152 Should Be Equal As Strings ${policy} 11
153 END
154
155 # Last Power Event - 4th bit should be 1b i.e, last ‘Power is on’ state was entered via IPMI command
156 ${last_power_event}= Convert To Binary ${status[1]} base=16
157 ${last_power_event}= Zfill Data ${last_power_event} 8
158 Should Be Equal As Strings ${last_power_event[3]} 1
159
160
Rahul Maheshwarif724a002020-02-21 05:17:02 -0600161Test Setup Execution
162 [Documentation] Do test setup tasks.
163
164 ${chassis_status}= Get Chassis Status
165 Set Test Variable ${initial_power_policy} ${chassis_status['power_restore_policy']}
166
chithragf4595402022-03-30 16:35:03 +0000167
168Test Teardown Execution
169 [Documentation] Do Test Teardown tasks.
170
171 ${resp}= Run IPMI Standard Command chassis status
172 ${power_status}= Get Lines Containing String ${resp} System Power
173 @{powertolist}= Split String ${power_status} :
174 ${status}= Get From List ${powertolist} 1
175 # Chassis Power ON if status is off
176 Run Keyword If '${status.strip()}' != 'on'
177 ... Redfish Power On
178 FFDC On Test Case Fail