Skip to content

Commit 2bccf77

Browse files
committed
OpTestConfiguration: Add OpenBMC NTP time sync
Run OpenBMC NTP Server time synchronization commands to allow synchronization between OpenBMC and op-test logging. Signed-off-by: Deb McLemore <debmc@linux.ibm.com>
1 parent 316b793 commit 2bccf77

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

OpTestConfiguration.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ def get_parser():
241241
bmcgroup.add_argument("--bmc-password", help="SSH password for BMC")
242242
bmcgroup.add_argument("--bmc-usernameipmi", help="IPMI username for BMC")
243243
bmcgroup.add_argument("--bmc-passwordipmi", help="IPMI password for BMC")
244+
bmcgroup.add_argument("--bmc-ntp-server", help="NTP Server for OpenBMC")
244245
bmcgroup.add_argument("--bmc-prompt", default="#",
245246
help="Prompt for BMC ssh session")
246247
bmcgroup.add_argument("--smc-presshipmicmd")
@@ -820,6 +821,22 @@ def objs(self):
820821
conf=self,
821822
)
822823
bmc.set_system(self.op_system)
824+
try:
825+
if self.args.bmc_ntp_server in [None, ""]:
826+
self.args.bmc_ntp_server = "216.239.35.4"
827+
bmc.run_command("busctl set-property xyz.openbmc_project.Network "
828+
"/xyz/openbmc_project/network/eth0 "
829+
"xyz.openbmc_project.Network.EthernetInterface NTPServers as 1 {}"
830+
.format(self.args.bmc_ntp_server), retry=10)
831+
OpTestLogger.optest_logger_glob.optest_logger.debug("Set Network for OpenBMC NTP server")
832+
bmc.run_command("busctl set-property xyz.openbmc_project.Settings "
833+
"/xyz/openbmc_project/time/sync_method "
834+
"xyz.openbmc_project.Time.Synchronization TimeSyncMethod s "
835+
"xyz.openbmc_project.Time.Synchronization.Method.NTP", retry=10)
836+
OpTestLogger.optest_logger_glob.optest_logger.debug("Set TimeSync for OpenBMC NTP server")
837+
except Exception as e:
838+
OpTestLogger.optest_logger_glob.optest_logger.debug("Problem encountered with setting OpenBMC NTP server,"
839+
"Exception {}".format(e))
823840
elif self.args.bmc_type in ['qemu']:
824841
print((repr(self.args)))
825842
bmc = OpTestQemu(conf=self,

0 commit comments

Comments
 (0)