Add dbus interface for sol commands
Add dbus interface for sol config parameters so that after move set/get
sol config parameter command from net-ipmid to host-ipmid, the command
can send config parameters to net-ipmid sol service through the dbus
interface.
Tested by:
busctl introspect xyz.openbmc_project.Settings /xyz/openbmc_project
/network/host0/sol can show correct dbus properties of sol parameters.
ipmitool -I lanplus -H x -U x -P x raw 0x0c 0x21 0x0e 0x00 0x01
ipmitool -I lanplus -H x -U x -P x raw 0x0c 0x21 0x0e 0x01 0x00
ipmitool -I lanplus -H x -U x -P x raw 0x0c 0x21 0x0e 0x02 0x83
ipmitool -I lanplus -H x -U x -P x raw 0x0c 0x21 0x0e 0x03 0x5 0x03
ipmitool -I lanplus -H x -U x -P x raw 0x0c 0x21 0x0e 0x04 0x5 0x03
all these commands can change the dbus properties as the value in
above commands.
Before and after run these commands, ipmitool -I lanplus -H x -U x
-P x sol activate can start sol session correctly.
After reboot BMC, "Progress" property in dbus interface change back
to 0 and other properties will not reset to default value.
Signed-off-by: Cheng C Yang <cheng.c.yang@linux.intel.com>
Change-Id: Ib441b551a1559908c427be5378ff3414693e20dd
diff --git a/sol/sol_manager.cpp b/sol/sol_manager.cpp
index a118457..8407292 100644
--- a/sol/sol_manager.cpp
+++ b/sol/sol_manager.cpp
@@ -14,6 +14,11 @@
#include <cmath>
#include <ipmid/utils.hpp>
#include <phosphor-logging/log.hpp>
+#include <sdbusplus/message/types.hpp>
+
+constexpr const char* solInterface = "xyz.openbmc_project.Ipmi.SOL";
+constexpr const char* solPath = "/xyz/openbmc_project/ipmi/sol/";
+constexpr const char* PROP_INTF = "org.freedesktop.DBus.Properties";
namespace sol
{
@@ -103,6 +108,66 @@
}
}
+void Manager::updateSOLParameter(uint8_t channelNum)
+{
+ std::variant<uint8_t, bool> value;
+ sdbusplus::bus::bus dbus(ipmid_get_sd_bus_connection());
+ static std::string solService{};
+ ipmi::PropertyMap properties;
+ std::string ethdevice = ipmi::getChannelName(channelNum);
+ std::string solPathWitheEthName = solPath + ethdevice;
+ if (solService.empty())
+ {
+ try
+ {
+ solService =
+ ipmi::getService(dbus, solInterface, solPathWitheEthName);
+ }
+ catch (const std::runtime_error& e)
+ {
+ solService.clear();
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "Error: get SOL service failed");
+ return;
+ }
+ }
+ try
+ {
+ properties = ipmi::getAllDbusProperties(
+ dbus, solService, solPathWitheEthName, solInterface);
+ }
+ catch (const std::runtime_error&)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "Error setting sol parameter");
+ return;
+ }
+
+ progress = std::get<uint8_t>(properties["Progress"]);
+
+ enable = std::get<bool>(properties["Enable"]);
+
+ forceEncrypt = std::get<bool>(properties["ForceEncryption"]);
+
+ forceAuth = std::get<bool>(properties["ForceAuthentication"]);
+
+ solMinPrivilege = static_cast<session::Privilege>(
+ std::get<uint8_t>(properties["Privilege"]));
+
+ accumulateInterval =
+ std::get<uint8_t>((properties["AccumulateIntervalMS"])) *
+ sol::accIntervalFactor * 1ms;
+
+ sendThreshold = std::get<uint8_t>(properties["Threshold"]);
+
+ retryCount = std::get<uint8_t>(properties["RetryCount"]);
+
+ retryInterval = std::get<uint8_t>(properties["RetryIntervalMS"]) *
+ sol::retryIntervalFactor * 1ms;
+
+ return;
+}
+
void Manager::startPayloadInstance(uint8_t payloadInstance,
session::SessionID sessionID)
{