blob: 6f9d6cf2a49a0c86b0019bfb8880eb83dfb596ec [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
16
17*** Variables ***
18
19${bios_original_data} ${EMPTY}
George Keishinge18030c2022-07-20 13:37:01 -050020${attr_table_data} ${EMPTY}
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050021
22
23*** Test Cases ***
24
25Verify Get BIOS Attribute With Invalid Attribute Name
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050026 [Documentation] Verify get BIOS attribute with invalid attribute name.
27 [Tags] Verify_Get_BIOS_Attribute_With_Invalid_Attribute_Name
28
29 ${random_attr}= Generate Random String 8 [LETTERS][NUMBERS]
30 ${pldm_output}= pldmtool bios GetBIOSAttributeCurrentValueByHandle -a ${random_attr}
31
32 # Example output:
33 #
34 # pldmtool bios GetBIOSAttributeCurrentValueByHandle -a hjkhkj
35 # Can not find the attribute hjkhkj
36 #
37
38 Should Contain ${pldm_output} Can not find the attribute
39
40
41Verify Set BIOS Attribute With Invalid Attribute Name
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050042 [Documentation] Verify set BIOS attribute with invalid attribute name.
43 [Tags] Verify_Set_BIOS_Attribute_With_Invalid_Attribute_Name
44
45 ${random_str}= Generate Random String 8 [LETTERS][NUMBERS]
46 ${pldm_output}= pldmtool bios SetBIOSAttributeCurrentValue -a ${random_str} -d ${random_str}
47
48 # Example output:
49 #
50 # pldmtool bios SetBIOSAttributeCurrentValue -a hjkhkj -d 0
51 # Could not find attribute :hjkhkj
52 #
53
54 Should Contain ${pldm_output} Could not find attribute
55
56
57Verify Set Invalid Optional Value For BIOS Enumeration Attribute Type
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050058 [Documentation] Verify set invalid optional value for BIOS enumeration attribute type.
59 [Tags] Verify_Set_Invalid_Optional_Value_For_BIOS_Enumeration_Attribute_Type
60
61 ${attr_val_data}= GetBIOSEnumAttributeOptionalValues ${attr_table_data}
62 @{attr_handles}= Get Dictionary Keys ${attr_val_data}
63 ${enum_attr}= Evaluate random.choice(${attr_handles}) modules=random
64
65 # Example output:
66 #
67 # pldmtool bios SetBIOSAttributeCurrentValue -a pvm_os_boot_side -d hhhhhj
68 # Set Attribute Error: It's not a possible value
69 #
70
71 ${pldm_output}= pldmtool bios SetBIOSAttributeCurrentValue -a ${enum_attr} -d 0
72 Should Contain ${pldm_output} Set Attribute Error
73
74
75Verify Set Out Of Range Integer Value For BIOS Integer Attribute Type
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050076 [Documentation] Verify set out of range integer value for BIOS integer attribute type.
77 [Tags] Verify_Set_Out_Of_Range_Integer_Value_For_BIOS_Integer_Attribute_Type
78
79 ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSInteger ${attr_table_data}
80 @{attr_handles}= Get Dictionary Keys ${attr_val_data}
81 ${int_attr}= Evaluate random.choice(${attr_handles}) modules=random
82 ${count}= Evaluate ${attr_val_data['${int_attr}']["UpperBound"]} + 5
83
84 # Example output:
85 #
86 # pldmtool bios SetBIOSAttributeCurrentValue -a vmi_if_count -d 12
87 # Response Message Error: rc=0,cc=2
88 #
89
90 ${pldm_output}= pldmtool bios SetBIOSAttributeCurrentValue -a ${int_attr} -d ${count}
91 Should Contain ${pldm_output} Response Message Error
92
93
94Verify Set Out Of Range String Value For BIOS String Attribute Type
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -050095 [Documentation] Verify set out of range string value for BIOS string attribute type.
96 [Tags] Verify_Set_Out_Of_Range_String_Value_For_BIOS_String_Attribute_Type
97
98 ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSString ${attr_table_data}
99 @{attr_handles}= Get Dictionary Keys ${attr_val_data}
100 ${str_attr}= Evaluate random.choice(${attr_handles}) modules=random
101 ${count}= Evaluate ${attr_val_data['${str_attr}']["MaximumStringLength"]} + 5
102 ${random_value}= Generate Random String ${count} [LETTERS][NUMBERS]
103
104 # Example output:
105 #
106 # pldmtool bios SetBIOSAttributeCurrentValue -a vmi_if0_ipv4_ipaddr -d 1234566788999
107 # Response Message Error: rc=0,cc=2
108 #
109
110 ${pldm_output}= pldmtool bios SetBIOSAttributeCurrentValue -a ${str_attr} -d ${random_value}
111 Should Contain ${pldm_output} Response Message Error
112
113
114Verify Set BIOS String Attribute Type
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500115 [Documentation] Verify set BIOS string attribute type for various BIOS
116 ... attribute handle with random values with in the range.
117 [Tags] Verify_Set_BIOS_String_Attribute_Type
118
119 ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSString ${attr_table_data}
120
121 # Example output:
122 #
123 # pldmtool bios SetBIOSAttributeCurrentValue -a vmi_hostname -d BMC
124 # {
125 # "Response": "SUCCESS"
126 # }
127
128 @{attr_handles}= Get Dictionary Keys ${attr_val_data}
129 FOR ${i} IN @{attr_handles}
130 ${random_value}= GetRandomBIOSIntAndStrValues ${i} ${attr_val_data['${i}']["MaximumStringLength"]}
131 ${attr_val_list}= Create List
132 Append To List ${attr_val_list} ${random_value}
133 Validate Set BIOS Attributes With Optional Values ${i} @{attr_val_list}
134 END
135
136
137Verify Set BIOS Integer Attribute Type
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500138 [Documentation] Verify set BIOS integer attribute type for various BIOS
139 ... attribute handle with random values with in the range.
140 [Tags] Verify_Set_BIOS_Integer_Attribute_Type
141
142 ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSInteger ${attr_table_data}
143
144 # Example output:
145 #
146 # pldmtool bios SetBIOSAttributeCurrentValue -a vmi_if_count -d 1
147 # {
148 # "Response": "SUCCESS"
149 # }
150
151 @{attr_handles}= Get Dictionary Keys ${attr_val_data}
152
153 FOR ${i} IN @{attr_handles}
154 ${random_value}= GetRandomBIOSIntAndStrValues ${i} ${attr_val_data['${i}']["UpperBound"]}
155 ${attr_val_list}= Create List
156 Append To List ${attr_val_list} ${random_value}
157 Validate Set BIOS Attributes With Optional Values ${i} @{attr_val_list}
158 END
159
160
161Verify Set BIOS Enumeration Attribute Type
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500162 [Documentation] Verify set BIOS enumeration attribute type for various BIOS
163 ... attribute handle with random values with in the range of
164 ... default optional values.
George Keishingb98036a2022-01-31 12:39:47 -0600165 [Tags] Verify_Set_BIOS_Enumeration_Attribute_Type
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500166
167 ${attr_val_data}= GetBIOSEnumAttributeOptionalValues ${attr_table_data}
168
169 # Example output:
170 #
171 # pldmtool bios SetBIOSAttributeCurrentValue -a pvm_default_os_type -d AIX
172 # {
173 # "Response": "SUCCESS"
174 # }
175
176 @{attr_handles}= Get Dictionary Keys ${attr_val_data}
177 FOR ${i} IN @{attr_handles}
178 @{attr_val_list}= Set Variable ${attr_val_data}[${i}]
179 Validate Set BIOS Attributes With Optional Values ${i} @{attr_val_list}
180 END
181
182
183Verify Restore BIOS Attribute Values
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500184 [Documentation] Restore all BIOS attribute values with its default values and verify.
185 [Tags] Verify_Restore_BIOS_Attribute_Values
186
187 ${bios_default_data}= GetBIOSAttrDefaultValues ${attr_table_data}
188 Validate Set All BIOS Attributes Values ${bios_default_data}
189
190
191*** Keywords ***
192
193PLDM BIOS Attribute Suite Setup
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500194 [Documentation] Perform PLDM BIOS attribute suite setup.
195
196 ${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeTable
197 Set Global Variable ${attr_table_data} ${pldm_output}
198
199 ${data}= GetBIOSAttrOriginalValues ${pldm_output}
200 Set Global Variable ${bios_original_data} ${data}
201
202
203PLDM BIOS Attribute Suite Cleanup
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500204 [Documentation] Perform PLDM BIOS attribute suite cleanup.
205
George Keishinge18030c2022-07-20 13:37:01 -0500206 Run Keyword And Ignore Error
207 ... Validate Set All BIOS Attributes Values ${bios_original_data}
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500208
209
210Validate Set BIOS Attributes With Optional Values
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500211 [Documentation] Set BIOS attribute with the available attribute handle
212 ... values and revert back to original attribute handle value.
213 [Arguments] ${attr_handle} @{attr_val_list}
214
215 # Description of argument(s):
216 # attr_handle BIOS attribute handle (e.g. pvm_system_power_off_policy).
217 # attr_val_list List of the attribute values for the given attribute handle
218 # (e.g. ['"Power Off"', '"Stay On"', 'Automatic']).
219
220 FOR ${j} IN @{attr_val_list}
221 ${pldm_resp}= pldmtool bios SetBIOSAttributeCurrentValue -a ${attr_handle} -d ${j}
222 Valid Value pldm_resp['Response'] ['SUCCESS']
223
224 # Compare BIOS attribute values after set operation.
225 ${output}= pldmtool bios GetBIOSAttributeCurrentValueByHandle -a ${attr_handle}
226 ${value1}= Convert To String ${output["CurrentValue"]}
227 ${value2}= Convert To String ${j}
228 ${value2}= Replace String ${value2} " ${EMPTY}
229 Should Be Equal ${value1.strip()} ${value2.strip()}
230
231 END
232
233
234Validate Set All BIOS Attributes Values
Sridevi Ramesh2ab3d382021-03-29 04:16:01 -0500235 [Documentation] Validate Set BIOS Attributes Values.
236 [Arguments] ${bios_attr_data}
237
238 # Description of argument(s):
239 # bios_attr_data Dictionary containing BIOS attribute name and values.
240
241 @{keys}= Get Dictionary Keys ${bios_attr_data}
242
243 FOR ${key} IN @{keys}
244 ${pldm_resp}= pldmtool bios SetBIOSAttributeCurrentValue -a ${key} -d ${bios_attr_data['${key}']}
245 Valid Value pldm_resp['Response'] ['SUCCESS']
246
247 # Compare BIOS attribute values after set operation.
248 ${output}= pldmtool bios GetBIOSAttributeCurrentValueByHandle -a ${key}
249 ${value1}= Convert To String ${output["CurrentValue"]}
250 ${value2}= Convert To String ${bios_attr_data['${key}']}
251 ${value2}= Replace String ${value2} " ${EMPTY}
252 Should Be Equal ${value1.strip()} ${value2.strip()}
253 END