blob: b9e8aedac524a56dc7c789c61a024d8539ca32b0 [file] [log] [blame]
Sushil Singh32e2b582019-08-16 04:58:24 -05001*** Settings ***
2Documentation Update firmware on a target Host via Redifsh.
3
4# Test Parameters:
5# IMAGE_FILE_PATH The path to the Host 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/boot_utils.robot
15Resource ../../lib/openbmc_ffdc.robot
16Resource ../../lib/common_utils.robot
17Resource ../../lib/code_update_utils.robot
18Resource ../../lib/dump_utils.robot
19Resource ../../lib/logging_utils.robot
20Resource ../../lib/redfish_code_update_utils.robot
Sushil Singh9770dae2020-02-10 03:17:51 -060021Resource ../../lib/utils.robot
Sushil Singh32e2b582019-08-16 04:58:24 -050022Library ../../lib/gen_robot_valid.py
23Library ../../lib/tftp_update_utils.py
24
25Suite Setup Suite Setup Execution
26Suite Teardown Redfish.Logout
27Test Setup Printn
28Test Teardown FFDC On Test Case Fail
29
30Force Tags Host_Code_Update
31
32*** Test Cases ***
33
Tony Leedce3be12020-06-02 11:19:19 +080034Redfish Host Code Update With ApplyTime OnReset
George Keishing16b3c7b2021-01-28 09:23:37 -060035 [Documentation] Update the firmware image with ApplyTime of OnReset.
Tony Leedce3be12020-06-02 11:19:19 +080036 [Tags] Redfish_Host_Code_Update_With_ApplyTime_OnReset
Sushil Singh32e2b582019-08-16 04:58:24 -050037 [Template] Redfish Update Firmware
38
39 # policy
40 OnReset
41
42
Tony Leedce3be12020-06-02 11:19:19 +080043Redfish Host Code Update With ApplyTime Immediate
George Keishing16b3c7b2021-01-28 09:23:37 -060044 [Documentation] Update the firmware image with ApplyTime of Immediate.
Tony Leedce3be12020-06-02 11:19:19 +080045 [Tags] Redfish_Host_Code_Update_With_ApplyTime_Immediate
Sushil Singh32e2b582019-08-16 04:58:24 -050046 [Template] Redfish Update Firmware
47
48 # policy
49 Immediate
50
Sushil Singh1620cfb2019-10-10 06:07:53 -050051
Sivas SRRbf2d10e2019-10-22 23:25:35 -050052BMC Reboot When PNOR Update Goes On
53 [Documentation] Trigger PNOR update and do BMC reboot.
54 [Tags] BMC_Reboot_When_PNOR_Update_Goes_On
55
56 ${bios_version_before}= Redfish.Get Attribute /redfish/v1/Systems/system/ BiosVersion
57 Redfish Firmware Update And Do BMC Reboot
58 ${bios_version_after}= Redfish.Get Attribute /redfish/v1/Systems/system/ BiosVersion
59 Valid Value bios_version_after ['${bios_version_before}']
60
61
Sushil Singh32e2b582019-08-16 04:58:24 -050062*** Keywords ***
63
64Suite Setup Execution
65 [Documentation] Do the suite setup.
66
67 Valid File Path IMAGE_FILE_PATH
68 Redfish.Login
George Keishing44c09102021-08-18 23:29:28 -050069 Run Keyword And Ignore Error Redfish Delete All BMC Dumps
70 Run Keyword And Ignore Error Redfish Purge Event Log
George Keishing219c6332021-08-19 03:37:13 -050071 Redfish Power Off stack_mode=skip
Sushil Singh32e2b582019-08-16 04:58:24 -050072
73
74Redfish Update Firmware
George Keishinga9763de2022-04-18 08:17:32 -050075 [Documentation] Update the Host firmware via redfish interface.
Sushil Singh32e2b582019-08-16 04:58:24 -050076 [Arguments] ${apply_time}
77
78 # Description of argument(s):
79 # policy ApplyTime allowed values (e.g. "OnReset", "Immediate").
80
81 Redfish.Login
Sushil Singh9770dae2020-02-10 03:17:51 -060082 ${post_code_update_actions}= Get Post Boot Action
Sushil Singh6f86f172019-10-30 11:36:25 -050083 Set ApplyTime policy=${apply_Time}
84 Redfish Upload Image And Check Progress State
Sushil Singh9770dae2020-02-10 03:17:51 -060085 Run Key ${post_code_update_actions['Host image']['${apply_time}']}
86 Redfish.Login
87 Redfish Verify Host Version ${IMAGE_FILE_PATH}
Sushil Singh811ffae2019-10-23 05:16:22 -050088 Verify Get ApplyTime ${apply_time}
Sushil Singh32e2b582019-08-16 04:58:24 -050089
Sivas SRRbf2d10e2019-10-22 23:25:35 -050090
91Redfish Firmware Update And Do BMC Reboot
92 [Documentation] Update the firmware via redfish interface and do BMC reboot.
93
94 Set ApplyTime policy="Immediate"
95 Redfish Upload Image ${REDFISH_BASE_URI}UpdateService ${IMAGE_FILE_PATH}
96 ${image_id}= Get Latest Image ID
97 Wait Until Keyword Succeeds 1 min 10 sec
98 ... Check Image Update Progress State match_state='Updating' image_id=${image_id}
99
100 # BMC reboot while PNOR update is in progress.
101 Redfish OBMC Reboot (off)