blob: 28376fedb64ff3bab352277d6c47404ffc5a2a69 [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
George Keishing6e641262022-05-05 10:46:22 -050064 [Documentation] Verify chassis power Cycle operation and check the Chassis
65 ... Power Status using external IPMI command.
chithragf4595402022-03-30 16:35:03 +000066 [Tags] Verify_Chassis_Power_Cycle_And_Check_Chassis_Status_Via_IPMI
67
68 # Chassis power cycle command via IPMI
69 IPMI Power Cycle
70 ${ipmi_state}= Get Host State Via External IPMI
71 Valid Value ipmi_state ['on']
72
73
74Verify Chassis Power Reset And Check Chassis Status Via IPMI
George Keishing6e641262022-05-05 10:46:22 -050075 [Documentation] Verify chassis power Reset operation and check the Chassis
76 ... Power Status using external IPMI command.
chithragf4595402022-03-30 16:35:03 +000077 [Tags] Verify_Chassis_Power_Reset_And_Check_Chassis_Status_Via_IPMI
78
79 # Chassis power reset command via IPMI
80 IPMI Power Reset
81 ${ipmi_state}= Get Host State Via External IPMI
82 Valid Value ipmi_state ['on']
83
84
Rahul Maheshwarif724a002020-02-21 05:17:02 -060085Verify Chassis Power Policy
86 [Documentation] Verify setting chassis power policy via IPMI command.
87 [Tags] Verify_Chassis_Power_Policy
88 [Setup] Test Setup Execution
89 [Teardown] Run Keywords FFDC On Test Case Fail AND
90 ... Run IPMI Standard Command chassis policy ${initial_power_policy}
91 [Template] Set Chassis Power Policy Via IPMI And Verify
92
93 # power_policy
94 always-off
95 always-on
96 previous
97
98
chithragf4595402022-03-30 16:35:03 +000099Verify Chassis Status Via IPMI
100 [Documentation] Verify Chassis Status via IPMI command.
101 [Tags] Verify_Chassis_Status_Via_IPMI
102 [Setup] Test Setup Execution
103 [Teardown] Run Keywords FFDC On Test Case Fail AND
104 ... Run IPMI Standard Command chassis policy ${initial_power_policy}
105 [Template] Check Chassis Status Via IPMI
106
107 # power_policy
108 always-off
109 always-on
110 previous
111
112
Rahul Maheshwarif724a002020-02-21 05:17:02 -0600113*** Keywords ***
114
115Set Chassis Power Policy Via IPMI And Verify
116 [Documentation] Set chasiss power policy via IPMI and verify.
117 [Arguments] ${power_policy}
118
119 # Description of argument(s):
120 # power_policy Chassis power policy to be set(e.g. "always-off", "always-on").
121
122 Run IPMI Standard Command chassis policy ${power_policy}
123 ${resp}= Get Chassis Status
124 Valid Value resp['power_restore_policy'] ['${power_policy}']
125
126
chithragf4595402022-03-30 16:35:03 +0000127Check Chassis Status Via IPMI
128 [Documentation] Set Chassis Status via IPMI and verify and verify chassis status.
129 [Arguments] ${power_policy}
130
131 # Sets power policy according to requested policy
132 Set Chassis Power Policy Via IPMI And Verify ${power_policy}
133
134 # Gets chassis status via IPMI raw command and validate byte 1
135 ${status}= Run External IPMI Raw Command ${IPMI_RAW_CMD['Chassis_status']['get'][0]}
136 ${status}= Split String ${status}
137 ${state}= Convert To Binary ${status[0]} base=16
138 ${state}= Zfill Data ${state} 8
139
140 # Last bit corresponds whether Power is on
141 Should Be Equal As Strings ${state[-1]} 1
142 # bit 1-2 corresponds to power restore policy
143 ${policy}= Set Variable ${state[1:3]}
144
145 # condition to verify each power policy
146 IF '${power_policy}' == 'always-off'
147 Should Be Equal As Strings ${policy} 00
148 ELSE IF '${power_policy}' == 'always-on'
149 Should Be Equal As Strings ${policy} 10
150 ELSE IF '${power_policy}' == 'previous'
151 Should Be Equal As Strings ${policy} 01
152 ELSE
153 Log Power Restore Policy is Unknown
154 Should Be Equal As Strings ${policy} 11
155 END
156
157 # Last Power Event - 4th bit should be 1b i.e, last ‘Power is on’ state was entered via IPMI command
158 ${last_power_event}= Convert To Binary ${status[1]} base=16
159 ${last_power_event}= Zfill Data ${last_power_event} 8
160 Should Be Equal As Strings ${last_power_event[3]} 1
161
162
Rahul Maheshwarif724a002020-02-21 05:17:02 -0600163Test Setup Execution
164 [Documentation] Do test setup tasks.
165
166 ${chassis_status}= Get Chassis Status
167 Set Test Variable ${initial_power_policy} ${chassis_status['power_restore_policy']}
168
chithragf4595402022-03-30 16:35:03 +0000169
170Test Teardown Execution
171 [Documentation] Do Test Teardown tasks.
172
173 ${resp}= Run IPMI Standard Command chassis status
174 ${power_status}= Get Lines Containing String ${resp} System Power
175 @{powertolist}= Split String ${power_status} :
176 ${status}= Get From List ${powertolist} 1
177 # Chassis Power ON if status is off
178 Run Keyword If '${status.strip()}' != 'on'
179 ... Redfish Power On
180 FFDC On Test Case Fail