Add the Drives Interface to eStorageD
This new interface will be able to send machine health information from
eStorageD to clients on dbus using phosphor dbus interfaces.
$ busctl call -j xyz.openbmc_project.ObjectMapper /xyz/openbmc_project/object_mapper xyz.openbmc_project.ObjectMapper GetSubTree sias "/xyz/openbmc_project/inventory" 0 1 "xyz.openbmc_project.Inventory.Item.Drive"
$ curl -u root:0penBmc -X GET "http://localbmc/redfish/v1/Systems/system/Storage/1/Drives/mmcblk0"
Signed-off-by: John Edward Broadbent <jebr@google.com>
Change-Id: I91facaf6d1ac0d52258fc97ba93e6f2138619073
diff --git a/src/test/estoraged_test.cpp b/src/test/estoraged_test.cpp
index 7a3286c..e77d4c6 100644
--- a/src/test/estoraged_test.cpp
+++ b/src/test/estoraged_test.cpp
@@ -48,6 +48,7 @@
const char* testPath = "/test/openbmc_project/storage/test_dev";
const char* estoragedInterface =
"xyz.openbmc_project.Inventory.Item.Volume";
+ const char* driveInterface = "xyz.openbmc_project.Inventory.Item.Drive";
sdbusplus::bus::bus bus;
std::string passwordString;
std::vector<uint8_t> password;
@@ -76,6 +77,11 @@
.WillRepeatedly(Return(0));
EXPECT_CALL(sdbusMock,
+ sd_bus_add_object_vtable(IsNull(), _, StrEq(testPath),
+ StrEq(driveInterface), _, _))
+ .WillRepeatedly(Return(0));
+
+ EXPECT_CALL(sdbusMock,
sd_bus_emit_object_added(IsNull(), StrEq(testPath)))
.WillRepeatedly(Return(0));
@@ -105,6 +111,11 @@
TEST_F(EStoragedTest, FormatPass)
{
EXPECT_CALL(sdbusMock,
+ sd_bus_emit_properties_changed_strv(IsNull(), StrEq(testPath),
+ StrEq(driveInterface), _))
+ .WillRepeatedly(Return(0));
+
+ EXPECT_CALL(sdbusMock,
sd_bus_emit_properties_changed_strv(
IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
.WillRepeatedly(Return(0));
@@ -155,6 +166,11 @@
TEST_F(EStoragedTest, MountPointExistsPass)
{
EXPECT_CALL(sdbusMock,
+ sd_bus_emit_properties_changed_strv(IsNull(), StrEq(testPath),
+ StrEq(driveInterface), _))
+ .WillRepeatedly(Return(0));
+
+ EXPECT_CALL(sdbusMock,
sd_bus_emit_properties_changed_strv(
IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
.WillRepeatedly(Return(0));
@@ -229,6 +245,11 @@
TEST_F(EStoragedTest, AddKeyslotFail)
{
EXPECT_CALL(sdbusMock,
+ sd_bus_emit_properties_changed_strv(IsNull(), StrEq(testPath),
+ StrEq(driveInterface), _))
+ .WillRepeatedly(Return(0));
+
+ EXPECT_CALL(sdbusMock,
sd_bus_emit_properties_changed_strv(
IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
.WillRepeatedly(Return(0));
@@ -247,6 +268,11 @@
TEST_F(EStoragedTest, LoadLuksHeaderFail)
{
EXPECT_CALL(sdbusMock,
+ sd_bus_emit_properties_changed_strv(IsNull(), StrEq(testPath),
+ StrEq(driveInterface), _))
+ .WillRepeatedly(Return(0));
+
+ EXPECT_CALL(sdbusMock,
sd_bus_emit_properties_changed_strv(
IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
.WillRepeatedly(Return(0));
@@ -267,6 +293,11 @@
TEST_F(EStoragedTest, ActivateFail)
{
EXPECT_CALL(sdbusMock,
+ sd_bus_emit_properties_changed_strv(IsNull(), StrEq(testPath),
+ StrEq(driveInterface), _))
+ .WillRepeatedly(Return(0));
+
+ EXPECT_CALL(sdbusMock,
sd_bus_emit_properties_changed_strv(
IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
.WillRepeatedly(Return(0));
@@ -290,6 +321,11 @@
TEST_F(EStoragedTest, CreateFilesystemFail)
{
EXPECT_CALL(sdbusMock,
+ sd_bus_emit_properties_changed_strv(IsNull(), StrEq(testPath),
+ StrEq(driveInterface), _))
+ .WillRepeatedly(Return(0));
+
+ EXPECT_CALL(sdbusMock,
sd_bus_emit_properties_changed_strv(
IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
.WillRepeatedly(Return(0));
@@ -315,6 +351,11 @@
TEST_F(EStoragedTest, CreateMountPointFail)
{
EXPECT_CALL(sdbusMock,
+ sd_bus_emit_properties_changed_strv(IsNull(), StrEq(testPath),
+ StrEq(driveInterface), _))
+ .WillRepeatedly(Return(0));
+
+ EXPECT_CALL(sdbusMock,
sd_bus_emit_properties_changed_strv(
IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
.WillRepeatedly(Return(0));
@@ -346,6 +387,11 @@
TEST_F(EStoragedTest, MountFail)
{
EXPECT_CALL(sdbusMock,
+ sd_bus_emit_properties_changed_strv(IsNull(), StrEq(testPath),
+ StrEq(driveInterface), _))
+ .WillRepeatedly(Return(0));
+
+ EXPECT_CALL(sdbusMock,
sd_bus_emit_properties_changed_strv(
IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
.WillRepeatedly(Return(0));
@@ -385,6 +431,11 @@
TEST_F(EStoragedTest, UnmountFail)
{
EXPECT_CALL(sdbusMock,
+ sd_bus_emit_properties_changed_strv(IsNull(), StrEq(testPath),
+ StrEq(driveInterface), _))
+ .WillRepeatedly(Return(0));
+
+ EXPECT_CALL(sdbusMock,
sd_bus_emit_properties_changed_strv(
IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
.WillRepeatedly(Return(0));
@@ -426,6 +477,11 @@
TEST_F(EStoragedTest, RemoveMountPointFail)
{
EXPECT_CALL(sdbusMock,
+ sd_bus_emit_properties_changed_strv(IsNull(), StrEq(testPath),
+ StrEq(driveInterface), _))
+ .WillRepeatedly(Return(0));
+
+ EXPECT_CALL(sdbusMock,
sd_bus_emit_properties_changed_strv(
IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
.WillRepeatedly(Return(0));
@@ -471,6 +527,11 @@
TEST_F(EStoragedTest, DeactivateFail)
{
EXPECT_CALL(sdbusMock,
+ sd_bus_emit_properties_changed_strv(IsNull(), StrEq(testPath),
+ StrEq(driveInterface), _))
+ .WillRepeatedly(Return(0));
+
+ EXPECT_CALL(sdbusMock,
sd_bus_emit_properties_changed_strv(
IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
.WillRepeatedly(Return(0));