blob: bebf57eae048111307e588ac98ad176e5028690d [file] [log] [blame]
Sushil Singhcdebdd52019-08-14 15:29:24 -05001*** 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
Sushil Singhb13fc362020-02-06 03:40:56 -060020Resource ../../lib/utils.robot
Sushil Singhcdebdd52019-08-14 15:29:24 -050021Library ../../lib/gen_robot_valid.py
22Library ../../lib/tftp_update_utils.py
Sushil Singhf7674a52019-11-19 00:36:15 -060023Library ../../lib/gen_robot_keyword.py
Sushil Singhcdebdd52019-08-14 15:29:24 -050024
25Suite Setup Suite Setup Execution
26Suite Teardown Redfish.Logout
27Test Setup Printn
28Test Teardown FFDC On Test Case Fail
29
30Force Tags BMC_Code_Update
31
32*** Test Cases ***
33
34Redfish Code Update With ApplyTime OnReset
35 [Documentation] Update the firmaware image with ApplyTime of OnReset.
36 [Tags] Redfish_Code_Update_With_ApplyTime_OnReset
37 [Template] Redfish Update Firmware
38
39 # policy
40 OnReset
41
42
43Redfish Code Update With ApplyTime Immediate
44 [Documentation] Update the firmaware image with ApplyTime of Immediate.
45 [Tags] Redfish_Code_Update_With_ApplyTime_Immediate
46 [Template] Redfish Update Firmware
47
48 # policy
49 Immediate
50
51
Sushil Singhffbfedf2019-10-17 15:58:25 -050052Redfish Code Update With Multiple Firmware
53 [Documentation] Update the firmaware image with ApplyTime of Immediate.
54 [Tags] Redfish_Code_Update_With_Multiple_Firmware
55 [Template] Redfish Multiple Upload Image And Check Progress State
56
57 # policy image_file_path alternate_image_file_path
58 Immediate ${IMAGE_FILE_PATH} ${ALTERNATE_IMAGE_FILE_PATH}
59
60
Sushil Singhcdebdd52019-08-14 15:29:24 -050061*** Keywords ***
62
63Suite Setup Execution
64 [Documentation] Do the suite setup.
65
Sushil Singhcdebdd52019-08-14 15:29:24 -050066 Valid File Path IMAGE_FILE_PATH
67 Redfish.Login
Sushil Singhcdebdd52019-08-14 15:29:24 -050068 Delete All BMC Dump
69 Redfish Purge Event Log
70
71
72Redfish Update Firmware
73 [Documentation] Update the BMC firmware via redfish interface.
74 [Arguments] ${apply_time}
75
76 # Description of argument(s):
77 # policy ApplyTime allowed values (e.g. "OnReset", "Immediate").
78
Sushil Singhb13fc362020-02-06 03:40:56 -060079 ${post_code_update_actions}= Get Post Boot Action
Sushil Singhcdebdd52019-08-14 15:29:24 -050080 ${state}= Get Pre Reboot State
81 Rprint Vars state
Sushil Singh6f86f172019-10-30 11:36:25 -050082 Set ApplyTime policy=${apply_Time}
83 Redfish Upload Image And Check Progress State
Sushil Singhb13fc362020-02-06 03:40:56 -060084 Run Key ${post_code_update_actions['BMC image']['${apply_time}']}
Sushil Singhf7674a52019-11-19 00:36:15 -060085 Redfish.Login
Sushil Singhb13fc362020-02-06 03:40:56 -060086 Redfish Verify BMC Version ${IMAGE_FILE_PATH}
Sushil Singh811ffae2019-10-23 05:16:22 -050087 Verify Get ApplyTime ${apply_time}
Sushil Singhcdebdd52019-08-14 15:29:24 -050088
Sushil Singhffbfedf2019-10-17 15:58:25 -050089
90Redfish Multiple Upload Image And Check Progress State
91 [Documentation] Update multiple BMC firmware via redfish interface and check status.
92 [Arguments] ${apply_time} ${IMAGE_FILE_PATH} ${ALTERNATE_IMAGE_FILE_PATH}
93
94 # Description of argument(s):
95 # apply_time ApplyTime allowed values (e.g. "OnReset", "Immediate").
96 # IMAGE_FILE_PATH The path to BMC image file.
97 # ALTERNATE_IMAGE_FILE_PATH The path to alternate BMC image file.
98
Sushil Singhb13fc362020-02-06 03:40:56 -060099 ${post_code_update_actions}= Get Post Boot Action
Sushil Singhffbfedf2019-10-17 15:58:25 -0500100 Valid File Path ALTERNATE_IMAGE_FILE_PATH
101 ${state}= Get Pre Reboot State
102 Rprint Vars state
103
104 Set ApplyTime policy=${apply_time}
105 Redfish Upload Image ${REDFISH_BASE_URI}UpdateService ${IMAGE_FILE_PATH}
106
107 ${first_image_id}= Get Latest Image ID
108 Rprint Vars first_image_id
109 Sleep 5s
110 Redfish Upload Image ${REDFISH_BASE_URI}UpdateService ${ALTERNATE_IMAGE_FILE_PATH}
111
112 ${second_image_id}= Get Latest Image ID
113 Rprint Vars second_image_id
114
115 Check Image Update Progress State
116 ... match_state='Updating', 'Disabled' image_id=${second_image_id}
117
118 Check Image Update Progress State
119 ... match_state='Updating' image_id=${first_image_id}
120
121 Wait Until Keyword Succeeds 8 min 20 sec
122 ... Check Image Update Progress State
123 ... match_state='Enabled' image_id=${first_image_id}
Sushil Singhb13fc362020-02-06 03:40:56 -0600124 Run Key ${post_code_update_actions['BMC image']['${apply_time}']}
125 Redfish.Login
126 Redfish Verify BMC Version ${IMAGE_FILE_PATH}