Skip to content

Commit c25a5f3

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 675d88f commit c25a5f3

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
@@ -222,6 +222,7 @@ def get_parser():
222222
bmcgroup.add_argument("--bmc-password", help="SSH password for BMC")
223223
bmcgroup.add_argument("--bmc-usernameipmi", help="IPMI username for BMC")
224224
bmcgroup.add_argument("--bmc-passwordipmi", help="IPMI password for BMC")
225+
bmcgroup.add_argument("--bmc-ntp-server", help="NTP Server for OpenBMC")
225226
bmcgroup.add_argument("--bmc-prompt", default="#",
226227
help="Prompt for BMC ssh session")
227228
bmcgroup.add_argument("--smc-presshipmicmd")
@@ -697,6 +698,22 @@ def objs(self):
697698
conf=self,
698699
)
699700
bmc.set_system(self.op_system)
701+
try:
702+
if self.args.bmc_ntp_server in [None, ""]:
703+
self.args.bmc_ntp_server = "216.239.35.4"
704+
bmc.run_command("busctl set-property xyz.openbmc_project.Network "
705+
"/xyz/openbmc_project/network/eth0 "
706+
"xyz.openbmc_project.Network.EthernetInterface NTPServers as 1 {}"
707+
.format(self.args.bmc_ntp_server), retry=10)
708+
OpTestLogger.optest_logger_glob.optest_logger.debug("Set Network for OpenBMC NTP server")
709+
bmc.run_command("busctl set-property xyz.openbmc_project.Settings "
710+
"/xyz/openbmc_project/time/sync_method "
711+
"xyz.openbmc_project.Time.Synchronization TimeSyncMethod s "
712+
"xyz.openbmc_project.Time.Synchronization.Method.NTP", retry=10)
713+
OpTestLogger.optest_logger_glob.optest_logger.debug("Set TimeSync for OpenBMC NTP server")
714+
except Exception as e:
715+
OpTestLogger.optest_logger_glob.optest_logger.debug("Problem encountered with setting OpenBMC NTP server,"
716+
"Exception {}".format(e))
700717
elif self.args.bmc_type in ['qemu']:
701718
print(repr(self.args))
702719
bmc = OpTestQemu(conf=self,

0 commit comments

Comments
 (0)