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