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 |
| 15 | Suite Teardown Redfish BIOS Suite Cleanup |
| 16 | |
| 17 | *** Variables *** |
| 18 | |
| 19 | ${bios_original_data} ${EMPTY} |
| 20 | ${attr_table_data} ${EMPTY} |
| 21 | |
| 22 | |
| 23 | *** Test Cases *** |
| 24 | |
| 25 | Redfish Verify Set BIOS Attribute With Invalid Attribute Name |
| 26 | |
| 27 | [Documentation] Verify set BIOS attribute with invalid attribute name using |
| 28 | ... Redfish. |
| 29 | [Tags] Redfish_Verify_Set_BIOS_Attribute_With_Invalid_Attribute_Name |
| 30 | |
| 31 | ${random_str}= Generate Random String 8 [LETTERS][NUMBERS] |
| 32 | Redfish.Patch ${BIOS_ATTR_SETTINGS_URI} body={"Attributes":{"${random_str}": '${random_str}'}} |
| 33 | ... valid_status_codes=[${HTTP_BAD_REQUEST}] |
| 34 | |
| 35 | |
| 36 | Redfish Verify Set Invalid Optional Value For BIOS Enumeration Attribute Type |
| 37 | |
| 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 | |
| 42 | ${attr_val_data}= GetBIOSEnumAttributeOptionalValues ${attr_table_data} |
| 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'}} |
| 47 | ... valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}] |
| 48 | |
| 49 | |
| 50 | Redfish Verify Set Out Of Range Integer Value For BIOS Integer Attribute Type |
| 51 | |
| 52 | [Documentation] Verify set out of range integer value for BIOS integer attribute type |
| 53 | ... using Redfish. |
| 54 | [Tags] Redfish_Verify_Set_Out_Of_Range_Integer_Value_For_BIOS_Integer_Attribute_Type |
| 55 | |
| 56 | ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSInteger ${attr_table_data} |
| 57 | @{attr_handles}= Get Dictionary Keys ${attr_val_data} |
| 58 | ${int_attr}= Evaluate random.choice(${attr_handles}) modules=random |
| 59 | ${count}= Evaluate ${attr_val_data['${int_attr}']["UpperBound"]} + 5 |
| 60 | |
| 61 | Redfish.Patch ${BIOS_ATTR_SETTINGS_URI} body={"Attributes":{"${int_attr}": ${count}}} |
| 62 | ... valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}] |
| 63 | |
| 64 | |
| 65 | Redfish Verify Set Out Of Range String Value For BIOS String Attribute Type |
| 66 | |
| 67 | [Documentation] Verify set out of range string value for BIOS string attribute type |
| 68 | ... using Redfish. |
| 69 | [Tags] Redfish_Verify_Set_Out_Of_Range_String_Value_For_BIOS_String_Attribute_Type |
| 70 | |
| 71 | ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSString ${attr_table_data} |
| 72 | @{attr_handles}= Get Dictionary Keys ${attr_val_data} |
| 73 | ${str_attr}= Evaluate random.choice(${attr_handles}) modules=random |
| 74 | ${count}= Evaluate ${attr_val_data['${str_attr}']["MaximumStringLength"]} + 5 |
| 75 | ${random_value}= Generate Random String ${count} [LETTERS][NUMBERS] |
| 76 | |
| 77 | Redfish.Patch ${BIOS_ATTR_SETTINGS_URI} body={"Attributes":{"${str_attr}": '${random_value}'}} |
| 78 | ... valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}] |
| 79 | |
| 80 | |
| 81 | Redfish Verify Set BIOS String Attribute Type |
| 82 | |
| 83 | [Documentation] Verify set BIOS string attribute type for various BIOS |
| 84 | ... attribute handle with random values with in the range using Redfish. |
| 85 | [Tags] Redfish_Verify_Set_BIOS_String_Attribute_Type |
| 86 | |
| 87 | ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSString ${attr_table_data} |
| 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"]} |
| 91 | Set BIOS Attribute Value And Verify ${i} ${random_value} |
| 92 | END |
| 93 | |
| 94 | |
| 95 | Redfish Verify Set BIOS Integer Attribute Type |
| 96 | |
| 97 | [Documentation] Verify set BIOS integer attribute type for various BIOS |
| 98 | ... attribute handle with random values with in the range using Redfish. |
| 99 | [Tags] Redfish_Verify_Set_BIOS_Integer_Attribute_Type |
| 100 | |
| 101 | ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSInteger ${attr_table_data} |
| 102 | @{attr_handles}= Get Dictionary Keys ${attr_val_data} |
| 103 | FOR ${i} IN @{attr_handles} |
| 104 | ${random_value}= GetRandomBIOSIntAndStrValues ${i} ${attr_val_data['${i}']["UpperBound"]} |
| 105 | Set BIOS Attribute Value And Verify ${i} ${random_value} |
| 106 | END |
| 107 | |
| 108 | |
| 109 | Redfish Verify Set BIOS Enumeration Attribute Type |
| 110 | |
| 111 | [Documentation] Validate get and update BIOS attribute optional values |
| 112 | ... and set back to original BIOS attribute values using Redfish. |
George Keishing | 4203fad | 2022-01-31 12:22:33 -0600 | [diff] [blame] | 113 | [Tags] Redfish_Verify_Set_BIOS_Enumeration_Attribute_Type |
Sridevi Ramesh | eedcf1a | 2021-03-17 07:09:32 -0500 | [diff] [blame] | 114 | |
| 115 | |
| 116 | # Fetch BIOS attribute optional values from pldmtool getbiostable. |
| 117 | ${attr_val_data}= GetBIOSEnumAttributeOptionalValues ${attr_table_data} |
| 118 | @{attr_handles}= Get Dictionary Keys ${attr_val_data} |
| 119 | |
| 120 | # Example: |
| 121 | # {'vmi_if0_ipv4_method': ['IPv4Static', 'IPv4DHCP']} |
| 122 | |
| 123 | # Update multiple attribute values for corresponding attribute handle. |
| 124 | FOR ${i} IN @{attr_handles} |
| 125 | @{attr_val_list}= Set Variable ${attr_val_data}[${i}] |
| 126 | Set Optional BIOS Attribute Values And Verify ${i} @{attr_val_list} |
| 127 | END |
| 128 | |
| 129 | |
| 130 | Redfish Verify Restore BIOS Attribute Values |
| 131 | |
| 132 | [Documentation] Restore all BIOS attribute values with its default values and verify |
| 133 | ... using Redfish. |
| 134 | [Tags] Redfish_Verify_Restore_BIOS_Attribute_Values |
| 135 | |
| 136 | ${bios_default_data}= GetBIOSAttrDefaultValues ${attr_table_data} |
| 137 | @{attr_handles}= Get Dictionary Keys ${bios_default_data} |
| 138 | |
| 139 | FOR ${i} IN @{attr_handles} |
| 140 | Set BIOS Attribute Value And Verify ${i} ${bios_default_data['${i}']} |
| 141 | END |
| 142 | |
| 143 | |
| 144 | *** Keywords *** |
| 145 | |
| 146 | Redfish BIOS Suite Setup |
| 147 | |
| 148 | [Documentation] Perform Redfish BIOS suite setup. |
| 149 | |
| 150 | Redfish.Login |
| 151 | ${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeTable |
| 152 | Set Global Variable ${attr_table_data} ${pldm_output} |
| 153 | |
| 154 | ${data}= GetBIOSAttrOriginalValues ${pldm_output} |
| 155 | Set Global Variable ${bios_original_data} ${data} |
| 156 | |
| 157 | |
| 158 | Redfish BIOS Suite Cleanup |
| 159 | |
| 160 | [Documentation] Perform Redfish BIOS suite cleanup. |
| 161 | |
| 162 | @{attr_handles}= Get Dictionary Keys ${bios_original_data} |
| 163 | FOR ${i} IN @{attr_handles} |
| 164 | Set BIOS Attribute Value And Verify ${i} ${bios_original_data['${i}']} |
| 165 | END |
| 166 | Redfish.Logout |