update return type of getDHCPEnabled function
In the phosphor-dbus-interfaces, the DHCPEnabled property has been
changed from bool to enum type. Therefore, the getDHCPEnabled function
has to be updated to adapt to phosphor-dbus-interfaces.
Tested:
1. Request to active dhcp successfully
$ipmitool dcmi set_conf_param activate_dhcp
Change-Id: I0cd2ce3ab78c3e4d2f376a99ab1ebf33b0ea39d3
Signed-off-by: Thang Tran <thuutran@amperecomputing.com>
diff --git a/dcmihandler.cpp b/dcmihandler.cpp
index 3fd976f..f06441b 100644
--- a/dcmihandler.cpp
+++ b/dcmihandler.cpp
@@ -15,8 +15,11 @@
#include <sdbusplus/bus.hpp>
#include <variant>
#include <xyz/openbmc_project/Common/error.hpp>
+#include <xyz/openbmc_project/Network/EthernetInterface/server.hpp>
using namespace phosphor::logging;
+using sdbusplus::xyz::openbmc_project::Network::server::EthernetInterface;
+
using InternalFailure =
sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
@@ -245,7 +248,7 @@
return std::get<std::string>(value);
}
-bool getDHCPEnabled()
+EthernetInterface::DHCPConf getDHCPEnabled()
{
sdbusplus::bus_t bus{ipmid_get_sd_bus_connection()};
@@ -256,7 +259,8 @@
auto value = ipmi::getDbusProperty(bus, service, ethernetObj.first,
ethernetIntf, "DHCPEnabled");
- return std::get<bool>(value);
+ return EthernetInterface::convertDHCPConfFromString(
+ std::get<std::string>(value));
}
bool getDHCPOption(std::string prop)
@@ -1050,7 +1054,8 @@
case dcmi::DCMIConfigParameters::ActivateDHCP:
if ((requestData->data[0] & DCMI_ACTIVATE_DHCP_MASK) &&
- dcmi::getDHCPEnabled())
+ (dcmi::getDHCPEnabled() !=
+ EthernetInterface::DHCPConf::none))
{
// When these conditions are met we have to trigger DHCP
// protocol restart using the latest parameter settings, but