| George Keishing | 68e9827 | 2022-07-15 03:26:48 -0500 | [diff] [blame] | 1 | *** Settings *** | 
|  | 2 |  | 
|  | 3 | Documentation    Test firmware boot side switch using pldmtool. | 
|  | 4 |  | 
|  | 5 | # Test Procedure: | 
|  | 6 | # 1. Power off the host or post firmware is updated. | 
|  | 7 | # 2. Check the firmware boot side ( login to BMC and execute ) | 
|  | 8 | #    Example: | 
|  | 9 | #    pldmtool bios GetBIOSAttributeCurrentValueByHandle -a fw_boot_side | 
|  | 10 | # | 
|  | 11 | #    It should return response either Temp or Perm | 
|  | 12 | # 3. Set the firmware boot side to Temp or Perm accordingly | 
|  | 13 | #    Example: | 
|  | 14 | #    pldmtool bios SetBIOSAttributeCurrentValue -a fw_boot_side -d Temp | 
|  | 15 | # | 
|  | 16 | # 4. Power on | 
|  | 17 | # 5. BMC take reset during power on ( expected ) | 
|  | 18 | # 6. Check the system booted to Runtime | 
|  | 19 | # 7. Verify the boot side is still same which was set. | 
|  | 20 |  | 
|  | 21 | Library          Collections | 
|  | 22 | Library          ../lib/tftp_update_utils.py | 
|  | 23 | Resource         ../lib/bmc_redfish_resource.robot | 
|  | 24 | Resource         ../lib/openbmc_ffdc.robot | 
|  | 25 |  | 
|  | 26 | Test Setup       Printn | 
|  | 27 | Test Teardown    FFDC On Test Case Fail | 
|  | 28 |  | 
| Matt Fischer | 6fb70d9 | 2023-10-24 19:06:33 -0600 | [diff] [blame] | 29 | Test Tags       Firmware_Boot_Side | 
| George Keishing | 5431685 | 2023-10-16 14:03:29 +0530 | [diff] [blame] | 30 |  | 
| George Keishing | 68e9827 | 2022-07-15 03:26:48 -0500 | [diff] [blame] | 31 | *** Variables *** | 
|  | 32 |  | 
|  | 33 | # By default 2, to ensure, it performs both Perm and Temp side switch and boot. | 
|  | 34 | ${LOOP_COUNT}     2 | 
|  | 35 |  | 
|  | 36 | # This dictionary is for Temp -> Perm or vice versa in the test code. | 
|  | 37 | &{FW_BOOT_SIDE_DICT}  Perm=Temp  Temp=Perm | 
|  | 38 |  | 
|  | 39 | *** Test Cases *** | 
|  | 40 |  | 
|  | 41 | Test Firmware Boot Side Using Pldmtool | 
|  | 42 | [Documentation]   Power off the host , set the firmware boot side via pldmtool, | 
|  | 43 | ...               power on the host and confirm the fw_boot_side attribute is | 
|  | 44 | ...               still set. | 
|  | 45 | [Tags]  Test_Firmware_Boot_Side_Using_Pldmtool | 
|  | 46 | [Template]  Firmware Side Switch Power On Loop | 
|  | 47 |  | 
|  | 48 | # iteration | 
|  | 49 | ${LOOP_COUNT} | 
|  | 50 |  | 
|  | 51 |  | 
|  | 52 | *** Keywords *** | 
|  | 53 |  | 
|  | 54 | Firmware Side Switch Power On Loop | 
|  | 55 | [Documentation]   Number of iteration, test should perform switch side and boot. | 
|  | 56 | [Arguments]  ${iteration} | 
|  | 57 |  | 
|  | 58 | # Description of argument(s): | 
|  | 59 | # iteration      Number of switch it needs to perform. | 
|  | 60 |  | 
|  | 61 | FOR  ${count}  IN RANGE  0  ${iteration} | 
|  | 62 | Print Timen  The Current Loop Count is ${count} of ${iteration} | 
|  | 63 |  | 
|  | 64 | # Get the current system state before BMC reset. | 
|  | 65 | ${state}=  Get Pre Reboot State | 
|  | 66 |  | 
|  | 67 | Redfish Power Off  stack_mode=skip | 
|  | 68 |  | 
|  | 69 | ${cur_boot_side}=  PLDM Get BIOS Attribute  fw_boot_side | 
|  | 70 | Print Timen  Current BIOS attribute fw_boot_side: ${cur_boot_side} | 
|  | 71 |  | 
|  | 72 | ${next_boot_side}=  Set Variable  ${FW_BOOT_SIDE_DICT["${cur_boot_side["CurrentValue"]}"]} | 
|  | 73 | Print Timen  Set BIOS attribute fw_boot_side: ${next_boot_side} | 
|  | 74 | PLDM Set BIOS Attribute  fw_boot_side  ${next_boot_side} | 
|  | 75 |  | 
|  | 76 | ${cur_boot_side}=  PLDM Get BIOS Attribute  fw_boot_side | 
|  | 77 | Print Timen   Next boot will apply BIOS attribute fw_boot_side: ${cur_boot_side} | 
|  | 78 |  | 
|  | 79 | Print Timen  Perform power on operation and expect BMC to take reset. | 
|  | 80 | Redfish Power Operation  On | 
|  | 81 | Print Timen  Wait for the BMC to take reset and come back online. | 
|  | 82 | Wait For Reboot  start_boot_seconds=${state['epoch_seconds']}  wait_state_check=0 | 
|  | 83 |  | 
|  | 84 | Print Timen  BMC rebooted, wait for host to boot to Runtime. | 
|  | 85 | # Post BMC reset, host should auto power on back to runtime. | 
| George Keishing | e292123 | 2024-10-22 18:25:53 +0530 | [diff] [blame] | 86 | Wait Until Keyword Succeeds  ${power_on_timeout}  20 sec | 
|  | 87 | ...  Is Boot Progress Runtime Matched | 
| George Keishing | 68e9827 | 2022-07-15 03:26:48 -0500 | [diff] [blame] | 88 |  | 
|  | 89 | # Verify the system is booting up with the new fw_boot_side set. | 
|  | 90 | ${cur_boot_side}=  PLDM Get BIOS Attribute  fw_boot_side | 
|  | 91 | Should Be Equal As Strings  ${cur_boot_side["CurrentValue"]}  ${next_boot_side} | 
|  | 92 | Print Timen  Current: ${cur_boot_side["CurrentValue"]} and set side: ${next_boot_side} are same. | 
|  | 93 | END | 
|  | 94 |  | 
|  | 95 |  | 
|  | 96 | Is Boot Progress Runtime Matched | 
|  | 97 | [Documentation]  Get BootProgress state and expect boot state mismatch. | 
|  | 98 |  | 
|  | 99 | # Match any of the BootProgress state SystemHardwareInitializationComplete|OSBootStarted|OSRunning | 
|  | 100 | ${boot_progress}  ${host_state}=  Redfish Get Boot Progress | 
|  | 101 | Should Contain Any  ${boot_progress}  SystemHardwareInitializationComplete  OSBootStarted  OSRunning |