1cdfea1d0SGeorge Keishing*** Settings *** 2cdfea1d0SGeorge KeishingDocumentation Test suite to verify BIOS POST code log entries. 3cdfea1d0SGeorge Keishing 4cdfea1d0SGeorge KeishingResource ../../../lib/resource.robot 5cdfea1d0SGeorge KeishingResource ../../../lib/bmc_redfish_resource.robot 6cdfea1d0SGeorge KeishingResource ../../../lib/openbmc_ffdc.robot 7cdfea1d0SGeorge KeishingResource ../../../lib/logging_utils.robot 8cdfea1d0SGeorge Keishing 9cdfea1d0SGeorge KeishingSuite Setup Suite Setup Execution 10cdfea1d0SGeorge KeishingTest Setup Test Setup Execution 11cdfea1d0SGeorge KeishingTest Teardown Test Teardown Execution 12cdfea1d0SGeorge KeishingSuite Teardown Suite Teardown Execution 13cdfea1d0SGeorge Keishing 14*6fb70d98SMatt FischerTest Tags Post_Codes 15649666a9Saravinth0510 16649666a9Saravinth0510*** Variables *** 17649666a9Saravinth0510${max_view_count} 1000 18649666a9Saravinth0510 19649666a9Saravinth0510 20cdfea1d0SGeorge Keishing*** Test Cases *** 21cdfea1d0SGeorge Keishing 22cdfea1d0SGeorge KeishingTest PostCodes When Host Boots 23cdfea1d0SGeorge Keishing [Documentation] Boot the system and verify PostCodes from host are logged. 24cdfea1d0SGeorge Keishing [Tags] Test_PostCodes_When_Host_Boots 25cdfea1d0SGeorge Keishing 26cdfea1d0SGeorge Keishing Redfish Power On 27cdfea1d0SGeorge Keishing ${post_code_list}= Redfish Get PostCodes 28cdfea1d0SGeorge Keishing Rprint Vars post_code_list 29cdfea1d0SGeorge Keishing 30cdfea1d0SGeorge Keishing ${post_codes}= Redfish.Get Properties 31c32434a3SYi Hu ... /redfish/v1/Systems/${SYSTEM_ID}/LogServices/PostCodes/Entries 32cdfea1d0SGeorge Keishing Log To Console BIOS POST Codes count: ${post_codes['Members@odata.count']} 33cdfea1d0SGeorge Keishing Should Be True ${post_codes['Members@odata.count']} >= 1 msg=No BIOS POST Codes populated. 34cdfea1d0SGeorge Keishing 35cdfea1d0SGeorge Keishing 368b5d53a1SGeorge KeishingTest PostCodes When Host Reboot 378b5d53a1SGeorge Keishing [Documentation] Initiate Host reboot the system and verify PostCodes from host are logged. 388b5d53a1SGeorge Keishing [Tags] Test_PostCodes_When_Host_Reboot 398b5d53a1SGeorge Keishing 408b5d53a1SGeorge Keishing # Boot to runtime and clear post codes. 418b5d53a1SGeorge Keishing Redfish Power On stack_mode=skip 428b5d53a1SGeorge Keishing Redfish Clear PostCodes 438b5d53a1SGeorge Keishing 448b5d53a1SGeorge Keishing RF SYS GracefulRestart 458b5d53a1SGeorge Keishing ${post_code_list}= Redfish Get PostCodes 468b5d53a1SGeorge Keishing Rprint Vars post_code_list 478b5d53a1SGeorge Keishing 488b5d53a1SGeorge Keishing ${post_codes}= Redfish.Get Properties 49c32434a3SYi Hu ... /redfish/v1/Systems/${SYSTEM_ID}/LogServices/PostCodes/Entries 508b5d53a1SGeorge Keishing Log To Console BIOS POST Codes count: ${post_codes['Members@odata.count']} 518b5d53a1SGeorge Keishing Should Be True ${post_codes['Members@odata.count']} >= 1 msg=No BIOS POST Codes populated. 528b5d53a1SGeorge Keishing 538b5d53a1SGeorge Keishing 548b5d53a1SGeorge KeishingTest PostCodes When Host Powered Off 558b5d53a1SGeorge Keishing [Documentation] Power off the system and verify PostCodes from host are logged. 568b5d53a1SGeorge Keishing [Tags] Test_PostCodes_When_Host_Powered_Off 578b5d53a1SGeorge Keishing 588b5d53a1SGeorge Keishing # Boot to runtime and clear post codes. 598b5d53a1SGeorge Keishing Redfish Power On stack_mode=skip 608b5d53a1SGeorge Keishing Redfish Clear PostCodes 618b5d53a1SGeorge Keishing 628b5d53a1SGeorge Keishing Redfish Power Off 638b5d53a1SGeorge Keishing ${post_code_list}= Redfish Get PostCodes 648b5d53a1SGeorge Keishing Rprint Vars post_code_list 658b5d53a1SGeorge Keishing 668b5d53a1SGeorge Keishing ${post_codes}= Redfish.Get Properties 67c32434a3SYi Hu ... /redfish/v1/Systems/${SYSTEM_ID}/LogServices/PostCodes/Entries 688b5d53a1SGeorge Keishing Log To Console BIOS POST Codes count: ${post_codes['Members@odata.count']} 699bd171faSGeorge Keishing Should Be True ${post_codes['Members@odata.count']} == 0 709bd171faSGeorge Keishing ... msg=BIOS POST Codes populated. 718b5d53a1SGeorge Keishing 728b5d53a1SGeorge Keishing 73649666a9Saravinth0510Test PostCode Id Value Incremented On Host Reboot 74649666a9Saravinth0510 [Documentation] Verify the value of ID in postcode entry is incremented 75649666a9Saravinth0510 ... on host reboot. In the ID value 'B2-49', '2' represents 76649666a9Saravinth0510 ... the boot cycle count of the host system. 77649666a9Saravinth0510 [Tags] Test_PostCode_Id_Value_Incremented_On_Host_Reboot 78649666a9Saravinth0510 [Setup] Populate PostCode Logs Incase No Prior Entries Available 79649666a9Saravinth0510 80649666a9Saravinth0510 # Get boot count of current postcode logs. 81649666a9Saravinth0510 ${initial_boot_count}= Get Boot Count For Last PostCode Entry 82649666a9Saravinth0510 ${expected_boot_count}= Evaluate ${initial_boot_count} + 1 83649666a9Saravinth0510 84649666a9Saravinth0510 # Perform host reboot and verify boot count incremented in ID value. 85649666a9Saravinth0510 RF SYS GracefulRestart 86649666a9Saravinth0510 ${current_boot_count}= Get Boot Count For Last PostCode Entry 87649666a9Saravinth0510 Should Be True ${current_boot_count} == ${expected_boot_count} 88649666a9Saravinth0510 89649666a9Saravinth0510 90649666a9Saravinth0510Test PostCode Log Perisistency After BMC Reboot 91649666a9Saravinth0510 [Documentation] Verify the post code log entries persist after BMC reboot. 92649666a9Saravinth0510 [Tags] Test_PostCode_Log_Perisistency_After_BMC_Reboot 93649666a9Saravinth0510 [Setup] Populate PostCode Logs Incase No Prior Entries Available 94649666a9Saravinth0510 95649666a9Saravinth0510 Redfish Power On stack_mode=skip 96649666a9Saravinth0510 97649666a9Saravinth0510 # Get log count before BMC reboot. 98649666a9Saravinth0510 ${post_codes}= Redfish.Get Properties 99c32434a3SYi Hu ... /redfish/v1/Systems/${SYSTEM_ID}/LogServices/PostCodes/Entries 100649666a9Saravinth0510 ${initial_log_count}= Set Variable ${post_codes['Members@odata.count']} 101649666a9Saravinth0510 102649666a9Saravinth0510 # Reboot BMC. 103649666a9Saravinth0510 OBMC Reboot (run) 104649666a9Saravinth0510 105649666a9Saravinth0510 # Get log count after BMC reboot and compare with initial log count. 106649666a9Saravinth0510 ${post_codes}= Redfish.Get Properties 107c32434a3SYi Hu ... /redfish/v1/Systems/${SYSTEM_ID}/LogServices/PostCodes/Entries 108649666a9Saravinth0510 ${current_log_count}= Set Variable ${post_codes['Members@odata.count']} 109649666a9Saravinth0510 Should Be True ${current_log_count} == ${initial_log_count} 110649666a9Saravinth0510 111649666a9Saravinth0510 112649666a9Saravinth0510Test Clear Post Code Log Action 113649666a9Saravinth0510 [Documentation] Verify clear log action for post code entries. 114649666a9Saravinth0510 [Tags] Test_Clear_Post_Code_Log_Action 115649666a9Saravinth0510 [Setup] Populate PostCode Logs Incase No Prior Entries Available 116649666a9Saravinth0510 117649666a9Saravinth0510 # Perform clear postcode log action. 118649666a9Saravinth0510 Redfish Clear PostCodes 119649666a9Saravinth0510 ${post_codes}= Redfish.Get Properties 120c32434a3SYi Hu ... /redfish/v1/Systems/${SYSTEM_ID}/LogServices/PostCodes/Entries 121649666a9Saravinth0510 122649666a9Saravinth0510 # Verify if log count becomes zero. 123649666a9Saravinth0510 Should Be True ${post_codes['Members@odata.count']} == 0 124649666a9Saravinth0510 ... msg=BIOS POST code logs not cleared. 125649666a9Saravinth0510 126649666a9Saravinth0510 127cdfea1d0SGeorge Keishing*** Keywords *** 128cdfea1d0SGeorge Keishing 129cdfea1d0SGeorge KeishingTest Setup Execution 130cdfea1d0SGeorge Keishing [Documentation] Do test setup operation. 131cdfea1d0SGeorge Keishing 132cdfea1d0SGeorge Keishing Redfish.Login 133cdfea1d0SGeorge Keishing Redfish Clear PostCodes 134cdfea1d0SGeorge Keishing 135cdfea1d0SGeorge Keishing 136cdfea1d0SGeorge KeishingTest Teardown Execution 137cdfea1d0SGeorge Keishing [Documentation] Do test teardown operation. 138cdfea1d0SGeorge Keishing 139cdfea1d0SGeorge Keishing FFDC On Test Case Fail 140cdfea1d0SGeorge Keishing 141cdfea1d0SGeorge Keishing 142cdfea1d0SGeorge KeishingSuite Setup Execution 143cdfea1d0SGeorge Keishing [Documentation] Do suite setup operation. 144cdfea1d0SGeorge Keishing 145cdfea1d0SGeorge Keishing Redfish.Login 146cdfea1d0SGeorge Keishing Redfish Power Off stack_mode=skip 147cdfea1d0SGeorge Keishing 148cdfea1d0SGeorge Keishing Run Keyword And Ignore Error Redfish Delete All BMC Dumps 149cdfea1d0SGeorge Keishing Run Keyword And Ignore Error Redfish Purge Event Log 150cdfea1d0SGeorge Keishing Run Keyword And Ignore Error Delete All Redfish Sessions 151cdfea1d0SGeorge Keishing 152cdfea1d0SGeorge Keishing 153cdfea1d0SGeorge KeishingSuite Teardown Execution 154cdfea1d0SGeorge Keishing [Documentation] Do suite teardown operation. 155cdfea1d0SGeorge Keishing 156cdfea1d0SGeorge Keishing Run Keyword And Ignore Error Redfish Delete All BMC Dumps 157cdfea1d0SGeorge Keishing Run Keyword And Ignore Error Redfish Purge Event Log 158cdfea1d0SGeorge Keishing Run Keyword And Ignore Error Delete All Redfish Sessions 159649666a9Saravinth0510 160649666a9Saravinth0510 161649666a9Saravinth0510Get Boot Count For Last PostCode Entry 162649666a9Saravinth0510 [Documentation] Get the latest boot count from post code log entry. 163649666a9Saravinth0510 ... log entry has ID "B2-1000", latest boot count "2" is returned. 164649666a9Saravinth0510 165649666a9Saravinth0510 # { 166649666a9Saravinth0510 # "@odata.id": "/redfish/v1/Systems/system/LogServices/PostCodes/Entries", 167649666a9Saravinth0510 # "@odata.type": "#LogEntryCollection.LogEntryCollection", 168649666a9Saravinth0510 # "Description": "Collection of POST Code Log Entries", 169649666a9Saravinth0510 # "Members": [ 170649666a9Saravinth0510 # { 171649666a9Saravinth0510 # "@odata.id": "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-1000", 172649666a9Saravinth0510 # "@odata.type": "#LogEntry.v1_8_0.LogEntry", 173649666a9Saravinth0510 # "Created": "1970-01-01T00:16:40+00:00", 174649666a9Saravinth0510 # "EntryType": "Event", 175649666a9Saravinth0510 # "Id": "B2-1000", 176649666a9Saravinth0510 # "Message": "Boot Count: 2; Time Stamp Offset: 117.4928 seconds; POST Code: 0xac10", 177649666a9Saravinth0510 # "MessageArgs": [ 178649666a9Saravinth0510 # "2", 179649666a9Saravinth0510 # "117.4928", 180649666a9Saravinth0510 # "0xac10" 181649666a9Saravinth0510 # ], 182649666a9Saravinth0510 # "MessageId": "OpenBMC.0.2.BIOSPOSTCode", 183649666a9Saravinth0510 # "Name": "POST Code Log Entry", 184649666a9Saravinth0510 # "Severity": "OK" 185649666a9Saravinth0510 # } 186649666a9Saravinth0510 # ], 187649666a9Saravinth0510 # "Members@odata.count": 2240, 188649666a9Saravinth0510 # "Members@odata.nextLink": "/redfish/v1/Systems/system/LogServices/PostCodes/Entries?$skip=1000", 189649666a9Saravinth0510 # "Name": "BIOS POST Code Log Entries" 190649666a9Saravinth0510 # } 191649666a9Saravinth0510 ${post_codes}= Redfish.Get Properties 192c32434a3SYi Hu ... /redfish/v1/Systems/${SYSTEM_ID}/LogServices/PostCodes/Entries 193649666a9Saravinth0510 ${total_log_count}= Set Variable ${post_codes['Members@odata.count']} 194649666a9Saravinth0510 195649666a9Saravinth0510 IF ${total_log_count} > ${max_view_count} 196649666a9Saravinth0510 ${skip_count}= Evaluate (${total_log_count}//${max_view_count})*${max_view_count} 197649666a9Saravinth0510 ${uri}= Set Variable 198c32434a3SYi Hu ... /redfish/v1/Systems/${SYSTEM_ID}/LogServices/PostCodes/Entries?$skip=${skip_count} 199649666a9Saravinth0510 ${post_codes}= Redfish.Get Properties ${uri} 200649666a9Saravinth0510 END 201649666a9Saravinth0510 202649666a9Saravinth0510 ${last_id}= Set Variable ${post_codes['Members'][-1]['Id']} 203649666a9Saravinth0510 ${last_id}= Split String ${last_id} - 204649666a9Saravinth0510 ${boot_count}= Set Variable ${last_id[0][1]} 205649666a9Saravinth0510 206649666a9Saravinth0510 Return From Keyword ${boot_count} 207649666a9Saravinth0510 208649666a9Saravinth0510 209649666a9Saravinth0510Populate PostCode Logs Incase No Prior Entries Available 210649666a9Saravinth0510 [Documentation] Trigger Redfish graceful restart action on host system 211649666a9Saravinth0510 ... to populate postcode logs if there are no prior log entries. 212649666a9Saravinth0510 213649666a9Saravinth0510 ${post_codes}= Redfish.Get Properties 214c32434a3SYi Hu ... /redfish/v1/Systems/${SYSTEM_ID}/LogServices/PostCodes/Entries 215649666a9Saravinth0510 Run Keyword If ${post_codes['Members@odata.count']} == 0 216649666a9Saravinth0510 ... RF SYS GracefulRestart 217649666a9Saravinth0510 218