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