blob: 3520a1fcadf67abe4d6f685d0e7e9f1e02272a62 [file] [log] [blame]
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -05001*** Settings ***
2Documentation Utilities for redfish BIOS attribute operations.
3
Anusha Dathatri0e0e67c2021-06-06 09:38:26 -05004Resource resource.robot
5Resource bmc_redfish_resource.robot
6Resource common_utils.robot
Sridevi Ramesh13d84bf2022-10-31 09:14:52 -05007Resource utils.robot
8Library tftp_update_utils.py
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -05009
10
Sridevi Ramesha4ab9f32023-12-13 02:58:53 -060011*** Variables ***
12${OS_RUNNING_TIMEOUT} 30
13
14
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050015*** Keywords ***
16
17Set BIOS Attribute Value And Verify
18
19 [Documentation] Set BIOS attribute handle with attribute value and verify.
Anusha Dathatri99d08922021-05-25 04:19:38 -050020 [Arguments] ${attr_handle} ${attr_val} ${verify}=${True}
21
22 # Description of argument(s):
23 # ${attr_handle} BIOS Attribute handle (e.g. 'vmi_if0_ipv4_method').
24 # @{attr_val} Attribute value for the given attribute handle.
25 # ${verify} Verify the new value.
26
Sridevi Ramesha4ab9f32023-12-13 02:58:53 -060027 # Check if the BIOS attribute value type is string.
28 ${type_str}= Evaluate isinstance($attr_val, str)
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050029
Sridevi Ramesha4ab9f32023-12-13 02:58:53 -060030 IF ${type_str}
31 # Handling the case when the BIOS attribute value is an empty string.
32 ${attr_value_length}= Evaluate len($attr_val.replace('"', ''))
33 IF ${attr_value_length}
34 ${value}= Set Variable "${attr_val}"
35 ELSE
36 ${value}= Set Variable ${attr_val}
37 END
38 ELSE
39 ${value}= Set Variable ${attr_val}
40 END
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050041
Sridevi Ramesha4ab9f32023-12-13 02:58:53 -060042 # BIOS attribute with _current are ReadOnly can not be updated.
43 IF 'current' in '${attr_handle}'
44 Log To Console BIOS attribute with _current are ReadOnly can not be updated !!
45 ELSE
46 Redfish.Patch ${BIOS_ATTR_SETTINGS_URI} body={"Attributes":{"${attr_handle}": ${value}}}
47 ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050048
Sridevi Ramesha4ab9f32023-12-13 02:58:53 -060049 Run Keyword If '${verify}' == '${True}' Verify BIOS Attribute ${attr_handle} ${attr_val}
50 END
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050051
52
53Set Optional BIOS Attribute Values And Verify
54
55 [Documentation] For the given BIOS attribute handle update with optional
56 ... attribute values and verify.
57 [Arguments] ${attr_handle} @{attr_val_list}
58
59 # Description of argument(s):
60 # ${attr_handle} BIOS Attribute handle (e.g. 'vmi_if0_ipv4_method').
61 # @{attr_val_list} List of the attribute values for the given attribute handle.
62 # (e.g. ['IPv4Static', 'IPv4DHCP']).
63
64 FOR ${attr} IN @{attr_val_list}
65 ${new_attr}= Evaluate $attr.replace('"', '')
66 Set BIOS Attribute Value And Verify ${attr_handle} ${new_attr}
67 END
Anusha Dathatri99d08922021-05-25 04:19:38 -050068
69
70Verify BIOS Attribute
71
72 [Documentation] Verify BIOS attribute value.
73 [Arguments] ${attr_handle} ${attr_val}
74
75 # Description of argument(s):
76 # ${attr_handle} BIOS Attribute handle (e.g. 'vmi_if0_ipv4_method').
77 # ${attr_val} The expected value for the given attribute handle.
78
79 ${output}= Redfish.Get Attribute ${BIOS_ATTR_URI} Attributes
Sridevi Ramesha4ab9f32023-12-13 02:58:53 -060080 ${cmd_rsp_status}= Run Keyword And Return Status Should Not Be Empty ${output['${attr_handle}']}
81 IF ${cmd_rsp_status}
82 Should Be Equal ${output['${attr_handle}']} ${attr_val}
83 END
Sridevi Ramesh13d84bf2022-10-31 09:14:52 -050084
85
86Switch And Verify BIOS Attribute Firmware Boot Side
87 [Documentation] Switch BIOS attribute firmware boot side value to Perm/Temp
88 ... at host power off state and verify firmware boot side
89 ... value after BMC reboot.
90 [Arguments] ${set_fw_boot_side}
91
92 # Description of argument(s):
93 # set_fw_boot_side Firmware boot side optional value Perm/Temp.
94
95 # Do host power off.
96 Redfish Power Off stack_mode=skip quiet=1
97
98 # Get pre reboot state.
99 ${pre_reboot_state}= Get Pre Reboot State
100
George Keishing99b36fb2022-12-14 01:49:15 -0600101 # Get fw_boot_side value.
Sridevi Ramesh13d84bf2022-10-31 09:14:52 -0500102 # fw_boot_side values are not same.
103
104 ${cur_boot_side}= Redfish.Get Attribute ${BIOS_ATTR_URI} Attributes
Sridevi Ramesh13d84bf2022-10-31 09:14:52 -0500105
106 Log To Console Current firmware boot side :: ${cur_boot_side["fw_boot_side"]}
107 Log To Console Given firmware boot side :: ${set_fw_boot_side}
108
George Keishing99b36fb2022-12-14 01:49:15 -0600109 Return From Keyword If "${cur_boot_side["fw_boot_side_current"]}" == "${set_fw_boot_side}"
110 ... ${True}
111
Sridevi Ramesh13d84bf2022-10-31 09:14:52 -0500112 # Set the given firmware boot side value.
113 Set BIOS Attribute Value And Verify fw_boot_side ${set_fw_boot_side} False
114
115 # Power on BMC and wait for BMC to take reboot.
116 Log To Console Perform power on operation & expect BMC to take reboot...
117 Redfish Power Operation On
118
119 Log To Console Wait for the BMC to take reboot and come back online...
120 Wait For Reboot start_boot_seconds=${pre_reboot_state['epoch_seconds']}
121 ... wait_state_check=0
122
123 # Post BMC reboot, host should auto power on back to runtime.
124 Log To Console BMC rebooted, wait for host to boot...
125 Wait Until Keyword Succeeds ${OS_RUNNING_TIMEOUT} min 20 sec
126 ... Is Boot Progress At Any State
127
128 # Verify firmware boot side values after BMC reboot.
129 Verify BIOS Attribute fw_boot_side ${set_fw_boot_side}
130 Verify BIOS Attribute fw_boot_side_current ${set_fw_boot_side}