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