system_queries: Get Interface Info from netlink
This reduces all of the interface information probing down to a single
netlink request for all the label + mac information needed to build an
ethernet interface.
If we ever plumb the ethernet stats into dbus, we can get that
information with this same netlink code.
Change-Id: Ied8a73639dcd74bcfecda392905638573ab7970f
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/test/test_ethernet_interface.cpp b/test/test_ethernet_interface.cpp
index ace2b1d..e65d03c 100644
--- a/test/test_ethernet_interface.cpp
+++ b/test/test_ethernet_interface.cpp
@@ -2,6 +2,7 @@
#include "ipaddress.hpp"
#include "mock_network_manager.hpp"
#include "mock_syscall.hpp"
+#include "system_queries.hpp"
#include "util.hpp"
#include <arpa/inet.h>
@@ -45,7 +46,8 @@
{
mock_clear();
mock_addIF("test0", /*idx=*/1);
- return {bus, manager, getInterfaceInfo("test0"),
+ return {bus, manager,
+ system::InterfaceInfo{.idx = 1, .flags = 0, .name = "test0"},
"/xyz/openbmc_test/network"sv, config::Parser()};
}
@@ -113,7 +115,12 @@
constexpr unsigned mtu = 150;
mock_addIF("test1", idx, IFF_RUNNING, mac, mtu);
- MockEthernetInterface intf(bus, manager, getInterfaceInfo("test1"),
+ MockEthernetInterface intf(bus, manager,
+ system::InterfaceInfo{.idx = idx,
+ .flags = IFF_RUNNING,
+ .name = "test1",
+ .mac = mac,
+ .mtu = mtu},
"/xyz/openbmc_test/network"sv, config::Parser());
EXPECT_EQ(mtu, intf.mtu());