blob: d87ba60588567e13638574683013dfd1efa0311e [file] [log] [blame]
Sushil Singh5ea86d02019-07-11 02:05:16 -05001*** Settings ***
Sushil Singh11d0d142019-08-03 11:09:42 -05002Documentation 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.
Sushil Singh5ea86d02019-07-11 02:05:16 -050011
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
Sushil Singhacd6b4c2019-07-30 05:32:36 -050017Resource ../../lib/dump_utils.robot
18Resource ../../lib/logging_utils.robot
Sushil Singh11d0d142019-08-03 11:09:42 -050019Resource ../../lib/redfish_code_update_utils.robot
Sushil Singh5ea86d02019-07-11 02:05:16 -050020Library ../../lib/gen_robot_valid.py
Sushil Singh11d0d142019-08-03 11:09:42 -050021Library ../../lib/tftp_update_utils.py
Sushil Singh5ea86d02019-07-11 02:05:16 -050022
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*** Variables ***
31${immediate} Immediate
32${onreset} OnReset
33
34*** Test Cases ***
35
Sushil Singh11d0d142019-08-03 11:09:42 -050036Redfish Code Update With ApplyTime OnReset
37 [Documentation] Update the firmaware image with ApplyTime of OnReset.
38 [Tags] Redfish_Code_Update_With_ApplyTime_OnReset
39 [Template] Redfish Update Firmware
Sushil Singh5ea86d02019-07-11 02:05:16 -050040
Sushil Singh11d0d142019-08-03 11:09:42 -050041 # policy
42 ${onreset}
Sushil Singh5ea86d02019-07-11 02:05:16 -050043
Sushil Singh5ea86d02019-07-11 02:05:16 -050044
Sushil Singh11d0d142019-08-03 11:09:42 -050045Redfish Code Update With ApplyTime Immediate
46 [Documentation] Update the firmaware image with ApplyTime of Immediate.
47 [Tags] Redfish_Code_Update_With_ApplyTime_Immediate
48 [Template] Redfish Update Firmware
Sushil Singh5ea86d02019-07-11 02:05:16 -050049
Sushil Singh11d0d142019-08-03 11:09:42 -050050 # policy
51 ${immediate}
Sushil Singh5ea86d02019-07-11 02:05:16 -050052
53
54*** Keywords ***
55
56Suite Setup Execution
57 [Documentation] Do the suite setup.
58
59 Redfish.Login
Sushil Singhacd6b4c2019-07-30 05:32:36 -050060
61 # Delete BMC dump and Error logs
62 Delete All BMC Dump
63 Redfish Purge Event Log
64
Sushil Singh5ea86d02019-07-11 02:05:16 -050065 # Checking for file existence.
66 OperatingSystem.File Should Exist ${IMAGE_FILE_PATH}
Sushil Singhacd6b4c2019-07-30 05:32:36 -050067
Sushil Singh11d0d142019-08-03 11:09:42 -050068
69Redfish Update Firmware
70 [Documentation] Code update with ApplyTime and verify installation.
71 [Arguments] ${apply_time}
72
73 # Description of argument(s):
74 # policy ApplyTime allowed values (e.g. "OnReset", "Immediate").
75
76 ${state}= Get Pre Reboot State
77 Rprint Vars state
78
79 Set ApplyTime policy=${apply_time}
80
81 Redfish Upload Image ${REDFISH_BASE_URI}UpdateService ${IMAGE_FILE_PATH}
82
83 ${image_id}= Get Latest Image ID
84 Rprint Vars image_id
85
86 Check Image Update Progress State
87 ... match_state='Disabled', 'Updating' image_id=${image_id}
88
89 # Wait a few seconds to check if the update progress started.
90 Sleep 5s
91 Check Image Update Progress State
92 ... match_state='Updating' image_id=${image_id}
93
94 Wait Until Keyword Succeeds 8 min 20 sec
95 ... Check Image Update Progress State
96 ... match_state='Enabled' image_id=${image_id}
97
98 Reboot BMC And Verify BMC Image
99 ... ${apply_time} start_boot_seconds=${state['epoch_seconds']}
100
101
102Reboot BMC And Verify BMC Image
103 [Documentation] Reboot or wait for BMC standby post reboot and
104 ... verify installed image is functional.
105 [Arguments] ${apply_time} ${start_boot_seconds}
106
107 # Description of argument(s):
108 # policy ApplyTime allowed values (e.g. "OnReset", "Immediate").
109 # start_boot_seconds See 'Wait For Reboot' for details.
110
111 Run Keyword if 'OnReset' == '${apply_time}'
112 ... Run Keywords
113 ... Redfish OBMC Reboot (off) AND
114 ... Redfish.Login AND
115 ... Redfish Verify BMC Version ${IMAGE_FILE_PATH}
116 ... ELSE
117 ... Run Keywords
118 ... Wait For Reboot start_boot_seconds=${start_boot_seconds} AND
119 ... Redfish.Login AND
120 ... Redfish Verify BMC Version ${IMAGE_FILE_PATH}
121