1*** Settings ***
2
3Documentation       Module to test IPMI System Info Parameters functionality.
4...                 Following parameters are verfied in the script,
5...                 1. Set In Progress - param 0,
6...                 2. System Firmware Version - param 1,
7...                 3. System Name - param 2,
8...                 4. Primary OS Name - param 3,
9...                 5. OS Name - param 4,
10...                 6. Present OS Version Number - param 5.
11
12Library             Collections
13Library             String
14Resource            ../lib/ipmi_client.robot
15Resource            ../lib/openbmc_ffdc.robot
16Library             ../lib/ipmi_utils.py
17Variables           ../data/ipmi_raw_cmd_table.py
18
19Suite Setup         Suite Setup Execution
20Suite Teardown      FFDC On Test Case Fail
21
22Test Teardown       Restore Default Configuration
23
24
25*** Variables ***
26
27# Converting to hexadecimal provides 14 bytes so string length is 0e for param 3, 4, 5.
28${valid_os_version_name}       Version2.12345
29${invalid_os_version}          ${valid_os_version_name}${6789}
30
31
32*** Test Cases ***
33
34Verify System Info Set In Progress
35    [Documentation]  Verify Set In Progress of System Info Parameter,
36    ...  to set the set-in-progress and set complete state via IPMI,
37    ...  and verify whether the state is updated and restored as expected.
38    [Tags]  Verify_System_Info_Set_In_Progress
39
40    # Set In Progress - set complete.
41    Set System Info Set In Progress  0x00
42
43    # Get System Info Parameter for param 0 - Set In Progress.
44    # Check if set-in-progress set to set complete.
45    ${complete}=  Get System Info Set In Progress
46    # ${complete[0]} - parameter version.
47    # ${complete[1]} - Configuration parameter data,
48    # here,  01h (set in progress).
49    Should Be Equal  ${complete[1]}  00
50
51    # Set In Progress - set in progress.
52    Set System Info Set In Progress  0x01
53
54    # Get System Info Parameter for param 0 - Set In Progress.
55    # Check if set-in-progress set to set inprogress.
56    ${inprogress}=  Get System Info Set In Progress
57    # ${inprogress[0]} - parameter version.
58    # ${inprogress[1]} - Configuration parameter data,
59    # here,  01h (set in progress).
60    Should Be Equal  ${inprogress[1]}  01
61
62
63Verify System Info Set In Progress After BMC Reboot
64    [Documentation]  Verify Set In Progress changes to default,
65    ...  after bmc reboot of System Info Parameter via IPMI,
66    ...  and verify whether the default setting is reflected.
67    [Tags]  Verify_System_Info_Set_In_Progress_After_BMC_Reboot
68
69    # Set the parameter 0 - Set_In_Progress to set in progress state.
70    Set System Info Set In Progress  0x01
71
72    # Get System Info Parameter for param 0 - Set In Progress.
73    # Check if set-in-progress set to set in progress.
74    ${inprogress}=  Get System Info Set In Progress
75    # ${inprogress[0]} - parameter version.
76    # ${inprogress[1]} - Configuration parameter data,
77    # here,  01h (set in progress).
78    Should Be Equal  ${inprogress[1]}  01
79
80    # Reboot BMC.
81    IPMI Std MC Reset Cold (off)
82
83    # Since the param 0 - Set In Progress is volatile,
84    # Default value should be updated after BMC reboot.
85    ${state}=  Get System Info Set In Progress
86    # ${state[0]} - parameter version.
87    # ${state[1]} - Configuration parameter data,
88    # here, 00h (set complete), 01h (set in progress),
89    #       10 (commit write), 11 (reserved).
90    Should Be Equal  ${state[1]}  ${set_in_progress}
91
92
93Verify Get System Info Set In Progress With Invalid Data Length
94    [Documentation]  Verify Get System Info Parameter Set In Progress via IPMI with extra bytes,
95    ...  and expect to get the error message for invalid length.
96    [Tags]  Verify_Get_System_Info_Set_In_Progress_With_Invalid_Data_Length
97
98    # Check if the Get System Info Parameter for param 0 - set in progress throws
99    # error for invalid data length.
100    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param0_Set_In_Progress']['Get'][1]}*
101    ...  Run IPMI Standard Command
102    ...  raw ${IPMI_RAW_CMD['System_Info']['param0_Set_In_Progress']['Get'][0]} 0x00
103
104
105Verify Set System Info Set In Progress With Invalid Data Length
106    [Documentation]  Verify Set System Info Parameter Set In Progress via IPMI with extra bytes,
107    ...  and expect to get the error message for invalid length.
108    [Tags]  Verify_Set_System_Info_Set_In_Progress_With_Invalid_Data_Length
109
110    # Check if the Set System Info Parameter for param 0 - set in progress throws
111    # error for invalid data length.
112    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param0_Set_In_Progress']['Set'][1]}*
113    ...  Run IPMI Standard Command
114    ...  raw ${IPMI_RAW_CMD['System_Info']['param0_Set_In_Progress']['Set'][0]} 0x00 0x00
115
116
117Verify Set System Info Set In Progress With Invalid State
118    [Documentation]  Verify Set System Info Parameter Set In Progress via IPMI invalid state,
119    ...  and expect to get the error message for invalid data.
120    [Tags]  Verify_Set_System_Info_Set_In_Progress_With_Invalid_State
121
122    # Check if the Set System Info Parameter for param 0 - set in progress throws error for invalid State.
123    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param0_Set_In_Progress']['Set'][2]}*
124    ...  Run IPMI Standard Command
125    ...  raw ${IPMI_RAW_CMD['System_Info']['param0_Set_In_Progress']['Set'][0]} 0x04
126
127
128Verify System Info System Firmware Version
129    [Documentation]  Verify System Firmware Version of System Info Parameter via IPMI,
130    ...  and verify whether the version is updated.
131    [Tags]  Verify_System_Info_System_Firmware_Version
132
133    # Generate a random 14 byte data,
134    # i,e 16-byte block for system firmware name string data.
135    # data 1 - Encoding string type,
136    # data 2 - string length (in bytes, 1-based),
137    # data 3 to 16 - system firmware name string data - 14 bytes.
138    ${firmware_version}=  Generate Random String  14  [LETTERS]
139    ${firmware_version}  ${fw_hex_data}=  Identify Request Data  ${firmware_version}
140    # Consider random string generated is 'zwclMXwfczMvcY'.
141    # Set the System Firmware Version of System Info Parameter.
142    Set System Firmware Version  ${firmware_version}
143    # Get the response of System Firmware Version,
144    # and compare against randomly generated data bytes.
145    ${fw_version}=  Get System Firmware Version
146    # The response data will something be like,
147    # ${fw_version}= ["11","00","00","0e","7a","77","63","6c","4d","58","77","66","63","7a","4d","76"].
148    Should Be Equal  ${fw_version[4:]}  ${fw_hex_data}
149
150
151Verify Get System Info System Firmware Version With Invalid Data Length
152    [Documentation]  Verify Get System Info Parameter System Firmware Version via IPMI with extra bytes,
153    ...  and expect to get the error message for invalid length.
154    [Tags]  Verify_Get_System_Info_System_Firmware_Version_With_Invalid_Data_Length
155
156    # Check if the Get System Info Parameter for param 1 - System Firmware Version throws
157    # error for invalid data length.
158    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param1_System_Firmware_Version']['Get'][1]}*
159    ...  Run IPMI Standard Command
160    ...  raw ${IPMI_RAW_CMD['System_Info']['param1_System_Firmware_Version']['Get'][0]} 0x00
161
162
163Verify Set System Info System Firmware Version With Invalid Data Length
164    [Documentation]  Verify Set System Info Parameter System Firmware Version via IPMI with extra bytes,
165    ...  and expect to get the error message for invalid length.
166    [Tags]  Verify_Set_System_Info_System_Firmware_Version_With_Invalid_Data_Length
167
168    # Generate a random 15 byte data,
169    # i,e 16-byte block for system firmware name string data,
170    # data 1 - Encoding string type,
171    # data 2 - string length (in bytes, 1-based),
172    # data 3 to 16 - system firmware name string data - 14 bytes,
173    # data 17 - extra byte.
174    ${firmware_version}=  Generate Random String  15  [LETTERS]
175    ${firmware_version}  ${fw_hex_data}=  Identify Request Data  ${firmware_version}
176    # Consider random string generated is 'zwclMXwfczMvcYz'.
177    # The request data bytes will be 15 bytes, in which 14 bytes are only expected.
178    # Check if the Set System Info Parameter for param 1 - System Firmware Version throws
179    # error for invalid request data.
180    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param1_System_Firmware_Version']['Set'][1]}*
181    ...  Run IPMI Standard Command
182    ...  raw ${IPMI_RAW_CMD['System_Info']['param1_System_Firmware_Version']['Set'][0]} ${firmware_version}
183
184
185Verify System Info System Name
186    [Documentation]  Verify System Name of System Info Parameter via IPMI by setting,
187    ...  a random system name and verify whether it is updated as expected.
188    [Tags]  Verify_System_Info_System_Name
189
190    # Generate a random 14 byte data,
191    # i,e 16-byte block for system firmware name string data,
192    # data 1 - Encoding string type,
193    # data 2 - string length (in bytes, 1-based),
194    # data 3 to 16 - system firmware name string data - 14 bytes.
195    ${system_name}=  Generate Random String  14  [LETTERS]
196    ${system_name}  ${name_hex_data}=  Identify Request Data  ${system_name}
197    # Consider random string generated is 'zwclMXwfczMvcY'.
198
199    # Set System Name for System Info Parameter.
200    Set System Name  ${system_name}
201
202    # Get the response of System Name,
203    # and compare against randomly generated data bytes.
204    ${sys_name}=  Get System Name
205    # The response data will something be like,
206    # ${sys_name}= ["11","00","00","0e","7a","77","63","6c","4d","58","77","66","63","7a","4d","76"].
207    Should Be Equal  ${sys_name[4:]}  ${name_hex_data}
208
209
210Verify Get System Info System Name With Invalid Data Length
211    [Documentation]  Verify Get System Info Parameter System Name via IPMI with extra bytes,
212    ...  and expect to get the error message for invalid length.
213    [Tags]  Verify_Get_System_Info_System_Name_With_Invalid_Data_Length
214
215    # Check if the Get System Info Parameter for param 2 - System Name throws error
216    # for invalid request data length.
217    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param2_System_Name']['Get'][1]}*
218    ...  Run IPMI Standard Command
219    ...  raw ${IPMI_RAW_CMD['System_Info']['param2_System_Name']['Get'][0]} 0x00
220
221
222Verify Set System Info System Name With Invalid Data Length
223    [Documentation]  Verify Set System Info Parameter System Name via IPMI with extra bytes,
224    ...  and expect to get the error message for invalid length.
225    [Tags]  Verify_Set_System_Info_System_Name_With_Invalid_Data_Length
226
227    # Generate a random 15 byte data,
228    # i,e 16-byte block for system firmware name string data,
229    # data 1 - Encoding string type,
230    # data 2 - string length (in bytes, 1-based),
231    # data 3 to 16 - system firmware name string data - 14 bytes,
232    # data 17 - extra byte.
233    ${system_name}=  Generate Random String  15  [LETTERS]
234    ${system_name}  ${name_hex_data}=  Identify Request Data  ${system_name}
235    # Consider random string generated is 'zwclMXwfczMvcYz'.
236    # The request data bytes will be 15 bytes, in which 14 bytes are only exepcted.
237
238    # Check if the Set System Info Parameter for param 2 - System Name throws error for invalid request data.
239    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param2_System_Name']['Set'][1]}*
240    ...  Run IPMI Standard Command
241    ...  raw ${IPMI_RAW_CMD['System_Info']['param2_System_Name']['Set'][0]} ${system_name}
242
243
244Verify System Info Primary OS Name
245    [Documentation]  Verify Primary OS Name of System Info Parameter via IPMI,
246    ...  by setting a valid os version and verify whether it is updated as expected.
247    [Tags]  Verify_System_Info_Primary_OS_Name
248
249    # os_version_name given in variable section which is a 14 byte data.
250    ${os_name}  ${os_hex_data}=  Identify Request Data  ${valid_os_version_name}
251
252    # Set Primary OS Name of System Info Parameter.
253    Set Primary OS Name  ${os_name}
254
255    # Get Primary OS Name of System Info Parameter.
256    # Compare with the assigned os version name data.
257    ${pr_os}=  Get Primary OS Name
258    # The response data will something be like,
259    # ${pr_os}= ["11","00","00","0e","56","65","72","73","69","6f","6e","32","2e","31","32","33"].
260    Should Be Equal  ${pr_os[4:]}  ${os_hex_data}
261
262
263Verify System Info Primary OS Name After BMC Reboot
264    [Documentation]  Verify setting valid os version name in Primary OS Name,
265    ...  of System Info Parameter and verify it retains after BMC Reboot via IPMI.
266    [Tags]  Verify_System_Info_Primary_OS_Name_After_BMC_Reboot
267
268    # os_version_name given in variable section which is a 14 byte data.
269    ${os_name}  ${os_hex_data}=  Identify Request Data  ${valid_os_version_name}
270
271    # Set Primary OS Name of System Info Parameter.
272    Set Primary OS Name  ${os_name}
273
274    # Get Primary OS Name of System Info Parameter.
275    # Compare with the assigned os version name data.
276    ${pr_os}=  Get Primary OS Name
277    # The response data will something be like,
278    # ${pr_os}= ["11","00","00","0e","56","65","72","73","69","6f","6e","32","2e","31","32","33"].
279    Should Be Equal  ${pr_os[4:]}  ${os_hex_data}
280
281    # Cold Reset Via IPMI
282    IPMI Std MC Reset Cold (off)
283
284    # Since Primary OS Name is non-volatile,
285    # compare with response data of Get Primary OS Name,
286    # with assigned OS version name.
287    ${pr_os}=  Get Primary OS Name
288    # The response data should be,
289    # ${pr_os}= ["11","00","00","0e","56","65","72","73","69","6f","6e","32","2e","31","32","33"].
290    Should Be Equal  ${pr_os[4:]}  ${os_hex_data}
291
292
293Verify Get System Info Primary OS Name With Invalid Data Length
294    [Documentation]  Verify Get System Info Parameter Primary OS Name via IPMI with extra bytes,
295    ...  and expect to get the error message for invalid length.
296    [Tags]  Verify_Get_System_Info_Primary_OS_Name_With_Invalid_Data_Length
297
298    # Check if the Get System Info Parameter for param 3 - Primary OS Name throws
299    # error for invalid request data.
300    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param3_Primary_OS_Name']['Get'][1]}*
301    ...  Run IPMI Standard Command
302    ...  raw ${IPMI_RAW_CMD['System_Info']['param3_Primary_OS_Name']['Get'][0]} 0x00
303
304
305Verify Set System Info Primary OS Name With Invalid Data Length
306    [Documentation]  Verify setting invalid os version name to Primary OS Name,
307    ...  of Set System Info Parameter via IPMI,
308    ...  and expect to get the error message for invalid length.
309    [Tags]  Verify_Set_System_Info_Primary_OS_Name_With_Invalid_Data_Length
310
311    # invalid_os_version given in variable section which is a 15 byte data,
312    # The actual request byte should be 16 byte data where,
313    # data 1 - Encoding string type,
314    # data 2 - string length (in bytes, 1-based),
315    # data 3 to 16 - system firmware name string data - 14 bytes,
316    # Here 15 bytes so, data 17 - extra byte.
317    ${os_name}  ${name_hex_data}=  Identify Request Data  ${invalid_os_version}
318
319    # Check if the Set System Info Parameter for param 3 - Primary OS Name throws error
320    # for invalid data request.
321    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param3_Primary_OS_Name']['Set'][1]}*
322    ...  Run IPMI Standard Command
323    ...  raw ${IPMI_RAW_CMD['System_Info']['param3_Primary_OS_Name']['Set'][0]} ${os_name}
324
325
326Verify System Info OS Name
327    [Documentation]  Verify setting valid os version to OS Name,
328    ...  of System Info Parameter via IPMI and verify whether it updates as expected.
329    [Tags]  Verify_System_Info_OS_Name
330
331    # os_version_name given in variable section which is a 14 byte data.
332    ${os_name}  ${os_hex_data}=  Identify Request Data  ${valid_os_version_name}
333
334    # Set OS Name of System Info Parameters.
335    Set OS Name  ${os_name}
336
337    # Get the OS Name and compare against given os_version_name.
338    ${sysos}=  Get OS Name
339    # The response data will something be like,
340    # ${sysos}= ["11","00","00","0e","56","65","72","73","69","6f","6e","32","2e","31","32","33"].
341    Should Be Equal  ${sysos[4:]}  ${os_hex_data}
342
343
344Verify System Info OS Name After BMC Reboot
345    [Documentation]  Verify setting valid os version name for OS Name,
346    ...  of System Info Parameter and verify it changes to default after BMC Reboot via IPMI.
347    [Tags]  Verify_System_Info_OS_Name_After_BMC_Reboot
348
349    # os_version_name given in variable section which is a 14 byte data.
350    ${os_name}  ${os_hex_data}=  Identify Request Data  ${valid_os_version_name}
351
352    # Set OS Name of System Info Parameters.
353    Set OS Name  ${os_name}
354
355    # Get the OS Name and compare against given os_version_name.
356    ${sysos}=  Get OS Name
357    # The response data will something be like,
358    # ${sysos}= ["11","00","00","0e","56","65","72","73","69","6f","6e","32","2e","31","32","33"].
359    Should Be Equal  ${sysos[4:]}  ${os_hex_data}
360
361    # Cold Reset via IPMI
362    IPMI Std MC Reset Cold (off)
363
364    # Since OS Name is volatile,
365    # compare with response data of Get OS Name,
366    # with default OS Name.
367    ${sysos}=  Get OS Name
368    # Should return default response data.
369    Should Be Equal  ${sysos[2:]}  ${default_os_name}
370
371
372Verify Get System Info OS Name With Invalid Data Length
373    [Documentation]  Verify OS Name of Get System Info Parameter via IPMI,
374    ...  with extra bytes, and expect to get the error message for invalid length.
375    [Tags]  Verify_Get_System_Info_OS_Name_With_Invalid_Data_Length
376
377    # Check if the Get System Info Parameter for param 4 - OS Name throws error for invalid request data.
378    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param4_OS_Name']['Get'][1]}*
379    ...  Run IPMI Standard Command
380    ...  raw ${IPMI_RAW_CMD['System_Info']['param4_OS_Name']['Get'][0]} 0x00
381
382
383Verify Set System Info OS Name With Invalid Data Length
384    [Documentation]  Verify setting invalid os version name to OS Name,
385    ...  of Get System Info Parameter via IPMI,
386    ...  and expect to get the error message for invalid length.
387    [Tags]  Verify_Set_System_Info_OS_Name_With_Invalid_Data_Length
388
389    # invalid_os_version given in variable section which is a 15 byte data,
390    # The actual request byte should be 16 byte data where,
391    # data 1 - Encoding string type,
392    # data 2 - string length (in bytes, 1-based),
393    # data 3 to 16 - system firmware name string data - 14 bytes,
394    # Here 15 bytes so, data 17 - extra byte.
395    ${os_name}  ${name_hex_data}=  Identify Request Data  ${invalid_os_version}
396
397    # Check if the Set System Info Parameter for param 4 - OS Name throws error for invalid request data.
398    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param4_OS_Name']['Set'][1]}*
399    ...  Run IPMI Standard Command
400    ...  raw ${IPMI_RAW_CMD['System_Info']['param4_OS_Name']['Set'][0]} ${os_name}
401
402
403Verify System Info Present OS Version Number
404    [Documentation]  Verify setting valid os version for Present OS Version Number,
405    ...  of System Info Parameter via IPMI and verify whether it is updated as expected.
406    [Tags]  Verify_System_Info_Present_OS_Version_Number
407
408    # os_version_name given in variable section which is a 14 byte data.
409    ${os_name}  ${os_hex_data}=  Identify Request Data  ${valid_os_version_name}
410
411    # Set Present OS Version Number for System Info Parameters.
412    Set Present OS Version Number  ${os_name}
413
414    # Get Present OS Version Number for System Info Parameters,
415    # compare with response data of Get OS Name,
416    # with assigned os version name.
417    ${os_version}=  Get Present OS Version Number
418    # The response data will something be like,
419    # ${os_version}= ["11","00","00","0e","56","65","72","73","69","6f","6e","32","2e","31","32","33"].
420    Should Be Equal  ${os_version[4:]}  ${os_hex_data}
421
422
423Verify Get System Info Present OS Version Number With Invalid Data Length
424    [Documentation]  Verify Get System Info Parameter Present OS Version Number via IPMI,
425    ...  with extra bytes, and expect to get the error message for invalid length.
426    [Tags]  Verify_Get_System_Info_Present_OS_Version_Number_With_Invalid_Data_Length
427
428    # Check if the Get System Info Parameter for param 5 - Present OS Version Number throws
429    # error for invalid request data.
430    Run Keyword and Expect Error
431    ...  *${IPMI_RAW_CMD['System_Info']['param5_Present_OS_Version_number']['Get'][1]}*
432    ...  Run IPMI Standard Command
433    ...  raw ${IPMI_RAW_CMD['System_Info']['param5_Present_OS_Version_number']['Get'][0]} 0x00
434
435
436Verify Set System Info Present OS Version Number With Invalid Data Length
437    [Documentation]  Verify setting invalid os version to Present OS Version Number
438    ...  of Set System Info Parameter via IPMI,
439    ...  and expect to get the error message for invalid length.
440    [Tags]  Verify_Set_System_Info_Present_OS_Version_Number_With_Invalid_Data_Length
441
442    # invalid_os_version given in variable section which is a 15 byte data.
443    # The actual request byte should be 16 byte data where,
444    # data 1 - Encoding string type,
445    # data 2 - string length (in bytes, 1-based),
446    # data 3 to 16 - system firmware name string data - 14 bytes,
447    # Here 15 bytes so, data 17 - extra byte.
448    ${os_name}  ${name_hex_data}=  Identify Request Data  ${invalid_os_version}
449
450    # Check if the Set System Info Parameter for param 5 - Present OS Version Number throws
451    # error for invalid request data.
452    Run Keyword and Expect Error
453    ...  *${IPMI_RAW_CMD['System_Info']['param5_Present_OS_Version_number']['Set'][1]}*
454    ...  Run IPMI Standard Command
455    ...  raw ${IPMI_RAW_CMD['System_Info']['param5_Present_OS_Version_number']['Set'][0]} ${os_name}
456
457
458*** Keywords ***
459
460Identify Request Data
461    [Documentation]  Convert string to hexadecimal request data with and without prefix 0x.
462    [Arguments]  ${string}
463
464    # Given a string, convert to hexadecimal and prefix with 0x.
465    # Consider random string generated ${string} is 'zwc'.
466    ${fw_ver_hex_list}=  Create List
467    ${hex_data_list}=  Create List
468    ${resp_data_list}=  Split String With Index  ${string}  1
469    # ${resp_data_list} will be ['z', 'w', 'c'].
470    FOR  ${data}  IN  @{resp_data_list}
471        # prefixes 0x by default.
472        # Example : 0x00.
473        ${hex_value}=  Evaluate  hex(ord("${data}"))
474        # provides only hexadecimal bytes.
475        # Example : 00.
476        ${hex}=  Evaluate  hex(ord("${data}"))[2:]
477        # With prefix 0x.
478        Append To List  ${fw_ver_hex_list}  ${hex_value}
479        # Without prefix.
480        Append To List  ${hex_data_list}  ${hex}
481    END
482    ${fw_ver_hex}=  Evaluate  " ".join(${fw_ver_hex_list})
483
484    [Return]  ${fw_ver_hex}  ${hex_data_list}
485
486
487Get System Info Set In Progress
488    [Documentation]  Run Get system info parameter command for set-in-progress and return response data.
489
490    # Get System Info Parameter for param 0 - Set In Progress.
491    ${resp}=  Run IPMI Standard Command
492    ...  raw ${IPMI_RAW_CMD['System_Info']['param0_Set_In_Progress']['Get'][0]}
493    ${resp}=  Split String  ${resp}
494
495    [Return]  ${resp}
496
497
498Set System Info Set In Progress
499    [Documentation]  Set System Info Set In Progress with valid state via IPMI.
500    [Arguments]  ${state}
501
502    # Set System Info Parameter for param 0 - Set In Progress.
503    # ${state} can be can be any - 00 | 01 | 10 | 11.
504    Run IPMI Standard Command
505    ...  raw ${IPMI_RAW_CMD['System_Info']['param0_Set_In_Progress']['Set'][0]} ${state}
506
507
508Get System Firmware Version
509    [Documentation]  Run Get system info parameter command for system firmware version
510    ...              and return response data.
511
512    # Get System Info Parameter for param 1 - System Firmware Version.
513    ${resp}=  Run IPMI Standard Command
514    ...  raw ${IPMI_RAW_CMD['System_Info']['param1_System_Firmware_Version']['Get'][0]}
515    ${resp}=  Split String  ${resp}
516
517    [Return]  ${resp}
518
519
520Set System Firmware Version
521    [Documentation]  Set System Firmware Version for System Info with valid version.
522    [Arguments]  ${version}
523
524    # Set System Info Parameter for param 1 - System Firmware Version.
525    # ${version} can be any 14 data.
526    Run IPMI Standard Command
527    ...  raw ${IPMI_RAW_CMD['System_Info']['param1_System_Firmware_Version']['Set'][0]} ${version}
528
529
530Get System Name
531    [Documentation]  Run system info parameter command for system name and return response data.
532
533    # Get System Info Parameter for param 2 - System Name.
534    ${resp}=  Run IPMI Standard Command
535    ...  raw ${IPMI_RAW_CMD['System_Info']['param2_System_Name']['Get'][0]}
536    ${resp}=  Split String  ${resp}
537
538    [Return]  ${resp}
539
540
541Set System Name
542    [Documentation]  Set System Name for System Info with valid name.
543    [Arguments]  ${sys_name}
544
545    # Set System Info Parameter for param 2 - System Name.
546    # ${sys_name} can be any 14 byte data.
547    Run IPMI Standard Command
548    ...  raw ${IPMI_RAW_CMD['System_Info']['param2_System_Name']['Set'][0]} ${sys_name}
549
550
551Get Primary OS Name
552    [Documentation]  Run Get System Info command for primary OS name and return response data.
553
554    # Get System Info Parameter for param 3 - Primary OS Name.
555    ${resp}=  Run IPMI Standard Command
556    ...  raw ${IPMI_RAW_CMD['System_Info']['param3_Primary_OS_Name']['Get'][0]}
557    ${resp}=  Split String  ${resp}
558
559    [Return]  ${resp}
560
561
562Set Primary OS Name
563    [Documentation]  Set Primary OS Name for System Info with valid os name.
564    [Arguments]  ${os_name}
565
566    # Set System Info Parameter for param 3 - Primary OS Name.
567    # ${os_name} can be any 14 byte data.
568    Run IPMI Standard Command
569    ...  raw ${IPMI_RAW_CMD['System_Info']['param3_Primary_OS_Name']['Set'][0]} ${os_name}
570
571
572Get OS Name
573    [Documentation]  Run get System Info command for OS name and return response data.
574
575    # Get System Info Parameter for param 4 - OS Name.
576    ${resp}=  Run IPMI Standard Command
577    ...  raw ${IPMI_RAW_CMD['System_Info']['param4_OS_Name']['Get'][0]}
578    ${resp}=  Split String  ${resp}
579
580    [Return]  ${resp}
581
582
583Set OS Name
584    [Documentation]  Set OS Name for System Info with valid os name.
585    [Arguments]  ${os_name}
586
587    # Set System Info Parameter for param 4 - OS Name.
588    # ${os_name} can be any 14 byte data.
589    Run IPMI Standard Command
590    ...  raw ${IPMI_RAW_CMD['System_Info']['param4_OS_Name']['Set'][0]} ${os_name}
591
592
593Get Present OS Version Number
594    [Documentation]  Run Get System Info command for present os version name and return response.
595
596    # Get System Info Parameter for param 5 - Present OS Version Number.
597    ${resp}=  Run IPMI Standard Command
598    ...  raw ${IPMI_RAW_CMD['System_Info']['param5_Present_OS_Version_number']['Get'][0]}
599    ${resp}=  Split String  ${resp}
600
601    [Return]  ${resp}
602
603
604Set Present OS Version Number
605    [Documentation]  Set Present OS Version Number for System Info with valid os version.
606    [Arguments]  ${os_name}
607
608    # Set System Info Parameter for param 5 - Present OS Version Number.
609    # ${os_name} can be any 14 byte data
610    Run IPMI Standard Command
611    ...  raw ${IPMI_RAW_CMD['System_Info']['param5_Present_OS_Version_number']['Set'][0]} ${os_name}
612
613
614Add Prefix To List Objects And Join String
615    [Documentation]  Adding prefix '0x' to each list object and join the string.
616    [Arguments]  ${list}
617
618    # ${list} contains list of hexadecimal data.
619
620    # Prefix Bytes with 0x for each data bytes and makes a string of request bytes.
621    # Prefix Bytes function under lib/ipmi_utils.py.
622    # Prefixes every list item with 0x and returns list of prefixed hexadecimal data.
623    ${prefix_list}=  Prefix Bytes  ${list}
624    ${prefix_list}=  Evaluate  " ".join(${prefix_list})
625
626    [Return]  ${prefix_list}
627
628
629Suite Setup Execution
630    [Documentation]  Suite setup execution to fetch all the default response bytes,
631    ...  prefix each byte with 0x and make them a suite variable.
632
633    # Get Default Values of each parameters.
634    # Set In Progress - param 0.
635    ${resp}=  Get System Info Set In Progress
636    # Configuration parameter data - 11 xx (xx can be any - 00 | 01 | 10 | 11).
637    ${set_in_progress}=  Set Variable  ${resp[1]}
638
639    Set Suite Variable  ${set_in_progress}
640
641    # System Firmware Version - param 1.
642    ${resp}=  Get System Firmware Version
643    # Configuration parameter data - 11 x1 x2 xx xx xx xx .. xx (xx - 14 bytes).
644    # x1 - encoding, x2 - string length in bytes.
645    ${sys_fw_version}=  Set Variable  ${resp[2:]}
646    # Prefix all bytes with 0x.
647    ${sys_fw_version_string}=  Add Prefix To List Objects And Join String  ${sys_fw_version}
648
649    Set Suite Variable  ${sys_fw_version}
650    Set Suite Variable  ${sys_fw_version_string}
651
652    # System Name - param 2.
653    ${resp}=  Get System Name
654    # Configuration parameter data - 11 x1 x2 xx xx xx xx .. xx (xx - 14 bytes).
655    # x1 - encoding, x2 - string length in bytes.
656    ${sys_name_default}=  Set Variable  ${resp[2:]}
657    # Prefix all bytes with 0x.
658    ${sys_name_hex_default}=  Add Prefix To List Objects And Join String  ${sys_name_default}
659
660    Set Suite Variable  ${sys_name_default}
661    Set Suite Variable  ${sys_name_hex_default}
662
663    # Primary OS Name - param 3.
664    ${resp}=  Get Primary OS Name
665    # Configuration parameter data - 11 x1 x2 xx xx xx xx .. xx (xx - 14 bytes).
666    # x1 - encoding, x2 - string length in bytes.
667    ${primary_os_name}=  Set Variable  ${resp[2:]}
668    # Prefix all bytes with 0x.
669    ${primary_os_name_hex}=  Add Prefix To List Objects And Join String  ${primary_os_name}
670
671    Set Suite Variable  ${primary_os_name}
672    Set Suite Variable  ${primary_os_name_hex}
673
674    # OS Name - param 4.
675    ${resp}=  Get OS Name
676    # Configuration parameter data - 11 x1 x2 xx xx xx xx .. xx (xx - 14 bytes).
677    # x1 - encoding, x2 - string length in bytes.
678    ${default_os_name}=  Set Variable  ${resp[2:]}
679    # Prefix all bytes with 0x.
680    ${default_os_name_hex}=  Add Prefix To List Objects And Join String  ${default_os_name}
681
682    Set Suite Variable  ${default_os_name}
683    Set Suite Variable  ${default_os_name_hex}
684
685    # Present OS Version Number - param 5.
686    ${resp}=  Get Present OS Version Number
687    # Configuration parameter data - 11 x1 x2 xx xx xx xx .. xx (xx - 14 bytes).
688    # x1 - encoding, x2 - string length in bytes.
689    ${present_os_num}=  Set Variable  ${resp[2:]}
690    # Prefix all bytes with 0x.
691    ${present_os_num_hex}=  Add Prefix To List Objects And Join String  ${present_os_num}
692
693    Set Suite Variable  ${present_os_num}
694    Set Suite Variable  ${present_os_num_hex}
695
696
697Restore Default Configuration
698    [Documentation]  Restore all system info parameter response data to,
699    ...  default data obtained from suite setup.
700
701    # All variable to set are suite variables declared in suite setup.
702
703    # Set In Progress - param 0.
704    Set System Info Set In Progress  0x${set_in_progress}
705
706    # System Firmware Version - param 1.
707    Run IPMI Standard Command  raw 0x06 0x58 0x01 0x00 ${sys_fw_version_string}
708
709    # System Name - param 2.
710    Run IPMI Standard Command  raw 0x06 0x58 0x02 0x00 ${sys_name_hex_default}
711
712    # Primary OS Name - param 3.
713    Run IPMI Standard Command  raw 0x06 0x58 0x03 0x00 ${primary_os_name_hex}
714
715    # OS Name - param 4.
716    Run IPMI Standard Command  raw 0x06 0x58 0x04 0x00 ${default_os_name_hex}
717
718    # Present OS Version Number - param 5.
719    Run IPMI Standard Command  raw 0x06 0x58 0x05 0x00 ${present_os_num_hex}
720
721    FFDC On Test Case Fail
722