blob: 05e0ac668094c61e9839f159d7e7c2ec00573a4d [file] [log] [blame]
chithrag0a8c8782022-03-01 12:35:00 +00001*** Settings ***
2
3Documentation Module to test IPMI SEL Time functionality.
George Keishing6e641262022-05-05 10:46:22 -05004... Pre-requisite Condition : Client Machine and BMC should be in
5... Same TimeZone (example : UST)
chithrag0a8c8782022-03-01 12:35:00 +00006...
George Keishing6e641262022-05-05 10:46:22 -05007... IPMI Raw command variables are defined under
8... ../data/ipmi_raw_command_table.py
chithrag0a8c8782022-03-01 12:35:00 +00009...
George Keishing6e641262022-05-05 10:46:22 -050010... Test the Set/Get SEL Time functionality and compare the result against
11... BMC Native command (date).
chithrag0a8c8782022-03-01 12:35:00 +000012...
13... Set the Time Sync Mode from NTP to Manual to Set SEL Time.
14... Time Sync Mode change performed via REDFISH URI.
George Keishing6e641262022-05-05 10:46:22 -050015... Performs the change in Time Sync Mode with Test Setup and Teardown Execution
16... with default NETWORK_TIMEOUT provided under ../lib/resource.robot.
chithrag0a8c8782022-03-01 12:35:00 +000017...
George Keishing6e641262022-05-05 10:46:22 -050018... NETWORK_RESTART_TIME added for Set SEL Time and Add SEL Entry as the corresponding
19... command takes approx 5 seconds for the operation to reflect.
chithrag0a8c8782022-03-01 12:35:00 +000020...
21... Current SEL time identified via BMC Native command (date) and perform SEL Time operations.
22...
23... Script Verifies SEL Time for various scenarios such as,
24... Get current time from BMC and add future year and compare against BMC native command (date),
25... Gets BMC Current Time and Adds 15 minutes and compare against BMC native command (date),
26... Gets BMC Current Time and subtracts 1 day and compare against BMC native command (date),
27... Add SEL Entry for all the above scenarios and compare against BMC native command (date).
28
ganesanbd0c4b802023-04-28 18:29:38 +000029Resource ../lib/ipmi_client.robot
30Resource ../lib/openbmc_ffdc.robot
chithrag0a8c8782022-03-01 12:35:00 +000031Library DateTime
32Library Collections
33Library String
34Library ../lib/ipmi_utils.py
chithrag0a8c8782022-03-01 12:35:00 +000035Variables ../data/ipmi_raw_cmd_table.py
36
37Test Setup Test Setup Execution
38Test Teardown Test Teardown Execution
39
Matt Fischer6fb70d92023-10-24 19:06:33 -060040Test Tags IPMI_SEL_Time
George Keishing87dc4422023-10-20 12:56:30 +053041
chithrag0a8c8782022-03-01 12:35:00 +000042*** Variables ***
43
44${NETWORK_RESTART_TIME} 5s
ganesanb11fe27f2022-08-24 10:00:17 +000045@{time_difference_list} +8760:153:25 -87600:453:120 +175200:40:15 -43800:10:05 +20:35:12 -8760:00:00
chithrag0a8c8782022-03-01 12:35:00 +000046
George Keishinga91601b2023-03-21 09:35:49 +053047# Based on 13th byte of add SEL entry command as per IPMI spec
ganesanb11fe27f2022-08-24 10:00:17 +000048# event_dir and event_type variable value needs to be given.
49${sel_no_entry_msg} SEL has no entries
50${event_type} Lower Non-critical going low
51${event_dir} Asserted
52# number_of_times_sel_entry_added this variable is used in Verify Multiple Set SEL Time With Multiple Add SEL Entry
53# test case. Need to give how many sel should be added with multiple date and time.
54${number_of_times_sel_entry_added} 6
chithrag0a8c8782022-03-01 12:35:00 +000055
56*** Test Cases ***
57
58Verify Default Get SEL Time
59 [Documentation] Verify IPMI Get SEL Time.
60 [Tags] Verify_Default_Get_SEL_Time
chithrag0a8c8782022-03-01 12:35:00 +000061
62 # Gets the current SEL time via Get SEL Time Command.
63 ${resp}= Get SEL Time Command
64 Should Not Be Empty ${resp}
65
66
George Keishing70deec02022-05-04 14:23:22 -050067Verify Set SEL Time On NTP Mode
chithrag0a8c8782022-03-01 12:35:00 +000068 [Documentation] IPMI Set SEL Time without NTP
George Keishing70deec02022-05-04 14:23:22 -050069 [Tags] Verify_Set_SEL_Time_On_NTP_Mode
chithrag0a8c8782022-03-01 12:35:00 +000070
71 # Get current time from BMC and add future year (here, 5years).
72 ${sel_date}= Get Specific Sel Date 5
73
74 # Gives Hexa decimal raw command data request with the prefix of 0x.
75 ${sel_date_raw}= Converting Date to HexaDecimal ${sel_date}
76
77 ${Set_sel_time}= Run Keyword and Expect Error *${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][2]}*
78 ... Run IPMI Command ${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][0]} ${sel_date_raw}
79 Should Contain ${Set_sel_time} ${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][1]}
80
81
82Verify SEL Set Time For Specific Time
83 [Documentation] Verify IPMI Set SEL Time.
84 [Tags] Verify_SEL_Set_Time_For_Specific_Time
85
86 # Get current time from BMC and add future year (here, 5years).
87 ${sel_date}= Get Specific Sel Date 5
88
89 # Gives Hexa decimal raw command data request with the prefix of 0x.
90 ${sel_date_raw}= Converting Date to HexaDecimal ${sel_date}
91
92 # Set SEL Entry command.
93 Set SEL Time Entry Via Raw Command ${sel_date_raw}
94
95 # Get SEL Time command.
96 ${get_sel_time}= Check Current Date Time Via IPMI
97
98 # Identify Time difference and find the difference is less than 6 seconds.
99 # Command execution may happen at the end of millisecond so considered 6 seconds as difference.
100 ${time_difference}= Get Time Difference ${get_sel_time} ${sel_date}
101 Should Be True 0<=${time_difference}<=5
102 ... msg=Set SEL Time Not Working
103
104 # Get BMC time (native) and compare with set sel time given.
105 ${bmc_time}= Get Current Date from BMC
106
107 ${difference}= Get Time Difference ${bmc_time} ${sel_date}
108 Should Be True 0<=${difference}<=6
109
110
111Verify Set SEL Time With Future Date And Time
112 [Documentation] Verify IPMI Get SEL Time by adding 15 minutes from current time.
113 [Tags] Verify_Set_SEL_Time_With_Future_Date_And_Time
114
115 # Gets BMC Current Time and Adds 15 minutes and sets the SEL Time.
ganesanb11fe27f2022-08-24 10:00:17 +0000116 ${sel_time} ${set_sel_time}= Identify SEL Time +06:15:00
chithrag0a8c8782022-03-01 12:35:00 +0000117
118 # Set SEL Time via IPMI command.
119 Set SEL Time Via IPMI ${sel_time}
120
121 # Get SEL Time Command.
122 ${get_sel_time}= Check Current Date Time Via IPMI
123
124 # Difference of time between set sel time and get time.
125 ${difference}= Get Time Difference ${get_sel_time} ${set_sel_time}
126 Should Be True 0<=${difference}<=2
127
128 # Difference of time between BMC Date and Get SEL Time.
129 ${bmc_time}= Get Current Date from BMC
Sridevi Ramesh52b71f82025-03-21 04:18:26 -0500130 ${difference}= Get Time Difference ${bmc_time} ${get_sel_time}
chithrag0a8c8782022-03-01 12:35:00 +0000131 Should Be True 0<=${difference}<=2
132
133
134Verify Set SEL Time With Past Date And Time
135 [Documentation] Verify IPMI Get SEL Time for yime delay of 1 day from current dat and time.
136 [Tags] Verify_Set_SEL_Time_With_Past_Date_And_Time
137
138 # Gets BMC current time and subtracts 1 day and sets the SEL Time.
ganesanb11fe27f2022-08-24 10:00:17 +0000139 ${sel_time} ${set_sel_time}= Identify SEL Time -24:00:00
chithrag0a8c8782022-03-01 12:35:00 +0000140
141 ${status}= Run Keyword And Return Status Should Not Contain ${sel_time} 1969
142 ... msg=Date cannot be less than 1970.
143
144 IF '${status}' == '${TRUE}'
145 # Set SEL Time via IPMI command.
146 Set SEL Time Via IPMI ${sel_time}
147 # Get SEL Time Command.
148 ${get_sel_time}= Check Current Date Time Via IPMI
149 # Difference of time between set sel time and get time.
150 ${difference}= Get Time Difference ${get_sel_time} ${set_sel_time}
151 Should Be True 0<=${difference}<=2
152 # Difference of time between BMC Date and Get SEL Time.
153 ${bmc_time}= Get Current Date from BMC
Sridevi Ramesh52b71f82025-03-21 04:18:26 -0500154 ${difference}= Get Time Difference ${bmc_time} ${get_sel_time}
chithrag0a8c8782022-03-01 12:35:00 +0000155 Should Be True 0<=${difference}<=2
156 ELSE
157 FAIL SEL Time cannot set Date less than 1970
158 END
159
160
161Verify SEL Set Time For Invalid Data Request
162 [Documentation] Verify IPMI Get SEL Time for invalid data request
163 [Tags] Verify_SEL_Set_Time_For_Invalid_Data_Request
chithrag0a8c8782022-03-01 12:35:00 +0000164
165 # Gets BMC current date via date command.
166 ${current_date}= Get Current Date from BMC
167
168 # Gives hexa decimal Raw command data request with the prefix of 0x.
169 ${sel_date_raw}= Converting Date to HexaDecimal ${current_date}
170
171 # Set Invalid SEL Time with one extra request byte.
172 ${Set_seltime_invalid}= Run Keyword and Expect Error *${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][4]}*
173 ... Run IPMI Command ${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][0]} ${sel_date_raw} 0x00
174 Should Contain ${Set_seltime_invalid} ${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][3]}
175
176
177Verify SEL Set Time For Incomplete Data Request
178 [Documentation] Verify IPMI Get SEL Time for invalid data with one byte less request data.
179 [Tags] Verify_SEL_Set_Time_For_Incomplete_Data_Request
chithrag0a8c8782022-03-01 12:35:00 +0000180
181 # Gets BMC current date via date command.
182 ${current_date}= Get Current Date from BMC
183
184 # Gives hexa decimal raw command data request with the prefix of 0x.
185 ${sel_date_raw}= Converting Date to HexaDecimal ${current_date}
186
187 # For data request less than expected byes, remove last byte.
188 ${sel_date_raw}= Split String ${sel_date_raw}
189 Remove From List ${sel_date_raw} -1
190 ${sel_date_raw}= Evaluate " ".join(${sel_date_raw})
191
192 # Set incomplete SEL Time with one less request byte.
George Keishing6e641262022-05-05 10:46:22 -0500193 ${Set_seltime_incomplete}=
194 ... Run Keyword and Expect Error *${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][4]}*
chithrag0a8c8782022-03-01 12:35:00 +0000195 ... Run IPMI Command ${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][0]} ${sel_date_raw}
196 Should Contain ${Set_seltime_incomplete} ${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][3]}
197
198
199Verify SEL Time In SEL Entry
200 [Documentation] Verify Configured SEL Time reflects in newly added SEL Entry.
201 [Tags] Verify_SEL_Time_In_SEL_Entry
202
203 Clear The SEL
204
205 # change to manual, get current time and add future year (here, 5years).
206 ${sel_date}= Get Specific Sel Date 5
207
208 # Gives hexa decimal raw command data request with the prefix of 0x.
209 ${sel_date_raw}= Converting Date to HexaDecimal ${sel_date}
210
211 # Set SEL Entry Command.
212 Set SEL Time Entry Via Raw Command ${sel_date_raw}
213
214 # Get SEL Time Command.
215 ${get_sel_time}= Check Current Date Time Via IPMI
216
217 # Identify Time difference and find the difference is less than 6 seconds.
218 # Command execution may happen at the end of millisecond so considered 6 seconds as difference.
219 ${time_difference}= Get Time Difference ${get_sel_time} ${sel_date}
220 Should Be True 0<=${time_difference}<=5
221 ... msg=Set SEL Time Not Working
222
223 # Get BMC time (native) and compare with set sel time given.
224 ${bmc_time}= Get Current Date from BMC
225
226 ${difference}= Get Time Difference ${bmc_time} ${sel_date}
227 Should Be True 0<=${difference}<=6
228
229 # Get any Sensor available from Sensor list.
ganesanb02d19662022-05-24 15:24:23 +0530230 ${sensor_name}= Fetch One Threshold Sensor From Sensor List
chithrag0a8c8782022-03-01 12:35:00 +0000231
232 # Get Sensor ID from SDR Get "sensor".
233 ${sensor_data1}= Fetch Sensor Details From SDR ${sensor_name} Sensor ID
ganesanb11fe27f2022-08-24 10:00:17 +0000234 ${sensor_number}= Get Bytes From SDR Sensor ${sensor_data1}
chithrag0a8c8782022-03-01 12:35:00 +0000235
236 # Get Sensor Type from SDR Get "sensor".
237 ${sensor_data2}= Fetch Sensor Details From SDR ${sensor_name} Sensor Type (Threshold)
ganesanb11fe27f2022-08-24 10:00:17 +0000238 ${sensor_type_id}= Get Bytes From SDR Sensor ${sensor_data2}
chithrag0a8c8782022-03-01 12:35:00 +0000239
240 # Add SEL Entry.
241 ${sel_create_resp}= Create SEL ${sensor_type_id} ${sensor_number}
242
243 # Finds the last added sel entry.
ganesanb11fe27f2022-08-24 10:00:17 +0000244 ${resp}= Verify SEL Added ${sensor_name}
chithrag0a8c8782022-03-01 12:35:00 +0000245
246 # Fetches the date of the last added SEL Entry.
247 ${sel_entry_date}= Fetch Added SEL Date ${resp}
248
249 # Identify and find the time difference is less than 60 seconds.
250 # Finding the sensor details and execution may take up to a minute.
251 # Compare date and time of Set SEL with sel entry.
252 ${d}= Get Time Difference ${sel_entry_date} ${sel_date}
253 Should Be True 0<=${d}<=60
254
255
256Verify SEL Time In SEL Entry For Future Date and Time
257 [Documentation] Verify configured SEL Time (Future Date & Time) in added SEL Entry.
258 [Tags] Verify_SEL_Time_In_SEL_Entry_For_Future_Date_and_Time
259
260 Clear The SEL
261
262 # Gets BMC Current Time and Adds 15 minutes and sets the SEL Time.
ganesanb11fe27f2022-08-24 10:00:17 +0000263 ${sel_time} ${set_sel_time}= Identify SEL Time +06:15:00
chithrag0a8c8782022-03-01 12:35:00 +0000264
265 # Set SEL Time via IPMI command.
266 Set SEL Time Via IPMI ${sel_time}
267
268 # Get SEL Time Command.
269 ${get_sel_time}= Check Current Date Time Via IPMI
270
271 # Difference of time between set sel time and get time.
272 ${difference}= Get Time Difference ${get_sel_time} ${set_sel_time}
273 Should Be True 0<=${difference}<=2
274
275 # Difference of time between BMC Date and Get SEL Time.
276 ${bmc_time}= Get Current Date from BMC
Sridevi Ramesh52b71f82025-03-21 04:18:26 -0500277 ${difference}= Get Time Difference ${bmc_time} ${get_sel_time}
chithrag0a8c8782022-03-01 12:35:00 +0000278 Should Be True 0<=${difference}<=2
279
280 # Get any Sensor available from Sensor list.
ganesanb02d19662022-05-24 15:24:23 +0530281 ${sensor_name}= Fetch One Threshold Sensor From Sensor List
chithrag0a8c8782022-03-01 12:35:00 +0000282
283 # Get Sensor ID from SDR Get "sensor".
284 ${sensor_data1}= Fetch Sensor Details From SDR ${sensor_name} Sensor ID
ganesanb11fe27f2022-08-24 10:00:17 +0000285 ${sensor_number}= Get Bytes From SDR Sensor ${sensor_data1}
chithrag0a8c8782022-03-01 12:35:00 +0000286
287 # Get Sensor Type from SDR Get "sensor".
288 ${sensor_data2}= Fetch Sensor Details From SDR ${sensor_name} Sensor Type (Threshold)
ganesanb11fe27f2022-08-24 10:00:17 +0000289 ${sensor_type_id}= Get Bytes From SDR Sensor ${sensor_data2}
chithrag0a8c8782022-03-01 12:35:00 +0000290
291 # Add SEL Entry.
292 ${sel_create_resp}= Create SEL ${sensor_type_id} ${sensor_number}
293
294 # Finds the last added sel entry.
ganesanb11fe27f2022-08-24 10:00:17 +0000295 ${resp}= Verify SEL Added ${sensor_name}
chithrag0a8c8782022-03-01 12:35:00 +0000296
297 # Fetches the date of the last added SEL Entry.
298 ${sel_entry_date}= Fetch Added SEL Date ${resp}
299
300 # Identify and find the time difference is less than 60 seconds.
301 # Finding the sensor details and execution may take up to a minute.
302 # Compare date and time of Set SEL with sel entry.
303 ${d}= Get Time Difference ${sel_entry_date} ${set_sel_time}
304 Should Be True 0<=${d}<=60
305
306
307Verify SEL Time In SEL Entry For Past Date And Time
308 [Documentation] Verify configured SEL Time (Past Date & Time) in added SEL Entry.
George Keishing70deec02022-05-04 14:23:22 -0500309 [Tags] Verify_SEL_Time_In_SEL_Entry_For_Past_Date_And_Time
chithrag0a8c8782022-03-01 12:35:00 +0000310
311 Clear The SEL
312
313 # Gets BMC Current Time and subtracts 1 day and sets the SEL Time.
ganesanb11fe27f2022-08-24 10:00:17 +0000314 ${sel_time} ${set_sel_time}= Identify SEL Time -24:00:00
chithrag0a8c8782022-03-01 12:35:00 +0000315
316 ${status}= Run Keyword And Return Status Should Not Contain ${sel_time} 1969
317 ... msg=Date cannot be less than 1970
318
319 IF '${status}' == '${TRUE}'
320 # Set SEL Time via IPMI command.
321 Set SEL Time Via IPMI ${sel_time}
322 # Get SEL Time Command.
323 ${get_sel_time}= Check Current Date Time Via IPMI
324 # Difference of time between set sel time and get time.
325 ${difference}= Get Time Difference ${get_sel_time} ${set_sel_time}
326 Should Be True 0<=${difference}<=2
327 # Difference of time between BMC Date and Get SEL Time.
328 ${bmc_time}= Get Current Date from BMC
Sridevi Ramesh52b71f82025-03-21 04:18:26 -0500329 ${difference}= Get Time Difference ${bmc_time} ${get_sel_time}
chithrag0a8c8782022-03-01 12:35:00 +0000330 Should Be True 0<=${difference}<=2
331
332 # Get any Sensor available from Sensor list.
ganesanb02d19662022-05-24 15:24:23 +0530333 ${sensor_name}= Fetch One Threshold Sensor From Sensor List
chithrag0a8c8782022-03-01 12:35:00 +0000334 # Get Sensor ID from SDR Get "sensor".
335 ${sensor_data1}= Fetch Sensor Details From SDR ${sensor_name} Sensor ID
ganesanb11fe27f2022-08-24 10:00:17 +0000336 ${sensor_number}= Get Bytes From SDR Sensor ${sensor_data1}
chithrag0a8c8782022-03-01 12:35:00 +0000337
338 # Get Sensor Type from SDR Get "sensor".
339 ${sensor_data2}= Fetch Sensor Details From SDR ${sensor_name} Sensor Type (Threshold)
ganesanb11fe27f2022-08-24 10:00:17 +0000340 ${sensor_type_id}= Get Bytes From SDR Sensor ${sensor_data2}
chithrag0a8c8782022-03-01 12:35:00 +0000341
342 # Add SEL Entry.
343 ${sel_create_resp}= Create SEL ${sensor_type_id} ${sensor_number}
344
345 # Finds the last added sel entry.
ganesanb11fe27f2022-08-24 10:00:17 +0000346 ${resp}= Verify SEL Added ${sensor_name}
chithrag0a8c8782022-03-01 12:35:00 +0000347
348 # Fetches the date of the last added SEL Entry.
349 ${sel_entry_date}= Fetch Added SEL Date ${resp}
350
351 # Identify and find the time difference is less than 60 seconds.
352 # Finding the sensor details and execution may take up to a minute.
353 # Compare date and time of Set SEL with sel entry.
354 ${d}= Get Time Difference ${sel_entry_date} ${set_sel_time}
355 Should Be True 0<=${d}<=60
356 ELSE
357 FAIL SEL Time cannot set Date less than 1970.
358 END
359
360
361Verify Multiple Set SEL Time With Multiple Add SEL Entry
362 [Documentation] Verify SEL time in multiple addition Of SEL entry.
363 [Tags] Verify_Multiple_Set_SEL_Time_With_Multiple_Add_SEL_Entry
364
ganesanb11fe27f2022-08-24 10:00:17 +0000365 FOR ${i} IN RANGE ${number_of_times_sel_entry_added}
chithrag0a8c8782022-03-01 12:35:00 +0000366
ganesanb11fe27f2022-08-24 10:00:17 +0000367 ${sel_time} ${set_sel_time}= Identify SEL Time ${time_difference_list[${i}]}
chithrag0a8c8782022-03-01 12:35:00 +0000368
369 # Set SEL Time via IPMI command.
370 Set SEL Time Via IPMI ${sel_time}
371
372 # Clear the SEL.
373 Clear The SEL
374
375 # Get any Sensor available from Sensor list.
ganesanb02d19662022-05-24 15:24:23 +0530376 ${sensor_name}= Fetch One Threshold Sensor From Sensor List
chithrag0a8c8782022-03-01 12:35:00 +0000377
378 # Get Sensor ID from SDR Get "sensor" and Identify Sensor ID.
379 ${sensor_data1}= Fetch Sensor Details From SDR ${sensor_name} Sensor ID
ganesanb11fe27f2022-08-24 10:00:17 +0000380 ${sensor_number}= Get Bytes From SDR Sensor ${sensor_data1}
chithrag0a8c8782022-03-01 12:35:00 +0000381
382 # Get Sensor Type from SDR Get "sensor" and identify Sensor Type.
383 ${sensor_data2}= Fetch Sensor Details From SDR ${sensor_name} Sensor Type (Threshold)
ganesanb11fe27f2022-08-24 10:00:17 +0000384 ${sensor_type_id}= Get Bytes From SDR Sensor ${sensor_data2}
chithrag0a8c8782022-03-01 12:35:00 +0000385
386 # Add SEL Entry.
387 ${sel_create_resp}= Create SEL ${sensor_type_id} ${sensor_number}
388
389 # Finds the last added sel entry.
ganesanb11fe27f2022-08-24 10:00:17 +0000390 ${resp}= Verify SEL Added ${sensor_name}
chithrag0a8c8782022-03-01 12:35:00 +0000391
392 # Fetches the date of the last added SEL Entry.
393 ${sel_entry_date}= Fetch Added SEL Date ${resp}
394
395 # Identify and find the time difference is less than 60 seconds.
396 # Finding the sensor details and execution may take up to a minute.
397 # Compare date and time of Set SEL with sel entry.
398 ${d}= Get Time Difference ${sel_entry_date} ${set_sel_time}
399 Should Be True ${d}<=60
400
401 END
402
403
404*** Keywords ***
405
406Time Sync Mode Change Through Redfish
407 [Documentation] Export IP, token and change the time sync to manual.
408 [Arguments] ${value}
409
410 # Description of argument(s):
George Keishing6d15bf12022-05-06 11:50:44 -0500411 # ${value} Can be either ${FALSE} or ${TRUE}.
chithrag0a8c8782022-03-01 12:35:00 +0000412
413 # May be changed to WebView.
414
415 # Changing Time Sync Mode to Manual.
416 Change Time Sync Mode Via Redfish ${value}
417
418
419Change Time Sync Mode Via Redfish
420 [Documentation] To change the time sync mode via Redfish.
421 [Arguments] ${value}
422
423 # Description of argument(s):
George Keishing6d15bf12022-05-06 11:50:44 -0500424 # ${value} Can be either ${FALSE} or ${TRUE}
chithrag0a8c8782022-03-01 12:35:00 +0000425
426 # Creates request body for Redfish url.
427 ${mode}= Create Dictionary ProtocolEnabled=${value}
428 ${data}= Create Dictionary NTP=${mode}
429
430 # Patches the obtained body to the given url.
431 Redfish.patch ${REDFISH_NW_PROTOCOL_URI} body=&{data}
432 ... valid_status_codes=[${HTTP_NO_CONTENT}]
433
434 Sleep ${NETWORK_RESTART_TIME}
435
436
437Get SEL Time Command
438 [Documentation] Get SEL Time command.
439
440 # The response will be 8 byte timestamp in hexadecimal.
441 # example: If current date and time is "Wed May 4 18:55:00 UTC 2022",
442 # then, ${get_sel_time} will be "07 cc 72 62".
443 ${get_sel_time}= Run IPMI Command
444 ... ${IPMI_RAW_CMD['SEL_entry']['Get_SEL_Time'][0]}
445
George Keishing409df052024-01-17 22:36:14 +0530446 RETURN ${get_sel_time}
chithrag0a8c8782022-03-01 12:35:00 +0000447
448
449Set SEL Time Entry Via Raw Command
450 [Documentation] Set SEL Time command.
451 [Arguments] ${sel_date_raw}
452
453 # Description of argument(s):
George Keishing6d15bf12022-05-06 11:50:44 -0500454 # ${sel_date_raw} Time to set in hexadecimal bytes.
455 # Example:
456 # If date is 1st January 2022 12:30:00 PM,
457 # the hexadecimal timestamp is, 61D04948.
chithrag0a8c8782022-03-01 12:35:00 +0000458 # then the request bytes are,
459 # ${sel_date_raw} 0x48 0x49 0xd0 0x61
460
461 Run IPMI Command ${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][0]} ${sel_date_raw}
462 Sleep ${NETWORK_RESTART_TIME}
463
464
465Clear The SEL
466 [Documentation] Clear SEL Command.
467
468 # Clear the SEL.
469 ${out}= Run IPMI Standard Command sel clear
470 Should Contain ${out} Clearing SEL
471 Sleep 2s
472
473
ganesanb11fe27f2022-08-24 10:00:17 +0000474Verify SEL Added
475 [Documentation] Verify Added SEL.
476 [Arguments] ${sensor_name}
chithrag0a8c8782022-03-01 12:35:00 +0000477
478 # Description of argument(s):
ganesanb11fe27f2022-08-24 10:00:17 +0000479 # sensor_name Name of the sensor.
chithrag0a8c8782022-03-01 12:35:00 +0000480
ganesanb11fe27f2022-08-24 10:00:17 +0000481 ${resp}= Run IPMI Standard Command sel elist
482 Should Not Contain ${resp} ${sel_no_entry_msg}
483 ${get_sel_entry}= Get Lines Containing String ${resp} ${sensor_name}
484 ${sel_entry}= Get Lines Containing String ${get_sel_entry} ${event_type}
485 Should Contain ${sel_entry} ${event_dir} msg=Add SEL Entry failed.
chithrag0a8c8782022-03-01 12:35:00 +0000486
George Keishing409df052024-01-17 22:36:14 +0530487 RETURN ${sel_entry}
chithrag0a8c8782022-03-01 12:35:00 +0000488
489
490Check Current Date Time Via IPMI
491 [Documentation] Verify Current Date and Time Via IPMI user command.
492
493 ${resp}= Run IPMI Standard Command sel time get
George Keishing409df052024-01-17 22:36:14 +0530494 RETURN ${resp}
chithrag0a8c8782022-03-01 12:35:00 +0000495
496
497Get Specific Sel Date
498 [Documentation] Gets initial time and adds year to the current date and returns future date.
499 [Arguments] ${year}
500
501 # Description of argument(s):
George Keishing6d15bf12022-05-06 11:50:44 -0500502 # ${year} Can be any number of years (say 5 year).
chithrag0a8c8782022-03-01 12:35:00 +0000503
504 ${current_date}= Get Current Date from BMC
505
506 # Converting given years to days by multiplying with 365days and adding the days to current date.
507 ${days}= Evaluate 365*${year}+1
George Keishing6d15bf12022-05-06 11:50:44 -0500508 ${date}= Add Time To Date
509 ... ${current_date} ${days}d result_format=%m/%d/%Y %H:%M:%S date_format=%m/%d/%Y %H:%M:%S
chithrag0a8c8782022-03-01 12:35:00 +0000510
George Keishing409df052024-01-17 22:36:14 +0530511 RETURN ${date}
chithrag0a8c8782022-03-01 12:35:00 +0000512
513
514Converting Date to HexaDecimal
515 [Documentation] Converting the date into hexa decimal values.
516 [Arguments] ${date}
517
518 # Description of argument(s):
George Keishing6d15bf12022-05-06 11:50:44 -0500519 # ${date} Can be any date in format %m/%d/%Y %H:%M:%S.
chithrag0a8c8782022-03-01 12:35:00 +0000520
521 ${epoch_date}= Convert Date ${date} epoch exclude_millis=yes date_format=%m/%d/%Y %H:%M:%S
522 ${date}= Convert To Hex ${epoch_date} lowercase=yes
523
524 # function calls from utils.py.
525 # Length of the date byte should be 8 so that each bytes are separated.
526 ${date}= Zfill Data ${date} 8
527 # To split every two characters to form one byte each.
528 ${date}= Split String With Index ${date} 2
529 # Prefix every list index value with 0x.
530 ${date}= Prefix Bytes ${date}
531
532 # Reverse the bytes and join the list to form request Time stamp data.
533 Reverse List ${date}
534 ${date}= Evaluate " ".join(${date})
535
George Keishing409df052024-01-17 22:36:14 +0530536 RETURN ${date}
chithrag0a8c8782022-03-01 12:35:00 +0000537
538
539Get Time Difference
540 [Documentation] Converting the date into hexa decimal values.
541 [Arguments] ${date1} ${date2}
542
543 # Description of argument(s):
George Keishing6d15bf12022-05-06 11:50:44 -0500544 # ${date1} Can be any date in format %m/%d/%Y %H:%M:%S.
545 # ${date2} Can be any date in format %m/%d/%Y %H:%M:%S.
chithrag0a8c8782022-03-01 12:35:00 +0000546
547 ${epoch_date1}= Convert Date ${date1} epoch exclude_millis=yes date_format=%m/%d/%Y %H:%M:%S
548 ${epoch_date2}= Convert Date ${date2} epoch exclude_millis=yes date_format=%m/%d/%Y %H:%M:%S
549
550 ${diff}= Evaluate int(${epoch_date1}) - int(${epoch_date2})
551
George Keishing409df052024-01-17 22:36:14 +0530552 RETURN ${diff}
chithrag0a8c8782022-03-01 12:35:00 +0000553
554
ganesanb11fe27f2022-08-24 10:00:17 +0000555Identify SEL Time
556 [Documentation] Modify SEL Time From BMC For Set Sel Time Command.
chithrag0a8c8782022-03-01 12:35:00 +0000557 [Arguments] ${time}
558
559 # Description of argument(s):
ganesanb11fe27f2022-08-24 10:00:17 +0000560 # time Can be any number of hours or minutes in format %H:%M:%S.
chithrag0a8c8782022-03-01 12:35:00 +0000561
562 # Gets BMC current date via date command.
563 ${current_date}= Get Current Date from BMC
564
ganesanb11fe27f2022-08-24 10:00:17 +0000565 ${modifying_date_status}= Run Keyword And Return Status Should Contain ${time} +
566
567 ${date_time}= Set Variable IF
568 ... ${modifying_date_status} == True ${time.split("+")[-1]}
569 ... ${modifying_date_status} == False ${time.split("-")[-1]}
570
571 ${datetime} = Run Keyword IF ${modifying_date_status} == True
572 ... Add Time To Date
573 ... ${current_date} ${date_time} result_format=%m/%d/%Y %H:%M:%S date_format=%m/%d/%Y %H:%M:%S
574 ... ELSE IF ${modifying_date_status} == False
575 ... Subtract Time From Date
576 ... ${current_date} ${date_time} result_format=%m/%d/%Y %H:%M:%S date_format=%m/%d/%Y %H:%M:%S
chithrag0a8c8782022-03-01 12:35:00 +0000577
578 #Set SEL Time.
579 ${quoted_date}= Fetch Date ${datetime}
580
George Keishing409df052024-01-17 22:36:14 +0530581 RETURN ${quoted_date} ${datetime}
chithrag0a8c8782022-03-01 12:35:00 +0000582
583
chithrag0a8c8782022-03-01 12:35:00 +0000584Set SEL Time Via IPMI
585 [Documentation] Set SEL Time for given date using IPMI.
586 [Arguments] ${date_time}
587
588 # Description of argument(s):
George Keishing6d15bf12022-05-06 11:50:44 -0500589 # ${date_time} Can be any date in format %m/%d/%Y %H:%M:%S.
chithrag0a8c8782022-03-01 12:35:00 +0000590
591 ${resp}= Run IPMI Standard Command sel time set "${date_time}"
592 Should Not Contain ${resp} Unspecified error
593
594
595Test Setup Execution
596 [Documentation] Test Setup Execution.
597
598 Redfish.Login
599 # Change timesync mode to manual with timeout as per resource.robot.
600 Time Sync Mode Change Through Redfish ${FALSE}
601 Sleep ${NETWORK_TIMEOUT}
Sridevi Ramesh52b71f82025-03-21 04:18:26 -0500602 Printn
chithrag0a8c8782022-03-01 12:35:00 +0000603
604
605Test Teardown Execution
606 [Documentation] For execution of Test teardown.
607
608 Clear The SEL
609
610 # Change TimeSync mode to NTP with Timeout as per default resource.robot.
611 Time Sync Mode Change Through Redfish ${TRUE}
612 Sleep ${NETWORK_TIMEOUT}
613 Redfish.Logout
614 FFDC On Test Case Fail