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