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 | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 7 | |
| 8 | |
| 9 | *** Keywords *** |
| 10 | |
| 11 | Set BIOS Attribute Value And Verify |
| 12 | |
| 13 | [Documentation] Set BIOS attribute handle with attribute value and verify. |
Anusha Dathatri | 99d0892 | 2021-05-25 04:19:38 -0500 | [diff] [blame] | 14 | [Arguments] ${attr_handle} ${attr_val} ${verify}=${True} |
| 15 | |
| 16 | # Description of argument(s): |
| 17 | # ${attr_handle} BIOS Attribute handle (e.g. 'vmi_if0_ipv4_method'). |
| 18 | # @{attr_val} Attribute value for the given attribute handle. |
| 19 | # ${verify} Verify the new value. |
| 20 | |
Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 21 | |
| 22 | ${type_int}= Evaluate isinstance($attr_val, int) |
| 23 | ${value}= Set Variable If '${type_int}' == '${True}' ${attr_val} '${attr_val}' |
| 24 | |
| 25 | Redfish.Patch ${BIOS_ATTR_SETTINGS_URI} body={"Attributes":{"${attr_handle}": ${value}}} |
| 26 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
| 27 | |
Anusha Dathatri | 99d0892 | 2021-05-25 04:19:38 -0500 | [diff] [blame] | 28 | Run Keyword If '${verify}' == '${True}' Verify BIOS Attribute ${attr_handle} ${attr_val} |
Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 29 | |
| 30 | |
| 31 | Set Optional BIOS Attribute Values And Verify |
| 32 | |
| 33 | [Documentation] For the given BIOS attribute handle update with optional |
| 34 | ... attribute values and verify. |
| 35 | [Arguments] ${attr_handle} @{attr_val_list} |
| 36 | |
| 37 | # Description of argument(s): |
| 38 | # ${attr_handle} BIOS Attribute handle (e.g. 'vmi_if0_ipv4_method'). |
| 39 | # @{attr_val_list} List of the attribute values for the given attribute handle. |
| 40 | # (e.g. ['IPv4Static', 'IPv4DHCP']). |
| 41 | |
| 42 | FOR ${attr} IN @{attr_val_list} |
| 43 | ${new_attr}= Evaluate $attr.replace('"', '') |
| 44 | Set BIOS Attribute Value And Verify ${attr_handle} ${new_attr} |
| 45 | END |
Anusha Dathatri | 99d0892 | 2021-05-25 04:19:38 -0500 | [diff] [blame] | 46 | |
| 47 | |
| 48 | Verify BIOS Attribute |
| 49 | |
| 50 | [Documentation] Verify BIOS attribute value. |
| 51 | [Arguments] ${attr_handle} ${attr_val} |
| 52 | |
| 53 | # Description of argument(s): |
| 54 | # ${attr_handle} BIOS Attribute handle (e.g. 'vmi_if0_ipv4_method'). |
| 55 | # ${attr_val} The expected value for the given attribute handle. |
| 56 | |
| 57 | ${output}= Redfish.Get Attribute ${BIOS_ATTR_URI} Attributes |
| 58 | Should Be Equal ${output['${attr_handle}']} ${attr_val} |