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