1*** Settings *** 2Documentation This suite tests IPMI POH Counter Support in OpenBMC. 3... Feature: IPMI POH Counter Support 4... 5... POH (Power-On Hours) counter is the incremental count of power ON 6... hours in the system. 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... 21... Wait Time given - 1 hour, 1 hour 30minutes when Host power OFF, 1 hour 22... after Host Power ON 23... 24... Comparison between Initial POH Counter reading and reading after wait 25... time / Power operation. 26 27 28Library Collections 29Library ../lib/ipmi_utils.py 30Resource ../lib/ipmi_client.robot 31Resource ../lib/openbmc_ffdc.robot 32Variables ../data/ipmi_raw_cmd_table.py 33 34Suite Setup Suite Setup Execution 35Suite Teardown Suite Teardown Execution 36 37Test Teardown FFDC On Test Case Fail 38 39 40*** Variables *** 41 42 43*** Test Cases *** 44 45Get 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 55Verify 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 64Verify 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 83Verify 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 104Verify 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 128Run 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 148Suite 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 162Suite Teardown Execution 163 [Documentation] Suite Teardown Execution. 164 165 IPMI Power On 166 Redfish.Logout 167