xref: /openbmc/openbmc-test-automation/ipmi/test_ipmi_systeminfo_parameters.robot (revision 6fb70d98f2f1cb9273ba912deaa2cebe3c23ea86)
1015f787cSchithrag*** Settings ***
2015f787cSchithrag
3015f787cSchithragDocumentation       Module to test IPMI System Info Parameters functionality.
49bfdf8a7SGeorge Keishing...                 Following parameters are verified in the script,
5015f787cSchithrag...                 1. Set In Progress - param 0,
6015f787cSchithrag...                 2. System Firmware Version - param 1,
7015f787cSchithrag...                 3. System Name - param 2,
8015f787cSchithrag...                 4. Primary OS Name - param 3,
9015f787cSchithrag...                 5. OS Name - param 4,
10015f787cSchithrag...                 6. Present OS Version Number - param 5.
11015f787cSchithrag
12015f787cSchithragResource            ../lib/ipmi_client.robot
13015f787cSchithragResource            ../lib/openbmc_ffdc.robot
14d0c4b800SganesanbLibrary             Collections
15d0c4b800SganesanbLibrary             String
16015f787cSchithragLibrary             ../lib/ipmi_utils.py
17015f787cSchithragVariables           ../data/ipmi_raw_cmd_table.py
18015f787cSchithrag
19015f787cSchithragSuite Setup         Suite Setup Execution
20c46f7944Snagarjunb22Test Teardown       Run Keywords  Restore Default Configuration  AND  FFDC On Test Case Fail
21015f787cSchithrag
22*6fb70d98SMatt FischerTest Tags          IPMI_SystemInfo_Parameters
23015f787cSchithrag
24015f787cSchithrag*** Variables ***
25015f787cSchithrag
26015f787cSchithrag# Converting to hexadecimal provides 14 bytes so string length is 0e for param 3, 4, 5.
27015f787cSchithrag${valid_os_version_name}       Version2.12345
28015f787cSchithrag${invalid_os_version}          ${valid_os_version_name}${6789}
29015f787cSchithrag
30015f787cSchithrag
31015f787cSchithrag*** Test Cases ***
32015f787cSchithrag
33015f787cSchithragVerify System Info Set In Progress
34015f787cSchithrag    [Documentation]  Verify Set In Progress of System Info Parameter,
35015f787cSchithrag    ...  to set the set-in-progress and set complete state via IPMI,
36015f787cSchithrag    ...  and verify whether the state is updated and restored as expected.
37015f787cSchithrag    [Tags]  Verify_System_Info_Set_In_Progress
38015f787cSchithrag
39015f787cSchithrag    # Set In Progress - set complete.
40015f787cSchithrag    Set System Info Set In Progress  0x00
41015f787cSchithrag
42015f787cSchithrag    # Get System Info Parameter for param 0 - Set In Progress.
43015f787cSchithrag    # Check if set-in-progress set to set complete.
44015f787cSchithrag    ${complete}=  Get System Info Set In Progress
45015f787cSchithrag    # ${complete[0]} - parameter version.
46015f787cSchithrag    # ${complete[1]} - Configuration parameter data,
47015f787cSchithrag    # here,  01h (set in progress).
48015f787cSchithrag    Should Be Equal  ${complete[1]}  00
49015f787cSchithrag
50015f787cSchithrag    # Set In Progress - set in progress.
51015f787cSchithrag    Set System Info Set In Progress  0x01
52015f787cSchithrag
53015f787cSchithrag    # Get System Info Parameter for param 0 - Set In Progress.
54015f787cSchithrag    # Check if set-in-progress set to set inprogress.
55015f787cSchithrag    ${inprogress}=  Get System Info Set In Progress
56015f787cSchithrag    # ${inprogress[0]} - parameter version.
57015f787cSchithrag    # ${inprogress[1]} - Configuration parameter data,
58015f787cSchithrag    # here,  01h (set in progress).
59015f787cSchithrag    Should Be Equal  ${inprogress[1]}  01
60015f787cSchithrag
61015f787cSchithrag
62015f787cSchithragVerify System Info Set In Progress After BMC Reboot
63015f787cSchithrag    [Documentation]  Verify Set In Progress changes to default,
64015f787cSchithrag    ...  after bmc reboot of System Info Parameter via IPMI,
65015f787cSchithrag    ...  and verify whether the default setting is reflected.
66015f787cSchithrag    [Tags]  Verify_System_Info_Set_In_Progress_After_BMC_Reboot
67015f787cSchithrag
68015f787cSchithrag    # Set the parameter 0 - Set_In_Progress to set in progress state.
69015f787cSchithrag    Set System Info Set In Progress  0x01
70015f787cSchithrag    # Get System Info Parameter for param 0 - Set In Progress.
71015f787cSchithrag    # Check if set-in-progress set to set in progress.
72015f787cSchithrag    ${inprogress}=  Get System Info Set In Progress
73015f787cSchithrag    # ${inprogress[0]} - parameter version.
74015f787cSchithrag    # ${inprogress[1]} - Configuration parameter data,
75015f787cSchithrag    # here,  01h (set in progress).
76015f787cSchithrag    Should Be Equal  ${inprogress[1]}  01
77015f787cSchithrag
78015f787cSchithrag    # Reboot BMC.
79c46f7944Snagarjunb22    IPMI MC Reset Cold (run)
80015f787cSchithrag
81015f787cSchithrag    # Since the param 0 - Set In Progress is volatile,
82015f787cSchithrag    # Default value should be updated after BMC reboot.
83015f787cSchithrag    ${state}=  Get System Info Set In Progress
84015f787cSchithrag    # ${state[0]} - parameter version.
85015f787cSchithrag    # ${state[1]} - Configuration parameter data,
86015f787cSchithrag    # here, 00h (set complete), 01h (set in progress),
87015f787cSchithrag    #       10 (commit write), 11 (reserved).
88015f787cSchithrag    Should Be Equal  ${state[1]}  ${set_in_progress}
89015f787cSchithrag
90015f787cSchithrag
91015f787cSchithragVerify Get System Info Set In Progress With Invalid Data Length
92015f787cSchithrag    [Documentation]  Verify Get System Info Parameter Set In Progress via IPMI with extra bytes,
93015f787cSchithrag    ...  and expect to get the error message for invalid length.
94015f787cSchithrag    [Tags]  Verify_Get_System_Info_Set_In_Progress_With_Invalid_Data_Length
95015f787cSchithrag
966e641262SGeorge Keishing    # Check if the Get System Info Parameter for param 0 - set in progress throws
976e641262SGeorge Keishing    # error for invalid data length.
98015f787cSchithrag    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param0_Set_In_Progress']['Get'][1]}*
99372cd862Sishwaryamathim    ...  Run IPMI Command
100372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param0_Set_In_Progress']['Get'][0]} 0x00
101015f787cSchithrag
102015f787cSchithrag
103015f787cSchithragVerify Set System Info Set In Progress With Invalid Data Length
104015f787cSchithrag    [Documentation]  Verify Set System Info Parameter Set In Progress via IPMI with extra bytes,
105015f787cSchithrag    ...  and expect to get the error message for invalid length.
106015f787cSchithrag    [Tags]  Verify_Set_System_Info_Set_In_Progress_With_Invalid_Data_Length
107015f787cSchithrag
1086e641262SGeorge Keishing    # Check if the Set System Info Parameter for param 0 - set in progress throws
1096e641262SGeorge Keishing    # error for invalid data length.
110015f787cSchithrag    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param0_Set_In_Progress']['Set'][1]}*
111372cd862Sishwaryamathim    ...  Run IPMI Command
112372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param0_Set_In_Progress']['Set'][0]} 0x00 0x00
113015f787cSchithrag
114015f787cSchithrag
115015f787cSchithragVerify Set System Info Set In Progress With Invalid State
116015f787cSchithrag    [Documentation]  Verify Set System Info Parameter Set In Progress via IPMI invalid state,
117015f787cSchithrag    ...  and expect to get the error message for invalid data.
118015f787cSchithrag    [Tags]  Verify_Set_System_Info_Set_In_Progress_With_Invalid_State
119015f787cSchithrag
120015f787cSchithrag    # Check if the Set System Info Parameter for param 0 - set in progress throws error for invalid State.
121015f787cSchithrag    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param0_Set_In_Progress']['Set'][2]}*
122372cd862Sishwaryamathim    ...  Run IPMI Command
123372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param0_Set_In_Progress']['Set'][0]} 0x04
124015f787cSchithrag
125015f787cSchithrag
126015f787cSchithragVerify System Info System Firmware Version
127015f787cSchithrag    [Documentation]  Verify System Firmware Version of System Info Parameter via IPMI,
128015f787cSchithrag    ...  and verify whether the version is updated.
129015f787cSchithrag    [Tags]  Verify_System_Info_System_Firmware_Version
130015f787cSchithrag
131015f787cSchithrag    # Generate a random 14 byte data,
132015f787cSchithrag    # i,e 16-byte block for system firmware name string data.
133015f787cSchithrag    # data 1 - Encoding string type,
134015f787cSchithrag    # data 2 - string length (in bytes, 1-based),
135015f787cSchithrag    # data 3 to 16 - system firmware name string data - 14 bytes.
136015f787cSchithrag    ${firmware_version}=  Generate Random String  14  [LETTERS]
137015f787cSchithrag    ${firmware_version}  ${fw_hex_data}=  Identify Request Data  ${firmware_version}
138015f787cSchithrag    # Consider random string generated is 'zwclMXwfczMvcY'.
139015f787cSchithrag    # Set the System Firmware Version of System Info Parameter.
140015f787cSchithrag    Set System Firmware Version  ${firmware_version}
141015f787cSchithrag    # Get the response of System Firmware Version,
142015f787cSchithrag    # and compare against randomly generated data bytes.
143015f787cSchithrag    ${fw_version}=  Get System Firmware Version
144015f787cSchithrag    # The response data will something be like,
145015f787cSchithrag    # ${fw_version}= ["11","00","00","0e","7a","77","63","6c","4d","58","77","66","63","7a","4d","76"].
146015f787cSchithrag    Should Be Equal  ${fw_version[4:]}  ${fw_hex_data}
147015f787cSchithrag
148015f787cSchithrag
149015f787cSchithragVerify Get System Info System Firmware Version With Invalid Data Length
150015f787cSchithrag    [Documentation]  Verify Get System Info Parameter System Firmware Version via IPMI with extra bytes,
151015f787cSchithrag    ...  and expect to get the error message for invalid length.
152015f787cSchithrag    [Tags]  Verify_Get_System_Info_System_Firmware_Version_With_Invalid_Data_Length
153015f787cSchithrag
1546e641262SGeorge Keishing    # Check if the Get System Info Parameter for param 1 - System Firmware Version throws
1556e641262SGeorge Keishing    # error for invalid data length.
156015f787cSchithrag    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param1_System_Firmware_Version']['Get'][1]}*
157372cd862Sishwaryamathim    ...  Run IPMI Command
158372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param1_System_Firmware_Version']['Get'][0]} 0x00
159015f787cSchithrag
160015f787cSchithrag
161015f787cSchithragVerify Set System Info System Firmware Version With Invalid Data Length
162015f787cSchithrag    [Documentation]  Verify Set System Info Parameter System Firmware Version via IPMI with extra bytes,
163015f787cSchithrag    ...  and expect to get the error message for invalid length.
164015f787cSchithrag    [Tags]  Verify_Set_System_Info_System_Firmware_Version_With_Invalid_Data_Length
165015f787cSchithrag
166015f787cSchithrag    # Generate a random 15 byte data,
167015f787cSchithrag    # i,e 16-byte block for system firmware name string data,
168015f787cSchithrag    # data 1 - Encoding string type,
169015f787cSchithrag    # data 2 - string length (in bytes, 1-based),
170015f787cSchithrag    # data 3 to 16 - system firmware name string data - 14 bytes,
171015f787cSchithrag    # data 17 - extra byte.
172015f787cSchithrag    ${firmware_version}=  Generate Random String  15  [LETTERS]
173015f787cSchithrag    ${firmware_version}  ${fw_hex_data}=  Identify Request Data  ${firmware_version}
174015f787cSchithrag    # Consider random string generated is 'zwclMXwfczMvcYz'.
175015f787cSchithrag    # The request data bytes will be 15 bytes, in which 14 bytes are only expected.
1766e641262SGeorge Keishing    # Check if the Set System Info Parameter for param 1 - System Firmware Version throws
1776e641262SGeorge Keishing    # error for invalid request data.
178015f787cSchithrag    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param1_System_Firmware_Version']['Set'][1]}*
179372cd862Sishwaryamathim    ...  Run IPMI Command
180372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param1_System_Firmware_Version']['Set'][0]} ${firmware_version}
181015f787cSchithrag
182015f787cSchithrag
183015f787cSchithragVerify System Info System Name
184015f787cSchithrag    [Documentation]  Verify System Name of System Info Parameter via IPMI by setting,
185015f787cSchithrag    ...  a random system name and verify whether it is updated as expected.
186015f787cSchithrag    [Tags]  Verify_System_Info_System_Name
187015f787cSchithrag
188015f787cSchithrag    # Generate a random 14 byte data,
189015f787cSchithrag    # i,e 16-byte block for system firmware name string data,
190015f787cSchithrag    # data 1 - Encoding string type,
191015f787cSchithrag    # data 2 - string length (in bytes, 1-based),
192015f787cSchithrag    # data 3 to 16 - system firmware name string data - 14 bytes.
193015f787cSchithrag    ${system_name}=  Generate Random String  14  [LETTERS]
194015f787cSchithrag    ${system_name}  ${name_hex_data}=  Identify Request Data  ${system_name}
195015f787cSchithrag    # Consider random string generated is 'zwclMXwfczMvcY'.
196015f787cSchithrag
197015f787cSchithrag    # Set System Name for System Info Parameter.
198015f787cSchithrag    Set System Name  ${system_name}
199015f787cSchithrag
200015f787cSchithrag    # Get the response of System Name,
201015f787cSchithrag    # and compare against randomly generated data bytes.
202015f787cSchithrag    ${sys_name}=  Get System Name
203015f787cSchithrag    # The response data will something be like,
204015f787cSchithrag    # ${sys_name}= ["11","00","00","0e","7a","77","63","6c","4d","58","77","66","63","7a","4d","76"].
205015f787cSchithrag    Should Be Equal  ${sys_name[4:]}  ${name_hex_data}
206015f787cSchithrag
207015f787cSchithrag
208015f787cSchithragVerify Get System Info System Name With Invalid Data Length
209015f787cSchithrag    [Documentation]  Verify Get System Info Parameter System Name via IPMI with extra bytes,
210015f787cSchithrag    ...  and expect to get the error message for invalid length.
211015f787cSchithrag    [Tags]  Verify_Get_System_Info_System_Name_With_Invalid_Data_Length
212015f787cSchithrag
2136e641262SGeorge Keishing    # Check if the Get System Info Parameter for param 2 - System Name throws error
2146e641262SGeorge Keishing    # for invalid request data length.
215015f787cSchithrag    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param2_System_Name']['Get'][1]}*
216372cd862Sishwaryamathim    ...  Run IPMI Command
217372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param2_System_Name']['Get'][0]} 0x00
218015f787cSchithrag
219015f787cSchithrag
220015f787cSchithragVerify Set System Info System Name With Invalid Data Length
221015f787cSchithrag    [Documentation]  Verify Set System Info Parameter System Name via IPMI with extra bytes,
222015f787cSchithrag    ...  and expect to get the error message for invalid length.
223015f787cSchithrag    [Tags]  Verify_Set_System_Info_System_Name_With_Invalid_Data_Length
224015f787cSchithrag
225015f787cSchithrag    # Generate a random 15 byte data,
226015f787cSchithrag    # i,e 16-byte block for system firmware name string data,
227015f787cSchithrag    # data 1 - Encoding string type,
228015f787cSchithrag    # data 2 - string length (in bytes, 1-based),
229015f787cSchithrag    # data 3 to 16 - system firmware name string data - 14 bytes,
230015f787cSchithrag    # data 17 - extra byte.
231015f787cSchithrag    ${system_name}=  Generate Random String  15  [LETTERS]
232015f787cSchithrag    ${system_name}  ${name_hex_data}=  Identify Request Data  ${system_name}
233015f787cSchithrag    # Consider random string generated is 'zwclMXwfczMvcYz'.
234e16f158fSGeorge Keishing    # The request data bytes will be 15 bytes, in which 14 bytes are only expected.
235015f787cSchithrag
236015f787cSchithrag    # Check if the Set System Info Parameter for param 2 - System Name throws error for invalid request data.
237015f787cSchithrag    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param2_System_Name']['Set'][1]}*
238372cd862Sishwaryamathim    ...  Run IPMI Command
239372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param2_System_Name']['Set'][0]} ${system_name}
240015f787cSchithrag
241015f787cSchithrag
242015f787cSchithragVerify System Info Primary OS Name
243015f787cSchithrag    [Documentation]  Verify Primary OS Name of System Info Parameter via IPMI,
244015f787cSchithrag    ...  by setting a valid os version and verify whether it is updated as expected.
245015f787cSchithrag    [Tags]  Verify_System_Info_Primary_OS_Name
246015f787cSchithrag
247015f787cSchithrag    # os_version_name given in variable section which is a 14 byte data.
248015f787cSchithrag    ${os_name}  ${os_hex_data}=  Identify Request Data  ${valid_os_version_name}
249015f787cSchithrag
250015f787cSchithrag    # Set Primary OS Name of System Info Parameter.
251015f787cSchithrag    Set Primary OS Name  ${os_name}
252015f787cSchithrag
253015f787cSchithrag    # Get Primary OS Name of System Info Parameter.
254015f787cSchithrag    # Compare with the assigned os version name data.
255015f787cSchithrag    ${pr_os}=  Get Primary OS Name
256015f787cSchithrag    # The response data will something be like,
257015f787cSchithrag    # ${pr_os}= ["11","00","00","0e","56","65","72","73","69","6f","6e","32","2e","31","32","33"].
258015f787cSchithrag    Should Be Equal  ${pr_os[4:]}  ${os_hex_data}
259015f787cSchithrag
260015f787cSchithrag
261015f787cSchithragVerify Get System Info Primary OS Name With Invalid Data Length
262015f787cSchithrag    [Documentation]  Verify Get System Info Parameter Primary OS Name via IPMI with extra bytes,
263015f787cSchithrag    ...  and expect to get the error message for invalid length.
264015f787cSchithrag    [Tags]  Verify_Get_System_Info_Primary_OS_Name_With_Invalid_Data_Length
265015f787cSchithrag
2666e641262SGeorge Keishing    # Check if the Get System Info Parameter for param 3 - Primary OS Name throws
2676e641262SGeorge Keishing    # error for invalid request data.
2689e5626d2SGeorge Keishing    Run Keyword and Expect Error
2699e5626d2SGeorge Keishing    ...  *${IPMI_RAW_CMD['System_Info']['param3_Primary_Operating_System_Name']['Get'][1]}*
270372cd862Sishwaryamathim    ...  Run IPMI Command
271372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param3_Primary_Operating_System_Name']['Get'][0]} 0x00
272015f787cSchithrag
273015f787cSchithrag
274015f787cSchithragVerify Set System Info Primary OS Name With Invalid Data Length
275015f787cSchithrag    [Documentation]  Verify setting invalid os version name to Primary OS Name,
276015f787cSchithrag    ...  of Set System Info Parameter via IPMI,
277015f787cSchithrag    ...  and expect to get the error message for invalid length.
278015f787cSchithrag    [Tags]  Verify_Set_System_Info_Primary_OS_Name_With_Invalid_Data_Length
279015f787cSchithrag
280015f787cSchithrag    # invalid_os_version given in variable section which is a 15 byte data,
281015f787cSchithrag    # The actual request byte should be 16 byte data where,
282015f787cSchithrag    # data 1 - Encoding string type,
283015f787cSchithrag    # data 2 - string length (in bytes, 1-based),
284015f787cSchithrag    # data 3 to 16 - system firmware name string data - 14 bytes,
285015f787cSchithrag    # Here 15 bytes so, data 17 - extra byte.
286015f787cSchithrag    ${os_name}  ${name_hex_data}=  Identify Request Data  ${invalid_os_version}
287015f787cSchithrag
2886e641262SGeorge Keishing    # Check if the Set System Info Parameter for param 3 - Primary OS Name throws error
2896e641262SGeorge Keishing    # for invalid data request.
2909e5626d2SGeorge Keishing    Run Keyword and Expect Error
2919e5626d2SGeorge Keishing    ...  *${IPMI_RAW_CMD['System_Info']['param3_Primary_Operating_System_Name']['Set'][1]}*
292372cd862Sishwaryamathim    ...  Run IPMI Command
293372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param3_Primary_Operating_System_Name']['Set'][0]} ${os_name}
294015f787cSchithrag
295015f787cSchithrag
296015f787cSchithragVerify System Info OS Name
297015f787cSchithrag    [Documentation]  Verify setting valid os version to OS Name,
298015f787cSchithrag    ...  of System Info Parameter via IPMI and verify whether it updates as expected.
299015f787cSchithrag    [Tags]  Verify_System_Info_OS_Name
300015f787cSchithrag
301015f787cSchithrag    # os_version_name given in variable section which is a 14 byte data.
302015f787cSchithrag    ${os_name}  ${os_hex_data}=  Identify Request Data  ${valid_os_version_name}
303015f787cSchithrag
304015f787cSchithrag    # Set OS Name of System Info Parameters.
305015f787cSchithrag    Set OS Name  ${os_name}
306015f787cSchithrag
307015f787cSchithrag    # Get the OS Name and compare against given os_version_name.
308015f787cSchithrag    ${sysos}=  Get OS Name
309015f787cSchithrag    # The response data will something be like,
310015f787cSchithrag    # ${sysos}= ["11","00","00","0e","56","65","72","73","69","6f","6e","32","2e","31","32","33"].
311015f787cSchithrag    Should Be Equal  ${sysos[4:]}  ${os_hex_data}
312015f787cSchithrag
313015f787cSchithrag
314015f787cSchithragVerify System Info OS Name After BMC Reboot
315015f787cSchithrag    [Documentation]  Verify setting valid os version name for OS Name,
316015f787cSchithrag    ...  of System Info Parameter and verify it changes to default after BMC Reboot via IPMI.
317015f787cSchithrag    [Tags]  Verify_System_Info_OS_Name_After_BMC_Reboot
318015f787cSchithrag
319015f787cSchithrag    # os_version_name given in variable section which is a 14 byte data.
320015f787cSchithrag    ${os_name}  ${os_hex_data}=  Identify Request Data  ${valid_os_version_name}
321015f787cSchithrag
322015f787cSchithrag    # Set OS Name of System Info Parameters.
323015f787cSchithrag    Set OS Name  ${os_name}
324015f787cSchithrag
325015f787cSchithrag    # Get the OS Name and compare against given os_version_name.
326015f787cSchithrag    ${sysos}=  Get OS Name
327015f787cSchithrag    # The response data will something be like,
328015f787cSchithrag    # ${sysos}= ["11","00","00","0e","56","65","72","73","69","6f","6e","32","2e","31","32","33"].
329015f787cSchithrag    Should Be Equal  ${sysos[4:]}  ${os_hex_data}
330015f787cSchithrag
331015f787cSchithrag    # Cold Reset via IPMI
332c46f7944Snagarjunb22    IPMI MC Reset Cold (run)
333015f787cSchithrag
334015f787cSchithrag    # Since OS Name is volatile,
335015f787cSchithrag    # compare with response data of Get OS Name,
336015f787cSchithrag    # with default OS Name.
337015f787cSchithrag    ${sysos}=  Get OS Name
338015f787cSchithrag    # Should return default response data.
339015f787cSchithrag    Should Be Equal  ${sysos[2:]}  ${default_os_name}
340015f787cSchithrag
341015f787cSchithrag
342015f787cSchithragVerify Get System Info OS Name With Invalid Data Length
343015f787cSchithrag    [Documentation]  Verify OS Name of Get System Info Parameter via IPMI,
344015f787cSchithrag    ...  with extra bytes, and expect to get the error message for invalid length.
345015f787cSchithrag    [Tags]  Verify_Get_System_Info_OS_Name_With_Invalid_Data_Length
346015f787cSchithrag
347015f787cSchithrag    # Check if the Get System Info Parameter for param 4 - OS Name throws error for invalid request data.
348c46f7944Snagarjunb22    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param4_Operating_System_Name']['Get'][1]}*
349372cd862Sishwaryamathim    ...  Run IPMI Command
350372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param4_Operating_System_Name']['Get'][0]} 0x00
351015f787cSchithrag
352015f787cSchithrag
353015f787cSchithragVerify Set System Info OS Name With Invalid Data Length
354015f787cSchithrag    [Documentation]  Verify setting invalid os version name to OS Name,
355015f787cSchithrag    ...  of Get System Info Parameter via IPMI,
356015f787cSchithrag    ...  and expect to get the error message for invalid length.
357015f787cSchithrag    [Tags]  Verify_Set_System_Info_OS_Name_With_Invalid_Data_Length
358015f787cSchithrag
359015f787cSchithrag    # invalid_os_version given in variable section which is a 15 byte data,
360015f787cSchithrag    # The actual request byte should be 16 byte data where,
361015f787cSchithrag    # data 1 - Encoding string type,
362015f787cSchithrag    # data 2 - string length (in bytes, 1-based),
363015f787cSchithrag    # data 3 to 16 - system firmware name string data - 14 bytes,
364015f787cSchithrag    # Here 15 bytes so, data 17 - extra byte.
365015f787cSchithrag    ${os_name}  ${name_hex_data}=  Identify Request Data  ${invalid_os_version}
366015f787cSchithrag
367015f787cSchithrag    # Check if the Set System Info Parameter for param 4 - OS Name throws error for invalid request data.
368c46f7944Snagarjunb22    Run Keyword and Expect Error  *${IPMI_RAW_CMD['System_Info']['param4_Operating_System_Name']['Set'][1]}*
369372cd862Sishwaryamathim    ...  Run IPMI Command
370372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param4_Operating_System_Name']['Set'][0]} ${os_name}
371015f787cSchithrag
372015f787cSchithrag
373015f787cSchithragVerify System Info Present OS Version Number
374015f787cSchithrag    [Documentation]  Verify setting valid os version for Present OS Version Number,
375015f787cSchithrag    ...  of System Info Parameter via IPMI and verify whether it is updated as expected.
376015f787cSchithrag    [Tags]  Verify_System_Info_Present_OS_Version_Number
377015f787cSchithrag
378015f787cSchithrag    # os_version_name given in variable section which is a 14 byte data.
379015f787cSchithrag    ${os_name}  ${os_hex_data}=  Identify Request Data  ${valid_os_version_name}
380015f787cSchithrag
381015f787cSchithrag    # Set Present OS Version Number for System Info Parameters.
382015f787cSchithrag    Set Present OS Version Number  ${os_name}
383015f787cSchithrag
384015f787cSchithrag    # Get Present OS Version Number for System Info Parameters,
385015f787cSchithrag    # compare with response data of Get OS Name,
386015f787cSchithrag    # with assigned os version name.
387015f787cSchithrag    ${os_version}=  Get Present OS Version Number
388015f787cSchithrag    # The response data will something be like,
389015f787cSchithrag    # ${os_version}= ["11","00","00","0e","56","65","72","73","69","6f","6e","32","2e","31","32","33"].
390015f787cSchithrag    Should Be Equal  ${os_version[4:]}  ${os_hex_data}
391015f787cSchithrag
392015f787cSchithrag
393015f787cSchithragVerify Get System Info Present OS Version Number With Invalid Data Length
394015f787cSchithrag    [Documentation]  Verify Get System Info Parameter Present OS Version Number via IPMI,
395015f787cSchithrag    ...  with extra bytes, and expect to get the error message for invalid length.
396015f787cSchithrag    [Tags]  Verify_Get_System_Info_Present_OS_Version_Number_With_Invalid_Data_Length
397015f787cSchithrag
3986e641262SGeorge Keishing    # Check if the Get System Info Parameter for param 5 - Present OS Version Number throws
3996e641262SGeorge Keishing    # error for invalid request data.
4006e641262SGeorge Keishing    Run Keyword and Expect Error
4016e641262SGeorge Keishing    ...  *${IPMI_RAW_CMD['System_Info']['param5_Present_OS_Version_number']['Get'][1]}*
402372cd862Sishwaryamathim    ...  Run IPMI Command
403372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param5_Present_OS_Version_number']['Get'][0]} 0x00
404015f787cSchithrag
405015f787cSchithrag
406015f787cSchithragVerify Set System Info Present OS Version Number With Invalid Data Length
407015f787cSchithrag    [Documentation]  Verify setting invalid os version to Present OS Version Number
408015f787cSchithrag    ...  of Set System Info Parameter via IPMI,
409015f787cSchithrag    ...  and expect to get the error message for invalid length.
410015f787cSchithrag    [Tags]  Verify_Set_System_Info_Present_OS_Version_Number_With_Invalid_Data_Length
411015f787cSchithrag
412015f787cSchithrag    # invalid_os_version given in variable section which is a 15 byte data.
413015f787cSchithrag    # The actual request byte should be 16 byte data where,
414015f787cSchithrag    # data 1 - Encoding string type,
415015f787cSchithrag    # data 2 - string length (in bytes, 1-based),
416015f787cSchithrag    # data 3 to 16 - system firmware name string data - 14 bytes,
417015f787cSchithrag    # Here 15 bytes so, data 17 - extra byte.
418015f787cSchithrag    ${os_name}  ${name_hex_data}=  Identify Request Data  ${invalid_os_version}
419015f787cSchithrag
4206e641262SGeorge Keishing    # Check if the Set System Info Parameter for param 5 - Present OS Version Number throws
4216e641262SGeorge Keishing    # error for invalid request data.
4226e641262SGeorge Keishing    Run Keyword and Expect Error
4236e641262SGeorge Keishing    ...  *${IPMI_RAW_CMD['System_Info']['param5_Present_OS_Version_number']['Set'][1]}*
424372cd862Sishwaryamathim    ...  Run IPMI Command
425372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param5_Present_OS_Version_number']['Set'][0]} ${os_name}
426015f787cSchithrag
427015f787cSchithrag
428015f787cSchithrag*** Keywords ***
429015f787cSchithrag
430015f787cSchithragIdentify Request Data
431015f787cSchithrag    [Documentation]  Convert string to hexadecimal request data with and without prefix 0x.
432015f787cSchithrag    [Arguments]  ${string}
433015f787cSchithrag
434015f787cSchithrag    # Given a string, convert to hexadecimal and prefix with 0x.
435015f787cSchithrag    # Consider random string generated ${string} is 'zwc'.
436015f787cSchithrag    ${fw_ver_hex_list}=  Create List
437015f787cSchithrag    ${hex_data_list}=  Create List
438015f787cSchithrag    ${resp_data_list}=  Split String With Index  ${string}  1
439015f787cSchithrag    # ${resp_data_list} will be ['z', 'w', 'c'].
440015f787cSchithrag    FOR  ${data}  IN  @{resp_data_list}
441015f787cSchithrag        # prefixes 0x by default.
442015f787cSchithrag        # Example : 0x00.
443015f787cSchithrag        ${hex_value}=  Evaluate  hex(ord("${data}"))
444015f787cSchithrag        # provides only hexadecimal bytes.
445015f787cSchithrag        # Example : 00.
446015f787cSchithrag        ${hex}=  Evaluate  hex(ord("${data}"))[2:]
447015f787cSchithrag        # With prefix 0x.
448015f787cSchithrag        Append To List  ${fw_ver_hex_list}  ${hex_value}
449015f787cSchithrag        # Without prefix.
450015f787cSchithrag        Append To List  ${hex_data_list}  ${hex}
451015f787cSchithrag    END
452015f787cSchithrag    ${fw_ver_hex}=  Evaluate  " ".join(${fw_ver_hex_list})
453015f787cSchithrag
454409df05dSGeorge Keishing    RETURN  ${fw_ver_hex}  ${hex_data_list}
455015f787cSchithrag
456015f787cSchithrag
457015f787cSchithragGet System Info Set In Progress
458015f787cSchithrag    [Documentation]  Run Get system info parameter command for set-in-progress and return response data.
459015f787cSchithrag
460015f787cSchithrag    # Get System Info Parameter for param 0 - Set In Progress.
461372cd862Sishwaryamathim    ${resp}=  Run IPMI Command
462372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param0_Set_In_Progress']['Get'][0]}
463015f787cSchithrag    ${resp}=  Split String  ${resp}
464015f787cSchithrag
465409df05dSGeorge Keishing    RETURN  ${resp}
466015f787cSchithrag
467015f787cSchithrag
468015f787cSchithragSet System Info Set In Progress
469015f787cSchithrag    [Documentation]  Set System Info Set In Progress with valid state via IPMI.
470015f787cSchithrag    [Arguments]  ${state}
471015f787cSchithrag
472015f787cSchithrag    # Set System Info Parameter for param 0 - Set In Progress.
473015f787cSchithrag    # ${state} can be can be any - 00 | 01 | 10 | 11.
474372cd862Sishwaryamathim    Run IPMI Command
475372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param0_Set_In_Progress']['Set'][0]} ${state}
476015f787cSchithrag
477015f787cSchithrag
478015f787cSchithragGet System Firmware Version
4796e641262SGeorge Keishing    [Documentation]  Run Get system info parameter command for system firmware version
4806e641262SGeorge Keishing    ...              and return response data.
481015f787cSchithrag
482015f787cSchithrag    # Get System Info Parameter for param 1 - System Firmware Version.
483372cd862Sishwaryamathim    ${resp}=  Run IPMI Command
484372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param1_System_Firmware_Version']['Get'][0]}
485015f787cSchithrag    ${resp}=  Split String  ${resp}
486015f787cSchithrag
487409df05dSGeorge Keishing    RETURN  ${resp}
488015f787cSchithrag
489015f787cSchithrag
490015f787cSchithragSet System Firmware Version
491015f787cSchithrag    [Documentation]  Set System Firmware Version for System Info with valid version.
492015f787cSchithrag    [Arguments]  ${version}
493015f787cSchithrag
494015f787cSchithrag    # Set System Info Parameter for param 1 - System Firmware Version.
495015f787cSchithrag    # ${version} can be any 14 data.
496372cd862Sishwaryamathim    Run IPMI Command
497372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param1_System_Firmware_Version']['Set'][0]} ${version}
498015f787cSchithrag
499015f787cSchithrag
500015f787cSchithragGet System Name
501015f787cSchithrag    [Documentation]  Run system info parameter command for system name and return response data.
502015f787cSchithrag
503015f787cSchithrag    # Get System Info Parameter for param 2 - System Name.
504372cd862Sishwaryamathim    ${resp}=  Run IPMI Command
505372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param2_System_Name']['Get'][0]}
506015f787cSchithrag    ${resp}=  Split String  ${resp}
507015f787cSchithrag
508409df05dSGeorge Keishing    RETURN  ${resp}
509015f787cSchithrag
510015f787cSchithrag
511015f787cSchithragSet System Name
512015f787cSchithrag    [Documentation]  Set System Name for System Info with valid name.
513015f787cSchithrag    [Arguments]  ${sys_name}
514015f787cSchithrag
515015f787cSchithrag    # Set System Info Parameter for param 2 - System Name.
516015f787cSchithrag    # ${sys_name} can be any 14 byte data.
517372cd862Sishwaryamathim    Run IPMI Command
518372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param2_System_Name']['Set'][0]} ${sys_name}
519015f787cSchithrag
520015f787cSchithrag
521015f787cSchithragGet Primary OS Name
522015f787cSchithrag    [Documentation]  Run Get System Info command for primary OS name and return response data.
523015f787cSchithrag
524015f787cSchithrag    # Get System Info Parameter for param 3 - Primary OS Name.
525372cd862Sishwaryamathim    ${resp}=  Run IPMI Command
526372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param3_Primary_Operating_System_Name']['Get'][0]}
527015f787cSchithrag    ${resp}=  Split String  ${resp}
528015f787cSchithrag
529409df05dSGeorge Keishing    RETURN  ${resp}
530015f787cSchithrag
531015f787cSchithrag
532015f787cSchithragSet Primary OS Name
533015f787cSchithrag    [Documentation]  Set Primary OS Name for System Info with valid os name.
534015f787cSchithrag    [Arguments]  ${os_name}
535015f787cSchithrag
536015f787cSchithrag    # Set System Info Parameter for param 3 - Primary OS Name.
537015f787cSchithrag    # ${os_name} can be any 14 byte data.
538372cd862Sishwaryamathim    Run IPMI Command
539372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param3_Primary_Operating_System_Name']['Set'][0]} ${os_name}
540015f787cSchithrag
541015f787cSchithrag
542015f787cSchithragGet OS Name
543015f787cSchithrag    [Documentation]  Run get System Info command for OS name and return response data.
544015f787cSchithrag
545015f787cSchithrag    # Get System Info Parameter for param 4 - OS Name.
546372cd862Sishwaryamathim    ${resp}=  Run IPMI Command
547372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param4_Operating_System_Name']['Get'][0]}
548015f787cSchithrag    ${resp}=  Split String  ${resp}
549015f787cSchithrag
550409df05dSGeorge Keishing    RETURN  ${resp}
551015f787cSchithrag
552015f787cSchithrag
553015f787cSchithragSet OS Name
554015f787cSchithrag    [Documentation]  Set OS Name for System Info with valid os name.
555015f787cSchithrag    [Arguments]  ${os_name}
556015f787cSchithrag
557015f787cSchithrag    # Set System Info Parameter for param 4 - OS Name.
558015f787cSchithrag    # ${os_name} can be any 14 byte data.
559372cd862Sishwaryamathim    Run IPMI Command
560372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param4_Operating_System_Name']['Set'][0]} ${os_name}
561015f787cSchithrag
562015f787cSchithrag
563015f787cSchithragGet Present OS Version Number
564015f787cSchithrag    [Documentation]  Run Get System Info command for present os version name and return response.
565015f787cSchithrag
566015f787cSchithrag    # Get System Info Parameter for param 5 - Present OS Version Number.
567372cd862Sishwaryamathim    ${resp}=  Run IPMI Command
568372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param5_Present_OS_Version_number']['Get'][0]}
569015f787cSchithrag    ${resp}=  Split String  ${resp}
570015f787cSchithrag
571409df05dSGeorge Keishing    RETURN  ${resp}
572015f787cSchithrag
573015f787cSchithrag
574015f787cSchithragSet Present OS Version Number
575015f787cSchithrag    [Documentation]  Set Present OS Version Number for System Info with valid os version.
576015f787cSchithrag    [Arguments]  ${os_name}
577015f787cSchithrag
578015f787cSchithrag    # Set System Info Parameter for param 5 - Present OS Version Number.
579015f787cSchithrag    # ${os_name} can be any 14 byte data
580372cd862Sishwaryamathim    Run IPMI Command
581372cd862Sishwaryamathim    ...  ${IPMI_RAW_CMD['System_Info']['param5_Present_OS_Version_number']['Set'][0]} ${os_name}
582015f787cSchithrag
583015f787cSchithrag
584015f787cSchithragAdd Prefix To List Objects And Join String
585015f787cSchithrag    [Documentation]  Adding prefix '0x' to each list object and join the string.
586015f787cSchithrag    [Arguments]  ${list}
587015f787cSchithrag
588015f787cSchithrag    # ${list} contains list of hexadecimal data.
589015f787cSchithrag
590015f787cSchithrag    # Prefix Bytes with 0x for each data bytes and makes a string of request bytes.
591015f787cSchithrag    # Prefix Bytes function under lib/ipmi_utils.py.
592015f787cSchithrag    # Prefixes every list item with 0x and returns list of prefixed hexadecimal data.
593015f787cSchithrag    ${prefix_list}=  Prefix Bytes  ${list}
594015f787cSchithrag    ${prefix_list}=  Evaluate  " ".join(${prefix_list})
595015f787cSchithrag
596409df05dSGeorge Keishing    RETURN  ${prefix_list}
597015f787cSchithrag
598015f787cSchithrag
599015f787cSchithragSuite Setup Execution
600015f787cSchithrag    [Documentation]  Suite setup execution to fetch all the default response bytes,
601015f787cSchithrag    ...  prefix each byte with 0x and make them a suite variable.
602015f787cSchithrag
603015f787cSchithrag    # Get Default Values of each parameters.
604015f787cSchithrag    # Set In Progress - param 0.
605015f787cSchithrag    ${resp}=  Get System Info Set In Progress
606015f787cSchithrag    # Configuration parameter data - 11 xx (xx can be any - 00 | 01 | 10 | 11).
607015f787cSchithrag    ${set_in_progress}=  Set Variable  ${resp[1]}
608015f787cSchithrag
609015f787cSchithrag    Set Suite Variable  ${set_in_progress}
610015f787cSchithrag
611015f787cSchithrag    # System Firmware Version - param 1.
612015f787cSchithrag    ${resp}=  Get System Firmware Version
613015f787cSchithrag    # Configuration parameter data - 11 x1 x2 xx xx xx xx .. xx (xx - 14 bytes).
614015f787cSchithrag    # x1 - encoding, x2 - string length in bytes.
615015f787cSchithrag    ${sys_fw_version}=  Set Variable  ${resp[2:]}
616015f787cSchithrag    # Prefix all bytes with 0x.
617015f787cSchithrag    ${sys_fw_version_string}=  Add Prefix To List Objects And Join String  ${sys_fw_version}
618015f787cSchithrag
619015f787cSchithrag    Set Suite Variable  ${sys_fw_version}
620015f787cSchithrag    Set Suite Variable  ${sys_fw_version_string}
621015f787cSchithrag
622015f787cSchithrag    # System Name - param 2.
623015f787cSchithrag    ${resp}=  Get System Name
624015f787cSchithrag    # Configuration parameter data - 11 x1 x2 xx xx xx xx .. xx (xx - 14 bytes).
625015f787cSchithrag    # x1 - encoding, x2 - string length in bytes.
626015f787cSchithrag    ${sys_name_default}=  Set Variable  ${resp[2:]}
627015f787cSchithrag    # Prefix all bytes with 0x.
628015f787cSchithrag    ${sys_name_hex_default}=  Add Prefix To List Objects And Join String  ${sys_name_default}
629015f787cSchithrag
630015f787cSchithrag    Set Suite Variable  ${sys_name_default}
631015f787cSchithrag    Set Suite Variable  ${sys_name_hex_default}
632015f787cSchithrag
633015f787cSchithrag    # Primary OS Name - param 3.
634015f787cSchithrag    ${resp}=  Get Primary OS Name
635015f787cSchithrag    # Configuration parameter data - 11 x1 x2 xx xx xx xx .. xx (xx - 14 bytes).
636015f787cSchithrag    # x1 - encoding, x2 - string length in bytes.
637015f787cSchithrag    ${primary_os_name}=  Set Variable  ${resp[2:]}
638015f787cSchithrag    # Prefix all bytes with 0x.
639015f787cSchithrag    ${primary_os_name_hex}=  Add Prefix To List Objects And Join String  ${primary_os_name}
640015f787cSchithrag
641015f787cSchithrag    Set Suite Variable  ${primary_os_name}
642015f787cSchithrag    Set Suite Variable  ${primary_os_name_hex}
643015f787cSchithrag
644015f787cSchithrag    # OS Name - param 4.
645015f787cSchithrag    ${resp}=  Get OS Name
646015f787cSchithrag    # Configuration parameter data - 11 x1 x2 xx xx xx xx .. xx (xx - 14 bytes).
647015f787cSchithrag    # x1 - encoding, x2 - string length in bytes.
648015f787cSchithrag    ${default_os_name}=  Set Variable  ${resp[2:]}
649015f787cSchithrag    # Prefix all bytes with 0x.
650015f787cSchithrag    ${default_os_name_hex}=  Add Prefix To List Objects And Join String  ${default_os_name}
651015f787cSchithrag
652015f787cSchithrag    Set Suite Variable  ${default_os_name}
653015f787cSchithrag    Set Suite Variable  ${default_os_name_hex}
654015f787cSchithrag
655015f787cSchithrag    # Present OS Version Number - param 5.
656015f787cSchithrag    ${resp}=  Get Present OS Version Number
657015f787cSchithrag    # Configuration parameter data - 11 x1 x2 xx xx xx xx .. xx (xx - 14 bytes).
658015f787cSchithrag    # x1 - encoding, x2 - string length in bytes.
659015f787cSchithrag    ${present_os_num}=  Set Variable  ${resp[2:]}
660015f787cSchithrag    # Prefix all bytes with 0x.
661015f787cSchithrag    ${present_os_num_hex}=  Add Prefix To List Objects And Join String  ${present_os_num}
662015f787cSchithrag
663015f787cSchithrag    Set Suite Variable  ${present_os_num}
664015f787cSchithrag    Set Suite Variable  ${present_os_num_hex}
665015f787cSchithrag
666015f787cSchithrag
667015f787cSchithragRestore Default Configuration
668015f787cSchithrag    [Documentation]  Restore all system info parameter response data to,
669015f787cSchithrag    ...  default data obtained from suite setup.
670015f787cSchithrag
671015f787cSchithrag    # All variable to set are suite variables declared in suite setup.
672015f787cSchithrag
673015f787cSchithrag    # Set In Progress - param 0.
674015f787cSchithrag    Set System Info Set In Progress  0x${set_in_progress}
675015f787cSchithrag
676015f787cSchithrag    # System Firmware Version - param 1.
677372cd862Sishwaryamathim    Run IPMI Command  0x06 0x58 0x01 0x00 ${sys_fw_version_string}
678015f787cSchithrag
679015f787cSchithrag    # System Name - param 2.
680372cd862Sishwaryamathim    Run IPMI Command  0x06 0x58 0x02 0x00 ${sys_name_hex_default}
681015f787cSchithrag
682015f787cSchithrag    # Primary OS Name - param 3.
683372cd862Sishwaryamathim    Run IPMI Command  0x06 0x58 0x03 0x00 ${primary_os_name_hex}
684015f787cSchithrag
685015f787cSchithrag    # OS Name - param 4.
686372cd862Sishwaryamathim    Run IPMI Command  0x06 0x58 0x04 0x00 ${default_os_name_hex}
687015f787cSchithrag
688015f787cSchithrag    # Present OS Version Number - param 5.
689372cd862Sishwaryamathim    Run IPMI Command  0x06 0x58 0x05 0x00 ${present_os_num_hex}
690