blob: 03f99857274e617b5db80ae520491b895ce527c3 [file] [log] [blame]
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -05001*** Settings ***
2Documentation This suite test various BIOS attributes operations using Redfish.
3
George Keishing67a8bef2021-05-27 14:35:58 -05004Resource ../lib/resource.robot
5Resource ../lib/bmc_redfish_resource.robot
6Resource ../lib/common_utils.robot
7Resource ../lib/openbmc_ffdc.robot
8Resource ../lib/bios_attr_utils.robot
9Library ../lib/pldm_utils.py
10Variables ../data/pldm_variables.py
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050011
George Keishing855babf2021-05-03 23:50:08 -050012Test Teardown FFDC On Test Case Fail
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050013
14Suite Setup Redfish BIOS Suite Setup
George Keishinga78fe5d2022-07-21 11:18:18 -050015Suite Teardown Run Keyword And Ignore Error Redfish BIOS Suite Cleanup
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050016
Matt Fischer6fb70d92023-10-24 19:06:33 -060017Test Tags Redfish_Bios_Attributes
George Keishing54316852023-10-16 14:03:29 +053018
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050019*** Variables ***
20
George Keishingaa2329b2025-04-25 22:26:12 +053021${BIOS_ORIGINAL_DATA} ${EMPTY}
22${ATTR_TABLE_DATA} ${EMPTY}
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050023
24
25*** Test Cases ***
26
27Redfish Verify Set BIOS Attribute With Invalid Attribute Name
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050028 [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
37Redfish Verify Set Invalid Optional Value For BIOS Enumeration Attribute Type
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050038 [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 Keishingaa2329b2025-04-25 22:26:12 +053042 ${attr_val_data}= GetBIOSEnumAttributeOptionalValues ${ATTR_TABLE_DATA}
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050043 @{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'}}
George Keishingc9f02592022-09-19 09:10:20 -050047 ... valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR},${HTTP_FORBIDDEN}]
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050048
49
50Redfish Verify Set Out Of Range Integer Value For BIOS Integer Attribute Type
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050051 [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 Keishingaa2329b2025-04-25 22:26:12 +053055 ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSInteger ${ATTR_TABLE_DATA}
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050056 @{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}}}
George Keishing52f01af2022-09-19 08:55:10 -050061 ... valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR},${HTTP_BAD_REQUEST}]
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050062
63
64Redfish 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 Keishingaa2329b2025-04-25 22:26:12 +053070 ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSString ${ATTR_TABLE_DATA}
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050071 @{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 Keishing52f01af2022-09-19 08:55:10 -050077 ... valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR},${HTTP_BAD_REQUEST}]
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050078
79
80Redfish Verify Set BIOS String Attribute Type
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050081 [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 Keishing74bdf3d2022-07-25 12:34:47 -050085 @{failed_attr_list}= Create List
86
George Keishingaa2329b2025-04-25 22:26:12 +053087 ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSString ${ATTR_TABLE_DATA}
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050088 @{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 Keishing74bdf3d2022-07-25 12:34:47 -050091 ${status}= Run Keyword And Return Status
92 ... Set BIOS Attribute Value And Verify ${i} ${random_value}
George Keishingaa2329b2025-04-25 22:26:12 +053093 IF ${status} == ${False} Append To List ${failed_attr_list} ${i}
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050094 END
95
George Keishing74bdf3d2022-07-25 12:34:47 -050096 ${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 Ramesheedcf1a2021-03-17 07:09:32 -0500101
102Redfish Verify Set BIOS Integer Attribute Type
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500103 [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 Keishing74bdf3d2022-07-25 12:34:47 -0500107 @{failed_attr_list}= Create List
108
George Keishingaa2329b2025-04-25 22:26:12 +0530109 ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSInteger ${ATTR_TABLE_DATA}
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500110 @{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 Keishing74bdf3d2022-07-25 12:34:47 -0500113 ${status}= Run Keyword And Return Status
114 ... Set BIOS Attribute Value And Verify ${i} ${random_value}
George Keishingaa2329b2025-04-25 22:26:12 +0530115 IF ${status} == ${False} Append To List ${failed_attr_list} ${i}
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500116 END
117
George Keishing74bdf3d2022-07-25 12:34:47 -0500118 ${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 Ramesheedcf1a2021-03-17 07:09:32 -0500122
123Redfish Verify Set BIOS Enumeration Attribute Type
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500124 [Documentation] Validate get and update BIOS attribute optional values
125 ... and set back to original BIOS attribute values using Redfish.
George Keishing4203fad2022-01-31 12:22:33 -0600126 [Tags] Redfish_Verify_Set_BIOS_Enumeration_Attribute_Type
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500127
Sridevi Ramesha4ab9f32023-12-13 02:58:53 -0600128 @{failed_attr_list}= Create List
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500129
130 # Fetch BIOS attribute optional values from pldmtool getbiostable.
George Keishingaa2329b2025-04-25 22:26:12 +0530131 ${attr_val_data}= GetBIOSEnumAttributeOptionalValues ${ATTR_TABLE_DATA}
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500132 @{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 Ramesha4ab9f32023-12-13 02:58:53 -0600140 ${status}= Run Keyword And Return Status
141 ... Set Optional BIOS Attribute Values And Verify ${i} @{attr_val_list}
George Keishingaa2329b2025-04-25 22:26:12 +0530142 IF ${status} == ${False} Append To List ${failed_attr_list} ${i}
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500143 END
144
Sridevi Ramesha4ab9f32023-12-13 02:58:53 -0600145 ${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 Ramesheedcf1a2021-03-17 07:09:32 -0500149
150Redfish Verify Restore BIOS Attribute Values
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500151 [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 Keishingaa2329b2025-04-25 22:26:12 +0530155 ${bios_default_data}= GetBIOSAttrDefaultValues ${ATTR_TABLE_DATA}
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500156 @{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 Ramesheedcf1a2021-03-17 07:09:32 -0500162*** Keywords ***
163
164Redfish BIOS Suite Setup
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500165 [Documentation] Perform Redfish BIOS suite setup.
166
167 Redfish.Login
168 ${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeTable
George Keishingaa2329b2025-04-25 22:26:12 +0530169 Set Suite Variable ${ATTR_TABLE_DATA} ${pldm_output}
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500170
171 ${data}= GetBIOSAttrOriginalValues ${pldm_output}
George Keishingaa2329b2025-04-25 22:26:12 +0530172 Set Suite Variable ${BIOS_ORIGINAL_DATA} ${data}
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500173
174
175Redfish BIOS Suite Cleanup
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500176 [Documentation] Perform Redfish BIOS suite cleanup.
177
George Keishingaa2329b2025-04-25 22:26:12 +0530178 @{attr_handles}= Get Dictionary Keys ${BIOS_ORIGINAL_DATA}
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500179 FOR ${i} IN @{attr_handles}
George Keishingaa2329b2025-04-25 22:26:12 +0530180 Set BIOS Attribute Value And Verify ${i} ${BIOS_ORIGINAL_DATA['${i}']}
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500181 END
182 Redfish.Logout