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