blob: 028659a5dfd63b84115bfce7173a8699030d5f7b [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
9... Python basic functionalities are defined under
10... ../lib/functions.py imported under ../lib/resource.robot
chithrag0a8c8782022-03-01 12:35:00 +000011...
George Keishing6e641262022-05-05 10:46:22 -050012... Test the Set/Get SEL Time functionality and compare the result against
13... BMC Native command (date).
chithrag0a8c8782022-03-01 12:35:00 +000014...
15... Set the Time Sync Mode from NTP to Manual to Set SEL Time.
16... Time Sync Mode change performed via REDFISH URI.
George Keishing6e641262022-05-05 10:46:22 -050017... Performs the change in Time Sync Mode with Test Setup and Teardown Execution
18... with default NETWORK_TIMEOUT provided under ../lib/resource.robot.
chithrag0a8c8782022-03-01 12:35:00 +000019...
George Keishing6e641262022-05-05 10:46:22 -050020... NETWORK_RESTART_TIME added for Set SEL Time and Add SEL Entry as the corresponding
21... command takes approx 5 seconds for the operation to reflect.
chithrag0a8c8782022-03-01 12:35:00 +000022...
23... Current SEL time identified via BMC Native command (date) and perform SEL Time operations.
24...
25... Script Verifies SEL Time for various scenarios such as,
26... Get current time from BMC and add future year and compare against BMC native command (date),
27... Gets BMC Current Time and Adds 15 minutes and compare against BMC native command (date),
28... Gets BMC Current Time and subtracts 1 day and compare against BMC native command (date),
29... Add SEL Entry for all the above scenarios and compare against BMC native command (date).
30
31Library DateTime
32Library Collections
33Library String
34Library ../lib/ipmi_utils.py
35Resource ../lib/ipmi_client.robot
36Resource ../lib/openbmc_ffdc.robot
37Variables ../data/ipmi_raw_cmd_table.py
38
39Test Setup Test Setup Execution
40Test Teardown Test Teardown Execution
41
42*** Variables ***
43
44${NETWORK_RESTART_TIME} 5s
45
46
47*** Test Cases ***
48
49Verify Default Get SEL Time
50 [Documentation] Verify IPMI Get SEL Time.
51 [Tags] Verify_Default_Get_SEL_Time
52 [Setup] Printn
53 [Teardown] FFDC On Test Case Fail
54
55 # Gets the current SEL time via Get SEL Time Command.
56 ${resp}= Get SEL Time Command
57 Should Not Be Empty ${resp}
58
59
George Keishing70deec02022-05-04 14:23:22 -050060Verify Set SEL Time On NTP Mode
chithrag0a8c8782022-03-01 12:35:00 +000061 [Documentation] IPMI Set SEL Time without NTP
George Keishing70deec02022-05-04 14:23:22 -050062 [Tags] Verify_Set_SEL_Time_On_NTP_Mode
chithrag0a8c8782022-03-01 12:35:00 +000063 [Setup] Printn
64 [Teardown] printn
65
66 # Get current time from BMC and add future year (here, 5years).
67 ${sel_date}= Get Specific Sel Date 5
68
69 # Gives Hexa decimal raw command data request with the prefix of 0x.
70 ${sel_date_raw}= Converting Date to HexaDecimal ${sel_date}
71
72 ${Set_sel_time}= Run Keyword and Expect Error *${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][2]}*
73 ... Run IPMI Command ${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][0]} ${sel_date_raw}
74 Should Contain ${Set_sel_time} ${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][1]}
75
76
77Verify SEL Set Time For Specific Time
78 [Documentation] Verify IPMI Set SEL Time.
79 [Tags] Verify_SEL_Set_Time_For_Specific_Time
80
81 # Get current time from BMC and add future year (here, 5years).
82 ${sel_date}= Get Specific Sel Date 5
83
84 # Gives Hexa decimal raw command data request with the prefix of 0x.
85 ${sel_date_raw}= Converting Date to HexaDecimal ${sel_date}
86
87 # Set SEL Entry command.
88 Set SEL Time Entry Via Raw Command ${sel_date_raw}
89
90 # Get SEL Time command.
91 ${get_sel_time}= Check Current Date Time Via IPMI
92
93 # Identify Time difference and find the difference is less than 6 seconds.
94 # Command execution may happen at the end of millisecond so considered 6 seconds as difference.
95 ${time_difference}= Get Time Difference ${get_sel_time} ${sel_date}
96 Should Be True 0<=${time_difference}<=5
97 ... msg=Set SEL Time Not Working
98
99 # Get BMC time (native) and compare with set sel time given.
100 ${bmc_time}= Get Current Date from BMC
101
102 ${difference}= Get Time Difference ${bmc_time} ${sel_date}
103 Should Be True 0<=${difference}<=6
104
105
106Verify Set SEL Time With Future Date And Time
107 [Documentation] Verify IPMI Get SEL Time by adding 15 minutes from current time.
108 [Tags] Verify_Set_SEL_Time_With_Future_Date_And_Time
109
110 # Gets BMC Current Time and Adds 15 minutes and sets the SEL Time.
111 ${sel_time} ${set_sel_time}= Identify SEL Time Future DateTime 06:15:00
112
113 # Set SEL Time via IPMI command.
114 Set SEL Time Via IPMI ${sel_time}
115
116 # Get SEL Time Command.
117 ${get_sel_time}= Check Current Date Time Via IPMI
118
119 # Difference of time between set sel time and get time.
120 ${difference}= Get Time Difference ${get_sel_time} ${set_sel_time}
121 Should Be True 0<=${difference}<=2
122
123 # Difference of time between BMC Date and Get SEL Time.
124 ${bmc_time}= Get Current Date from BMC
125 ${difference}= Get Time Difference ${get_sel_time} ${bmc_time}
126 Should Be True 0<=${difference}<=2
127
128
129Verify Set SEL Time With Past Date And Time
130 [Documentation] Verify IPMI Get SEL Time for yime delay of 1 day from current dat and time.
131 [Tags] Verify_Set_SEL_Time_With_Past_Date_And_Time
132
133 # Gets BMC current time and subtracts 1 day and sets the SEL Time.
134 ${sel_time} ${set_sel_time}= Identify SEL Time DateTime Delay 1d
135
136 ${status}= Run Keyword And Return Status Should Not Contain ${sel_time} 1969
137 ... msg=Date cannot be less than 1970.
138
139 IF '${status}' == '${TRUE}'
140 # Set SEL Time via IPMI command.
141 Set SEL Time Via IPMI ${sel_time}
142 # Get SEL Time Command.
143 ${get_sel_time}= Check Current Date Time Via IPMI
144 # Difference of time between set sel time and get time.
145 ${difference}= Get Time Difference ${get_sel_time} ${set_sel_time}
146 Should Be True 0<=${difference}<=2
147 # Difference of time between BMC Date and Get SEL Time.
148 ${bmc_time}= Get Current Date from BMC
149 ${difference}= Get Time Difference ${get_sel_time} ${bmc_time}
150 Should Be True 0<=${difference}<=2
151 ELSE
152 FAIL SEL Time cannot set Date less than 1970
153 END
154
155
156Verify SEL Set Time For Invalid Data Request
157 [Documentation] Verify IPMI Get SEL Time for invalid data request
158 [Tags] Verify_SEL_Set_Time_For_Invalid_Data_Request
159 [Setup] Printn
160 [Teardown] FFDC On Test Case Fail
161
162 # Gets BMC current date via date command.
163 ${current_date}= Get Current Date from BMC
164
165 # Gives hexa decimal Raw command data request with the prefix of 0x.
166 ${sel_date_raw}= Converting Date to HexaDecimal ${current_date}
167
168 # Set Invalid SEL Time with one extra request byte.
169 ${Set_seltime_invalid}= Run Keyword and Expect Error *${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][4]}*
170 ... Run IPMI Command ${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][0]} ${sel_date_raw} 0x00
171 Should Contain ${Set_seltime_invalid} ${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][3]}
172
173
174Verify SEL Set Time For Incomplete Data Request
175 [Documentation] Verify IPMI Get SEL Time for invalid data with one byte less request data.
176 [Tags] Verify_SEL_Set_Time_For_Incomplete_Data_Request
177 [Setup] Printn
178 [Teardown] FFDC On Test Case Fail
179
180 # Gets BMC current date via date command.
181 ${current_date}= Get Current Date from BMC
182
183 # Gives hexa decimal raw command data request with the prefix of 0x.
184 ${sel_date_raw}= Converting Date to HexaDecimal ${current_date}
185
186 # For data request less than expected byes, remove last byte.
187 ${sel_date_raw}= Split String ${sel_date_raw}
188 Remove From List ${sel_date_raw} -1
189 ${sel_date_raw}= Evaluate " ".join(${sel_date_raw})
190
191 # Set incomplete SEL Time with one less request byte.
George Keishing6e641262022-05-05 10:46:22 -0500192 ${Set_seltime_incomplete}=
193 ... Run Keyword and Expect Error *${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][4]}*
chithrag0a8c8782022-03-01 12:35:00 +0000194 ... Run IPMI Command ${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][0]} ${sel_date_raw}
195 Should Contain ${Set_seltime_incomplete} ${IPMI_RAW_CMD['SEL_entry']['Set_SEL_Time'][3]}
196
197
198Verify SEL Time In SEL Entry
199 [Documentation] Verify Configured SEL Time reflects in newly added SEL Entry.
200 [Tags] Verify_SEL_Time_In_SEL_Entry
201
202 Clear The SEL
203
204 # change to manual, get current time and add future year (here, 5years).
205 ${sel_date}= Get Specific Sel Date 5
206
207 # Gives hexa decimal raw command data request with the prefix of 0x.
208 ${sel_date_raw}= Converting Date to HexaDecimal ${sel_date}
209
210 # Set SEL Entry Command.
211 Set SEL Time Entry Via Raw Command ${sel_date_raw}
212
213 # Get SEL Time Command.
214 ${get_sel_time}= Check Current Date Time Via IPMI
215
216 # Identify Time difference and find the difference is less than 6 seconds.
217 # Command execution may happen at the end of millisecond so considered 6 seconds as difference.
218 ${time_difference}= Get Time Difference ${get_sel_time} ${sel_date}
219 Should Be True 0<=${time_difference}<=5
220 ... msg=Set SEL Time Not Working
221
222 # Get BMC time (native) and compare with set sel time given.
223 ${bmc_time}= Get Current Date from BMC
224
225 ${difference}= Get Time Difference ${bmc_time} ${sel_date}
226 Should Be True 0<=${difference}<=6
227
228 # Get any Sensor available from Sensor list.
229 ${sensor_name}= Fetch Any Sensor From Sensor List
230
231 # Get Sensor ID from SDR Get "sensor".
232 ${sensor_data1}= Fetch Sensor Details From SDR ${sensor_name} Sensor ID
233 ${name_sensor} ${sensor_number}= Get Data And Byte From SDR Sensor ${sensor_data1}
234
235 # Get Sensor Type from SDR Get "sensor".
236 ${sensor_data2}= Fetch Sensor Details From SDR ${sensor_name} Sensor Type (Threshold)
237 ${sensor_type} ${sensor_type_id}= Get Data And Byte From SDR Sensor ${sensor_data2}
238
239 # Add SEL Entry.
240 ${sel_create_resp}= Create SEL ${sensor_type_id} ${sensor_number}
241
242 # Finds the last added sel entry.
243 ${resp}= Verify Last SEL Added ${sensor_type} ${sensor_name}
244
245 # Fetches the date of the last added SEL Entry.
246 ${sel_entry_date}= Fetch Added SEL Date ${resp}
247
248 # Identify and find the time difference is less than 60 seconds.
249 # Finding the sensor details and execution may take up to a minute.
250 # Compare date and time of Set SEL with sel entry.
251 ${d}= Get Time Difference ${sel_entry_date} ${sel_date}
252 Should Be True 0<=${d}<=60
253
254
255Verify SEL Time In SEL Entry For Future Date and Time
256 [Documentation] Verify configured SEL Time (Future Date & Time) in added SEL Entry.
257 [Tags] Verify_SEL_Time_In_SEL_Entry_For_Future_Date_and_Time
258
259 Clear The SEL
260
261 # Gets BMC Current Time and Adds 15 minutes and sets the SEL Time.
262 ${sel_time} ${set_sel_time}= Identify SEL Time Future DateTime 06:15:00
263
264 # Set SEL Time via IPMI command.
265 Set SEL Time Via IPMI ${sel_time}
266
267 # Get SEL Time Command.
268 ${get_sel_time}= Check Current Date Time Via IPMI
269
270 # Difference of time between set sel time and get time.
271 ${difference}= Get Time Difference ${get_sel_time} ${set_sel_time}
272 Should Be True 0<=${difference}<=2
273
274 # Difference of time between BMC Date and Get SEL Time.
275 ${bmc_time}= Get Current Date from BMC
276 ${difference}= Get Time Difference ${get_sel_time} ${bmc_time}
277 Should Be True 0<=${difference}<=2
278
279 # Get any Sensor available from Sensor list.
280 ${sensor_name}= Fetch Any Sensor From Sensor List
281
282 # Get Sensor ID from SDR Get "sensor".
283 ${sensor_data1}= Fetch Sensor Details From SDR ${sensor_name} Sensor ID
284 ${name_sensor} ${sensor_number}= Get Data And Byte From SDR Sensor ${sensor_data1}
285
286 # Get Sensor Type from SDR Get "sensor".
287 ${sensor_data2}= Fetch Sensor Details From SDR ${sensor_name} Sensor Type (Threshold)
288 ${sensor_type} ${sensor_type_id}= Get Data And Byte From SDR Sensor ${sensor_data2}
289
290 # Add SEL Entry.
291 ${sel_create_resp}= Create SEL ${sensor_type_id} ${sensor_number}
292
293 # Finds the last added sel entry.
294 ${resp}= Verify Last SEL Added ${sensor_type} ${sensor_name}
295
296 # Fetches the date of the last added SEL Entry.
297 ${sel_entry_date}= Fetch Added SEL Date ${resp}
298
299 # Identify and find the time difference is less than 60 seconds.
300 # Finding the sensor details and execution may take up to a minute.
301 # Compare date and time of Set SEL with sel entry.
302 ${d}= Get Time Difference ${sel_entry_date} ${set_sel_time}
303 Should Be True 0<=${d}<=60
304
305
306Verify SEL Time In SEL Entry For Past Date And Time
307 [Documentation] Verify configured SEL Time (Past Date & Time) in added SEL Entry.
George Keishing70deec02022-05-04 14:23:22 -0500308 [Tags] Verify_SEL_Time_In_SEL_Entry_For_Past_Date_And_Time
chithrag0a8c8782022-03-01 12:35:00 +0000309
310 Clear The SEL
311
312 # Gets BMC Current Time and subtracts 1 day and sets the SEL Time.
313 ${sel_time} ${set_sel_time}= Identify SEL Time DateTime Delay 1d
314
315 ${status}= Run Keyword And Return Status Should Not Contain ${sel_time} 1969
316 ... msg=Date cannot be less than 1970
317
318 IF '${status}' == '${TRUE}'
319 # Set SEL Time via IPMI command.
320 Set SEL Time Via IPMI ${sel_time}
321 # Get SEL Time Command.
322 ${get_sel_time}= Check Current Date Time Via IPMI
323 # Difference of time between set sel time and get time.
324 ${difference}= Get Time Difference ${get_sel_time} ${set_sel_time}
325 Should Be True 0<=${difference}<=2
326 # Difference of time between BMC Date and Get SEL Time.
327 ${bmc_time}= Get Current Date from BMC
328 ${difference}= Get Time Difference ${get_sel_time} ${bmc_time}
329 Should Be True 0<=${difference}<=2
330
331 # Get any Sensor available from Sensor list.
332 ${sensor_name}= Fetch Any Sensor From Sensor List
333 # Get Sensor ID from SDR Get "sensor".
334 ${sensor_data1}= Fetch Sensor Details From SDR ${sensor_name} Sensor ID
335 ${name_sensor} ${sensor_number}= Get Data And Byte From SDR Sensor ${sensor_data1}
336
337 # Get Sensor Type from SDR Get "sensor".
338 ${sensor_data2}= Fetch Sensor Details From SDR ${sensor_name} Sensor Type (Threshold)
339 ${sensor_type} ${sensor_type_id}= Get Data And Byte From SDR Sensor ${sensor_data2}
340
341 # Add SEL Entry.
342 ${sel_create_resp}= Create SEL ${sensor_type_id} ${sensor_number}
343
344 # Finds the last added sel entry.
345 ${resp}= Verify Last SEL Added ${sensor_type} ${sensor_name}
346
347 # Fetches the date of the last added SEL Entry.
348 ${sel_entry_date}= Fetch Added SEL Date ${resp}
349
350 # Identify and find the time difference is less than 60 seconds.
351 # Finding the sensor details and execution may take up to a minute.
352 # Compare date and time of Set SEL with sel entry.
353 ${d}= Get Time Difference ${sel_entry_date} ${set_sel_time}
354 Should Be True 0<=${d}<=60
355 ELSE
356 FAIL SEL Time cannot set Date less than 1970.
357 END
358
359
360Verify Multiple Set SEL Time With Multiple Add SEL Entry
361 [Documentation] Verify SEL time in multiple addition Of SEL entry.
362 [Tags] Verify_Multiple_Set_SEL_Time_With_Multiple_Add_SEL_Entry
363
364 # Gets BMC Current Time and Adds 15 minutes and sets the SEL Time.
365 ${sel_time} ${set_sel_time}= Identify SEL Time Future DateTime 06:15:00
366
367 FOR ${i} IN RANGE 1 6
368
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.
376 ${sensor_name}= Fetch Any Sensor From Sensor List
377
378 # Get Sensor ID from SDR Get "sensor" and Identify Sensor ID.
379 ${sensor_data1}= Fetch Sensor Details From SDR ${sensor_name} Sensor ID
380 ${name_sensor} ${sensor_number}= Get Data And Byte From SDR Sensor ${sensor_data1}
381
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)
384 ${sensor_type} ${sensor_type_id}= Get Data And Byte From SDR Sensor ${sensor_data2}
385
386 # Add SEL Entry.
387 ${sel_create_resp}= Create SEL ${sensor_type_id} ${sensor_number}
388
389 # Finds the last added sel entry.
390 ${resp}= Verify Last SEL Added ${sensor_type} ${sensor_name}
391
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):
411 # ${value} can be either ${FALSE} or ${TRUE}
412
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):
424 # ${value} can be either ${FALSE} or ${TRUE}
425
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
446 [Return] ${get_sel_time}
447
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):
454 # ${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.
458 # 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
474Verify Last SEL Added
475 [Documentation] Verify last SEL added.
476 [Arguments] ${sensor_type} ${sensor_name}
477
478 # Description of argument(s):
479 # ${sensor_type} Type of the sensor (say Fan, Temp, etc.,).
480 # ${sensor_name} Name of the sensor.
481
482 ${resp}= Run IPMI Standard Command sel elist last 1
483 Run Keywords Should Contain ${resp} ${sensor_type} ${sensor_name} AND
484 ... Should Contain ${resp} Asserted msg=Add SEL Entry failed.
485 Should Not Contain ${resp} reset/cleared
486
487 [Return] ${resp}
488
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
494 [Return] ${resp}
495
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):
502 # ${year} Can be any number of years (say 5 year).
503
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
508 ${date} = Add Time To Date ${current_date} ${days}d result_format=%m/%d/%Y %H:%M:%S date_format=%m/%d/%Y %H:%M:%S
509
510 [Return] ${date}
511
512
513Converting Date to HexaDecimal
514 [Documentation] Converting the date into hexa decimal values.
515 [Arguments] ${date}
516
517 # Description of argument(s):
518 # ${date} Can be any date in format %m/%d/%Y %H:%M:%S.
519
520 ${epoch_date}= Convert Date ${date} epoch exclude_millis=yes date_format=%m/%d/%Y %H:%M:%S
521 ${date}= Convert To Hex ${epoch_date} lowercase=yes
522
523 # function calls from utils.py.
524 # Length of the date byte should be 8 so that each bytes are separated.
525 ${date}= Zfill Data ${date} 8
526 # To split every two characters to form one byte each.
527 ${date}= Split String With Index ${date} 2
528 # Prefix every list index value with 0x.
529 ${date}= Prefix Bytes ${date}
530
531 # Reverse the bytes and join the list to form request Time stamp data.
532 Reverse List ${date}
533 ${date}= Evaluate " ".join(${date})
534
535 [Return] ${date}
536
537
538Get Time Difference
539 [Documentation] Converting the date into hexa decimal values.
540 [Arguments] ${date1} ${date2}
541
542 # Description of argument(s):
543 # ${date1} Can be any date in format %m/%d/%Y %H:%M:%S.
544 # ${date2} Can be any date in format %m/%d/%Y %H:%M:%S.
545
546 ${epoch_date1}= Convert Date ${date1} epoch exclude_millis=yes date_format=%m/%d/%Y %H:%M:%S
547 ${epoch_date2}= Convert Date ${date2} epoch exclude_millis=yes date_format=%m/%d/%Y %H:%M:%S
548
549 ${diff}= Evaluate int(${epoch_date1}) - int(${epoch_date2})
550
551 [Return] ${diff}
552
553
554Identify SEL Time Future DateTime
555 [Documentation] Identify SEL Time Future DateTime.
556 [Arguments] ${time}
557
558 # Description of argument(s):
559 # ${time} Can be any number of hours or minutes in format %H:%M:%S.
560
561 # Gets BMC current date via date command.
562 ${current_date}= Get Current Date from BMC
563
564 ${datetime} = Add Time To Date ${current_date} ${time} result_format=%m/%d/%Y %H:%M:%S date_format=%m/%d/%Y %H:%M:%S
565
566 #Set SEL Time.
567 ${quoted_date}= Fetch Date ${datetime}
568
569 [Return] ${quoted_date} ${datetime}
570
571
572Identify SEL Time DateTime Delay
573 [Documentation] Identify SEL Time DateTime Delay by subtracting given date.
574 [Arguments] ${days}
575
576 # Description of argument(s):
577 # ${days} Can be any days (say 3d).
578
579 # Gets BMC current date via date command.
580 ${current_date}= Get Current Date from BMC
581
582 ${datetime} = Subtract Time From Date ${current_date} ${days} result_format=%m/%d/%Y %H:%M:%S date_format=%m/%d/%Y %H:%M:%S
583
584 # Format the sel time.
585 # function call from lib/utils.py.
586 ${quoted_date}= Fetch Date ${datetime}
587
588 [Return] ${quoted_date} ${datetime}
589
590
591Set SEL Time Via IPMI
592 [Documentation] Set SEL Time for given date using IPMI.
593 [Arguments] ${date_time}
594
595 # Description of argument(s):
596 # ${date_time} Can be any date in format %m/%d/%Y %H:%M:%S.
597
598 ${resp}= Run IPMI Standard Command sel time set "${date_time}"
599 Should Not Contain ${resp} Unspecified error
600
601
602Test Setup Execution
603 [Documentation] Test Setup Execution.
604
605 Redfish.Login
606 # Change timesync mode to manual with timeout as per resource.robot.
607 Time Sync Mode Change Through Redfish ${FALSE}
608 Sleep ${NETWORK_TIMEOUT}
609
610
611Test Teardown Execution
612 [Documentation] For execution of Test teardown.
613
614 Clear The SEL
615
616 # Change TimeSync mode to NTP with Timeout as per default resource.robot.
617 Time Sync Mode Change Through Redfish ${TRUE}
618 Sleep ${NETWORK_TIMEOUT}
619 Redfish.Logout
620 FFDC On Test Case Fail