Added enable/disable control of the Network Interface Card
Implemented enable/disable function to perform
"ip link set eth(x) up"
"ip link set eth(x) down"
functionality from DBus.
Tested:
Confirmed Redfish PATCH commands on the InterfaceEnabled property
changes the NIC state. Confirmed the NIC is DOWN/UP using "ip link".
Confirmed "ip link" state changes can be obsserved from dbus-send
commands, and from Redfish GET actions.
Confirmed the link is inactive after a reboot.
Confirmed link stays down despite assigning an IP manually.
Confirmed link stays down despite enabling DHCP.
Change-Id: I4152b53055e6546f7a6ca81b5a5eef6f689bcc66
Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com>
diff --git a/ethernet_interface.hpp b/ethernet_interface.hpp
index 4a0f030..f8086a4 100644
--- a/ethernet_interface.hpp
+++ b/ethernet_interface.hpp
@@ -51,9 +51,11 @@
using DuplexMode = uint8_t;
using Autoneg = uint8_t;
using LinkUp = bool;
+using NICEnabled = bool;
using VlanId = uint32_t;
using InterfaceName = std::string;
-using InterfaceInfo = std::tuple<LinkSpeed, DuplexMode, Autoneg, LinkUp>;
+using InterfaceInfo =
+ std::tuple<LinkSpeed, DuplexMode, Autoneg, LinkUp, NICEnabled>;
using AddressMap = std::map<std::string, std::shared_ptr<IPAddress>>;
using NeighborMap = std::map<std::string, std::shared_ptr<Neighbor>>;
using VlanInterfaceMap =
@@ -158,6 +160,12 @@
/** Retrieve Link State */
bool linkUp() const override;
+ /** Retrieve NIC State */
+ bool nICEnabled() const override;
+
+ /** Set value of NICEnabled */
+ bool nICEnabled(bool value) override;
+
/** @brief sets the MAC address.
* @param[in] value - MAC address which needs to be set on the system.
* @returns macAddress of the interface or throws an error.
@@ -212,6 +220,7 @@
using EthernetInterfaceIntf::dHCPEnabled;
using EthernetInterfaceIntf::interfaceName;
using EthernetInterfaceIntf::linkUp;
+ using EthernetInterfaceIntf::nICEnabled;
using MacAddressIntf::mACAddress;
/** @brief Absolute path of the resolv conf file */