blob: 91caa12f0e61238c84c7c47c5f813ce6864137fe [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
15Suite 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
25Redfish 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
36Redfish 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
50Redfish 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
65Redfish 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
81Redfish 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
95Redfish 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
109Redfish 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 Keishing4203fad2022-01-31 12:22:33 -0600113 [Tags] Redfish_Verify_Set_BIOS_Enumeration_Attribute_Type
Sridevi Ramesheedcf1a2021-03-17 07:09:32 -0500114
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
130Redfish 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
146Redfish 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
158Redfish 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