| Anvesh-Kumar_Rayankula | 365b8f9 | 2024-08-04 00:07:19 -0500 | [diff] [blame] | 1 | *** Settings *** | 
|  | 2 | Documentation                NTP configuration and verification | 
|  | 3 | ...  tests. | 
|  | 4 |  | 
|  | 5 | Resource                     ../../lib/openbmc_ffdc.robot | 
|  | 6 | Resource                     ../../lib/bmc_date_and_time_utils.robot | 
|  | 7 |  | 
|  | 8 | Test Setup                   Printn | 
|  | 9 | Test Teardown                FFDC On Test Case Fail | 
|  | 10 | Suite Setup                  Suite Setup Execution | 
|  | 11 | Suite Teardown               Suite Teardown Execution | 
|  | 12 |  | 
|  | 13 |  | 
|  | 14 | *** Variables *** | 
|  | 15 |  | 
|  | 16 | ${ntp_server_1}              9.9.9.9 | 
|  | 17 | ${ntp_server_2}              2.2.3.3 | 
|  | 18 | &{original_ntp}              &{EMPTY} | 
|  | 19 |  | 
|  | 20 | *** Test Cases *** | 
|  | 21 |  | 
|  | 22 | Verify NTP Server Set | 
|  | 23 | [Documentation]  Patch NTP servers and verify NTP servers is set. | 
|  | 24 | [Tags]  Verify_NTP_Server_Set | 
|  | 25 | [Setup]  Set NTP state  ${True} | 
|  | 26 |  | 
|  | 27 | Redfish.Patch  ${REDFISH_NW_PROTOCOL_URI} | 
|  | 28 | ...  body={'NTP':{'NTPServers': ['${ntp_server_1}', '${ntp_server_2}']}} | 
|  | 29 | ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] | 
|  | 30 |  | 
|  | 31 | # NTP network take few seconds to reload. | 
|  | 32 | Wait Until Keyword Succeeds  30 sec  10 sec  Verify NTP Servers Are Populated | 
|  | 33 |  | 
|  | 34 |  | 
|  | 35 | Verify NTP Server Value Not Duplicated | 
|  | 36 | [Documentation]  Verify NTP servers value not same for both primary and secondary server. | 
|  | 37 | [Tags]  Verify_NTP_Server_Value_Not_Duplicated | 
|  | 38 |  | 
|  | 39 | Redfish.Patch  ${REDFISH_NW_PROTOCOL_URI} | 
|  | 40 | ...  body={'NTP':{'NTPServers': ['${ntp_server_1}', '${ntp_server_1}']}} | 
|  | 41 | ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] | 
|  | 42 | ${network_protocol}=  Redfish.Get Properties  ${REDFISH_NW_PROTOCOL_URI} | 
|  | 43 | Should Contain X Times  ${network_protocol["NTP"]["NTPServers"]}  ${ntp_server_1}  1 | 
|  | 44 | ...  msg=NTP primary and secondary server values should not be same. | 
|  | 45 |  | 
|  | 46 |  | 
|  | 47 | Verify NTP Server Setting Persist After BMC Reboot | 
|  | 48 | [Documentation]  Verify NTP server setting persist after BMC reboot. | 
|  | 49 | [Tags]  Verify_NTP_Server_Setting_Persist_After_BMC_Reboot | 
|  | 50 | [Setup]  Set NTP state  ${True} | 
|  | 51 |  | 
|  | 52 | Redfish.Patch  ${REDFISH_NW_PROTOCOL_URI} | 
|  | 53 | ...  body={'NTP':{'NTPServers': ['${ntp_server_1}', '${ntp_server_2}']}} | 
|  | 54 | ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] | 
|  | 55 | Redfish OBMC Reboot (off) | 
|  | 56 | Redfish.Login | 
|  | 57 |  | 
|  | 58 | # NTP network take few seconds to reload. | 
|  | 59 | Wait Until Keyword Succeeds  30 sec  10 sec  Verify NTP Servers Are Populated | 
|  | 60 |  | 
|  | 61 |  | 
|  | 62 | Verify Enable NTP | 
|  | 63 | [Documentation]  Verify NTP protocol mode can be enabled. | 
|  | 64 | [Teardown]  Restore NTP Mode | 
|  | 65 | [Tags]  Verify_Enable_NTP | 
|  | 66 |  | 
| Anvesh-Kumar_Rayankula | 365b8f9 | 2024-08-04 00:07:19 -0500 | [diff] [blame] | 67 | # The following patch command should set the ["NTP"]["ProtocolEnabled"] property to "True". | 
|  | 68 | Redfish.Patch  ${REDFISH_NW_PROTOCOL_URI}  body={'NTP':{'ProtocolEnabled': ${True}}} | 
|  | 69 | ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] | 
|  | 70 | Wait Until Keyword Succeeds  1 min  5 sec | 
|  | 71 | ...  Verify System Time Sync Status  ${True} | 
|  | 72 | ${ntp}=  Redfish.Get Attribute  ${REDFISH_NW_PROTOCOL_URI}  NTP | 
|  | 73 | Rprint Vars  ntp | 
|  | 74 | Valid Value  ntp["ProtocolEnabled"]  valid_values=[True] | 
|  | 75 |  | 
| George Keishing | aaf7d1c | 2024-09-03 13:46:49 +0530 | [diff] [blame] | 76 | Verify Disable NTP | 
| Sweta Potthuri | dc9abaa | 2024-08-14 02:04:11 -0500 | [diff] [blame] | 77 | [Documentation]  Verify NTP protocol mode can be disabled. | 
|  | 78 | [Teardown]  Restore NTP Mode | 
|  | 79 | [Tags]  Verify_Disable_NTP | 
|  | 80 |  | 
|  | 81 | # The following patch command should set the ["NTP"]["ProtocolEnabled"] property to "False". | 
|  | 82 | Redfish.Patch  ${REDFISH_NW_PROTOCOL_URI}  body={'NTP':{'ProtocolEnabled': ${False}}} | 
|  | 83 | ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] | 
|  | 84 | Wait Until Keyword Succeeds  1 min  5 sec | 
|  | 85 | ...  Verify System Time Sync Status  ${False} | 
|  | 86 | ${ntp}=  Redfish.Get Attribute  ${REDFISH_NW_PROTOCOL_URI}  NTP | 
|  | 87 | Rprint Vars  ntp | 
|  | 88 | Valid Value  ntp["ProtocolEnabled"]  valid_values=[False] | 
| Anvesh-Kumar_Rayankula | 365b8f9 | 2024-08-04 00:07:19 -0500 | [diff] [blame] | 89 |  | 
|  | 90 | Verify Set DateTime With NTP Enabled | 
|  | 91 | [Documentation]  Verify whether set managers dateTime is restricted with NTP enabled. | 
|  | 92 | [Tags]  Verify_Set_DateTime_With_NTP_Enabled | 
|  | 93 |  | 
|  | 94 | Redfish.Patch  ${REDFISH_NW_PROTOCOL_URI}  body={'NTP':{'ProtocolEnabled': ${True}}} | 
|  | 95 | ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] | 
|  | 96 | ${ntp}=  Redfish.Get Attribute  ${REDFISH_NW_PROTOCOL_URI}  NTP | 
|  | 97 | Valid Value  ntp["ProtocolEnabled"]  valid_values=[True] | 
|  | 98 | ${local_system_time}=  Get Current Date | 
|  | 99 | Redfish Set DateTime  ${local_system_time} | 
|  | 100 | ...  valid_status_codes=[${HTTP_BAD_REQUEST}, ${HTTP_INTERNAL_SERVER_ERROR}] | 
|  | 101 |  | 
| Sweta Potthuri | ba083e5 | 2025-01-08 02:24:24 -0600 | [diff] [blame] | 102 | Verify NTP Server Is Not Populated In NetworkSuppliedServers | 
|  | 103 | [Documentation]  Patch NTP server and verify NTP servers is not populated | 
|  | 104 | ...  in NetworkSuppliedServers. | 
| George Keishing | 4ebb328 | 2025-01-17 10:01:34 +0530 | [diff] [blame] | 105 | [Tags]  Verify_NTP_Server_Is_Not_Populated_In_NetworkSuppliedServers | 
| Sweta Potthuri | ba083e5 | 2025-01-08 02:24:24 -0600 | [diff] [blame] | 106 | [Setup]  Set NTP state  ${True} | 
| Anvesh-Kumar_Rayankula | 365b8f9 | 2024-08-04 00:07:19 -0500 | [diff] [blame] | 107 |  | 
| Sweta Potthuri | ba083e5 | 2025-01-08 02:24:24 -0600 | [diff] [blame] | 108 | Redfish.Patch  ${REDFISH_NW_PROTOCOL_URI} | 
|  | 109 | ...  body={'NTP':{'NTPServers': ['${ntp_server_1}']}} | 
|  | 110 | ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] | 
|  | 111 |  | 
|  | 112 | # Verify the NTP server is populated in NTPServers. | 
|  | 113 | ${network_protocol}=  Redfish.Get Properties  ${REDFISH_NW_PROTOCOL_URI} | 
|  | 114 | Should Contain  ${network_protocol["NTP"]["NTPServers"]}  ${ntp_server_1} | 
|  | 115 | ...  msg=NTP server value ${ntp_server_1} not stored. | 
|  | 116 |  | 
|  | 117 | # Checking whether added NTP server is not populated in | 
|  | 118 | # ...  NetworkSuppliedServers as it has only DHCP NTP server list. | 
|  | 119 | ${network_protocol}=  Redfish.Get Properties  ${REDFISH_NW_PROTOCOL_URI} | 
|  | 120 | Should Not Contain  ${network_protocol["NTP"]["NetworkSuppliedServers"]}  ${ntp_server_1} | 
|  | 121 | ...  msg=Static NTP server is coming up in NetworkSuppliedServers. | 
|  | 122 |  | 
|  | 123 | *** Keywords *** | 
| Anvesh-Kumar_Rayankula | 365b8f9 | 2024-08-04 00:07:19 -0500 | [diff] [blame] | 124 |  | 
|  | 125 | Suite Setup Execution | 
|  | 126 | [Documentation]  Do the suite level setup. | 
|  | 127 |  | 
|  | 128 | Printn | 
|  | 129 | Redfish.Login | 
|  | 130 | Get NTP Initial Status | 
|  | 131 | ${old_date_time}=  CLI Get BMC DateTime | 
|  | 132 | ${year_status}=  Run Keyword And Return Status  Should Not Contain  ${old_date_time}  ${year_without_ntp} | 
| George Keishing | e6e161e | 2025-05-08 10:18:30 +0530 | [diff] [blame] | 133 |  | 
|  | 134 | IF  ${year_status} == False  Enable NTP And Add NTP Address | 
| Anvesh-Kumar_Rayankula | 365b8f9 | 2024-08-04 00:07:19 -0500 | [diff] [blame] | 135 |  | 
| Anvesh-Kumar_Rayankula | 365b8f9 | 2024-08-04 00:07:19 -0500 | [diff] [blame] | 136 | Suite Teardown Execution | 
|  | 137 | [Documentation]  Do the suite level teardown. | 
|  | 138 |  | 
|  | 139 | Redfish.Patch  ${REDFISH_NW_PROTOCOL_URI} | 
|  | 140 | ...  body={'NTP':{'NTPServers': ['${EMPTY}', '${EMPTY}']}} | 
|  | 141 | ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] | 
|  | 142 | Restore NTP Status | 
|  | 143 | Redfish.Logout |