Skip to content

Commit

Permalink
OpTestConfiguration: Add OpenBMC NTP time sync
Browse files Browse the repository at this point in the history
Run OpenBMC NTP Server time synchronization commands to allow
synchronization between OpenBMC and op-test logging.

Signed-off-by: Deb McLemore <[email protected]>
  • Loading branch information
debmc committed Nov 6, 2019
1 parent df8dbf8 commit 6754eb6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions OpTestConfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ def get_parser():
bmcgroup.add_argument("--bmc-password", help="SSH password for BMC")
bmcgroup.add_argument("--bmc-usernameipmi", help="IPMI username for BMC")
bmcgroup.add_argument("--bmc-passwordipmi", help="IPMI password for BMC")
bmcgroup.add_argument("--bmc-ntp-server", help="NTP Server for OpenBMC")
bmcgroup.add_argument("--bmc-prompt", default="#",
help="Prompt for BMC ssh session")
bmcgroup.add_argument("--smc-presshipmicmd")
Expand Down Expand Up @@ -832,6 +833,22 @@ def objs(self):
conf=self,
)
bmc.set_system(self.op_system)
try:
if self.args.bmc_ntp_server in [None, ""]:
self.args.bmc_ntp_server = "216.239.35.4"
bmc.run_command("busctl set-property xyz.openbmc_project.Network "
"/xyz/openbmc_project/network/eth0 "
"xyz.openbmc_project.Network.EthernetInterface NTPServers as 1 {}"
.format(self.args.bmc_ntp_server), retry=10)
OpTestLogger.optest_logger_glob.optest_logger.debug("Set Network for OpenBMC NTP server")
bmc.run_command("busctl set-property xyz.openbmc_project.Settings "
"/xyz/openbmc_project/time/sync_method "
"xyz.openbmc_project.Time.Synchronization TimeSyncMethod s "
"xyz.openbmc_project.Time.Synchronization.Method.NTP", retry=10)
OpTestLogger.optest_logger_glob.optest_logger.debug("Set TimeSync for OpenBMC NTP server")
except Exception as e:
OpTestLogger.optest_logger_glob.optest_logger.debug("Problem encountered with setting OpenBMC NTP server,"
"Exception {}".format(e))
elif self.args.bmc_type in ['qemu']:
print((repr(self.args)))
bmc = OpTestQemu(conf=self,
Expand Down

0 comments on commit 6754eb6

Please sign in to comment.