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 | |
| 11 | *** Keywords *** |
| 12 | |
| 13 | Set BIOS Attribute Value And Verify |
| 14 | |
| 15 | [Documentation] Set BIOS attribute handle with attribute value and verify. |
Anusha Dathatri | 99d0892 | 2021-05-25 04:19:38 -0500 | [diff] [blame] | 16 | [Arguments] ${attr_handle} ${attr_val} ${verify}=${True} |
| 17 | |
| 18 | # Description of argument(s): |
| 19 | # ${attr_handle} BIOS Attribute handle (e.g. 'vmi_if0_ipv4_method'). |
| 20 | # @{attr_val} Attribute value for the given attribute handle. |
| 21 | # ${verify} Verify the new value. |
| 22 | |
Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 23 | |
| 24 | ${type_int}= Evaluate isinstance($attr_val, int) |
| 25 | ${value}= Set Variable If '${type_int}' == '${True}' ${attr_val} '${attr_val}' |
| 26 | |
| 27 | Redfish.Patch ${BIOS_ATTR_SETTINGS_URI} body={"Attributes":{"${attr_handle}": ${value}}} |
| 28 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
| 29 | |
Anusha Dathatri | 99d0892 | 2021-05-25 04:19:38 -0500 | [diff] [blame] | 30 | Run Keyword If '${verify}' == '${True}' Verify BIOS Attribute ${attr_handle} ${attr_val} |
Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 31 | |
| 32 | |
| 33 | Set Optional BIOS Attribute Values And Verify |
| 34 | |
| 35 | [Documentation] For the given BIOS attribute handle update with optional |
| 36 | ... attribute values and verify. |
| 37 | [Arguments] ${attr_handle} @{attr_val_list} |
| 38 | |
| 39 | # Description of argument(s): |
| 40 | # ${attr_handle} BIOS Attribute handle (e.g. 'vmi_if0_ipv4_method'). |
| 41 | # @{attr_val_list} List of the attribute values for the given attribute handle. |
| 42 | # (e.g. ['IPv4Static', 'IPv4DHCP']). |
| 43 | |
| 44 | FOR ${attr} IN @{attr_val_list} |
| 45 | ${new_attr}= Evaluate $attr.replace('"', '') |
| 46 | Set BIOS Attribute Value And Verify ${attr_handle} ${new_attr} |
| 47 | END |
Anusha Dathatri | 99d0892 | 2021-05-25 04:19:38 -0500 | [diff] [blame] | 48 | |
| 49 | |
| 50 | Verify BIOS Attribute |
| 51 | |
| 52 | [Documentation] Verify BIOS attribute value. |
| 53 | [Arguments] ${attr_handle} ${attr_val} |
| 54 | |
| 55 | # Description of argument(s): |
| 56 | # ${attr_handle} BIOS Attribute handle (e.g. 'vmi_if0_ipv4_method'). |
| 57 | # ${attr_val} The expected value for the given attribute handle. |
| 58 | |
| 59 | ${output}= Redfish.Get Attribute ${BIOS_ATTR_URI} Attributes |
| 60 | Should Be Equal ${output['${attr_handle}']} ${attr_val} |
Sridevi Ramesh | 13d84bf | 2022-10-31 09:14:52 -0500 | [diff] [blame] | 61 | |
| 62 | |
| 63 | Switch And Verify BIOS Attribute Firmware Boot Side |
| 64 | [Documentation] Switch BIOS attribute firmware boot side value to Perm/Temp |
| 65 | ... at host power off state and verify firmware boot side |
| 66 | ... value after BMC reboot. |
| 67 | [Arguments] ${set_fw_boot_side} |
| 68 | |
| 69 | # Description of argument(s): |
| 70 | # set_fw_boot_side Firmware boot side optional value Perm/Temp. |
| 71 | |
| 72 | # Do host power off. |
| 73 | Redfish Power Off stack_mode=skip quiet=1 |
| 74 | |
| 75 | # Get pre reboot state. |
| 76 | ${pre_reboot_state}= Get Pre Reboot State |
| 77 | |
George Keishing | 99b36fb | 2022-12-14 01:49:15 -0600 | [diff] [blame] | 78 | # Get fw_boot_side value. |
Sridevi Ramesh | 13d84bf | 2022-10-31 09:14:52 -0500 | [diff] [blame] | 79 | # fw_boot_side values are not same. |
| 80 | |
| 81 | ${cur_boot_side}= Redfish.Get Attribute ${BIOS_ATTR_URI} Attributes |
Sridevi Ramesh | 13d84bf | 2022-10-31 09:14:52 -0500 | [diff] [blame] | 82 | |
| 83 | Log To Console Current firmware boot side :: ${cur_boot_side["fw_boot_side"]} |
| 84 | Log To Console Given firmware boot side :: ${set_fw_boot_side} |
| 85 | |
George Keishing | 99b36fb | 2022-12-14 01:49:15 -0600 | [diff] [blame] | 86 | Return From Keyword If "${cur_boot_side["fw_boot_side_current"]}" == "${set_fw_boot_side}" |
| 87 | ... ${True} |
| 88 | |
Sridevi Ramesh | 13d84bf | 2022-10-31 09:14:52 -0500 | [diff] [blame] | 89 | # Set the given firmware boot side value. |
| 90 | Set BIOS Attribute Value And Verify fw_boot_side ${set_fw_boot_side} False |
| 91 | |
| 92 | # Power on BMC and wait for BMC to take reboot. |
| 93 | Log To Console Perform power on operation & expect BMC to take reboot... |
| 94 | Redfish Power Operation On |
| 95 | |
| 96 | Log To Console Wait for the BMC to take reboot and come back online... |
| 97 | Wait For Reboot start_boot_seconds=${pre_reboot_state['epoch_seconds']} |
| 98 | ... wait_state_check=0 |
| 99 | |
| 100 | # Post BMC reboot, host should auto power on back to runtime. |
| 101 | Log To Console BMC rebooted, wait for host to boot... |
| 102 | Wait Until Keyword Succeeds ${OS_RUNNING_TIMEOUT} min 20 sec |
| 103 | ... Is Boot Progress At Any State |
| 104 | |
| 105 | # Verify firmware boot side values after BMC reboot. |
| 106 | Verify BIOS Attribute fw_boot_side ${set_fw_boot_side} |
| 107 | Verify BIOS Attribute fw_boot_side_current ${set_fw_boot_side} |