xref: /openbmc/openbmc-test-automation/extended/test_bios_update.robot (revision 6fb70d98f2f1cb9273ba912deaa2cebe3c23ea86)
1e9a70188SGeorge Keishing*** Settings ***
2abbe68c4SMichael WalshDocumentation  Update the PNOR image on the host for hostboot CI purposes.
3e9a70188SGeorge Keishing
442e023a1SGeorge KeishingLibrary                 OperatingSystem
5abbe68c4SMichael WalshLibrary                 ../lib/gen_robot_keyword.py
6abbe68c4SMichael Walsh
7abbe68c4SMichael WalshResource                ../extended/obmc_boot_test_resource.robot
8e9a70188SGeorge KeishingResource                ../lib/utils.robot
9e9a70188SGeorge KeishingResource                ../lib/connection_client.robot
1083317a09SJay AzurinResource                ../lib/openbmc_ffdc.robot
11cd72399fSRahul MaheshwariResource                ../lib/state_manager.robot
1242e023a1SGeorge Keishing
13fac31e97SSteven SombarTest Teardown           Test Teardown Execution
14e9a70188SGeorge Keishing
15*6fb70d98SMatt FischerTest Tags  BIOS_Code_Update
165db43e46SSweta Potthuri
17e9a70188SGeorge Keishing*** Variables ***
18e9a70188SGeorge Keishing
19abbe68c4SMichael Walsh${QUIET}                ${1}
20abbe68c4SMichael Walsh# OBMC Boot Test failures are not acceptable so we set the threshold to 0.
21abbe68c4SMichael Walsh${boot_fail_threshold}  ${0}
22abbe68c4SMichael Walsh# "skip" indicates to OBMC Boot Test that it should only process boot stack
23abbe68c4SMichael Walsh# items that would change the machine state, i.e. only if the action is
24abbe68c4SMichael Walsh# needed.
25abbe68c4SMichael Walsh${stack_mode}           skip
265284328aSPrachi Gupta${update_status}        True
27abbe68c4SMichael Walsh
28a0a13124SGeorge Keishing
29e9a70188SGeorge Keishing*** Test Cases ***
30e9a70188SGeorge Keishing
315284328aSPrachi GuptaHost BIOS Update
32abbe68c4SMichael Walsh    [Documentation]  Update PNOR image and verify.
335284328aSPrachi Gupta    [Tags]  Host_BIOS_Update  open-power
3442e023a1SGeorge Keishing
3542e023a1SGeorge Keishing    Validate Parameters
3642e023a1SGeorge Keishing    Prepare BMC For Update
37e9a70188SGeorge Keishing    Update PNOR Image
38a0a13124SGeorge Keishing    Verify PNOR Update
39e9a70188SGeorge Keishing
405284328aSPrachi GuptaHost BIOS Power On
415284328aSPrachi Gupta    [Documentation]  Power On the system and wait for OS
425284328aSPrachi Gupta    [Tags]  Host_BIOS_Power_On  open-power
435284328aSPrachi Gupta
445284328aSPrachi Gupta    Run Keyword If  '${PREV_TEST_STATUS}' == 'PASS'  Validate Power On
455284328aSPrachi Gupta
46e9a70188SGeorge Keishing*** Keywords ***
47e9a70188SGeorge Keishing
4842e023a1SGeorge KeishingPrepare BMC For Update
4942e023a1SGeorge Keishing    [Documentation]  Prepare system for PNOR update.
5042e023a1SGeorge Keishing
51abbe68c4SMichael Walsh    # Call 'OBMC Boot Test' to do a 'REST Power Off', if needed.
52abbe68c4SMichael Walsh    Run Key U  OBMC Boot Test \ REST Power Off
5381ae14c9SGeorge Keishing    Run Key  Delete Error logs
5442e023a1SGeorge Keishing
55e9a70188SGeorge KeishingUpdate PNOR Image
56e9a70188SGeorge Keishing    [Documentation]  Copy the PNOR image to the BMC /tmp dir and flash it.
5742e023a1SGeorge Keishing
58abbe68c4SMichael Walsh    Run Key  Copy PNOR to BMC
59e9a70188SGeorge Keishing    ${pnor_path}  ${pnor_basename}=  Split Path  ${PNOR_IMAGE_PATH}
60abbe68c4SMichael Walsh    Run Key  Flash PNOR \ /tmp/${pnor_basename}
6131062af8SMichael Walsh    Run Key  Wait Until Keyword Succeeds \ 15 min \ 10 sec \ Is PNOR Flash Done
62e9a70188SGeorge Keishing
635284328aSPrachi GuptaValidate Power On
6428e403b8SGunnar Mills    [Documentation]  Power the host on, and validate that the system booted.
655284328aSPrachi Gupta    [Teardown]  Validate Power On Teardown
6642e023a1SGeorge Keishing
675284328aSPrachi Gupta    # Have to start SOL logging here.  Starting SOL in test setup closes the
685284328aSPrachi Gupta    # connection when bmc reboots.
695284328aSPrachi Gupta    Run Key  Start SOL Console Logging
705284328aSPrachi Gupta    Run Key U  OBMC Boot Test \ REST Power On
7142e023a1SGeorge Keishing
725284328aSPrachi GuptaValidate Power On Teardown
735284328aSPrachi Gupta    [Documentation]  Teardown after Validate Power On.
74e9a70188SGeorge Keishing
755284328aSPrachi Gupta    ${keyword_buf}=  Catenate  Stop SOL Console Logging
765284328aSPrachi Gupta    ...  \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
775284328aSPrachi Gupta    Run Key  ${keyword_buf}
78e9a70188SGeorge Keishing
79fac31e97SSteven SombarTest Teardown Execution
805284328aSPrachi Gupta    [Documentation]  Log FFDC if test suite fails and collect SOL log for
815284328aSPrachi Gupta    ...              debugging purposes.
825284328aSPrachi Gupta
835284328aSPrachi Gupta    Printn
845284328aSPrachi Gupta    Run Key  FFDC On Test Case Fail
8542e023a1SGeorge Keishing
8642e023a1SGeorge KeishingValidate Parameters
8742e023a1SGeorge Keishing    [Documentation]   Validate parameter and file existence.
8842e023a1SGeorge Keishing    Should Not Be Empty
8942e023a1SGeorge Keishing    ...   ${PNOR_IMAGE_PATH}  msg=PNOR image path not set
9042e023a1SGeorge Keishing
9142e023a1SGeorge Keishing    OperatingSystem.File Should Exist  ${PNOR_IMAGE_PATH}
9242e023a1SGeorge Keishing    ...   msg=${PNOR_IMAGE_PATH} File not found
9342e023a1SGeorge Keishing
94