chithrag | a6be41e | 2022-03-01 13:20:23 +0000 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation This suite tests IPMI POH Counter Support in OpenBMC. |
| 3 | ... Feature: IPMI POH Counter Support |
| 4 | ... |
George Keishing | 6e64126 | 2022-05-05 10:46:22 -0500 | [diff] [blame] | 5 | ... POH (Power-On Hours) counter is the incremental count of power ON |
| 6 | ... hours in the system. |
chithrag | a6be41e | 2022-03-01 13:20:23 +0000 | [diff] [blame] | 7 | ... |
| 8 | ... Request and Response data defined under data/ipmi_raw_cmd_table.py |
| 9 | ... |
| 10 | ... Testcases added - |
| 11 | ... Get POH Counter Command Via IPMI |
| 12 | ... Verify Get POH Counter With Invalid Data Request Via IPMI |
| 13 | ... Verify POH Counter Reading With Wait Time |
| 14 | ... Verify POH Counter Reading With Host Power Off |
| 15 | ... Verify POH Counter Reading With Host Power On |
| 16 | ... |
| 17 | ... Script compares Minutes per count and Counter reading for the above scenarios. |
| 18 | ... |
| 19 | ... Minutes per count usually 60 minutes. |
| 20 | ... |
George Keishing | 6e64126 | 2022-05-05 10:46:22 -0500 | [diff] [blame] | 21 | ... Wait Time given - 1 hour, 1 hour 30minutes when Host power OFF, 1 hour |
| 22 | ... after Host Power ON |
chithrag | a6be41e | 2022-03-01 13:20:23 +0000 | [diff] [blame] | 23 | ... |
George Keishing | 6e64126 | 2022-05-05 10:46:22 -0500 | [diff] [blame] | 24 | ... Comparison between Initial POH Counter reading and reading after wait |
| 25 | ... time / Power operation. |
chithrag | a6be41e | 2022-03-01 13:20:23 +0000 | [diff] [blame] | 26 | |
| 27 | |
| 28 | Library Collections |
| 29 | Library ../lib/ipmi_utils.py |
| 30 | Resource ../lib/ipmi_client.robot |
| 31 | Resource ../lib/openbmc_ffdc.robot |
| 32 | Variables ../data/ipmi_raw_cmd_table.py |
| 33 | |
| 34 | Suite Setup Suite Setup Execution |
| 35 | Suite Teardown Suite Teardown Execution |
| 36 | |
| 37 | Test Teardown FFDC On Test Case Fail |
| 38 | |
| 39 | |
| 40 | *** Variables *** |
| 41 | |
| 42 | |
| 43 | *** Test Cases *** |
| 44 | |
| 45 | Get POH Counter Command Via IPMI |
| 46 | [Documentation] Verify get POH counter command Via IPMI. |
| 47 | [Tags] Get_POH_Counter_Command_Via_IPMI |
| 48 | |
| 49 | # Verify get POH counter command via IPMI. |
| 50 | ${resp}= Run IPMI Command |
| 51 | ... ${IPMI_RAW_CMD['Get']['POH_Counter'][0]} |
| 52 | Should Not Contain ${resp} ${IPMI_RAW_CMD['Get']['POH_Counter'][1]} |
| 53 | |
| 54 | |
| 55 | Verify Get POH Counter With Invalid Data Request Via IPMI |
| 56 | [Documentation] Verify get POH counter with invalid data request via IPMI. |
| 57 | [Tags] Verify_Get_POH_Counter_With_Invalid_Data_Request_Via_IPMI |
| 58 | |
| 59 | # verify get POH counter command with invalid data request Via IPMI. |
| 60 | ${resp}= Run Keyword and Expect Error *Request data length invalid* |
| 61 | ... Run IPMI Command ${IPMI_RAW_CMD['Get']['POH_Counter'][0]} 0x00 |
| 62 | |
| 63 | |
| 64 | Verify POH Counter Reading With Wait Time |
| 65 | [Documentation] Verify POH counter reading with wait time via IPMI. |
| 66 | [Tags] Verify_POH_Counter_Reading_With_Wait_Time |
| 67 | |
| 68 | # Get initial POH command counter reading. |
| 69 | ${poh_counter_1}= Run Get POH Command And Return Counter Reading |
| 70 | |
| 71 | # Sleep for given time. |
| 72 | Sleep 1h |
| 73 | |
| 74 | # Get POH Counter Reading after waiting for given time period. |
| 75 | ${poh_counter_2}= Run Get POH Command And Return Counter Reading |
| 76 | |
| 77 | # Verify difference between initial and present counter readings. |
| 78 | # The counter reading should always be incremented by 1 for each hour. |
| 79 | ${difference}= Evaluate ${poh_counter_2} - ${poh_counter_1} |
| 80 | Should Be Equal As Integers ${difference} 1 |
| 81 | |
| 82 | |
| 83 | Verify POH Counter Reading With Host Power Off |
| 84 | [Documentation] Verify POH counter reading with wait time after host power off. |
| 85 | [Tags] Verify_POH_Counter_Reading_With_Host_Power_Off |
| 86 | |
| 87 | # Get initial POH command counter reading. |
| 88 | ${poh_counter_1}= Run Get POH Command And Return Counter Reading |
| 89 | |
| 90 | # Power off the system. |
| 91 | IPMI Power Off |
| 92 | |
| 93 | # Sleep for given time. |
| 94 | Sleep 1 hours 30 minutes |
| 95 | |
| 96 | # Get POH counter reading after waiting for given time period. |
| 97 | ${poh_counter_2}= Run Get POH Command And Return Counter Reading |
| 98 | |
| 99 | # Once the system is powered off, |
| 100 | # the poh counter reading should not increment. |
| 101 | Should Be Equal As Integers ${poh_counter_2} ${poh_counter_1} |
| 102 | |
| 103 | |
| 104 | Verify POH Counter Reading With Host Power On |
| 105 | [Documentation] Verify Get POH Counter with wait time after host power on. |
| 106 | [Tags] Verify_POH_Counter_Reading_With_Host_Power_On |
| 107 | |
| 108 | # Get initial POH command counter reading. |
| 109 | ${poh_counter_1}= Run Get POH Command And Return Counter Reading |
| 110 | |
| 111 | # Power on the system. |
| 112 | IPMI Power On |
| 113 | |
| 114 | # Sleep for given time. |
| 115 | Sleep 1h |
| 116 | |
| 117 | # Get POH Counter reading after waiting for given time period. |
| 118 | ${poh_counter_2}= Run Get POH Command And Return Counter Reading |
| 119 | |
| 120 | # Once the system is powered on, |
| 121 | # the pon counter reading should increment by 1. |
| 122 | ${difference}= Evaluate ${poh_counter_2} - ${poh_counter_1} |
| 123 | Should Be Equal As Integers ${difference} 1 |
| 124 | |
| 125 | |
| 126 | *** Keywords *** |
| 127 | |
| 128 | Run Get POH Command And Return Counter Reading |
| 129 | [Documentation] Run the IPMI command to Get POH Counter. |
| 130 | |
| 131 | # Get POH counter Via IPMI. |
| 132 | ${resp}= Run IPMI Command |
| 133 | ... ${IPMI_RAW_CMD['Get']['POH_Counter'][0]} |
| 134 | |
| 135 | # Verify Minutes per count. |
| 136 | ${data}= Split String ${resp} |
| 137 | Should Be Equal ${data[0]} 3c |
| 138 | |
| 139 | # Get POH Command counter reading. |
| 140 | ${poh_counter_reading}= Set Variable ${data[1:]} |
| 141 | Reverse List ${poh_counter_reading} |
| 142 | ${poh_counter_reading}= Evaluate "".join(${poh_counter_reading}) |
| 143 | ${poh_counter_reading}= Convert To Integer ${poh_counter_reading} 16 |
| 144 | |
| 145 | [Return] ${poh_counter_reading} |
| 146 | |
| 147 | |
| 148 | Suite Setup Execution |
| 149 | [Documentation] Suite Setup Execution. |
| 150 | |
| 151 | Redfish.Login |
| 152 | |
| 153 | # Check Host current status. |
| 154 | ${current_host_state}= Get Host State Via Redfish |
| 155 | |
| 156 | # If Host state is 'On' then the condition will not be executed. |
| 157 | # Host may take approx 5 - 6 minutes to complete power ON process. |
| 158 | Run Keyword If '${current_host_state}' == 'Off' |
| 159 | ... IPMI Power On |
| 160 | |
| 161 | |
| 162 | Suite Teardown Execution |
| 163 | [Documentation] Suite Teardown Execution. |
| 164 | |
| 165 | IPMI Power On |
| 166 | Redfish.Logout |