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