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