1*365b8f93SAnvesh-Kumar_Rayankula*** Settings *** 2*365b8f93SAnvesh-Kumar_RayankulaDocumentation NTP configuration and verification 3*365b8f93SAnvesh-Kumar_Rayankula ... tests. 4*365b8f93SAnvesh-Kumar_Rayankula 5*365b8f93SAnvesh-Kumar_RayankulaResource ../../lib/openbmc_ffdc.robot 6*365b8f93SAnvesh-Kumar_RayankulaResource ../../lib/bmc_date_and_time_utils.robot 7*365b8f93SAnvesh-Kumar_Rayankula 8*365b8f93SAnvesh-Kumar_RayankulaTest Setup Printn 9*365b8f93SAnvesh-Kumar_RayankulaTest Teardown FFDC On Test Case Fail 10*365b8f93SAnvesh-Kumar_RayankulaSuite Setup Suite Setup Execution 11*365b8f93SAnvesh-Kumar_RayankulaSuite Teardown Suite Teardown Execution 12*365b8f93SAnvesh-Kumar_Rayankula 13*365b8f93SAnvesh-Kumar_Rayankula 14*365b8f93SAnvesh-Kumar_Rayankula*** Variables *** 15*365b8f93SAnvesh-Kumar_Rayankula 16*365b8f93SAnvesh-Kumar_Rayankula${ntp_server_1} 9.9.9.9 17*365b8f93SAnvesh-Kumar_Rayankula${ntp_server_2} 2.2.3.3 18*365b8f93SAnvesh-Kumar_Rayankula&{original_ntp} &{EMPTY} 19*365b8f93SAnvesh-Kumar_Rayankula 20*365b8f93SAnvesh-Kumar_Rayankula*** Test Cases *** 21*365b8f93SAnvesh-Kumar_Rayankula 22*365b8f93SAnvesh-Kumar_RayankulaVerify NTP Server Set 23*365b8f93SAnvesh-Kumar_Rayankula [Documentation] Patch NTP servers and verify NTP servers is set. 24*365b8f93SAnvesh-Kumar_Rayankula [Tags] Verify_NTP_Server_Set 25*365b8f93SAnvesh-Kumar_Rayankula [Setup] Set NTP state ${True} 26*365b8f93SAnvesh-Kumar_Rayankula 27*365b8f93SAnvesh-Kumar_Rayankula Redfish.Patch ${REDFISH_NW_PROTOCOL_URI} 28*365b8f93SAnvesh-Kumar_Rayankula ... body={'NTP':{'NTPServers': ['${ntp_server_1}', '${ntp_server_2}']}} 29*365b8f93SAnvesh-Kumar_Rayankula ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 30*365b8f93SAnvesh-Kumar_Rayankula 31*365b8f93SAnvesh-Kumar_Rayankula # NTP network take few seconds to reload. 32*365b8f93SAnvesh-Kumar_Rayankula Wait Until Keyword Succeeds 30 sec 10 sec Verify NTP Servers Are Populated 33*365b8f93SAnvesh-Kumar_Rayankula 34*365b8f93SAnvesh-Kumar_Rayankula 35*365b8f93SAnvesh-Kumar_RayankulaVerify NTP Server Value Not Duplicated 36*365b8f93SAnvesh-Kumar_Rayankula [Documentation] Verify NTP servers value not same for both primary and secondary server. 37*365b8f93SAnvesh-Kumar_Rayankula [Tags] Verify_NTP_Server_Value_Not_Duplicated 38*365b8f93SAnvesh-Kumar_Rayankula 39*365b8f93SAnvesh-Kumar_Rayankula Redfish.Patch ${REDFISH_NW_PROTOCOL_URI} 40*365b8f93SAnvesh-Kumar_Rayankula ... body={'NTP':{'NTPServers': ['${ntp_server_1}', '${ntp_server_1}']}} 41*365b8f93SAnvesh-Kumar_Rayankula ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 42*365b8f93SAnvesh-Kumar_Rayankula ${network_protocol}= Redfish.Get Properties ${REDFISH_NW_PROTOCOL_URI} 43*365b8f93SAnvesh-Kumar_Rayankula Should Contain X Times ${network_protocol["NTP"]["NTPServers"]} ${ntp_server_1} 1 44*365b8f93SAnvesh-Kumar_Rayankula ... msg=NTP primary and secondary server values should not be same. 45*365b8f93SAnvesh-Kumar_Rayankula 46*365b8f93SAnvesh-Kumar_Rayankula 47*365b8f93SAnvesh-Kumar_RayankulaVerify NTP Server Setting Persist After BMC Reboot 48*365b8f93SAnvesh-Kumar_Rayankula [Documentation] Verify NTP server setting persist after BMC reboot. 49*365b8f93SAnvesh-Kumar_Rayankula [Tags] Verify_NTP_Server_Setting_Persist_After_BMC_Reboot 50*365b8f93SAnvesh-Kumar_Rayankula [Setup] Set NTP state ${True} 51*365b8f93SAnvesh-Kumar_Rayankula 52*365b8f93SAnvesh-Kumar_Rayankula Redfish.Patch ${REDFISH_NW_PROTOCOL_URI} 53*365b8f93SAnvesh-Kumar_Rayankula ... body={'NTP':{'NTPServers': ['${ntp_server_1}', '${ntp_server_2}']}} 54*365b8f93SAnvesh-Kumar_Rayankula ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 55*365b8f93SAnvesh-Kumar_Rayankula Redfish OBMC Reboot (off) 56*365b8f93SAnvesh-Kumar_Rayankula Redfish.Login 57*365b8f93SAnvesh-Kumar_Rayankula 58*365b8f93SAnvesh-Kumar_Rayankula # NTP network take few seconds to reload. 59*365b8f93SAnvesh-Kumar_Rayankula Wait Until Keyword Succeeds 30 sec 10 sec Verify NTP Servers Are Populated 60*365b8f93SAnvesh-Kumar_Rayankula 61*365b8f93SAnvesh-Kumar_Rayankula 62*365b8f93SAnvesh-Kumar_RayankulaVerify Enable NTP 63*365b8f93SAnvesh-Kumar_Rayankula [Documentation] Verify NTP protocol mode can be enabled. 64*365b8f93SAnvesh-Kumar_Rayankula [Teardown] Restore NTP Mode 65*365b8f93SAnvesh-Kumar_Rayankula [Tags] Verify_Enable_NTP 66*365b8f93SAnvesh-Kumar_Rayankula 67*365b8f93SAnvesh-Kumar_Rayankula ${original_ntp}= Redfish.Get Attribute ${REDFISH_NW_PROTOCOL_URI} NTP 68*365b8f93SAnvesh-Kumar_Rayankula Set Suite Variable ${original_ntp} 69*365b8f93SAnvesh-Kumar_Rayankula Rprint Vars original_ntp 70*365b8f93SAnvesh-Kumar_Rayankula # The following patch command should set the ["NTP"]["ProtocolEnabled"] property to "True". 71*365b8f93SAnvesh-Kumar_Rayankula Redfish.Patch ${REDFISH_NW_PROTOCOL_URI} body={'NTP':{'ProtocolEnabled': ${True}}} 72*365b8f93SAnvesh-Kumar_Rayankula ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 73*365b8f93SAnvesh-Kumar_Rayankula Wait Until Keyword Succeeds 1 min 5 sec 74*365b8f93SAnvesh-Kumar_Rayankula ... Verify System Time Sync Status ${True} 75*365b8f93SAnvesh-Kumar_Rayankula ${ntp}= Redfish.Get Attribute ${REDFISH_NW_PROTOCOL_URI} NTP 76*365b8f93SAnvesh-Kumar_Rayankula Rprint Vars ntp 77*365b8f93SAnvesh-Kumar_Rayankula Valid Value ntp["ProtocolEnabled"] valid_values=[True] 78*365b8f93SAnvesh-Kumar_Rayankula 79*365b8f93SAnvesh-Kumar_Rayankula 80*365b8f93SAnvesh-Kumar_RayankulaVerify Set DateTime With NTP Enabled 81*365b8f93SAnvesh-Kumar_Rayankula [Documentation] Verify whether set managers dateTime is restricted with NTP enabled. 82*365b8f93SAnvesh-Kumar_Rayankula [Tags] Verify_Set_DateTime_With_NTP_Enabled 83*365b8f93SAnvesh-Kumar_Rayankula 84*365b8f93SAnvesh-Kumar_Rayankula Redfish.Patch ${REDFISH_NW_PROTOCOL_URI} body={'NTP':{'ProtocolEnabled': ${True}}} 85*365b8f93SAnvesh-Kumar_Rayankula ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 86*365b8f93SAnvesh-Kumar_Rayankula ${ntp}= Redfish.Get Attribute ${REDFISH_NW_PROTOCOL_URI} NTP 87*365b8f93SAnvesh-Kumar_Rayankula Valid Value ntp["ProtocolEnabled"] valid_values=[True] 88*365b8f93SAnvesh-Kumar_Rayankula ${local_system_time}= Get Current Date 89*365b8f93SAnvesh-Kumar_Rayankula Redfish Set DateTime ${local_system_time} 90*365b8f93SAnvesh-Kumar_Rayankula ... valid_status_codes=[${HTTP_BAD_REQUEST}, ${HTTP_INTERNAL_SERVER_ERROR}] 91*365b8f93SAnvesh-Kumar_Rayankula 92*365b8f93SAnvesh-Kumar_Rayankula 93*365b8f93SAnvesh-Kumar_Rayankula*** Keywords *** 94*365b8f93SAnvesh-Kumar_Rayankula 95*365b8f93SAnvesh-Kumar_Rayankula 96*365b8f93SAnvesh-Kumar_RayankulaSuite Setup Execution 97*365b8f93SAnvesh-Kumar_Rayankula [Documentation] Do the suite level setup. 98*365b8f93SAnvesh-Kumar_Rayankula 99*365b8f93SAnvesh-Kumar_Rayankula Printn 100*365b8f93SAnvesh-Kumar_Rayankula Redfish.Login 101*365b8f93SAnvesh-Kumar_Rayankula Get NTP Initial Status 102*365b8f93SAnvesh-Kumar_Rayankula ${old_date_time}= CLI Get BMC DateTime 103*365b8f93SAnvesh-Kumar_Rayankula ${year_status}= Run Keyword And Return Status Should Not Contain ${old_date_time} ${year_without_ntp} 104*365b8f93SAnvesh-Kumar_Rayankula Run Keyword If ${year_status} == False 105*365b8f93SAnvesh-Kumar_Rayankula ... Enable NTP And Add NTP Address 106*365b8f93SAnvesh-Kumar_Rayankula 107*365b8f93SAnvesh-Kumar_Rayankula 108*365b8f93SAnvesh-Kumar_RayankulaSuite Teardown Execution 109*365b8f93SAnvesh-Kumar_Rayankula [Documentation] Do the suite level teardown. 110*365b8f93SAnvesh-Kumar_Rayankula 111*365b8f93SAnvesh-Kumar_Rayankula Redfish.Patch ${REDFISH_NW_PROTOCOL_URI} 112*365b8f93SAnvesh-Kumar_Rayankula ... body={'NTP':{'NTPServers': ['${EMPTY}', '${EMPTY}']}} 113*365b8f93SAnvesh-Kumar_Rayankula ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 114*365b8f93SAnvesh-Kumar_Rayankula Restore NTP Status 115*365b8f93SAnvesh-Kumar_Rayankula Redfish.Logout 116