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 | |
Rahul Maheshwari | 07d91d2 | 2019-07-31 01:12:05 -0500 | [diff] [blame] | 14 | |
| 15 | *** Test Cases *** |
| 16 | |
| 17 | IPMI 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 | |
| 27 | IPMI 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 M | 1cc2127 | 2020-01-05 23:47:46 -0600 | [diff] [blame] | 36 | |
| 37 | Verify 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 | |
| 45 | Verify 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 Maheshwari | 460778d | 2020-02-23 22:37:22 -0600 | [diff] [blame] | 51 | Valid Value ipmi_state ['on'] |
| 52 | |
| 53 | |
| 54 | Verify Soft Shutdown |
| 55 | [Documentation] Verify host OS shutdown softly via IPMI command. |
George Keishing | fba5ad9 | 2021-11-08 02:52:35 -0600 | [diff] [blame] | 56 | [Tags] Verify_Soft_Shutdown |
Rahul Maheshwari | 460778d | 2020-02-23 22:37:22 -0600 | [diff] [blame] | 57 | |
| 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 Maheshwari | f724a00 | 2020-02-21 05:17:02 -0600 | [diff] [blame] | 62 | |
chithrag | f459540 | 2022-03-30 16:35:03 +0000 | [diff] [blame] | 63 | Verify Chassis Power Cycle And Check Chassis Status Via IPMI |
George Keishing | 6e64126 | 2022-05-05 10:46:22 -0500 | [diff] [blame] | 64 | [Documentation] Verify chassis power Cycle operation and check the Chassis |
| 65 | ... Power Status using external IPMI command. |
chithrag | f459540 | 2022-03-30 16:35:03 +0000 | [diff] [blame] | 66 | [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 | |
| 74 | Verify Chassis Power Reset And Check Chassis Status Via IPMI |
George Keishing | 6e64126 | 2022-05-05 10:46:22 -0500 | [diff] [blame] | 75 | [Documentation] Verify chassis power Reset operation and check the Chassis |
| 76 | ... Power Status using external IPMI command. |
chithrag | f459540 | 2022-03-30 16:35:03 +0000 | [diff] [blame] | 77 | [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 Maheshwari | f724a00 | 2020-02-21 05:17:02 -0600 | [diff] [blame] | 85 | Verify 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 | |
chithrag | f459540 | 2022-03-30 16:35:03 +0000 | [diff] [blame] | 99 | Verify 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 Maheshwari | f724a00 | 2020-02-21 05:17:02 -0600 | [diff] [blame] | 113 | *** Keywords *** |
| 114 | |
| 115 | Set 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 | |
chithrag | f459540 | 2022-03-30 16:35:03 +0000 | [diff] [blame] | 127 | Check 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 Maheshwari | f724a00 | 2020-02-21 05:17:02 -0600 | [diff] [blame] | 163 | Test 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 | |
chithrag | f459540 | 2022-03-30 16:35:03 +0000 | [diff] [blame] | 169 | |
| 170 | Test 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 |