blob: b17b2d3032125bf15d961ba8733957210aac3877 [file] [log] [blame]
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -05001*** Settings ***
2
3Documentation Module to test PLDM BIOS attribute types.
4
5Library Collections
6Library String
7Library ../lib/pldm_utils.py
8Variables ../data/pldm_variables.py
9Resource ../lib/openbmc_ffdc.robot
10
11Test Setup Printn
12Test Teardown FFDC On Test Case Fail
13Suite Setup PLDM BIOS Attribute Suite Setup
14Suite Teardown PLDM BIOS Attribute Suite Cleanup
15
George Keishing54316852023-10-16 14:03:29 +053016Force Tags Pldm_Bios_Attributes
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050017
18*** Variables ***
19
20${bios_original_data} ${EMPTY}
George Keishinge18030c2022-07-20 13:37:01 -050021${attr_table_data} ${EMPTY}
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050022
23
24*** Test Cases ***
25
26Verify Get BIOS Attribute With Invalid Attribute Name
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050027 [Documentation] Verify get BIOS attribute with invalid attribute name.
28 [Tags] Verify_Get_BIOS_Attribute_With_Invalid_Attribute_Name
29
30 ${random_attr}= Generate Random String 8 [LETTERS][NUMBERS]
31 ${pldm_output}= pldmtool bios GetBIOSAttributeCurrentValueByHandle -a ${random_attr}
32
33 # Example output:
34 #
35 # pldmtool bios GetBIOSAttributeCurrentValueByHandle -a hjkhkj
36 # Can not find the attribute hjkhkj
37 #
38
39 Should Contain ${pldm_output} Can not find the attribute
40
41
42Verify Set BIOS Attribute With Invalid Attribute Name
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050043 [Documentation] Verify set BIOS attribute with invalid attribute name.
44 [Tags] Verify_Set_BIOS_Attribute_With_Invalid_Attribute_Name
45
46 ${random_str}= Generate Random String 8 [LETTERS][NUMBERS]
47 ${pldm_output}= pldmtool bios SetBIOSAttributeCurrentValue -a ${random_str} -d ${random_str}
48
49 # Example output:
50 #
51 # pldmtool bios SetBIOSAttributeCurrentValue -a hjkhkj -d 0
52 # Could not find attribute :hjkhkj
53 #
54
55 Should Contain ${pldm_output} Could not find attribute
56
57
58Verify Set Invalid Optional Value For BIOS Enumeration Attribute Type
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050059 [Documentation] Verify set invalid optional value for BIOS enumeration attribute type.
60 [Tags] Verify_Set_Invalid_Optional_Value_For_BIOS_Enumeration_Attribute_Type
61
62 ${attr_val_data}= GetBIOSEnumAttributeOptionalValues ${attr_table_data}
63 @{attr_handles}= Get Dictionary Keys ${attr_val_data}
64 ${enum_attr}= Evaluate random.choice(${attr_handles}) modules=random
65
66 # Example output:
67 #
68 # pldmtool bios SetBIOSAttributeCurrentValue -a pvm_os_boot_side -d hhhhhj
69 # Set Attribute Error: It's not a possible value
70 #
71
72 ${pldm_output}= pldmtool bios SetBIOSAttributeCurrentValue -a ${enum_attr} -d 0
73 Should Contain ${pldm_output} Set Attribute Error
74
75
76Verify Set Out Of Range Integer Value For BIOS Integer Attribute Type
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050077 [Documentation] Verify set out of range integer value for BIOS integer attribute type.
78 [Tags] Verify_Set_Out_Of_Range_Integer_Value_For_BIOS_Integer_Attribute_Type
79
80 ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSInteger ${attr_table_data}
81 @{attr_handles}= Get Dictionary Keys ${attr_val_data}
82 ${int_attr}= Evaluate random.choice(${attr_handles}) modules=random
83 ${count}= Evaluate ${attr_val_data['${int_attr}']["UpperBound"]} + 5
84
85 # Example output:
86 #
87 # pldmtool bios SetBIOSAttributeCurrentValue -a vmi_if_count -d 12
88 # Response Message Error: rc=0,cc=2
89 #
90
91 ${pldm_output}= pldmtool bios SetBIOSAttributeCurrentValue -a ${int_attr} -d ${count}
92 Should Contain ${pldm_output} Response Message Error
93
94
95Verify Set Out Of Range String Value For BIOS String Attribute Type
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050096 [Documentation] Verify set out of range string value for BIOS string attribute type.
97 [Tags] Verify_Set_Out_Of_Range_String_Value_For_BIOS_String_Attribute_Type
98
99 ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSString ${attr_table_data}
100 @{attr_handles}= Get Dictionary Keys ${attr_val_data}
101 ${str_attr}= Evaluate random.choice(${attr_handles}) modules=random
102 ${count}= Evaluate ${attr_val_data['${str_attr}']["MaximumStringLength"]} + 5
103 ${random_value}= Generate Random String ${count} [LETTERS][NUMBERS]
104
105 # Example output:
106 #
107 # pldmtool bios SetBIOSAttributeCurrentValue -a vmi_if0_ipv4_ipaddr -d 1234566788999
108 # Response Message Error: rc=0,cc=2
109 #
110
111 ${pldm_output}= pldmtool bios SetBIOSAttributeCurrentValue -a ${str_attr} -d ${random_value}
112 Should Contain ${pldm_output} Response Message Error
113
114
115Verify Set BIOS String Attribute Type
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500116 [Documentation] Verify set BIOS string attribute type for various BIOS
117 ... attribute handle with random values with in the range.
118 [Tags] Verify_Set_BIOS_String_Attribute_Type
119
120 ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSString ${attr_table_data}
121
122 # Example output:
123 #
124 # pldmtool bios SetBIOSAttributeCurrentValue -a vmi_hostname -d BMC
125 # {
126 # "Response": "SUCCESS"
127 # }
128
129 @{attr_handles}= Get Dictionary Keys ${attr_val_data}
130 FOR ${i} IN @{attr_handles}
131 ${random_value}= GetRandomBIOSIntAndStrValues ${i} ${attr_val_data['${i}']["MaximumStringLength"]}
132 ${attr_val_list}= Create List
133 Append To List ${attr_val_list} ${random_value}
134 Validate Set BIOS Attributes With Optional Values ${i} @{attr_val_list}
135 END
136
137
138Verify Set BIOS Integer Attribute Type
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500139 [Documentation] Verify set BIOS integer attribute type for various BIOS
140 ... attribute handle with random values with in the range.
141 [Tags] Verify_Set_BIOS_Integer_Attribute_Type
142
143 ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSInteger ${attr_table_data}
144
145 # Example output:
146 #
147 # pldmtool bios SetBIOSAttributeCurrentValue -a vmi_if_count -d 1
148 # {
149 # "Response": "SUCCESS"
150 # }
151
152 @{attr_handles}= Get Dictionary Keys ${attr_val_data}
153
154 FOR ${i} IN @{attr_handles}
155 ${random_value}= GetRandomBIOSIntAndStrValues ${i} ${attr_val_data['${i}']["UpperBound"]}
156 ${attr_val_list}= Create List
157 Append To List ${attr_val_list} ${random_value}
158 Validate Set BIOS Attributes With Optional Values ${i} @{attr_val_list}
159 END
160
161
162Verify Set BIOS Enumeration Attribute Type
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500163 [Documentation] Verify set BIOS enumeration attribute type for various BIOS
164 ... attribute handle with random values with in the range of
165 ... default optional values.
George Keishingb98036a2022-01-31 12:39:47 -0600166 [Tags] Verify_Set_BIOS_Enumeration_Attribute_Type
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500167
168 ${attr_val_data}= GetBIOSEnumAttributeOptionalValues ${attr_table_data}
169
170 # Example output:
171 #
172 # pldmtool bios SetBIOSAttributeCurrentValue -a pvm_default_os_type -d AIX
173 # {
174 # "Response": "SUCCESS"
175 # }
176
177 @{attr_handles}= Get Dictionary Keys ${attr_val_data}
178 FOR ${i} IN @{attr_handles}
179 @{attr_val_list}= Set Variable ${attr_val_data}[${i}]
180 Validate Set BIOS Attributes With Optional Values ${i} @{attr_val_list}
181 END
182
183
184Verify Restore BIOS Attribute Values
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500185 [Documentation] Restore all BIOS attribute values with its default values and verify.
186 [Tags] Verify_Restore_BIOS_Attribute_Values
187
188 ${bios_default_data}= GetBIOSAttrDefaultValues ${attr_table_data}
189 Validate Set All BIOS Attributes Values ${bios_default_data}
190
191
192*** Keywords ***
193
194PLDM BIOS Attribute Suite Setup
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500195 [Documentation] Perform PLDM BIOS attribute suite setup.
196
197 ${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeTable
198 Set Global Variable ${attr_table_data} ${pldm_output}
199
200 ${data}= GetBIOSAttrOriginalValues ${pldm_output}
201 Set Global Variable ${bios_original_data} ${data}
202
203
204PLDM BIOS Attribute Suite Cleanup
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500205 [Documentation] Perform PLDM BIOS attribute suite cleanup.
206
George Keishinge18030c2022-07-20 13:37:01 -0500207 Run Keyword And Ignore Error
208 ... Validate Set All BIOS Attributes Values ${bios_original_data}
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500209
210
211Validate Set BIOS Attributes With Optional Values
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500212 [Documentation] Set BIOS attribute with the available attribute handle
213 ... values and revert back to original attribute handle value.
214 [Arguments] ${attr_handle} @{attr_val_list}
215
216 # Description of argument(s):
217 # attr_handle BIOS attribute handle (e.g. pvm_system_power_off_policy).
218 # attr_val_list List of the attribute values for the given attribute handle
219 # (e.g. ['"Power Off"', '"Stay On"', 'Automatic']).
220
221 FOR ${j} IN @{attr_val_list}
222 ${pldm_resp}= pldmtool bios SetBIOSAttributeCurrentValue -a ${attr_handle} -d ${j}
223 Valid Value pldm_resp['Response'] ['SUCCESS']
224
225 # Compare BIOS attribute values after set operation.
226 ${output}= pldmtool bios GetBIOSAttributeCurrentValueByHandle -a ${attr_handle}
227 ${value1}= Convert To String ${output["CurrentValue"]}
228 ${value2}= Convert To String ${j}
229 ${value2}= Replace String ${value2} " ${EMPTY}
230 Should Be Equal ${value1.strip()} ${value2.strip()}
231
232 END
233
234
235Validate Set All BIOS Attributes Values
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500236 [Documentation] Validate Set BIOS Attributes Values.
237 [Arguments] ${bios_attr_data}
238
239 # Description of argument(s):
240 # bios_attr_data Dictionary containing BIOS attribute name and values.
241
242 @{keys}= Get Dictionary Keys ${bios_attr_data}
243
244 FOR ${key} IN @{keys}
245 ${pldm_resp}= pldmtool bios SetBIOSAttributeCurrentValue -a ${key} -d ${bios_attr_data['${key}']}
246 Valid Value pldm_resp['Response'] ['SUCCESS']
247
248 # Compare BIOS attribute values after set operation.
249 ${output}= pldmtool bios GetBIOSAttributeCurrentValueByHandle -a ${key}
250 ${value1}= Convert To String ${output["CurrentValue"]}
251 ${value2}= Convert To String ${bios_attr_data['${key}']}
252 ${value2}= Replace String ${value2} " ${EMPTY}
253 Should Be Equal ${value1.strip()} ${value2.strip()}
254 END