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           Test Bios Teardown
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${update_status}        True
25
26*** Test Cases ***
27
28Host BIOS Update
29    [Documentation]  Update PNOR image and verify.
30    [Tags]  Host_BIOS_Update  open-power
31
32    Validate Parameters
33    Prepare BMC For Update
34    Update PNOR Image
35
36Host BIOS Power On
37    [Documentation]  Power On the system and wait for OS
38    [Tags]  Host_BIOS_Power_On  open-power
39
40    Run Keyword If  '${PREV_TEST_STATUS}' == 'PASS'  Validate Power On
41
42*** Keywords ***
43
44Prepare BMC For Update
45    [Documentation]  Prepare system for PNOR update.
46
47    # Call 'OBMC Boot Test' to do a 'REST Power Off', if needed.
48    Run Key U  OBMC Boot Test \ REST Power Off
49    Run Key  Clear BMC Record Log
50
51Update PNOR Image
52    [Documentation]  Copy the PNOR image to the BMC /tmp dir and flash it.
53
54    Run Key  Copy PNOR to BMC
55    ${pnor_path}  ${pnor_basename}=  Split Path  ${PNOR_IMAGE_PATH}
56    Run Key  Flash PNOR \ /tmp/${pnor_basename}
57    Run Key  Wait Until Keyword Succeeds \ 7 min \ 10 sec \ Is PNOR Flash Done
58
59Validate Power On
60    [Documentation]  Power the host on, and validate that the sytem booted.
61    [Teardown]  Validate Power On Teardown
62
63    # Have to start SOL logging here.  Starting SOL in test setup closes the
64    # connection when bmc reboots.
65    Run Key  Start SOL Console Logging
66    Run Key U  OBMC Boot Test \ REST Power On
67
68Validate Power On Teardown
69    [Documentation]  Teardown after Validate Power On.
70
71    ${keyword_buf}=  Catenate  Stop SOL Console Logging
72    ...  \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
73    Run Key  ${keyword_buf}
74
75Test Bios Teardown
76    [Documentation]  Log FFDC if test suite fails and collect SOL log for
77    ...              debugging purposes.
78
79    Printn
80    Run Key  FFDC On Test Case Fail
81
82Validate Parameters
83    [Documentation]   Validate parameter and file existence.
84    Should Not Be Empty
85    ...   ${PNOR_IMAGE_PATH}  msg=PNOR image path not set
86
87    OperatingSystem.File Should Exist  ${PNOR_IMAGE_PATH}
88    ...   msg=${PNOR_IMAGE_PATH} File not found
89
90