blob: 9e7f849e0d8231bf4178b01848097cc6a6ffb456 [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
17*** Variables ***
18
19${bios_original_data} ${EMPTY}
20${attr_table_data} ${EMPTY}
21
22
23*** Test Cases ***
24
25Redfish Verify Set BIOS Attribute With Invalid Attribute Name
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050026 [Documentation] Verify set BIOS attribute with invalid attribute name using
27 ... Redfish.
28 [Tags] Redfish_Verify_Set_BIOS_Attribute_With_Invalid_Attribute_Name
29
30 ${random_str}= Generate Random String 8 [LETTERS][NUMBERS]
31 Redfish.Patch ${BIOS_ATTR_SETTINGS_URI} body={"Attributes":{"${random_str}": '${random_str}'}}
32 ... valid_status_codes=[${HTTP_BAD_REQUEST}]
33
34
35Redfish Verify Set Invalid Optional Value For BIOS Enumeration Attribute Type
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050036 [Documentation] Verify set invalid optional value for BIOS enumeration attribute type
37 ... using Redfish.
38 [Tags] Redfish_Verify_Set_Invalid_Optional_Value_For_BIOS_Enumeration_Attribute_Type
39
40 ${attr_val_data}= GetBIOSEnumAttributeOptionalValues ${attr_table_data}
41 @{attr_handles}= Get Dictionary Keys ${attr_val_data}
42 ${enum_attr}= Evaluate random.choice(${attr_handles}) modules=random
43
44 Redfish.Patch ${BIOS_ATTR_SETTINGS_URI} body={"Attributes":{"${enum_attr}": '0'}}
45 ... valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}]
46
47
48Redfish Verify Set Out Of Range Integer Value For BIOS Integer Attribute Type
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050049 [Documentation] Verify set out of range integer value for BIOS integer attribute type
50 ... using Redfish.
51 [Tags] Redfish_Verify_Set_Out_Of_Range_Integer_Value_For_BIOS_Integer_Attribute_Type
52
53 ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSInteger ${attr_table_data}
54 @{attr_handles}= Get Dictionary Keys ${attr_val_data}
55 ${int_attr}= Evaluate random.choice(${attr_handles}) modules=random
56 ${count}= Evaluate ${attr_val_data['${int_attr}']["UpperBound"]} + 5
57
58 Redfish.Patch ${BIOS_ATTR_SETTINGS_URI} body={"Attributes":{"${int_attr}": ${count}}}
59 ... valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}]
60
61
62Redfish Verify Set Out Of Range String Value For BIOS String Attribute Type
63
64 [Documentation] Verify set out of range string value for BIOS string attribute type
65 ... using Redfish.
66 [Tags] Redfish_Verify_Set_Out_Of_Range_String_Value_For_BIOS_String_Attribute_Type
67
68 ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSString ${attr_table_data}
69 @{attr_handles}= Get Dictionary Keys ${attr_val_data}
70 ${str_attr}= Evaluate random.choice(${attr_handles}) modules=random
71 ${count}= Evaluate ${attr_val_data['${str_attr}']["MaximumStringLength"]} + 5
72 ${random_value}= Generate Random String ${count} [LETTERS][NUMBERS]
73
74 Redfish.Patch ${BIOS_ATTR_SETTINGS_URI} body={"Attributes":{"${str_attr}": '${random_value}'}}
75 ... valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}]
76
77
78Redfish Verify Set BIOS String Attribute Type
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050079 [Documentation] Verify set BIOS string attribute type for various BIOS
80 ... attribute handle with random values with in the range using Redfish.
81 [Tags] Redfish_Verify_Set_BIOS_String_Attribute_Type
82
George Keishing74bdf3d2022-07-25 12:34:47 -050083 @{failed_attr_list}= Create List
84
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050085 ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSString ${attr_table_data}
86 @{attr_handles}= Get Dictionary Keys ${attr_val_data}
87 FOR ${i} IN @{attr_handles}
88 ${random_value}= GetRandomBIOSIntAndStrValues ${i} ${attr_val_data['${i}']["MaximumStringLength"]}
George Keishing74bdf3d2022-07-25 12:34:47 -050089 ${status}= Run Keyword And Return Status
90 ... Set BIOS Attribute Value And Verify ${i} ${random_value}
91 Run Keyword If ${status} == ${False} Append To List ${failed_attr_list} ${i}
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050092 END
93
George Keishing74bdf3d2022-07-25 12:34:47 -050094 ${fail_count}= Get Length ${failed_attr_list}
95 Should Be Equal ${fail_count} ${0}
96 ... msg= BIOS write Failed ${fail_count} list: ${failed_attr_list}
97
98
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -050099
100Redfish Verify Set BIOS Integer Attribute Type
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500101 [Documentation] Verify set BIOS integer attribute type for various BIOS
102 ... attribute handle with random values with in the range using Redfish.
103 [Tags] Redfish_Verify_Set_BIOS_Integer_Attribute_Type
104
George Keishing74bdf3d2022-07-25 12:34:47 -0500105 @{failed_attr_list}= Create List
106
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500107 ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSInteger ${attr_table_data}
108 @{attr_handles}= Get Dictionary Keys ${attr_val_data}
109 FOR ${i} IN @{attr_handles}
110 ${random_value}= GetRandomBIOSIntAndStrValues ${i} ${attr_val_data['${i}']["UpperBound"]}
George Keishing74bdf3d2022-07-25 12:34:47 -0500111 ${status}= Run Keyword And Return Status
112 ... Set BIOS Attribute Value And Verify ${i} ${random_value}
113 Run Keyword If ${status} == ${False} Append To List ${failed_attr_list} ${i}
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500114 END
115
George Keishing74bdf3d2022-07-25 12:34:47 -0500116 ${fail_count}= Get Length ${failed_attr_list}
117 Should Be Equal ${fail_count} ${0}
118 ... msg= BIOS write Failed ${fail_count} list: ${failed_attr_list}
119
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500120
121Redfish Verify Set BIOS Enumeration Attribute Type
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500122 [Documentation] Validate get and update BIOS attribute optional values
123 ... and set back to original BIOS attribute values using Redfish.
George Keishing4203fad2022-01-31 12:22:33 -0600124 [Tags] Redfish_Verify_Set_BIOS_Enumeration_Attribute_Type
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500125
126
127 # Fetch BIOS attribute optional values from pldmtool getbiostable.
128 ${attr_val_data}= GetBIOSEnumAttributeOptionalValues ${attr_table_data}
129 @{attr_handles}= Get Dictionary Keys ${attr_val_data}
130
131 # Example:
132 # {'vmi_if0_ipv4_method': ['IPv4Static', 'IPv4DHCP']}
133
134 # Update multiple attribute values for corresponding attribute handle.
135 FOR ${i} IN @{attr_handles}
136 @{attr_val_list}= Set Variable ${attr_val_data}[${i}]
137 Set Optional BIOS Attribute Values And Verify ${i} @{attr_val_list}
138 END
139
140
141Redfish Verify Restore BIOS Attribute Values
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500142 [Documentation] Restore all BIOS attribute values with its default values and verify
143 ... using Redfish.
144 [Tags] Redfish_Verify_Restore_BIOS_Attribute_Values
145
146 ${bios_default_data}= GetBIOSAttrDefaultValues ${attr_table_data}
147 @{attr_handles}= Get Dictionary Keys ${bios_default_data}
148
149 FOR ${i} IN @{attr_handles}
150 Set BIOS Attribute Value And Verify ${i} ${bios_default_data['${i}']}
151 END
152
153
154*** Keywords ***
155
156Redfish BIOS Suite Setup
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500157 [Documentation] Perform Redfish BIOS suite setup.
158
159 Redfish.Login
160 ${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeTable
161 Set Global Variable ${attr_table_data} ${pldm_output}
162
163 ${data}= GetBIOSAttrOriginalValues ${pldm_output}
164 Set Global Variable ${bios_original_data} ${data}
165
166
167Redfish BIOS Suite Cleanup
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500168 [Documentation] Perform Redfish BIOS suite cleanup.
169
170 @{attr_handles}= Get Dictionary Keys ${bios_original_data}
171 FOR ${i} IN @{attr_handles}
172 Set BIOS Attribute Value And Verify ${i} ${bios_original_data['${i}']}
173 END
174 Redfish.Logout