| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 1 | *** Settings *** | 
|  | 2 | Documentation    This suite test various BIOS attributes operations using Redfish. | 
|  | 3 |  | 
| George Keishing | 67a8bef | 2021-05-27 14:35:58 -0500 | [diff] [blame] | 4 | Resource         ../lib/resource.robot | 
|  | 5 | Resource         ../lib/bmc_redfish_resource.robot | 
|  | 6 | Resource         ../lib/common_utils.robot | 
|  | 7 | Resource         ../lib/openbmc_ffdc.robot | 
|  | 8 | Resource         ../lib/bios_attr_utils.robot | 
|  | 9 | Library          ../lib/pldm_utils.py | 
|  | 10 | Variables        ../data/pldm_variables.py | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 11 |  | 
| George Keishing | 855babf | 2021-05-03 23:50:08 -0500 | [diff] [blame] | 12 | Test Teardown    FFDC On Test Case Fail | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 13 |  | 
|  | 14 | Suite Setup      Redfish BIOS Suite Setup | 
| George Keishing | a78fe5d | 2022-07-21 11:18:18 -0500 | [diff] [blame] | 15 | Suite Teardown   Run Keyword And Ignore Error  Redfish BIOS Suite Cleanup | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 16 |  | 
| Matt Fischer | 6fb70d9 | 2023-10-24 19:06:33 -0600 | [diff] [blame] | 17 | Test Tags       Redfish_Bios_Attributes | 
| George Keishing | 5431685 | 2023-10-16 14:03:29 +0530 | [diff] [blame] | 18 |  | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 19 | *** Variables *** | 
|  | 20 |  | 
| George Keishing | aa2329b | 2025-04-25 22:26:12 +0530 | [diff] [blame] | 21 | ${BIOS_ORIGINAL_DATA}       ${EMPTY} | 
|  | 22 | ${ATTR_TABLE_DATA}          ${EMPTY} | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 23 |  | 
|  | 24 |  | 
|  | 25 | *** Test Cases *** | 
|  | 26 |  | 
|  | 27 | Redfish Verify Set BIOS Attribute With Invalid Attribute Name | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 28 | [Documentation]  Verify set BIOS attribute with invalid attribute name using | 
|  | 29 | ...              Redfish. | 
|  | 30 | [Tags]  Redfish_Verify_Set_BIOS_Attribute_With_Invalid_Attribute_Name | 
|  | 31 |  | 
|  | 32 | ${random_str}=  Generate Random String  8  [LETTERS][NUMBERS] | 
|  | 33 | Redfish.Patch  ${BIOS_ATTR_SETTINGS_URI}  body={"Attributes":{"${random_str}": '${random_str}'}} | 
|  | 34 | ...  valid_status_codes=[${HTTP_BAD_REQUEST}] | 
|  | 35 |  | 
|  | 36 |  | 
|  | 37 | Redfish Verify Set Invalid Optional Value For BIOS Enumeration Attribute Type | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 38 | [Documentation]  Verify set invalid optional value for BIOS enumeration attribute type | 
|  | 39 | ...              using Redfish. | 
|  | 40 | [Tags]  Redfish_Verify_Set_Invalid_Optional_Value_For_BIOS_Enumeration_Attribute_Type | 
|  | 41 |  | 
| George Keishing | aa2329b | 2025-04-25 22:26:12 +0530 | [diff] [blame] | 42 | ${attr_val_data}=  GetBIOSEnumAttributeOptionalValues  ${ATTR_TABLE_DATA} | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 43 | @{attr_handles}=  Get Dictionary Keys  ${attr_val_data} | 
|  | 44 | ${enum_attr}=  Evaluate  random.choice(${attr_handles})  modules=random | 
|  | 45 |  | 
|  | 46 | Redfish.Patch  ${BIOS_ATTR_SETTINGS_URI}  body={"Attributes":{"${enum_attr}": '0'}} | 
| Sridevi Ramesh | 9891059 | 2025-07-28 11:40:39 -0500 | [diff] [blame] | 47 | ...  valid_status_codes=[${HTTP_BAD_REQUEST}, ${HTTP_FORBIDDEN}] | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 48 |  | 
|  | 49 |  | 
|  | 50 | Redfish Verify Set Out Of Range Integer Value For BIOS Integer Attribute Type | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 51 | [Documentation]  Verify set out of range integer value for BIOS integer attribute type | 
|  | 52 | ...              using Redfish. | 
|  | 53 | [Tags]  Redfish_Verify_Set_Out_Of_Range_Integer_Value_For_BIOS_Integer_Attribute_Type | 
|  | 54 |  | 
| George Keishing | aa2329b | 2025-04-25 22:26:12 +0530 | [diff] [blame] | 55 | ${attr_val_data}=  GetBIOSStrAndIntAttributeHandles  BIOSInteger  ${ATTR_TABLE_DATA} | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 56 | @{attr_handles}=  Get Dictionary Keys  ${attr_val_data} | 
|  | 57 | ${int_attr}=  Evaluate  random.choice(${attr_handles})  modules=random | 
|  | 58 | ${count}=  Evaluate  ${attr_val_data['${int_attr}']["UpperBound"]} + 5 | 
|  | 59 |  | 
|  | 60 | Redfish.Patch  ${BIOS_ATTR_SETTINGS_URI}  body={"Attributes":{"${int_attr}": ${count}}} | 
| Sridevi Ramesh | d8a6a66 | 2025-05-20 11:22:44 -0500 | [diff] [blame] | 61 | ...  valid_status_codes=[${HTTP_BAD_REQUEST}] | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 62 |  | 
| Sridevi Ramesh | d8a6a66 | 2025-05-20 11:22:44 -0500 | [diff] [blame] | 63 | *** Comments *** | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 64 | Redfish Verify Set Out Of Range String Value For BIOS String Attribute Type | 
|  | 65 |  | 
|  | 66 | [Documentation]  Verify set out of range string value for BIOS string attribute type | 
|  | 67 | ...              using Redfish. | 
|  | 68 | [Tags]  Redfish_Verify_Set_Out_Of_Range_String_Value_For_BIOS_String_Attribute_Type | 
|  | 69 |  | 
| George Keishing | aa2329b | 2025-04-25 22:26:12 +0530 | [diff] [blame] | 70 | ${attr_val_data}=  GetBIOSStrAndIntAttributeHandles  BIOSString  ${ATTR_TABLE_DATA} | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 71 | @{attr_handles}=  Get Dictionary Keys  ${attr_val_data} | 
|  | 72 | ${str_attr}=  Evaluate  random.choice(${attr_handles})  modules=random | 
|  | 73 | ${count}=  Evaluate  ${attr_val_data['${str_attr}']["MaximumStringLength"]} + 5 | 
|  | 74 | ${random_value}=  Generate Random String  ${count}  [LETTERS][NUMBERS] | 
|  | 75 |  | 
|  | 76 | Redfish.Patch  ${BIOS_ATTR_SETTINGS_URI}  body={"Attributes":{"${str_attr}": '${random_value}'}} | 
| George Keishing | 52f01af | 2022-09-19 08:55:10 -0500 | [diff] [blame] | 77 | ...  valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR},${HTTP_BAD_REQUEST}] | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 78 |  | 
|  | 79 |  | 
|  | 80 | Redfish Verify Set BIOS String Attribute Type | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 81 | [Documentation]  Verify set BIOS string attribute type for various BIOS | 
|  | 82 | ...              attribute handle with random values with in the range using Redfish. | 
|  | 83 | [Tags]  Redfish_Verify_Set_BIOS_String_Attribute_Type | 
|  | 84 |  | 
| George Keishing | 74bdf3d | 2022-07-25 12:34:47 -0500 | [diff] [blame] | 85 | @{failed_attr_list}=  Create List | 
|  | 86 |  | 
| George Keishing | aa2329b | 2025-04-25 22:26:12 +0530 | [diff] [blame] | 87 | ${attr_val_data}=  GetBIOSStrAndIntAttributeHandles  BIOSString  ${ATTR_TABLE_DATA} | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 88 | @{attr_handles}=  Get Dictionary Keys  ${attr_val_data} | 
|  | 89 | FOR  ${i}  IN  @{attr_handles} | 
|  | 90 | ${random_value}=  GetRandomBIOSIntAndStrValues  ${i}  ${attr_val_data['${i}']["MaximumStringLength"]} | 
| George Keishing | 74bdf3d | 2022-07-25 12:34:47 -0500 | [diff] [blame] | 91 | ${status}=  Run Keyword And Return Status | 
|  | 92 | ...  Set BIOS Attribute Value And Verify  ${i}  ${random_value} | 
| George Keishing | aa2329b | 2025-04-25 22:26:12 +0530 | [diff] [blame] | 93 | IF  ${status} == ${False}  Append To List  ${failed_attr_list}  ${i} | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 94 | END | 
|  | 95 |  | 
| George Keishing | 74bdf3d | 2022-07-25 12:34:47 -0500 | [diff] [blame] | 96 | ${fail_count}=  Get Length  ${failed_attr_list} | 
|  | 97 | Should Be Equal  ${fail_count}  ${0} | 
|  | 98 | ...  msg= BIOS write Failed ${fail_count} list: ${failed_attr_list} | 
|  | 99 |  | 
|  | 100 |  | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 101 |  | 
|  | 102 | Redfish Verify Set BIOS Integer Attribute Type | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 103 | [Documentation]  Verify set BIOS integer attribute type for various BIOS | 
|  | 104 | ...              attribute handle with random values with in the range using Redfish. | 
|  | 105 | [Tags]  Redfish_Verify_Set_BIOS_Integer_Attribute_Type | 
|  | 106 |  | 
| George Keishing | 74bdf3d | 2022-07-25 12:34:47 -0500 | [diff] [blame] | 107 | @{failed_attr_list}=  Create List | 
|  | 108 |  | 
| George Keishing | aa2329b | 2025-04-25 22:26:12 +0530 | [diff] [blame] | 109 | ${attr_val_data}=  GetBIOSStrAndIntAttributeHandles  BIOSInteger  ${ATTR_TABLE_DATA} | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 110 | @{attr_handles}=  Get Dictionary Keys  ${attr_val_data} | 
|  | 111 | FOR  ${i}  IN  @{attr_handles} | 
|  | 112 | ${random_value}=  GetRandomBIOSIntAndStrValues  ${i}  ${attr_val_data['${i}']["UpperBound"]} | 
| George Keishing | 74bdf3d | 2022-07-25 12:34:47 -0500 | [diff] [blame] | 113 | ${status}=  Run Keyword And Return Status | 
|  | 114 | ...  Set BIOS Attribute Value And Verify  ${i}  ${random_value} | 
| George Keishing | aa2329b | 2025-04-25 22:26:12 +0530 | [diff] [blame] | 115 | IF  ${status} == ${False}  Append To List  ${failed_attr_list}  ${i} | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 116 | END | 
|  | 117 |  | 
| George Keishing | 74bdf3d | 2022-07-25 12:34:47 -0500 | [diff] [blame] | 118 | ${fail_count}=  Get Length  ${failed_attr_list} | 
|  | 119 | Should Be Equal  ${fail_count}  ${0} | 
|  | 120 | ...  msg= BIOS write Failed ${fail_count} list: ${failed_attr_list} | 
|  | 121 |  | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 122 |  | 
|  | 123 | Redfish Verify Set BIOS Enumeration Attribute Type | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 124 | [Documentation]  Validate get and update BIOS attribute optional values | 
|  | 125 | ...              and set back to original BIOS attribute values using Redfish. | 
| George Keishing | 4203fad | 2022-01-31 12:22:33 -0600 | [diff] [blame] | 126 | [Tags]  Redfish_Verify_Set_BIOS_Enumeration_Attribute_Type | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 127 |  | 
| Sridevi Ramesh | a4ab9f3 | 2023-12-13 02:58:53 -0600 | [diff] [blame] | 128 | @{failed_attr_list}=  Create List | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 129 |  | 
|  | 130 | # Fetch BIOS attribute optional values from pldmtool getbiostable. | 
| George Keishing | aa2329b | 2025-04-25 22:26:12 +0530 | [diff] [blame] | 131 | ${attr_val_data}=  GetBIOSEnumAttributeOptionalValues  ${ATTR_TABLE_DATA} | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 132 | @{attr_handles}=  Get Dictionary Keys  ${attr_val_data} | 
|  | 133 |  | 
|  | 134 | # Example: | 
|  | 135 | # {'vmi_if0_ipv4_method': ['IPv4Static', 'IPv4DHCP']} | 
|  | 136 |  | 
|  | 137 | # Update multiple attribute values for corresponding attribute handle. | 
|  | 138 | FOR  ${i}  IN  @{attr_handles} | 
|  | 139 | @{attr_val_list}=  Set Variable  ${attr_val_data}[${i}] | 
| Sridevi Ramesh | a4ab9f3 | 2023-12-13 02:58:53 -0600 | [diff] [blame] | 140 | ${status}=  Run Keyword And Return Status | 
|  | 141 | ...  Set Optional BIOS Attribute Values And Verify  ${i}  @{attr_val_list} | 
| George Keishing | aa2329b | 2025-04-25 22:26:12 +0530 | [diff] [blame] | 142 | IF  ${status} == ${False}  Append To List  ${failed_attr_list}  ${i} | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 143 | END | 
|  | 144 |  | 
| Sridevi Ramesh | a4ab9f3 | 2023-12-13 02:58:53 -0600 | [diff] [blame] | 145 | ${fail_count}=  Get Length  ${failed_attr_list} | 
|  | 146 | Should Be Equal  ${fail_count}  ${0} | 
|  | 147 | ...  msg= BIOS write Failed ${fail_count} list: ${failed_attr_list} | 
|  | 148 |  | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 149 |  | 
|  | 150 | Redfish Verify Restore BIOS Attribute Values | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 151 | [Documentation]  Restore all BIOS attribute values with its default values and verify | 
|  | 152 | ...              using Redfish. | 
|  | 153 | [Tags]  Redfish_Verify_Restore_BIOS_Attribute_Values | 
|  | 154 |  | 
| George Keishing | aa2329b | 2025-04-25 22:26:12 +0530 | [diff] [blame] | 155 | ${bios_default_data}=  GetBIOSAttrDefaultValues  ${ATTR_TABLE_DATA} | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 156 | @{attr_handles}=  Get Dictionary Keys  ${bios_default_data} | 
|  | 157 |  | 
|  | 158 | FOR  ${i}  IN  @{attr_handles} | 
|  | 159 | Set BIOS Attribute Value And Verify  ${i}  ${bios_default_data['${i}']} | 
|  | 160 | END | 
|  | 161 |  | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 162 | *** Keywords *** | 
|  | 163 |  | 
|  | 164 | Redfish BIOS Suite Setup | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 165 | [Documentation]  Perform Redfish BIOS suite setup. | 
|  | 166 |  | 
|  | 167 | Redfish.Login | 
|  | 168 | ${pldm_output}=  Pldmtool  bios GetBIOSTable --type AttributeTable | 
| George Keishing | aa2329b | 2025-04-25 22:26:12 +0530 | [diff] [blame] | 169 | Set Suite Variable  ${ATTR_TABLE_DATA}  ${pldm_output} | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 170 |  | 
|  | 171 | ${data}=  GetBIOSAttrOriginalValues  ${pldm_output} | 
| George Keishing | aa2329b | 2025-04-25 22:26:12 +0530 | [diff] [blame] | 172 | Set Suite Variable  ${BIOS_ORIGINAL_DATA}  ${data} | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 173 |  | 
|  | 174 |  | 
|  | 175 | Redfish BIOS Suite Cleanup | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 176 | [Documentation]  Perform Redfish BIOS suite cleanup. | 
|  | 177 |  | 
| George Keishing | aa2329b | 2025-04-25 22:26:12 +0530 | [diff] [blame] | 178 | @{attr_handles}=  Get Dictionary Keys  ${BIOS_ORIGINAL_DATA} | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 179 | FOR  ${i}  IN  @{attr_handles} | 
| George Keishing | aa2329b | 2025-04-25 22:26:12 +0530 | [diff] [blame] | 180 | Set BIOS Attribute Value And Verify  ${i}  ${BIOS_ORIGINAL_DATA['${i}']} | 
| Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 181 | END | 
|  | 182 | Redfish.Logout |