George Keishing | cdfea1d | 2022-08-05 10:42:39 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test suite to verify BIOS POST code log entries. |
| 3 | |
| 4 | Resource ../../../lib/resource.robot |
| 5 | Resource ../../../lib/bmc_redfish_resource.robot |
| 6 | Resource ../../../lib/openbmc_ffdc.robot |
| 7 | Resource ../../../lib/logging_utils.robot |
| 8 | |
| 9 | Suite Setup Suite Setup Execution |
| 10 | Test Setup Test Setup Execution |
| 11 | Test Teardown Test Teardown Execution |
| 12 | Suite Teardown Suite Teardown Execution |
| 13 | |
aravinth0510 | 649666a | 2022-09-23 05:27:27 +0000 | [diff] [blame] | 14 | |
| 15 | *** Variables *** |
| 16 | ${max_view_count} 1000 |
| 17 | |
| 18 | |
George Keishing | cdfea1d | 2022-08-05 10:42:39 -0500 | [diff] [blame] | 19 | *** Test Cases *** |
| 20 | |
| 21 | Test PostCodes When Host Boots |
| 22 | [Documentation] Boot the system and verify PostCodes from host are logged. |
| 23 | [Tags] Test_PostCodes_When_Host_Boots |
| 24 | |
| 25 | Redfish Power On |
| 26 | ${post_code_list}= Redfish Get PostCodes |
| 27 | Rprint Vars post_code_list |
| 28 | |
| 29 | ${post_codes}= Redfish.Get Properties |
| 30 | ... /redfish/v1/Systems/system/LogServices/PostCodes/Entries |
| 31 | Log To Console BIOS POST Codes count: ${post_codes['Members@odata.count']} |
| 32 | Should Be True ${post_codes['Members@odata.count']} >= 1 msg=No BIOS POST Codes populated. |
| 33 | |
| 34 | |
George Keishing | 8b5d53a | 2022-08-08 06:39:17 -0500 | [diff] [blame] | 35 | Test PostCodes When Host Reboot |
| 36 | [Documentation] Initiate Host reboot the system and verify PostCodes from host are logged. |
| 37 | [Tags] Test_PostCodes_When_Host_Reboot |
| 38 | |
| 39 | # Boot to runtime and clear post codes. |
| 40 | Redfish Power On stack_mode=skip |
| 41 | Redfish Clear PostCodes |
| 42 | |
| 43 | RF SYS GracefulRestart |
| 44 | ${post_code_list}= Redfish Get PostCodes |
| 45 | Rprint Vars post_code_list |
| 46 | |
| 47 | ${post_codes}= Redfish.Get Properties |
| 48 | ... /redfish/v1/Systems/system/LogServices/PostCodes/Entries |
| 49 | Log To Console BIOS POST Codes count: ${post_codes['Members@odata.count']} |
| 50 | Should Be True ${post_codes['Members@odata.count']} >= 1 msg=No BIOS POST Codes populated. |
| 51 | |
| 52 | |
| 53 | Test PostCodes When Host Powered Off |
| 54 | [Documentation] Power off the system and verify PostCodes from host are logged. |
| 55 | [Tags] Test_PostCodes_When_Host_Powered_Off |
| 56 | |
| 57 | # Boot to runtime and clear post codes. |
| 58 | Redfish Power On stack_mode=skip |
| 59 | Redfish Clear PostCodes |
| 60 | |
| 61 | Redfish Power Off |
| 62 | ${post_code_list}= Redfish Get PostCodes |
| 63 | Rprint Vars post_code_list |
| 64 | |
| 65 | ${post_codes}= Redfish.Get Properties |
| 66 | ... /redfish/v1/Systems/system/LogServices/PostCodes/Entries |
| 67 | Log To Console BIOS POST Codes count: ${post_codes['Members@odata.count']} |
George Keishing | 9bd171f | 2023-09-06 09:50:33 +0530 | [diff] [blame^] | 68 | Should Be True ${post_codes['Members@odata.count']} == 0 |
| 69 | ... msg=BIOS POST Codes populated. |
George Keishing | 8b5d53a | 2022-08-08 06:39:17 -0500 | [diff] [blame] | 70 | |
| 71 | |
aravinth0510 | 649666a | 2022-09-23 05:27:27 +0000 | [diff] [blame] | 72 | Test PostCode Id Value Incremented On Host Reboot |
| 73 | [Documentation] Verify the value of ID in postcode entry is incremented |
| 74 | ... on host reboot. In the ID value 'B2-49', '2' represents |
| 75 | ... the boot cycle count of the host system. |
| 76 | [Tags] Test_PostCode_Id_Value_Incremented_On_Host_Reboot |
| 77 | [Setup] Populate PostCode Logs Incase No Prior Entries Available |
| 78 | |
| 79 | # Get boot count of current postcode logs. |
| 80 | ${initial_boot_count}= Get Boot Count For Last PostCode Entry |
| 81 | ${expected_boot_count}= Evaluate ${initial_boot_count} + 1 |
| 82 | |
| 83 | # Perform host reboot and verify boot count incremented in ID value. |
| 84 | RF SYS GracefulRestart |
| 85 | ${current_boot_count}= Get Boot Count For Last PostCode Entry |
| 86 | Should Be True ${current_boot_count} == ${expected_boot_count} |
| 87 | |
| 88 | |
| 89 | Test PostCode Log Perisistency After BMC Reboot |
| 90 | [Documentation] Verify the post code log entries persist after BMC reboot. |
| 91 | [Tags] Test_PostCode_Log_Perisistency_After_BMC_Reboot |
| 92 | [Setup] Populate PostCode Logs Incase No Prior Entries Available |
| 93 | |
| 94 | Redfish Power On stack_mode=skip |
| 95 | |
| 96 | # Get log count before BMC reboot. |
| 97 | ${post_codes}= Redfish.Get Properties |
| 98 | ... /redfish/v1/Systems/system/LogServices/PostCodes/Entries |
| 99 | ${initial_log_count}= Set Variable ${post_codes['Members@odata.count']} |
| 100 | |
| 101 | # Reboot BMC. |
| 102 | OBMC Reboot (run) |
| 103 | |
| 104 | # Get log count after BMC reboot and compare with initial log count. |
| 105 | ${post_codes}= Redfish.Get Properties |
| 106 | ... /redfish/v1/Systems/system/LogServices/PostCodes/Entries |
| 107 | ${current_log_count}= Set Variable ${post_codes['Members@odata.count']} |
| 108 | Should Be True ${current_log_count} == ${initial_log_count} |
| 109 | |
| 110 | |
| 111 | Test Clear Post Code Log Action |
| 112 | [Documentation] Verify clear log action for post code entries. |
| 113 | [Tags] Test_Clear_Post_Code_Log_Action |
| 114 | [Setup] Populate PostCode Logs Incase No Prior Entries Available |
| 115 | |
| 116 | # Perform clear postcode log action. |
| 117 | Redfish Clear PostCodes |
| 118 | ${post_codes}= Redfish.Get Properties |
| 119 | ... /redfish/v1/Systems/system/LogServices/PostCodes/Entries |
| 120 | |
| 121 | # Verify if log count becomes zero. |
| 122 | Should Be True ${post_codes['Members@odata.count']} == 0 |
| 123 | ... msg=BIOS POST code logs not cleared. |
| 124 | |
| 125 | |
George Keishing | cdfea1d | 2022-08-05 10:42:39 -0500 | [diff] [blame] | 126 | *** Keywords *** |
| 127 | |
| 128 | Test Setup Execution |
| 129 | [Documentation] Do test setup operation. |
| 130 | |
| 131 | Redfish.Login |
| 132 | Redfish Clear PostCodes |
| 133 | |
| 134 | |
| 135 | Test Teardown Execution |
| 136 | [Documentation] Do test teardown operation. |
| 137 | |
| 138 | FFDC On Test Case Fail |
| 139 | |
| 140 | |
| 141 | Suite Setup Execution |
| 142 | [Documentation] Do suite setup operation. |
| 143 | |
| 144 | Redfish.Login |
| 145 | Redfish Power Off stack_mode=skip |
| 146 | |
| 147 | Run Keyword And Ignore Error Redfish Delete All BMC Dumps |
| 148 | Run Keyword And Ignore Error Redfish Purge Event Log |
| 149 | Run Keyword And Ignore Error Delete All Redfish Sessions |
| 150 | |
| 151 | |
| 152 | Suite Teardown Execution |
| 153 | [Documentation] Do suite teardown operation. |
| 154 | |
| 155 | Run Keyword And Ignore Error Redfish Delete All BMC Dumps |
| 156 | Run Keyword And Ignore Error Redfish Purge Event Log |
| 157 | Run Keyword And Ignore Error Delete All Redfish Sessions |
aravinth0510 | 649666a | 2022-09-23 05:27:27 +0000 | [diff] [blame] | 158 | |
| 159 | |
| 160 | Get Boot Count For Last PostCode Entry |
| 161 | [Documentation] Get the latest boot count from post code log entry. |
| 162 | ... log entry has ID "B2-1000", latest boot count "2" is returned. |
| 163 | |
| 164 | # { |
| 165 | # "@odata.id": "/redfish/v1/Systems/system/LogServices/PostCodes/Entries", |
| 166 | # "@odata.type": "#LogEntryCollection.LogEntryCollection", |
| 167 | # "Description": "Collection of POST Code Log Entries", |
| 168 | # "Members": [ |
| 169 | # { |
| 170 | # "@odata.id": "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-1000", |
| 171 | # "@odata.type": "#LogEntry.v1_8_0.LogEntry", |
| 172 | # "Created": "1970-01-01T00:16:40+00:00", |
| 173 | # "EntryType": "Event", |
| 174 | # "Id": "B2-1000", |
| 175 | # "Message": "Boot Count: 2; Time Stamp Offset: 117.4928 seconds; POST Code: 0xac10", |
| 176 | # "MessageArgs": [ |
| 177 | # "2", |
| 178 | # "117.4928", |
| 179 | # "0xac10" |
| 180 | # ], |
| 181 | # "MessageId": "OpenBMC.0.2.BIOSPOSTCode", |
| 182 | # "Name": "POST Code Log Entry", |
| 183 | # "Severity": "OK" |
| 184 | # } |
| 185 | # ], |
| 186 | # "Members@odata.count": 2240, |
| 187 | # "Members@odata.nextLink": "/redfish/v1/Systems/system/LogServices/PostCodes/Entries?$skip=1000", |
| 188 | # "Name": "BIOS POST Code Log Entries" |
| 189 | # } |
| 190 | ${post_codes}= Redfish.Get Properties |
| 191 | ... /redfish/v1/Systems/system/LogServices/PostCodes/Entries |
| 192 | ${total_log_count}= Set Variable ${post_codes['Members@odata.count']} |
| 193 | |
| 194 | IF ${total_log_count} > ${max_view_count} |
| 195 | ${skip_count}= Evaluate (${total_log_count}//${max_view_count})*${max_view_count} |
| 196 | ${uri}= Set Variable |
| 197 | ... /redfish/v1/Systems/system/LogServices/PostCodes/Entries?$skip=${skip_count} |
| 198 | ${post_codes}= Redfish.Get Properties ${uri} |
| 199 | END |
| 200 | |
| 201 | ${last_id}= Set Variable ${post_codes['Members'][-1]['Id']} |
| 202 | ${last_id}= Split String ${last_id} - |
| 203 | ${boot_count}= Set Variable ${last_id[0][1]} |
| 204 | |
| 205 | Return From Keyword ${boot_count} |
| 206 | |
| 207 | |
| 208 | Populate PostCode Logs Incase No Prior Entries Available |
| 209 | [Documentation] Trigger Redfish graceful restart action on host system |
| 210 | ... to populate postcode logs if there are no prior log entries. |
| 211 | |
| 212 | ${post_codes}= Redfish.Get Properties |
| 213 | ... /redfish/v1/Systems/system/LogServices/PostCodes/Entries |
| 214 | Run Keyword If ${post_codes['Members@odata.count']} == 0 |
| 215 | ... RF SYS GracefulRestart |
| 216 | |