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