Implement network factory reset in network_manager
This commit implements a factory reset interface for the BMC
network. This factory reset is accomplished by removing any
/etc/systemd/network/*.network files, then writing new ones
configured for DHCP for each known interface.
Resolves openbmc/openbmc#1575
Change-Id: Ic006cd43fb336029479cffa783b56ab91e0339bd
Signed-off-by: Michael Tritz <mtritz@us.ibm.com>
diff --git a/network_manager.hpp b/network_manager.hpp
index f37544c..0bd082b 100644
--- a/network_manager.hpp
+++ b/network_manager.hpp
@@ -3,6 +3,7 @@
#include "ethernet_interface.hpp"
#include "types.hpp"
#include "xyz/openbmc_project/Network/VLAN/Create/server.hpp"
+#include <xyz/openbmc_project/Common/FactoryReset/server.hpp>
#include <sdbusplus/bus.hpp>
#include <ifaddrs.h>
@@ -20,12 +21,12 @@
namespace details
{
-template <typename T>
-using ServerObject = typename sdbusplus::server::object::object<T>;
+template <typename T, typename U>
+using ServerObject = typename sdbusplus::server::object::object<T, U>;
-using VLANCreateIface =
- details::ServerObject<sdbusplus::xyz::openbmc_project::
- Network::VLAN::server::Create>;
+using VLANCreateIface = details::ServerObject<
+ sdbusplus::xyz::openbmc_project::Network::VLAN::server::Create,
+ sdbusplus::xyz::openbmc_project::Common::server::FactoryReset>;
using IntfName = std::string;
@@ -85,6 +86,9 @@
/** @brief Persistent map of EthernetInterface dbus objects and their names */
std::map<IntfName, std::unique_ptr<EthernetInterface>> interfaces;
+ /** @brief BMC network reset - resets network configuration for BMC. */
+ void reset() override;
+
};
} // namespace network