Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Utilities for redfish BIOS attribute operations. |
| 3 | |
Anusha Dathatri | 0e0e67c | 2021-06-06 09:38:26 -0500 | [diff] [blame] | 4 | Resource resource.robot |
| 5 | Resource bmc_redfish_resource.robot |
| 6 | Resource common_utils.robot |
Sridevi Ramesh | 13d84bf | 2022-10-31 09:14:52 -0500 | [diff] [blame] | 7 | Resource utils.robot |
| 8 | Library tftp_update_utils.py |
Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 9 | |
| 10 | |
Sridevi Ramesh | a4ab9f3 | 2023-12-13 02:58:53 -0600 | [diff] [blame] | 11 | *** Variables *** |
| 12 | ${OS_RUNNING_TIMEOUT} 30 |
| 13 | |
| 14 | |
Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 15 | *** Keywords *** |
| 16 | |
| 17 | Set BIOS Attribute Value And Verify |
| 18 | |
| 19 | [Documentation] Set BIOS attribute handle with attribute value and verify. |
Anusha Dathatri | 99d0892 | 2021-05-25 04:19:38 -0500 | [diff] [blame] | 20 | [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 Ramesh | a4ab9f3 | 2023-12-13 02:58:53 -0600 | [diff] [blame] | 27 | # Check if the BIOS attribute value type is string. |
| 28 | ${type_str}= Evaluate isinstance($attr_val, str) |
Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 29 | |
Sridevi Ramesh | a4ab9f3 | 2023-12-13 02:58:53 -0600 | [diff] [blame] | 30 | 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('"', '')) |
George Keishing | ee0103d | 2024-01-30 12:35:37 +0530 | [diff] [blame^] | 33 | IF ${attr_value_length} |
Sridevi Ramesh | a4ab9f3 | 2023-12-13 02:58:53 -0600 | [diff] [blame] | 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 Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 41 | |
Sridevi Ramesh | a4ab9f3 | 2023-12-13 02:58:53 -0600 | [diff] [blame] | 42 | # 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 Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 48 | |
Sridevi Ramesh | a4ab9f3 | 2023-12-13 02:58:53 -0600 | [diff] [blame] | 49 | Run Keyword If '${verify}' == '${True}' Verify BIOS Attribute ${attr_handle} ${attr_val} |
| 50 | END |
Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 51 | |
| 52 | |
| 53 | Set 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 Dathatri | 99d0892 | 2021-05-25 04:19:38 -0500 | [diff] [blame] | 68 | |
| 69 | |
| 70 | Verify 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 Ramesh | a4ab9f3 | 2023-12-13 02:58:53 -0600 | [diff] [blame] | 80 | ${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 Ramesh | 13d84bf | 2022-10-31 09:14:52 -0500 | [diff] [blame] | 84 | |
| 85 | |
| 86 | Switch 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 Keishing | 99b36fb | 2022-12-14 01:49:15 -0600 | [diff] [blame] | 101 | # Get fw_boot_side value. |
Sridevi Ramesh | 13d84bf | 2022-10-31 09:14:52 -0500 | [diff] [blame] | 102 | # fw_boot_side values are not same. |
| 103 | |
| 104 | ${cur_boot_side}= Redfish.Get Attribute ${BIOS_ATTR_URI} Attributes |
Sridevi Ramesh | 13d84bf | 2022-10-31 09:14:52 -0500 | [diff] [blame] | 105 | |
| 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 Keishing | 99b36fb | 2022-12-14 01:49:15 -0600 | [diff] [blame] | 109 | Return From Keyword If "${cur_boot_side["fw_boot_side_current"]}" == "${set_fw_boot_side}" |
| 110 | ... ${True} |
| 111 | |
Sridevi Ramesh | 13d84bf | 2022-10-31 09:14:52 -0500 | [diff] [blame] | 112 | # 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} |