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