1*** Settings ***
2Documentation  Update the PNOR image on the host for hostboot CI purposes.
3
4Library                 OperatingSystem
5Library                 ../lib/gen_robot_keyword.py
6
7Resource                ../extended/obmc_boot_test_resource.robot
8Resource                ../lib/utils.robot
9Resource                ../lib/connection_client.robot
10Resource                ../lib/openbmc_ffdc.robot
11Resource                ../lib/state_manager.robot
12
13Test Teardown           Run Key  FFDC On Test Case Fail
14
15*** Variables ***
16
17${QUIET}                ${1}
18# OBMC Boot Test failures are not acceptable so we set the threshold to 0.
19${boot_fail_threshold}  ${0}
20# "skip" indicates to OBMC Boot Test that it should only process boot stack
21# items that would change the machine state, i.e. only if the action is
22# needed.
23${stack_mode}           skip
24
25*** Test Cases ***
26
27Host BIOS Update And Boot
28    [Documentation]  Update PNOR image and verify.
29    [Tags]  Host_BIOS_Update_And_Boot  open-power
30
31    Validate Parameters
32    Prepare BMC For Update
33    Update PNOR Image
34
35*** Keywords ***
36
37Prepare BMC For Update
38    [Documentation]  Prepare system for PNOR update.
39
40    # Call 'OBMC Boot Test' to do a 'REST Power Off', if needed.
41    Run Key U  OBMC Boot Test \ REST Power Off
42
43    Run Key  Clear BMC Record Log
44
45Update PNOR Image
46    [Documentation]  Copy the PNOR image to the BMC /tmp dir and flash it.
47
48    Run Key  Copy PNOR to BMC
49    ${pnor_path}  ${pnor_basename}=  Split Path  ${PNOR_IMAGE_PATH}
50    Run Key  Flash PNOR \ /tmp/${pnor_basename}
51    Run Key  Wait Until Keyword Succeeds \ 7 min \ 10 sec \ Is PNOR Flash Done
52
53Validate IPL
54    [Documentation]  Power the host on, and validate the IPL.
55
56    Initiate Power On
57    Wait Until Keyword Succeeds
58    ...  10 min    30 sec   Is System State Host Booted
59
60
61Collect SOL Log
62    [Documentation]    Log FFDC if test suite fails and collect SOL log
63    ...                for debugging purposes.
64     ${sol_out}=    Stop SOL Console Logging
65     Create File    ${EXECDIR}${/}logs${/}SOL.log    ${sol_out}
66
67
68Validate Parameters
69    [Documentation]   Validate parameter and file existence.
70    Should Not Be Empty
71    ...   ${PNOR_IMAGE_PATH}  msg=PNOR image path not set
72
73    OperatingSystem.File Should Exist  ${PNOR_IMAGE_PATH}
74    ...   msg=${PNOR_IMAGE_PATH} File not found
75
76