Sivas SRR | 0e3bc6d | 2019-04-23 08:36:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test BMC manager time functionality. |
Sivas SRR | 0e3bc6d | 2019-04-23 08:36:35 -0500 | [diff] [blame] | 3 | Resource ../../lib/openbmc_ffdc.robot |
Anvesh-Kumar_Rayankula | 365b8f9 | 2024-08-04 00:07:19 -0500 | [diff] [blame] | 4 | Resource ../../lib/bmc_date_and_time_utils.robot |
Sivas SRR | 0e3bc6d | 2019-04-23 08:36:35 -0500 | [diff] [blame] | 5 | |
Michael Walsh | 09083a8 | 2019-08-01 12:46:16 -0500 | [diff] [blame] | 6 | Test Setup Printn |
Sivas SRR | 0e3bc6d | 2019-04-23 08:36:35 -0500 | [diff] [blame] | 7 | Test Teardown Test Teardown Execution |
Sivas SRR | 20fe032 | 2019-06-17 04:24:18 -0500 | [diff] [blame] | 8 | Suite Setup Suite Setup Execution |
George Keishing | ade5f6e | 2019-07-12 11:42:42 -0500 | [diff] [blame] | 9 | Suite Teardown Suite Teardown Execution |
Sivas SRR | 0e3bc6d | 2019-04-23 08:36:35 -0500 | [diff] [blame] | 10 | |
Matt Fischer | 6fb70d9 | 2023-10-24 19:06:33 -0600 | [diff] [blame] | 11 | Test Tags Managers_BMC_Time |
George Keishing | 79fcf23 | 2023-10-12 17:06:38 +0530 | [diff] [blame] | 12 | |
Sivas SRR | 0e3bc6d | 2019-04-23 08:36:35 -0500 | [diff] [blame] | 13 | *** Variables *** |
George Keishing | 79fcf23 | 2023-10-12 17:06:38 +0530 | [diff] [blame] | 14 | |
Sivas SRR | 0e3bc6d | 2019-04-23 08:36:35 -0500 | [diff] [blame] | 15 | ${max_time_diff_in_seconds} 6 |
Sivas SRR | 9e00ff3 | 2019-07-18 10:38:44 -0500 | [diff] [blame] | 16 | ${date_time_with_offset} 2019-04-25T26:24:46+00:00 |
sarandev3 | 3d50089 | 2025-01-21 01:45:16 -0600 | [diff] [blame^] | 17 | ${invalid_datetime} 2019-04-251T12:24:46+00:00 |
Sivas SRR | 0e3bc6d | 2019-04-23 08:36:35 -0500 | [diff] [blame] | 18 | |
| 19 | *** Test Cases *** |
| 20 | |
| 21 | Verify Redfish BMC Time |
| 22 | [Documentation] Verify that date/time obtained via redfish matches |
| 23 | ... date/time obtained via BMC command line. |
| 24 | [Tags] Verify_Redfish_BMC_Time |
| 25 | |
| 26 | ${redfish_date_time}= Redfish Get DateTime |
| 27 | ${cli_date_time}= CLI Get BMC DateTime |
| 28 | ${time_diff}= Subtract Date From Date ${cli_date_time} |
| 29 | ... ${redfish_date_time} |
| 30 | ${time_diff}= Evaluate abs(${time_diff}) |
| 31 | Rprint Vars redfish_date_time cli_date_time time_diff |
| 32 | Should Be True ${time_diff} < ${max_time_diff_in_seconds} |
| 33 | ... The difference between Redfish time and CLI time exceeds the allowed time difference. |
| 34 | |
| 35 | |
Sivas SRR | 8a53dad | 2019-05-16 08:56:14 -0500 | [diff] [blame] | 36 | Verify Set Time Using Redfish |
| 37 | [Documentation] Verify set time using redfish API. |
| 38 | [Tags] Verify_Set_Time_Using_Redfish |
| 39 | |
Anusha Dathatri | 87e4e55 | 2020-05-28 07:02:42 -0500 | [diff] [blame] | 40 | Set Time To Manual Mode |
Sushil Singh | 79b04aa | 2019-06-18 05:25:34 -0500 | [diff] [blame] | 41 | |
Sivas SRR | 8a53dad | 2019-05-16 08:56:14 -0500 | [diff] [blame] | 42 | ${old_bmc_time}= CLI Get BMC DateTime |
| 43 | # Add 3 days to current date. |
| 44 | ${new_bmc_time}= Add Time to Date ${old_bmc_time} 3 Days |
| 45 | Redfish Set DateTime ${new_bmc_time} |
| 46 | ${cli_bmc_time}= CLI Get BMC DateTime |
| 47 | ${time_diff}= Subtract Date From Date ${cli_bmc_time} |
| 48 | ... ${new_bmc_time} |
| 49 | ${time_diff}= Evaluate abs(${time_diff}) |
| 50 | Rprint Vars old_bmc_time new_bmc_time cli_bmc_time time_diff max_time_diff_in_seconds |
| 51 | Should Be True ${time_diff} < ${max_time_diff_in_seconds} |
| 52 | ... The difference between Redfish time and CLI time exceeds the allowed time difference. |
| 53 | # Setting back to old bmc time. |
| 54 | Redfish Set DateTime ${old_bmc_time} |
| 55 | |
| 56 | |
Sivas SRR | 9e00ff3 | 2019-07-18 10:38:44 -0500 | [diff] [blame] | 57 | Verify Set DateTime With Offset Using Redfish |
| 58 | [Documentation] Verify set DateTime with offset using redfish API. |
| 59 | [Tags] Verify_Set_DateTime_With_Offset_Using_Redfish |
| 60 | [Teardown] Run Keywords Redfish Set DateTime AND FFDC On Test Case Fail |
| 61 | |
sarandev3 | 3d50089 | 2025-01-21 01:45:16 -0600 | [diff] [blame^] | 62 | Redfish Set DateTime ${date_time_with_offset} valid_status_codes=[${HTTP_BAD_REQUEST}] |
Sivas SRR | 9e00ff3 | 2019-07-18 10:38:44 -0500 | [diff] [blame] | 63 | |
| 64 | |
Sivas SRR | 3f152ae | 2019-06-07 10:02:51 -0500 | [diff] [blame] | 65 | Verify Set DateTime With Invalid Data Using Redfish |
| 66 | [Documentation] Verify error while setting invalid DateTime using Redfish. |
| 67 | [Tags] Verify_Set_DateTime_With_Invalid_Data_Using_Redfish |
| 68 | |
| 69 | Redfish Set DateTime ${invalid_datetime} valid_status_codes=[${HTTP_BAD_REQUEST}] |
| 70 | |
| 71 | |
Sivas SRR | 4d64599 | 2019-06-20 05:34:50 -0500 | [diff] [blame] | 72 | Verify DateTime Persists After Reboot |
| 73 | [Documentation] Verify date persists after BMC reboot. |
| 74 | [Tags] Verify_DateTime_Persists_After_Reboot |
| 75 | |
| 76 | # Synchronize BMC date/time to local system date/time. |
| 77 | ${local_system_time}= Get Current Date |
| 78 | Redfish Set DateTime ${local_system_time} |
| 79 | Redfish OBMC Reboot (off) |
| 80 | Redfish.Login |
| 81 | ${bmc_time}= CLI Get BMC DateTime |
| 82 | ${local_system_time}= Get Current Date |
| 83 | ${time_diff}= Subtract Date From Date ${bmc_time} |
| 84 | ... ${local_system_time} |
| 85 | ${time_diff}= Evaluate abs(${time_diff}) |
| 86 | Rprint Vars local_system_time bmc_time time_diff max_time_diff_in_seconds |
| 87 | Should Be True ${time_diff} < ${max_time_diff_in_seconds} |
| 88 | ... The difference between Redfish time and CLI time exceeds the allowed time difference. |
| 89 | |
| 90 | |
Anusha Dathatri | 4ad9f43 | 2020-06-29 05:18:29 -0500 | [diff] [blame] | 91 | Verify Immediate Consumption Of BMC Date |
| 92 | [Documentation] Verify immediate change in BMC date time. |
| 93 | [Tags] Verify_Immediate_Consumption_Of_BMC_Date |
| 94 | [Setup] Run Keywords Set Time To Manual Mode AND |
Anusha Dathatri | ad6a3df | 2020-07-22 05:20:18 -0500 | [diff] [blame] | 95 | ... Redfish Set DateTime valid_status_codes=[${HTTP_OK}] |
Anusha Dathatri | 4ad9f43 | 2020-06-29 05:18:29 -0500 | [diff] [blame] | 96 | [Teardown] Run Keywords FFDC On Test Case Fail AND |
| 97 | ... Redfish Set DateTime valid_status_codes=[${HTTP_OK}] |
| 98 | [Template] Set BMC Date And Verify |
| 99 | |
| 100 | # host_state |
| 101 | on |
| 102 | off |
| 103 | |
| 104 | |
aravinth0510 | f031ca1 | 2022-06-16 12:47:33 +0000 | [diff] [blame] | 105 | |
Sivas SRR | 0e3bc6d | 2019-04-23 08:36:35 -0500 | [diff] [blame] | 106 | *** Keywords *** |
| 107 | |
Sivas SRR | 4d64599 | 2019-06-20 05:34:50 -0500 | [diff] [blame] | 108 | |
Sivas SRR | 0e3bc6d | 2019-04-23 08:36:35 -0500 | [diff] [blame] | 109 | Test Teardown Execution |
| 110 | [Documentation] Do the post test teardown. |
| 111 | |
| 112 | FFDC On Test Case Fail |
Sivas SRR | 0e3bc6d | 2019-04-23 08:36:35 -0500 | [diff] [blame] | 113 | |
| 114 | |
Sivas SRR | 20fe032 | 2019-06-17 04:24:18 -0500 | [diff] [blame] | 115 | Suite Setup Execution |
| 116 | [Documentation] Do the suite level setup. |
| 117 | |
| 118 | Printn |
| 119 | Redfish.Login |
Tony Lee | 1082266 | 2020-05-12 14:53:35 +0800 | [diff] [blame] | 120 | Get NTP Initial Status |
ganesanb | 3937eaa | 2023-04-15 10:24:38 +0000 | [diff] [blame] | 121 | ${old_date_time}= CLI Get BMC DateTime |
| 122 | ${year_status}= Run Keyword And Return Status Should Not Contain ${old_date_time} ${year_without_ntp} |
| 123 | Run Keyword If ${year_status} == False |
| 124 | ... Enable NTP And Add NTP Address |
Anusha Dathatri | 87e4e55 | 2020-05-28 07:02:42 -0500 | [diff] [blame] | 125 | Set Time To Manual Mode |
Tony Lee | 1082266 | 2020-05-12 14:53:35 +0800 | [diff] [blame] | 126 | |
George Keishing | ade5f6e | 2019-07-12 11:42:42 -0500 | [diff] [blame] | 127 | |
| 128 | Suite Teardown Execution |
| 129 | [Documentation] Do the suite level teardown. |
Sivas SRR | 9e00ff3 | 2019-07-18 10:38:44 -0500 | [diff] [blame] | 130 | |
Anusha Dathatri | 87e4e55 | 2020-05-28 07:02:42 -0500 | [diff] [blame] | 131 | Set Time To Manual Mode |
Tony Lee | 1082266 | 2020-05-12 14:53:35 +0800 | [diff] [blame] | 132 | Restore NTP Status |
George Keishing | ade5f6e | 2019-07-12 11:42:42 -0500 | [diff] [blame] | 133 | Redfish.Logout |