1*** Settings ***
2Documentation            Update firmware on a target BMC via Redifsh.
3
4# Test Parameters:
5# IMAGE_FILE_PATH        The path to the BMC image file.
6#
7# Firmware update states:
8#     Enabled            Image is installed and either functional or active.
9#     Disabled           Image installation failed or ready for activation.
10#     Updating           Image installation currently in progress.
11
12Resource                 ../../lib/resource.robot
13Resource                 ../../lib/bmc_redfish_resource.robot
14Resource                 ../../lib/openbmc_ffdc.robot
15Resource                 ../../lib/common_utils.robot
16Resource                 ../../lib/code_update_utils.robot
17Resource                 ../../lib/dump_utils.robot
18Resource                 ../../lib/logging_utils.robot
19Resource                 ../../lib/redfish_code_update_utils.robot
20Library                  ../../lib/gen_robot_valid.py
21Library                  ../../lib/tftp_update_utils.py
22
23Suite Setup              Suite Setup Execution
24Suite Teardown           Redfish.Logout
25Test Setup               Printn
26Test Teardown            FFDC On Test Case Fail
27
28Force Tags               BMC_Code_Update
29
30*** Test Cases ***
31
32Redfish Code Update With ApplyTime OnReset
33    [Documentation]  Update the firmaware image with ApplyTime of OnReset.
34    [Tags]  Redfish_Code_Update_With_ApplyTime_OnReset
35    [Template]  Redfish Update Firmware
36
37    # policy
38    OnReset
39
40
41Redfish Code Update With ApplyTime Immediate
42    [Documentation]  Update the firmaware image with ApplyTime of Immediate.
43    [Tags]  Redfish_Code_Update_With_ApplyTime_Immediate
44    [Template]  Redfish Update Firmware
45
46    # policy
47    Immediate
48
49
50*** Keywords ***
51
52Suite Setup Execution
53    [Documentation]  Do the suite setup.
54
55    Valid File Path  IMAGE_FILE_PATH
56    Redfish.Login
57    Delete All BMC Dump
58    Redfish Purge Event Log
59
60
61Redfish Update Firmware
62    [Documentation]  Update the BMC firmware via redfish interface.
63    [Arguments]  ${apply_time}
64
65    # Description of argument(s):
66    # policy     ApplyTime allowed values (e.g. "OnReset", "Immediate").
67
68    ${state}=  Get Pre Reboot State
69    Rprint Vars  state
70
71    Set ApplyTime  policy=${apply_Time}
72    Redfish Upload Image And Check Progress State
73    Reboot BMC And Verify BMC Image
74    ...  ${apply_time}  start_boot_seconds=${state['epoch_seconds']}
75    Verify Get ApplyTime  ${apply_time}
76
77