Change default time mode/owner to MANUAL/BOTH
OPAL gets error on setting host time because the default time mode/owner
is NTP/BMC, which disallows host to set its time.
As discussed and requested by OPAL, change the default time mode/owner
to MANUAL/BOTH.
Change-Id: Ide55f970b66f3025f67ad2ef093a74a3c8f8b8ea
Signed-off-by: Lei YU <mine260309@gmail.com>
diff --git a/epoch_base.hpp b/epoch_base.hpp
index f31a32b..fedaeb6 100644
--- a/epoch_base.hpp
+++ b/epoch_base.hpp
@@ -38,10 +38,10 @@
sdbusplus::bus::bus& bus;
/** @brief The current time mode */
- Mode timeMode = Mode::NTP;
+ Mode timeMode = Mode::MANUAL;
/** @brief The current time owner */
- Owner timeOwner = Owner::BMC;
+ Owner timeOwner = Owner::BOTH;
/** @brief Set current time to system
*
diff --git a/test/TestBmcEpoch.cpp b/test/TestBmcEpoch.cpp
index 4661e20..f182de4 100644
--- a/test/TestBmcEpoch.cpp
+++ b/test/TestBmcEpoch.cpp
@@ -67,8 +67,9 @@
TEST_F(TestBmcEpoch, empty)
{
- EXPECT_EQ(Mode::NTP, getTimeMode());
- EXPECT_EQ(Owner::BMC, getTimeOwner());
+ // Default mode/owner is MANUAL/BOTH
+ EXPECT_EQ(Mode::MANUAL, getTimeMode());
+ EXPECT_EQ(Owner::BOTH, getTimeOwner());
}
TEST_F(TestBmcEpoch, getElapsed)
@@ -81,6 +82,7 @@
TEST_F(TestBmcEpoch, setElapsedNotAllowed)
{
+ setTimeMode(Mode::NTP);
auto epochNow = duration_cast<microseconds>(
system_clock::now().time_since_epoch()).count();
// In NTP mode, setting time is not allowed
diff --git a/test/TestHostEpoch.cpp b/test/TestHostEpoch.cpp
index 13d604d..0e59745 100644
--- a/test/TestHostEpoch.cpp
+++ b/test/TestHostEpoch.cpp
@@ -137,8 +137,9 @@
TEST_F(TestHostEpoch, empty)
{
- EXPECT_EQ(Mode::NTP, getTimeMode());
- EXPECT_EQ(Owner::BMC, getTimeOwner());
+ // Default mode/owner is MANUAL/BOTH
+ EXPECT_EQ(Mode::MANUAL, getTimeMode());
+ EXPECT_EQ(Owner::BOTH, getTimeOwner());
}
TEST_F(TestHostEpoch, readDataFileNotExist)
diff --git a/test/TestManager.cpp b/test/TestManager.cpp
index f05b863..5c9c8c3 100644
--- a/test/TestManager.cpp
+++ b/test/TestManager.cpp
@@ -67,8 +67,10 @@
EXPECT_FALSE(hostOn());
EXPECT_EQ("", getRequestedMode());
EXPECT_EQ("", getRequestedOwner());
- EXPECT_EQ(Mode::NTP, getTimeMode());
- EXPECT_EQ(Owner::BMC, getTimeOwner());
+
+ // Default mode/owner is MANUAL/BOTH
+ EXPECT_EQ(Mode::MANUAL, getTimeMode());
+ EXPECT_EQ(Owner::BOTH, getTimeOwner());
}