network_manager: Allow direct access to interfaces
Change-Id: I3dc2bb944b8d3a7873e26ce2958a2cb1d9be95af
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/test/mock_network_manager.hpp b/test/mock_network_manager.hpp
index 559a667..af26771 100644
--- a/test/mock_network_manager.hpp
+++ b/test/mock_network_manager.hpp
@@ -26,7 +26,7 @@
{
// clear all the interfaces first
interfaces.clear();
- auto interfaceStrList = getInterfaces();
+ auto interfaceStrList = getSystemInterfaces();
for (auto& interface : interfaceStrList)
{
fs::path objPath = objectPath;
diff --git a/test/test_network_manager.cpp b/test/test_network_manager.cpp
index 4e81d48..3d4cee8 100644
--- a/test/test_network_manager.cpp
+++ b/test/test_network_manager.cpp
@@ -56,8 +56,9 @@
// Now create the interfaces which will call the mocked getifaddrs
// which returns the above interface detail.
createInterfaces();
- EXPECT_EQ(1, manager.getInterfaceCount());
- EXPECT_EQ(true, manager.hasInterface("igb1"));
+ EXPECT_EQ(1, manager.getInterfaces().size());
+ EXPECT_NE(manager.getInterfaces().end(),
+ manager.getInterfaces().find("igb1"));
}
// getifaddrs returns two interfaces.
@@ -72,9 +73,11 @@
mock_addIP("igb1", "192.0.2.3", "255.255.255.128", IFF_UP | IFF_RUNNING);
createInterfaces();
- EXPECT_EQ(2, manager.getInterfaceCount());
- EXPECT_EQ(true, manager.hasInterface("igb0"));
- EXPECT_EQ(true, manager.hasInterface("igb1"));
+ EXPECT_EQ(2, manager.getInterfaces().size());
+ EXPECT_NE(manager.getInterfaces().end(),
+ manager.getInterfaces().find("igb0"));
+ EXPECT_NE(manager.getInterfaces().end(),
+ manager.getInterfaces().find("igb1"));
}
} // namespace network
} // namespace phosphor