blob: 2e22fa1b7d639752bce18f331217eedeca0de92d [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
George Keishing54316852023-10-16 14:03:29 +053017Force Tags Redfish_Bios_Attributes
18
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050019*** Variables ***
20
21${bios_original_data} ${EMPTY}
22${attr_table_data} ${EMPTY}
23
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
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'}}
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
55 ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSInteger ${attr_table_data}
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}}}
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
70 ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSString ${attr_table_data}
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 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
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050087 ${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"]}
George Keishing74bdf3d2022-07-25 12:34:47 -050091 ${status}= Run Keyword And Return Status
92 ... Set BIOS Attribute Value And Verify ${i} ${random_value}
93 Run Keyword 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
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500109 ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSInteger ${attr_table_data}
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 Keishing74bdf3d2022-07-25 12:34:47 -0500113 ${status}= Run Keyword And Return Status
114 ... Set BIOS Attribute Value And Verify ${i} ${random_value}
115 Run Keyword 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.
131 ${attr_val_data}= GetBIOSEnumAttributeOptionalValues ${attr_table_data}
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 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}
142 Run Keyword 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
155 ${bios_default_data}= GetBIOSAttrDefaultValues ${attr_table_data}
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 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
169 Set Global Variable ${attr_table_data} ${pldm_output}
170
171 ${data}= GetBIOSAttrOriginalValues ${pldm_output}
172 Set Global Variable ${bios_original_data} ${data}
173
174
175Redfish BIOS Suite Cleanup
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500176 [Documentation] Perform Redfish BIOS suite cleanup.
177
178 @{attr_handles}= Get Dictionary Keys ${bios_original_data}
179 FOR ${i} IN @{attr_handles}
180 Set BIOS Attribute Value And Verify ${i} ${bios_original_data['${i}']}
181 END
182 Redfish.Logout