@@ -223,6 +223,7 @@ def get_parser():
223
223
bmcgroup .add_argument ("--bmc-password" , help = "SSH password for BMC" )
224
224
bmcgroup .add_argument ("--bmc-usernameipmi" , help = "IPMI username for BMC" )
225
225
bmcgroup .add_argument ("--bmc-passwordipmi" , help = "IPMI password for BMC" )
226
+ bmcgroup .add_argument ("--bmc-ntp-server" , help = "NTP Server for OpenBMC" )
226
227
bmcgroup .add_argument ("--bmc-prompt" , default = "#" ,
227
228
help = "Prompt for BMC ssh session" )
228
229
bmcgroup .add_argument ("--smc-presshipmicmd" )
@@ -738,6 +739,22 @@ def objs(self):
738
739
conf = self ,
739
740
)
740
741
bmc .set_system (self .op_system )
742
+ try :
743
+ if self .args .bmc_ntp_server in [None , "" ]:
744
+ self .args .bmc_ntp_server = "216.239.35.4"
745
+ bmc .run_command ("busctl set-property xyz.openbmc_project.Network "
746
+ "/xyz/openbmc_project/network/eth0 "
747
+ "xyz.openbmc_project.Network.EthernetInterface NTPServers as 1 {}"
748
+ .format (self .args .bmc_ntp_server ), retry = 10 )
749
+ OpTestLogger .optest_logger_glob .optest_logger .debug ("Set Network for OpenBMC NTP server" )
750
+ bmc .run_command ("busctl set-property xyz.openbmc_project.Settings "
751
+ "/xyz/openbmc_project/time/sync_method "
752
+ "xyz.openbmc_project.Time.Synchronization TimeSyncMethod s "
753
+ "xyz.openbmc_project.Time.Synchronization.Method.NTP" , retry = 10 )
754
+ OpTestLogger .optest_logger_glob .optest_logger .debug ("Set TimeSync for OpenBMC NTP server" )
755
+ except Exception as e :
756
+ OpTestLogger .optest_logger_glob .optest_logger .debug ("Problem encountered with setting OpenBMC NTP server,"
757
+ "Exception {}" .format (e ))
741
758
elif self .args .bmc_type in ['qemu' ]:
742
759
print (repr (self .args ))
743
760
bmc = OpTestQemu (conf = self ,
0 commit comments