blob: 532a3997ff5274e9fda403a6254d6ae851988ae1 [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
20Library ../../lib/gen_robot_valid.py
21Library ../../lib/tftp_update_utils.py
Sushil Singhf7674a52019-11-19 00:36:15 -060022Library ../../lib/gen_robot_keyword.py
Sushil Singhcdebdd52019-08-14 15:29:24 -050023
24Suite Setup Suite Setup Execution
25Suite Teardown Redfish.Logout
26Test Setup Printn
27Test Teardown FFDC On Test Case Fail
28
29Force Tags BMC_Code_Update
30
31*** Test Cases ***
32
33Redfish Code Update With ApplyTime OnReset
34 [Documentation] Update the firmaware image with ApplyTime of OnReset.
35 [Tags] Redfish_Code_Update_With_ApplyTime_OnReset
36 [Template] Redfish Update Firmware
37
38 # policy
39 OnReset
40
41
42Redfish Code Update With ApplyTime Immediate
43 [Documentation] Update the firmaware image with ApplyTime of Immediate.
44 [Tags] Redfish_Code_Update_With_ApplyTime_Immediate
45 [Template] Redfish Update Firmware
46
47 # policy
48 Immediate
49
50
Sushil Singhffbfedf2019-10-17 15:58:25 -050051Redfish Code Update With Multiple Firmware
52 [Documentation] Update the firmaware image with ApplyTime of Immediate.
53 [Tags] Redfish_Code_Update_With_Multiple_Firmware
54 [Template] Redfish Multiple Upload Image And Check Progress State
55
56 # policy image_file_path alternate_image_file_path
57 Immediate ${IMAGE_FILE_PATH} ${ALTERNATE_IMAGE_FILE_PATH}
58
59
Sushil Singhcdebdd52019-08-14 15:29:24 -050060*** Keywords ***
61
62Suite Setup Execution
63 [Documentation] Do the suite setup.
64
Sushil Singhcdebdd52019-08-14 15:29:24 -050065 Valid File Path IMAGE_FILE_PATH
66 Redfish.Login
Sushil Singhcdebdd52019-08-14 15:29:24 -050067 Delete All BMC Dump
68 Redfish Purge Event Log
69
70
71Redfish Update Firmware
72 [Documentation] Update the BMC firmware via redfish interface.
73 [Arguments] ${apply_time}
74
75 # Description of argument(s):
76 # policy ApplyTime allowed values (e.g. "OnReset", "Immediate").
77
78 ${state}= Get Pre Reboot State
79 Rprint Vars state
Sushil Singh6f86f172019-10-30 11:36:25 -050080 Set ApplyTime policy=${apply_Time}
Sushil Singhf7674a52019-11-19 00:36:15 -060081 ${get_json_file}= OperatingSystem.Get File lib/applytime_table.json
82 ${post_code_update_actions}= Evaluate json.loads('''${get_json_file}''') json
Sushil Singh6f86f172019-10-30 11:36:25 -050083 Redfish Upload Image And Check Progress State
Sushil Singhf7674a52019-11-19 00:36:15 -060084 Run Key ${post_code_update_actions['bmc']['${apply_time}']}
85 Redfish.Login
Sushil Singh811ffae2019-10-23 05:16:22 -050086 Verify Get ApplyTime ${apply_time}
Sushil Singhcdebdd52019-08-14 15:29:24 -050087
Sushil Singhffbfedf2019-10-17 15:58:25 -050088
89Redfish Multiple Upload Image And Check Progress State
90 [Documentation] Update multiple BMC firmware via redfish interface and check status.
91 [Arguments] ${apply_time} ${IMAGE_FILE_PATH} ${ALTERNATE_IMAGE_FILE_PATH}
92
93 # Description of argument(s):
94 # apply_time ApplyTime allowed values (e.g. "OnReset", "Immediate").
95 # IMAGE_FILE_PATH The path to BMC image file.
96 # ALTERNATE_IMAGE_FILE_PATH The path to alternate BMC image file.
97
98 Valid File Path ALTERNATE_IMAGE_FILE_PATH
99 ${state}= Get Pre Reboot State
100 Rprint Vars state
101
102 Set ApplyTime policy=${apply_time}
103 Redfish Upload Image ${REDFISH_BASE_URI}UpdateService ${IMAGE_FILE_PATH}
104
105 ${first_image_id}= Get Latest Image ID
106 Rprint Vars first_image_id
107 Sleep 5s
108 Redfish Upload Image ${REDFISH_BASE_URI}UpdateService ${ALTERNATE_IMAGE_FILE_PATH}
109
110 ${second_image_id}= Get Latest Image ID
111 Rprint Vars second_image_id
112
113 Check Image Update Progress State
114 ... match_state='Updating', 'Disabled' image_id=${second_image_id}
115
116 Check Image Update Progress State
117 ... match_state='Updating' image_id=${first_image_id}
118
119 Wait Until Keyword Succeeds 8 min 20 sec
120 ... Check Image Update Progress State
121 ... match_state='Enabled' image_id=${first_image_id}
122 Reboot BMC And Verify BMC Image ${apply_time} start_boot_seconds=${state['epoch_seconds']}
123