1*** Settings ***
2
3Documentation       Module to test IPMI System Info Parameters functionality.
4...                 Following parameters are verified 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
22Test 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 Command
100    ...  ${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 Command
112    ...  ${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 Command
123    ...  ${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 Command
158    ...  ${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 Command
180    ...  ${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 Command
217    ...  ${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 Command
239    ...  ${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
269    ...  *${IPMI_RAW_CMD['System_Info']['param3_Primary_Operating_System_Name']['Get'][1]}*
270    ...  Run IPMI Command
271    ...  ${IPMI_RAW_CMD['System_Info']['param3_Primary_Operating_System_Name']['Get'][0]} 0x00
272
273
274Verify Set System Info Primary OS Name With Invalid Data Length
275    [Documentation]  Verify setting invalid os version name to Primary OS Name,
276    ...  of Set System Info Parameter via IPMI,
277    ...  and expect to get the error message for invalid length.
278    [Tags]  Verify_Set_System_Info_Primary_OS_Name_With_Invalid_Data_Length
279
280    # invalid_os_version given in variable section which is a 15 byte data,
281    # The actual request byte should be 16 byte data where,
282    # data 1 - Encoding string type,
283    # data 2 - string length (in bytes, 1-based),
284    # data 3 to 16 - system firmware name string data - 14 bytes,
285    # Here 15 bytes so, data 17 - extra byte.
286    ${os_name}  ${name_hex_data}=  Identify Request Data  ${invalid_os_version}
287
288    # Check if the Set System Info Parameter for param 3 - Primary OS Name throws error
289    # for invalid data request.
290    Run Keyword and Expect Error
291    ...  *${IPMI_RAW_CMD['System_Info']['param3_Primary_Operating_System_Name']['Set'][1]}*
292    ...  Run IPMI Command
293    ...  ${IPMI_RAW_CMD['System_Info']['param3_Primary_Operating_System_Name']['Set'][0]} ${os_name}
294
295
296Verify System Info OS Name
297    [Documentation]  Verify setting valid os version to OS Name,
298    ...  of System Info Parameter via IPMI and verify whether it updates as expected.
299    [Tags]  Verify_System_Info_OS_Name
300
301    # os_version_name given in variable section which is a 14 byte data.
302    ${os_name}  ${os_hex_data}=  Identify Request Data  ${valid_os_version_name}
303
304    # Set OS Name of System Info Parameters.
305    Set OS Name  ${os_name}
306
307    # Get the OS Name and compare against given os_version_name.
308    ${sysos}=  Get OS Name
309    # The response data will something be like,
310    # ${sysos}= ["11","00","00","0e","56","65","72","73","69","6f","6e","32","2e","31","32","33"].
311    Should Be Equal  ${sysos[4:]}  ${os_hex_data}
312
313
314Verify System Info OS Name After BMC Reboot
315    [Documentation]  Verify setting valid os version name for OS Name,
316    ...  of System Info Parameter and verify it changes to default after BMC Reboot via IPMI.
317    [Tags]  Verify_System_Info_OS_Name_After_BMC_Reboot
318
319    # os_version_name given in variable section which is a 14 byte data.
320    ${os_name}  ${os_hex_data}=  Identify Request Data  ${valid_os_version_name}
321
322    # Set OS Name of System Info Parameters.
323    Set OS Name  ${os_name}
324
325    # Get the OS Name and compare against given os_version_name.
326    ${sysos}=  Get OS Name
327    # The response data will something be like,
328    # ${sysos}= ["11","00","00","0e","56","65","72","73","69","6f","6e","32","2e","31","32","33"].
329    Should Be Equal  ${sysos[4:]}  ${os_hex_data}
330
331    # Cold Reset via IPMI
332    IPMI MC Reset Cold (run)
333
334    # Since OS Name is volatile,
335    # compare with response data of Get OS Name,
336    # with default OS Name.
337    ${sysos}=  Get OS Name
338    # Should return default response data.
339    Should Be Equal  ${sysos[2:]}  ${default_os_name}
340
341
342Verify Get System Info OS Name With Invalid Data Length
343    [Documentation]  Verify OS Name of Get System Info Parameter via IPMI,
344    ...  with extra bytes, and expect to get the error message for invalid length.
345    [Tags]  Verify_Get_System_Info_OS_Name_With_Invalid_Data_Length
346
347    # Check if the Get System Info Parameter for param 4 - OS Name throws error for invalid request data.
348    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param4_Operating_System_Name']['Get'][1]}*
349    ...  Run IPMI Command
350    ...  ${IPMI_RAW_CMD['System_Info']['param4_Operating_System_Name']['Get'][0]} 0x00
351
352
353Verify Set System Info OS Name With Invalid Data Length
354    [Documentation]  Verify setting invalid os version name to OS Name,
355    ...  of Get System Info Parameter via IPMI,
356    ...  and expect to get the error message for invalid length.
357    [Tags]  Verify_Set_System_Info_OS_Name_With_Invalid_Data_Length
358
359    # invalid_os_version given in variable section which is a 15 byte data,
360    # The actual request byte should be 16 byte data where,
361    # data 1 - Encoding string type,
362    # data 2 - string length (in bytes, 1-based),
363    # data 3 to 16 - system firmware name string data - 14 bytes,
364    # Here 15 bytes so, data 17 - extra byte.
365    ${os_name}  ${name_hex_data}=  Identify Request Data  ${invalid_os_version}
366
367    # Check if the Set System Info Parameter for param 4 - OS Name throws error for invalid request data.
368    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param4_Operating_System_Name']['Set'][1]}*
369    ...  Run IPMI Command
370    ...  ${IPMI_RAW_CMD['System_Info']['param4_Operating_System_Name']['Set'][0]} ${os_name}
371
372
373Verify System Info Present OS Version Number
374    [Documentation]  Verify setting valid os version for Present OS Version Number,
375    ...  of System Info Parameter via IPMI and verify whether it is updated as expected.
376    [Tags]  Verify_System_Info_Present_OS_Version_Number
377
378    # os_version_name given in variable section which is a 14 byte data.
379    ${os_name}  ${os_hex_data}=  Identify Request Data  ${valid_os_version_name}
380
381    # Set Present OS Version Number for System Info Parameters.
382    Set Present OS Version Number  ${os_name}
383
384    # Get Present OS Version Number for System Info Parameters,
385    # compare with response data of Get OS Name,
386    # with assigned os version name.
387    ${os_version}=  Get Present OS Version Number
388    # The response data will something be like,
389    # ${os_version}= ["11","00","00","0e","56","65","72","73","69","6f","6e","32","2e","31","32","33"].
390    Should Be Equal  ${os_version[4:]}  ${os_hex_data}
391
392
393Verify Get System Info Present OS Version Number With Invalid Data Length
394    [Documentation]  Verify Get System Info Parameter Present OS Version Number via IPMI,
395    ...  with extra bytes, and expect to get the error message for invalid length.
396    [Tags]  Verify_Get_System_Info_Present_OS_Version_Number_With_Invalid_Data_Length
397
398    # Check if the Get System Info Parameter for param 5 - Present OS Version Number throws
399    # error for invalid request data.
400    Run Keyword and Expect Error
401    ...  *${IPMI_RAW_CMD['System_Info']['param5_Present_OS_Version_number']['Get'][1]}*
402    ...  Run IPMI Command
403    ...  ${IPMI_RAW_CMD['System_Info']['param5_Present_OS_Version_number']['Get'][0]} 0x00
404
405
406Verify Set System Info Present OS Version Number With Invalid Data Length
407    [Documentation]  Verify setting invalid os version to Present OS Version Number
408    ...  of Set System Info Parameter via IPMI,
409    ...  and expect to get the error message for invalid length.
410    [Tags]  Verify_Set_System_Info_Present_OS_Version_Number_With_Invalid_Data_Length
411
412    # invalid_os_version given in variable section which is a 15 byte data.
413    # The actual request byte should be 16 byte data where,
414    # data 1 - Encoding string type,
415    # data 2 - string length (in bytes, 1-based),
416    # data 3 to 16 - system firmware name string data - 14 bytes,
417    # Here 15 bytes so, data 17 - extra byte.
418    ${os_name}  ${name_hex_data}=  Identify Request Data  ${invalid_os_version}
419
420    # Check if the Set System Info Parameter for param 5 - Present OS Version Number throws
421    # error for invalid request data.
422    Run Keyword and Expect Error
423    ...  *${IPMI_RAW_CMD['System_Info']['param5_Present_OS_Version_number']['Set'][1]}*
424    ...  Run IPMI Command
425    ...  ${IPMI_RAW_CMD['System_Info']['param5_Present_OS_Version_number']['Set'][0]} ${os_name}
426
427
428*** Keywords ***
429
430Identify Request Data
431    [Documentation]  Convert string to hexadecimal request data with and without prefix 0x.
432    [Arguments]  ${string}
433
434    # Given a string, convert to hexadecimal and prefix with 0x.
435    # Consider random string generated ${string} is 'zwc'.
436    ${fw_ver_hex_list}=  Create List
437    ${hex_data_list}=  Create List
438    ${resp_data_list}=  Split String With Index  ${string}  1
439    # ${resp_data_list} will be ['z', 'w', 'c'].
440    FOR  ${data}  IN  @{resp_data_list}
441        # prefixes 0x by default.
442        # Example : 0x00.
443        ${hex_value}=  Evaluate  hex(ord("${data}"))
444        # provides only hexadecimal bytes.
445        # Example : 00.
446        ${hex}=  Evaluate  hex(ord("${data}"))[2:]
447        # With prefix 0x.
448        Append To List  ${fw_ver_hex_list}  ${hex_value}
449        # Without prefix.
450        Append To List  ${hex_data_list}  ${hex}
451    END
452    ${fw_ver_hex}=  Evaluate  " ".join(${fw_ver_hex_list})
453
454    RETURN  ${fw_ver_hex}  ${hex_data_list}
455
456
457Get System Info Set In Progress
458    [Documentation]  Run Get system info parameter command for set-in-progress and return response data.
459
460    # Get System Info Parameter for param 0 - Set In Progress.
461    ${resp}=  Run IPMI Command
462    ...  ${IPMI_RAW_CMD['System_Info']['param0_Set_In_Progress']['Get'][0]}
463    ${resp}=  Split String  ${resp}
464
465    RETURN  ${resp}
466
467
468Set System Info Set In Progress
469    [Documentation]  Set System Info Set In Progress with valid state via IPMI.
470    [Arguments]  ${state}
471
472    # Set System Info Parameter for param 0 - Set In Progress.
473    # ${state} can be can be any - 00 | 01 | 10 | 11.
474    Run IPMI Command
475    ...  ${IPMI_RAW_CMD['System_Info']['param0_Set_In_Progress']['Set'][0]} ${state}
476
477
478Get System Firmware Version
479    [Documentation]  Run Get system info parameter command for system firmware version
480    ...              and return response data.
481
482    # Get System Info Parameter for param 1 - System Firmware Version.
483    ${resp}=  Run IPMI Command
484    ...  ${IPMI_RAW_CMD['System_Info']['param1_System_Firmware_Version']['Get'][0]}
485    ${resp}=  Split String  ${resp}
486
487    RETURN  ${resp}
488
489
490Set System Firmware Version
491    [Documentation]  Set System Firmware Version for System Info with valid version.
492    [Arguments]  ${version}
493
494    # Set System Info Parameter for param 1 - System Firmware Version.
495    # ${version} can be any 14 data.
496    Run IPMI Command
497    ...  ${IPMI_RAW_CMD['System_Info']['param1_System_Firmware_Version']['Set'][0]} ${version}
498
499
500Get System Name
501    [Documentation]  Run system info parameter command for system name and return response data.
502
503    # Get System Info Parameter for param 2 - System Name.
504    ${resp}=  Run IPMI Command
505    ...  ${IPMI_RAW_CMD['System_Info']['param2_System_Name']['Get'][0]}
506    ${resp}=  Split String  ${resp}
507
508    RETURN  ${resp}
509
510
511Set System Name
512    [Documentation]  Set System Name for System Info with valid name.
513    [Arguments]  ${sys_name}
514
515    # Set System Info Parameter for param 2 - System Name.
516    # ${sys_name} can be any 14 byte data.
517    Run IPMI Command
518    ...  ${IPMI_RAW_CMD['System_Info']['param2_System_Name']['Set'][0]} ${sys_name}
519
520
521Get Primary OS Name
522    [Documentation]  Run Get System Info command for primary OS name and return response data.
523
524    # Get System Info Parameter for param 3 - Primary OS Name.
525    ${resp}=  Run IPMI Command
526    ...  ${IPMI_RAW_CMD['System_Info']['param3_Primary_Operating_System_Name']['Get'][0]}
527    ${resp}=  Split String  ${resp}
528
529    RETURN  ${resp}
530
531
532Set Primary OS Name
533    [Documentation]  Set Primary OS Name for System Info with valid os name.
534    [Arguments]  ${os_name}
535
536    # Set System Info Parameter for param 3 - Primary OS Name.
537    # ${os_name} can be any 14 byte data.
538    Run IPMI Command
539    ...  ${IPMI_RAW_CMD['System_Info']['param3_Primary_Operating_System_Name']['Set'][0]} ${os_name}
540
541
542Get OS Name
543    [Documentation]  Run get System Info command for OS name and return response data.
544
545    # Get System Info Parameter for param 4 - OS Name.
546    ${resp}=  Run IPMI Command
547    ...  ${IPMI_RAW_CMD['System_Info']['param4_Operating_System_Name']['Get'][0]}
548    ${resp}=  Split String  ${resp}
549
550    RETURN  ${resp}
551
552
553Set OS Name
554    [Documentation]  Set OS Name for System Info with valid os name.
555    [Arguments]  ${os_name}
556
557    # Set System Info Parameter for param 4 - OS Name.
558    # ${os_name} can be any 14 byte data.
559    Run IPMI Command
560    ...  ${IPMI_RAW_CMD['System_Info']['param4_Operating_System_Name']['Set'][0]} ${os_name}
561
562
563Get Present OS Version Number
564    [Documentation]  Run Get System Info command for present os version name and return response.
565
566    # Get System Info Parameter for param 5 - Present OS Version Number.
567    ${resp}=  Run IPMI Command
568    ...  ${IPMI_RAW_CMD['System_Info']['param5_Present_OS_Version_number']['Get'][0]}
569    ${resp}=  Split String  ${resp}
570
571    RETURN  ${resp}
572
573
574Set Present OS Version Number
575    [Documentation]  Set Present OS Version Number for System Info with valid os version.
576    [Arguments]  ${os_name}
577
578    # Set System Info Parameter for param 5 - Present OS Version Number.
579    # ${os_name} can be any 14 byte data
580    Run IPMI Command
581    ...  ${IPMI_RAW_CMD['System_Info']['param5_Present_OS_Version_number']['Set'][0]} ${os_name}
582
583
584Add Prefix To List Objects And Join String
585    [Documentation]  Adding prefix '0x' to each list object and join the string.
586    [Arguments]  ${list}
587
588    # ${list} contains list of hexadecimal data.
589
590    # Prefix Bytes with 0x for each data bytes and makes a string of request bytes.
591    # Prefix Bytes function under lib/ipmi_utils.py.
592    # Prefixes every list item with 0x and returns list of prefixed hexadecimal data.
593    ${prefix_list}=  Prefix Bytes  ${list}
594    ${prefix_list}=  Evaluate  " ".join(${prefix_list})
595
596    RETURN  ${prefix_list}
597
598
599Suite Setup Execution
600    [Documentation]  Suite setup execution to fetch all the default response bytes,
601    ...  prefix each byte with 0x and make them a suite variable.
602
603    # Get Default Values of each parameters.
604    # Set In Progress - param 0.
605    ${resp}=  Get System Info Set In Progress
606    # Configuration parameter data - 11 xx (xx can be any - 00 | 01 | 10 | 11).
607    ${set_in_progress}=  Set Variable  ${resp[1]}
608
609    Set Suite Variable  ${set_in_progress}
610
611    # System Firmware Version - param 1.
612    ${resp}=  Get System Firmware Version
613    # Configuration parameter data - 11 x1 x2 xx xx xx xx .. xx (xx - 14 bytes).
614    # x1 - encoding, x2 - string length in bytes.
615    ${sys_fw_version}=  Set Variable  ${resp[2:]}
616    # Prefix all bytes with 0x.
617    ${sys_fw_version_string}=  Add Prefix To List Objects And Join String  ${sys_fw_version}
618
619    Set Suite Variable  ${sys_fw_version}
620    Set Suite Variable  ${sys_fw_version_string}
621
622    # System Name - param 2.
623    ${resp}=  Get System Name
624    # Configuration parameter data - 11 x1 x2 xx xx xx xx .. xx (xx - 14 bytes).
625    # x1 - encoding, x2 - string length in bytes.
626    ${sys_name_default}=  Set Variable  ${resp[2:]}
627    # Prefix all bytes with 0x.
628    ${sys_name_hex_default}=  Add Prefix To List Objects And Join String  ${sys_name_default}
629
630    Set Suite Variable  ${sys_name_default}
631    Set Suite Variable  ${sys_name_hex_default}
632
633    # Primary OS Name - param 3.
634    ${resp}=  Get Primary OS Name
635    # Configuration parameter data - 11 x1 x2 xx xx xx xx .. xx (xx - 14 bytes).
636    # x1 - encoding, x2 - string length in bytes.
637    ${primary_os_name}=  Set Variable  ${resp[2:]}
638    # Prefix all bytes with 0x.
639    ${primary_os_name_hex}=  Add Prefix To List Objects And Join String  ${primary_os_name}
640
641    Set Suite Variable  ${primary_os_name}
642    Set Suite Variable  ${primary_os_name_hex}
643
644    # OS Name - param 4.
645    ${resp}=  Get OS Name
646    # Configuration parameter data - 11 x1 x2 xx xx xx xx .. xx (xx - 14 bytes).
647    # x1 - encoding, x2 - string length in bytes.
648    ${default_os_name}=  Set Variable  ${resp[2:]}
649    # Prefix all bytes with 0x.
650    ${default_os_name_hex}=  Add Prefix To List Objects And Join String  ${default_os_name}
651
652    Set Suite Variable  ${default_os_name}
653    Set Suite Variable  ${default_os_name_hex}
654
655    # Present OS Version Number - param 5.
656    ${resp}=  Get Present OS Version Number
657    # Configuration parameter data - 11 x1 x2 xx xx xx xx .. xx (xx - 14 bytes).
658    # x1 - encoding, x2 - string length in bytes.
659    ${present_os_num}=  Set Variable  ${resp[2:]}
660    # Prefix all bytes with 0x.
661    ${present_os_num_hex}=  Add Prefix To List Objects And Join String  ${present_os_num}
662
663    Set Suite Variable  ${present_os_num}
664    Set Suite Variable  ${present_os_num_hex}
665
666
667Restore Default Configuration
668    [Documentation]  Restore all system info parameter response data to,
669    ...  default data obtained from suite setup.
670
671    # All variable to set are suite variables declared in suite setup.
672
673    # Set In Progress - param 0.
674    Set System Info Set In Progress  0x${set_in_progress}
675
676    # System Firmware Version - param 1.
677    Run IPMI Command  0x06 0x58 0x01 0x00 ${sys_fw_version_string}
678
679    # System Name - param 2.
680    Run IPMI Command  0x06 0x58 0x02 0x00 ${sys_name_hex_default}
681
682    # Primary OS Name - param 3.
683    Run IPMI Command  0x06 0x58 0x03 0x00 ${primary_os_name_hex}
684
685    # OS Name - param 4.
686    Run IPMI Command  0x06 0x58 0x04 0x00 ${default_os_name_hex}
687
688    # Present OS Version Number - param 5.
689    Run IPMI Command  0x06 0x58 0x05 0x00 ${present_os_num_hex}
690