1a78fe5ddSGeorge Keishing*** Settings *** 2a78fe5ddSGeorge KeishingDocumentation This suite test various BIOS attributes operations using Redfish. 3a78fe5ddSGeorge Keishing 4a78fe5ddSGeorge KeishingResource ../lib/resource.robot 5a78fe5ddSGeorge KeishingResource ../lib/bmc_redfish_resource.robot 6a78fe5ddSGeorge KeishingResource ../lib/common_utils.robot 7a78fe5ddSGeorge KeishingResource ../lib/openbmc_ffdc.robot 8a78fe5ddSGeorge KeishingResource ../lib/bios_attr_utils.robot 9a78fe5ddSGeorge KeishingLibrary ../lib/pldm_utils.py 10a78fe5ddSGeorge KeishingVariables ../data/pldm_variables.py 11a78fe5ddSGeorge Keishing 12a78fe5ddSGeorge KeishingTest Teardown FFDC On Test Case Fail 13a78fe5ddSGeorge Keishing 14a78fe5ddSGeorge KeishingSuite Setup Redfish BIOS Suite Setup 15a78fe5ddSGeorge KeishingSuite Teardown Run Keyword And Ignore Error Redfish BIOS Suite Cleanup 16a78fe5ddSGeorge Keishing 176fb70d98SMatt FischerTest Tags Redfish_Bios_Attributes 185431685fSGeorge Keishing 19a78fe5ddSGeorge Keishing*** Variables *** 20a78fe5ddSGeorge Keishing 21*aa2329b3SGeorge Keishing${BIOS_ORIGINAL_DATA} ${EMPTY} 22*aa2329b3SGeorge Keishing${ATTR_TABLE_DATA} ${EMPTY} 23a78fe5ddSGeorge Keishing 24a78fe5ddSGeorge Keishing 25a78fe5ddSGeorge Keishing*** Test Cases *** 26a78fe5ddSGeorge Keishing 27a78fe5ddSGeorge KeishingRedfish Verify Set BIOS Attribute With Invalid Attribute Name 28a78fe5ddSGeorge Keishing [Documentation] Verify set BIOS attribute with invalid attribute name using 29a78fe5ddSGeorge Keishing ... Redfish. 30a78fe5ddSGeorge Keishing [Tags] Redfish_Verify_Set_BIOS_Attribute_With_Invalid_Attribute_Name 31a78fe5ddSGeorge Keishing 32a78fe5ddSGeorge Keishing ${random_str}= Generate Random String 8 [LETTERS][NUMBERS] 33a78fe5ddSGeorge Keishing Redfish.Patch ${BIOS_ATTR_SETTINGS_URI} body={"Attributes":{"${random_str}": '${random_str}'}} 34a78fe5ddSGeorge Keishing ... valid_status_codes=[${HTTP_BAD_REQUEST}] 35a78fe5ddSGeorge Keishing 36a78fe5ddSGeorge Keishing 37a78fe5ddSGeorge KeishingRedfish Verify Set Invalid Optional Value For BIOS Enumeration Attribute Type 38a78fe5ddSGeorge Keishing [Documentation] Verify set invalid optional value for BIOS enumeration attribute type 39a78fe5ddSGeorge Keishing ... using Redfish. 40a78fe5ddSGeorge Keishing [Tags] Redfish_Verify_Set_Invalid_Optional_Value_For_BIOS_Enumeration_Attribute_Type 41a78fe5ddSGeorge Keishing 42*aa2329b3SGeorge Keishing ${attr_val_data}= GetBIOSEnumAttributeOptionalValues ${ATTR_TABLE_DATA} 43a78fe5ddSGeorge Keishing @{attr_handles}= Get Dictionary Keys ${attr_val_data} 44a78fe5ddSGeorge Keishing ${enum_attr}= Evaluate random.choice(${attr_handles}) modules=random 45a78fe5ddSGeorge Keishing 46a78fe5ddSGeorge Keishing Redfish.Patch ${BIOS_ATTR_SETTINGS_URI} body={"Attributes":{"${enum_attr}": '0'}} 47c9f0259fSGeorge Keishing ... valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR},${HTTP_FORBIDDEN}] 48a78fe5ddSGeorge Keishing 49a78fe5ddSGeorge Keishing 50a78fe5ddSGeorge KeishingRedfish Verify Set Out Of Range Integer Value For BIOS Integer Attribute Type 51a78fe5ddSGeorge Keishing [Documentation] Verify set out of range integer value for BIOS integer attribute type 52a78fe5ddSGeorge Keishing ... using Redfish. 53a78fe5ddSGeorge Keishing [Tags] Redfish_Verify_Set_Out_Of_Range_Integer_Value_For_BIOS_Integer_Attribute_Type 54a78fe5ddSGeorge Keishing 55*aa2329b3SGeorge Keishing ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSInteger ${ATTR_TABLE_DATA} 56a78fe5ddSGeorge Keishing @{attr_handles}= Get Dictionary Keys ${attr_val_data} 57a78fe5ddSGeorge Keishing ${int_attr}= Evaluate random.choice(${attr_handles}) modules=random 58a78fe5ddSGeorge Keishing ${count}= Evaluate ${attr_val_data['${int_attr}']["UpperBound"]} + 5 59a78fe5ddSGeorge Keishing 60a78fe5ddSGeorge Keishing Redfish.Patch ${BIOS_ATTR_SETTINGS_URI} body={"Attributes":{"${int_attr}": ${count}}} 6152f01af6SGeorge Keishing ... valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR},${HTTP_BAD_REQUEST}] 62a78fe5ddSGeorge Keishing 63a78fe5ddSGeorge Keishing 64a78fe5ddSGeorge KeishingRedfish Verify Set Out Of Range String Value For BIOS String Attribute Type 65a78fe5ddSGeorge Keishing 66a78fe5ddSGeorge Keishing [Documentation] Verify set out of range string value for BIOS string attribute type 67a78fe5ddSGeorge Keishing ... using Redfish. 68a78fe5ddSGeorge Keishing [Tags] Redfish_Verify_Set_Out_Of_Range_String_Value_For_BIOS_String_Attribute_Type 69a78fe5ddSGeorge Keishing 70*aa2329b3SGeorge Keishing ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSString ${ATTR_TABLE_DATA} 71a78fe5ddSGeorge Keishing @{attr_handles}= Get Dictionary Keys ${attr_val_data} 72a78fe5ddSGeorge Keishing ${str_attr}= Evaluate random.choice(${attr_handles}) modules=random 73a78fe5ddSGeorge Keishing ${count}= Evaluate ${attr_val_data['${str_attr}']["MaximumStringLength"]} + 5 74a78fe5ddSGeorge Keishing ${random_value}= Generate Random String ${count} [LETTERS][NUMBERS] 75a78fe5ddSGeorge Keishing 76a78fe5ddSGeorge Keishing Redfish.Patch ${BIOS_ATTR_SETTINGS_URI} body={"Attributes":{"${str_attr}": '${random_value}'}} 7752f01af6SGeorge Keishing ... valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR},${HTTP_BAD_REQUEST}] 78a78fe5ddSGeorge Keishing 79a78fe5ddSGeorge Keishing 80a78fe5ddSGeorge KeishingRedfish Verify Set BIOS String Attribute Type 81a78fe5ddSGeorge Keishing [Documentation] Verify set BIOS string attribute type for various BIOS 82a78fe5ddSGeorge Keishing ... attribute handle with random values with in the range using Redfish. 83a78fe5ddSGeorge Keishing [Tags] Redfish_Verify_Set_BIOS_String_Attribute_Type 84a78fe5ddSGeorge Keishing 8574bdf3deSGeorge Keishing @{failed_attr_list}= Create List 8674bdf3deSGeorge Keishing 87*aa2329b3SGeorge Keishing ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSString ${ATTR_TABLE_DATA} 88a78fe5ddSGeorge Keishing @{attr_handles}= Get Dictionary Keys ${attr_val_data} 89a78fe5ddSGeorge Keishing FOR ${i} IN @{attr_handles} 90a78fe5ddSGeorge Keishing ${random_value}= GetRandomBIOSIntAndStrValues ${i} ${attr_val_data['${i}']["MaximumStringLength"]} 9174bdf3deSGeorge Keishing ${status}= Run Keyword And Return Status 9274bdf3deSGeorge Keishing ... Set BIOS Attribute Value And Verify ${i} ${random_value} 93*aa2329b3SGeorge Keishing IF ${status} == ${False} Append To List ${failed_attr_list} ${i} 94a78fe5ddSGeorge Keishing END 95a78fe5ddSGeorge Keishing 9674bdf3deSGeorge Keishing ${fail_count}= Get Length ${failed_attr_list} 9774bdf3deSGeorge Keishing Should Be Equal ${fail_count} ${0} 9874bdf3deSGeorge Keishing ... msg= BIOS write Failed ${fail_count} list: ${failed_attr_list} 9974bdf3deSGeorge Keishing 10074bdf3deSGeorge Keishing 101a78fe5ddSGeorge Keishing 102a78fe5ddSGeorge KeishingRedfish Verify Set BIOS Integer Attribute Type 103a78fe5ddSGeorge Keishing [Documentation] Verify set BIOS integer attribute type for various BIOS 104a78fe5ddSGeorge Keishing ... attribute handle with random values with in the range using Redfish. 105a78fe5ddSGeorge Keishing [Tags] Redfish_Verify_Set_BIOS_Integer_Attribute_Type 106a78fe5ddSGeorge Keishing 10774bdf3deSGeorge Keishing @{failed_attr_list}= Create List 10874bdf3deSGeorge Keishing 109*aa2329b3SGeorge Keishing ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSInteger ${ATTR_TABLE_DATA} 110a78fe5ddSGeorge Keishing @{attr_handles}= Get Dictionary Keys ${attr_val_data} 111a78fe5ddSGeorge Keishing FOR ${i} IN @{attr_handles} 112a78fe5ddSGeorge Keishing ${random_value}= GetRandomBIOSIntAndStrValues ${i} ${attr_val_data['${i}']["UpperBound"]} 11374bdf3deSGeorge Keishing ${status}= Run Keyword And Return Status 11474bdf3deSGeorge Keishing ... Set BIOS Attribute Value And Verify ${i} ${random_value} 115*aa2329b3SGeorge Keishing IF ${status} == ${False} Append To List ${failed_attr_list} ${i} 116a78fe5ddSGeorge Keishing END 117a78fe5ddSGeorge Keishing 11874bdf3deSGeorge Keishing ${fail_count}= Get Length ${failed_attr_list} 11974bdf3deSGeorge Keishing Should Be Equal ${fail_count} ${0} 12074bdf3deSGeorge Keishing ... msg= BIOS write Failed ${fail_count} list: ${failed_attr_list} 12174bdf3deSGeorge Keishing 122a78fe5ddSGeorge Keishing 123a78fe5ddSGeorge KeishingRedfish Verify Set BIOS Enumeration Attribute Type 124a78fe5ddSGeorge Keishing [Documentation] Validate get and update BIOS attribute optional values 125a78fe5ddSGeorge Keishing ... and set back to original BIOS attribute values using Redfish. 126a78fe5ddSGeorge Keishing [Tags] Redfish_Verify_Set_BIOS_Enumeration_Attribute_Type 127a78fe5ddSGeorge Keishing 128a4ab9f33SSridevi Ramesh @{failed_attr_list}= Create List 129a78fe5ddSGeorge Keishing 130a78fe5ddSGeorge Keishing # Fetch BIOS attribute optional values from pldmtool getbiostable. 131*aa2329b3SGeorge Keishing ${attr_val_data}= GetBIOSEnumAttributeOptionalValues ${ATTR_TABLE_DATA} 132a78fe5ddSGeorge Keishing @{attr_handles}= Get Dictionary Keys ${attr_val_data} 133a78fe5ddSGeorge Keishing 134a78fe5ddSGeorge Keishing # Example: 135a78fe5ddSGeorge Keishing # {'vmi_if0_ipv4_method': ['IPv4Static', 'IPv4DHCP']} 136a78fe5ddSGeorge Keishing 137a78fe5ddSGeorge Keishing # Update multiple attribute values for corresponding attribute handle. 138a78fe5ddSGeorge Keishing FOR ${i} IN @{attr_handles} 139a78fe5ddSGeorge Keishing @{attr_val_list}= Set Variable ${attr_val_data}[${i}] 140a4ab9f33SSridevi Ramesh ${status}= Run Keyword And Return Status 141a4ab9f33SSridevi Ramesh ... Set Optional BIOS Attribute Values And Verify ${i} @{attr_val_list} 142*aa2329b3SGeorge Keishing IF ${status} == ${False} Append To List ${failed_attr_list} ${i} 143a78fe5ddSGeorge Keishing END 144a78fe5ddSGeorge Keishing 145a4ab9f33SSridevi Ramesh ${fail_count}= Get Length ${failed_attr_list} 146a4ab9f33SSridevi Ramesh Should Be Equal ${fail_count} ${0} 147a4ab9f33SSridevi Ramesh ... msg= BIOS write Failed ${fail_count} list: ${failed_attr_list} 148a4ab9f33SSridevi Ramesh 149a78fe5ddSGeorge Keishing 150a78fe5ddSGeorge KeishingRedfish Verify Restore BIOS Attribute Values 151a78fe5ddSGeorge Keishing [Documentation] Restore all BIOS attribute values with its default values and verify 152a78fe5ddSGeorge Keishing ... using Redfish. 153a78fe5ddSGeorge Keishing [Tags] Redfish_Verify_Restore_BIOS_Attribute_Values 154a78fe5ddSGeorge Keishing 155*aa2329b3SGeorge Keishing ${bios_default_data}= GetBIOSAttrDefaultValues ${ATTR_TABLE_DATA} 156a78fe5ddSGeorge Keishing @{attr_handles}= Get Dictionary Keys ${bios_default_data} 157a78fe5ddSGeorge Keishing 158a78fe5ddSGeorge Keishing FOR ${i} IN @{attr_handles} 159a78fe5ddSGeorge Keishing Set BIOS Attribute Value And Verify ${i} ${bios_default_data['${i}']} 160a78fe5ddSGeorge Keishing END 161a78fe5ddSGeorge Keishing 162a78fe5ddSGeorge Keishing*** Keywords *** 163a78fe5ddSGeorge Keishing 164a78fe5ddSGeorge KeishingRedfish BIOS Suite Setup 165a78fe5ddSGeorge Keishing [Documentation] Perform Redfish BIOS suite setup. 166a78fe5ddSGeorge Keishing 167a78fe5ddSGeorge Keishing Redfish.Login 168a78fe5ddSGeorge Keishing ${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeTable 169*aa2329b3SGeorge Keishing Set Suite Variable ${ATTR_TABLE_DATA} ${pldm_output} 170a78fe5ddSGeorge Keishing 171a78fe5ddSGeorge Keishing ${data}= GetBIOSAttrOriginalValues ${pldm_output} 172*aa2329b3SGeorge Keishing Set Suite Variable ${BIOS_ORIGINAL_DATA} ${data} 173a78fe5ddSGeorge Keishing 174a78fe5ddSGeorge Keishing 175a78fe5ddSGeorge KeishingRedfish BIOS Suite Cleanup 176a78fe5ddSGeorge Keishing [Documentation] Perform Redfish BIOS suite cleanup. 177a78fe5ddSGeorge Keishing 178*aa2329b3SGeorge Keishing @{attr_handles}= Get Dictionary Keys ${BIOS_ORIGINAL_DATA} 179a78fe5ddSGeorge Keishing FOR ${i} IN @{attr_handles} 180*aa2329b3SGeorge Keishing Set BIOS Attribute Value And Verify ${i} ${BIOS_ORIGINAL_DATA['${i}']} 181a78fe5ddSGeorge Keishing END 182a78fe5ddSGeorge Keishing Redfish.Logout 183