Shift to boost asio library
This commit shifts vpd manager from sdbusplus event loop to
boost io_context event loop.
The shift was done to have a more flexible way to perform
async Dbus calls.
For example read/write of vpd data can be performed
asynchronously.
It also removes dependency of Manager class on the interface
class created as a part of Phosphor-Dbus-Interface repo.
Test:
- Introspect com.ibm.VPD.Manager /com/ibm/VPD/Manager to ensure
that all the methods exposed under com.ibm.VPD.Manager interface
matches to the ones documented under PDI repo.
- Make DBus call to each of the exposed api to ensure that the
funcation calls are working fine.
-To ensure bios handler call back is working.
Stop vpd-manager service.
Stop pldm service.
Start vpd-manager service
Start pldm service.
Should recieve callback.
-To ensure gpio call back
std::cout were added to callback function being trigerred on
timer expiration and the same were verified in journal.
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
Change-Id: I00640f64de487d5244e8be2e7a3f3d63a013644e
diff --git a/vpd-manager/bios_handler.cpp b/vpd-manager/bios_handler.cpp
index 4271665..d4a5330 100644
--- a/vpd-manager/bios_handler.cpp
+++ b/vpd-manager/bios_handler.cpp
@@ -29,7 +29,7 @@
// the signal handler, call restoreBIOSAttribs
static std::shared_ptr<sdbusplus::bus::match_t> nameOwnerMatch =
std::make_shared<sdbusplus::bus::match_t>(
- bus,
+ *conn,
sdbusplus::bus::match::rules::nameOwnerChanged(
"xyz.openbmc_project.PLDM"),
[this](sdbusplus::message_t& msg) {
@@ -86,7 +86,7 @@
{
static std::shared_ptr<sdbusplus::bus::match_t> biosMatcher =
std::make_shared<sdbusplus::bus::match_t>(
- bus,
+ *conn,
sdbusplus::bus::match::rules::propertiesChanged(
"/xyz/openbmc_project/bios_config/manager",
"xyz.openbmc_project.BIOSConfig.Manager"),
diff --git a/vpd-manager/bios_handler.hpp b/vpd-manager/bios_handler.hpp
index 985daa7..dda120c 100644
--- a/vpd-manager/bios_handler.hpp
+++ b/vpd-manager/bios_handler.hpp
@@ -4,24 +4,9 @@
#include <stdint.h>
+#include <sdbusplus/asio/connection.hpp>
#include <string>
-namespace sdbusplus
-{
-namespace bus
-{
-class bus;
-} // namespace bus
-} // namespace sdbusplus
-
-namespace sdbusplus
-{
-namespace message
-{
-class message;
-} // namespace message
-} // namespace sdbusplus
-
namespace openpower
{
namespace vpd
@@ -55,8 +40,10 @@
BiosHandler& operator=(BiosHandler&&) = delete;
~BiosHandler() = default;
- BiosHandler(sdbusplus::bus_t& bus, Manager& manager) :
- bus(bus), manager(manager)
+ BiosHandler(std::shared_ptr<sdbusplus::asio::connection>& conn,
+ Manager& manager) :
+ conn(conn),
+ manager(manager)
{
checkAndListenPLDMService();
}
@@ -254,9 +241,9 @@
void restoreBIOSAttribs();
/**
- * @brief Reference to the bus.
+ * @brief Reference to the connection.
*/
- sdbusplus::bus_t& bus;
+ std::shared_ptr<sdbusplus::asio::connection>& conn;
/**
* @brief Reference to the manager.
diff --git a/vpd-manager/gpioMonitor.cpp b/vpd-manager/gpioMonitor.cpp
index 69d5e60..1affa62 100644
--- a/vpd-manager/gpioMonitor.cpp
+++ b/vpd-manager/gpioMonitor.cpp
@@ -3,19 +3,12 @@
#include "common_utility.hpp"
#include "ibm_vpd_utils.hpp"
-#include <systemd/sd-event.h>
-
-#include <chrono>
+#include <boost/asio.hpp>
+#include <boost/bind/bind.hpp>
#include <gpiod.hpp>
-#include <sdeventplus/clock.hpp>
-#include <sdeventplus/utility/timer.hpp>
using namespace std;
using namespace openpower::vpd::constants;
-using sdeventplus::ClockId;
-using sdeventplus::Event;
-using Timer = sdeventplus::utility::Timer<ClockId::Monotonic>;
-using namespace std::chrono_literals;
namespace openpower
{
@@ -44,7 +37,8 @@
return gpioData;
}
-void GpioMonitor::initGpioInfos(Event& event)
+void GpioMonitor::initGpioInfos(
+ std::shared_ptr<boost::asio::io_context>& ioContext)
{
Byte outputValue = 0;
Byte presenceValue = 0;
@@ -105,7 +99,7 @@
make_shared<GpioEventHandler>(
presencePinName, presenceValue, outputPinName,
outputValue, devNameAddr, driverType, busType,
- objectPath, event);
+ objectPath, ioContext);
gpioObjects.push_back(gpioObj);
}
@@ -161,20 +155,43 @@
executeCmd(cmnd);
}
-void GpioEventHandler::doEventAndTimerSetup(sdeventplus::Event& event)
+void GpioEventHandler::handleTimerExpiry(
+ const boost::system::error_code& ec,
+ std::shared_ptr<boost::asio::steady_timer>& timer)
+{
+ if (ec == boost::asio::error::operation_aborted)
+ {
+ return;
+ }
+
+ if (ec)
+ {
+ std::cerr << "Timer wait failed for gpio pin" << ec.message();
+ return;
+ }
+
+ if (hasEventOccurred())
+ {
+ toggleGpio();
+ }
+ timer->expires_at(std::chrono::steady_clock::now() +
+ std::chrono::seconds(5));
+ timer->async_wait(boost::bind(&GpioEventHandler::handleTimerExpiry, this,
+ boost::asio::placeholders::error, timer));
+}
+
+void GpioEventHandler::doEventAndTimerSetup(
+ std::shared_ptr<boost::asio::io_context>& ioContext)
{
prevPresPinValue = getPresencePinValue();
- static vector<shared_ptr<Timer>> timers;
- shared_ptr<Timer> timer = make_shared<Timer>(
- event,
- [this](Timer&) {
- if (hasEventOccurred())
- {
- toggleGpio();
- }
- },
- std::chrono::seconds{5s});
+ static vector<std::shared_ptr<boost::asio::steady_timer>> timers;
+
+ auto timer = make_shared<boost::asio::steady_timer>(
+ *ioContext, std::chrono::seconds(5));
+
+ timer->async_wait(boost::bind(&GpioEventHandler::handleTimerExpiry, this,
+ boost::asio::placeholders::error, timer));
timers.push_back(timer);
}
diff --git a/vpd-manager/gpioMonitor.hpp b/vpd-manager/gpioMonitor.hpp
index 66c049d..58fbf91 100644
--- a/vpd-manager/gpioMonitor.hpp
+++ b/vpd-manager/gpioMonitor.hpp
@@ -1,8 +1,9 @@
#pragma once
+#include "types.hpp"
-#include "manager.hpp"
-
-#include <sdeventplus/event.hpp>
+#include <boost/asio/steady_timer.hpp>
+#include <nlohmann/json.hpp>
+#include <sdbusplus/asio/connection.hpp>
namespace openpower
{
@@ -29,13 +30,13 @@
GpioEventHandler(std::string& presPin, Byte& presValue, std::string& outPin,
Byte& outValue, std::string& devAddr, std::string& driver,
std::string& bus, std::string& objPath,
- sdeventplus::Event& event) :
+ std::shared_ptr<boost::asio::io_context>& ioCon) :
presencePin(presPin),
presenceValue(presValue), outputPin(outPin), outputValue(outValue),
devNameAddr(devAddr), driverType(driver), busType(bus),
objectPath(objPath)
{
- doEventAndTimerSetup(event);
+ doEventAndTimerSetup(ioCon);
}
private:
@@ -88,11 +89,20 @@
/** @brief This function runs a timer , which keeps checking for if an event
* happened, if event occured then takes action.
- * @param[in] timer- Shared pointer of Timer to do event setup for each
- * object.
- * @param[in] event- Event which needs to be tagged with the timer.
+ *
+ * @param[in] ioContext - Pointer to io context object.
*/
- void doEventAndTimerSetup(sdeventplus::Event& event);
+ void doEventAndTimerSetup(
+ std::shared_ptr<boost::asio::io_context>& ioContext);
+
+ /**
+ * @brief Api to handle timer expiry.
+ *
+ * @param ec - Error code.
+ * @param timer - Pointer to timer object.
+ */
+ void handleTimerExpiry(const boost::system::error_code& ec,
+ std::shared_ptr<boost::asio::steady_timer>& timer);
};
/** @class GpioMonitor
@@ -109,9 +119,11 @@
GpioMonitor(GpioMonitor&&) = delete;
GpioMonitor& operator=(GpioMonitor&&) = delete;
- GpioMonitor(nlohmann::json& js, sdeventplus::Event& event) : jsonFile(js)
+ GpioMonitor(nlohmann::json& js,
+ std::shared_ptr<boost::asio::io_context>& ioCon) :
+ jsonFile(js)
{
- initGpioInfos(event);
+ initGpioInfos(ioCon);
}
private:
@@ -122,14 +134,10 @@
/** @brief This function will extract the gpio informations from vpd json
* and store it in GpioEventHandler's private variables
- * @param[in] gpioObj - shared object to initialise it's data and it's
- * Timer setup
- * @param[in] requestedGpioPin - Which GPIO's informations need to be
- * stored
- * @param[in] timer - shared object of timer to do the event setup
- * @param[in] event - event to be tagged with timer.
+ *
+ * @param[in] ioContext - Pointer to io context object.
*/
- void initGpioInfos(sdeventplus::Event& event);
+ void initGpioInfos(std::shared_ptr<boost::asio::io_context>& ioContext);
};
} // namespace manager
diff --git a/vpd-manager/manager.cpp b/vpd-manager/manager.cpp
index cf20b0a..23e6290 100644
--- a/vpd-manager/manager.cpp
+++ b/vpd-manager/manager.cpp
@@ -2,10 +2,8 @@
#include "manager.hpp"
-#include "bios_handler.hpp"
#include "common_utility.hpp"
#include "editor_impl.hpp"
-#include "gpioMonitor.hpp"
#include "ibm_vpd_utils.hpp"
#include "ipz_parser.hpp"
#include "parser_factory.hpp"
@@ -15,7 +13,6 @@
#include <filesystem>
#include <phosphor-logging/elog-errors.hpp>
-using namespace openpower::vpd::manager;
using namespace openpower::vpd::constants;
using namespace openpower::vpd::inventory;
using namespace openpower::vpd::manager::editor;
@@ -33,16 +30,49 @@
{
namespace manager
{
-Manager::Manager(sdbusplus::bus_t&& bus, const char* busName,
- const char* objPath, const char* /*iFace*/) :
- ServerObject<ManagerIface>(bus, objPath),
- _bus(std::move(bus)), _manager(_bus, objPath)
+Manager::Manager(std::shared_ptr<boost::asio::io_context>& ioCon,
+ std::shared_ptr<sdbusplus::asio::dbus_interface>& iFace,
+ std::shared_ptr<sdbusplus::asio::connection>& conn) :
+ ioContext(ioCon),
+ interface(iFace), conn(conn)
{
- _bus.request_name(busName);
+ interface->register_method(
+ "WriteKeyword",
+ [this](const sdbusplus::message::object_path& path,
+ const std::string& recordName, const std::string& keyword,
+ const Binary& value) {
+ this->writeKeyword(path, recordName, keyword, value);
+ });
+
+ interface->register_method(
+ "GetFRUsByUnexpandedLocationCode",
+ [this](const std::string& locationCode,
+ const uint16_t nodeNumber) -> inventory::ListOfPaths {
+ return this->getFRUsByUnexpandedLocationCode(locationCode,
+ nodeNumber);
+ });
+
+ interface->register_method(
+ "GetFRUsByExpandedLocationCode",
+ [this](const std::string& locationCode) -> inventory::ListOfPaths {
+ return this->getFRUsByExpandedLocationCode(locationCode);
+ });
+
+ interface->register_method(
+ "GetExpandedLocationCode",
+ [this](const std::string& locationCode,
+ const uint16_t nodeNumber) -> std::string {
+ return this->getExpandedLocationCode(locationCode, nodeNumber);
+ });
+
+ interface->register_method("PerformVPDRecollection",
+ [this]() { this->performVPDRecollection(); });
+
sd_bus_default(&sdBus);
+ initManager();
}
-void Manager::run()
+void Manager::initManager()
{
try
{
@@ -52,14 +82,10 @@
listenAssetTag();
// Create an instance of the BIOS handler
- BiosHandler biosHandler{_bus, *this};
+ biosHandler = std::make_shared<BiosHandler>(conn, *this);
- auto event = sdeventplus::Event::get_default();
- GpioMonitor gpioMon1(jsonFile, event);
-
- _bus.attach_event(event.get(), SD_EVENT_PRIORITY_IMPORTANT);
- cout << "VPD manager event loop started\n";
- event.loop();
+ // instantiate gpioMonitor class
+ gpioMon = std::make_shared<GpioMonitor>(jsonFile, ioContext);
}
catch (const std::exception& e)
{
@@ -169,7 +195,7 @@
{
static std::shared_ptr<sdbusplus::bus::match_t> hostState =
std::make_shared<sdbusplus::bus::match_t>(
- _bus,
+ *conn,
sdbusplus::bus::match::rules::propertiesChanged(
"/xyz/openbmc_project/state/host0",
"xyz.openbmc_project.State.Host"),
@@ -239,7 +265,7 @@
{
static std::shared_ptr<sdbusplus::bus::match_t> assetMatcher =
std::make_shared<sdbusplus::bus::match_t>(
- _bus,
+ *conn,
sdbusplus::bus::match::rules::propertiesChanged(
"/xyz/openbmc_project/inventory/system",
"xyz.openbmc_project.Inventory.Decorator.AssetTag"),
@@ -342,9 +368,9 @@
}
}
-void Manager::writeKeyword(const sdbusplus::message::object_path path,
- const std::string recordName,
- const std::string keyword, const Binary value)
+void Manager::writeKeyword(const sdbusplus::message::object_path& path,
+ const std::string& recordName,
+ const std::string& keyword, const Binary& value)
{
try
{
@@ -410,7 +436,7 @@
}
ListOfPaths
- Manager::getFRUsByUnexpandedLocationCode(const LocationCode locationCode,
+ Manager::getFRUsByUnexpandedLocationCode(const LocationCode& locationCode,
const NodeNumber nodeNumber)
{
ReaderImpl read;
@@ -418,13 +444,13 @@
}
ListOfPaths
- Manager::getFRUsByExpandedLocationCode(const LocationCode locationCode)
+ Manager::getFRUsByExpandedLocationCode(const LocationCode& locationCode)
{
ReaderImpl read;
return read.getFRUsByExpandedLocationCode(locationCode, fruLocationCode);
}
-LocationCode Manager::getExpandedLocationCode(const LocationCode locationCode,
+LocationCode Manager::getExpandedLocationCode(const LocationCode& locationCode,
const NodeNumber nodeNumber)
{
ReaderImpl read;
diff --git a/vpd-manager/manager.hpp b/vpd-manager/manager.hpp
index 4992801..12fc1d4 100644
--- a/vpd-manager/manager.hpp
+++ b/vpd-manager/manager.hpp
@@ -1,19 +1,11 @@
#pragma once
+#include "bios_handler.hpp"
#include "editor_impl.hpp"
-#include "types.hpp"
+#include "gpioMonitor.hpp"
-#include <com/ibm/VPD/Manager/server.hpp>
#include <map>
-#include <nlohmann/json.hpp>
-
-namespace sdbusplus
-{
-namespace bus
-{
-class bus;
-}
-} // namespace sdbusplus
+#include <sdbusplus/asio/object_server.hpp>
namespace openpower
{
@@ -22,18 +14,12 @@
namespace manager
{
-template <typename T>
-using ServerObject = T;
-
-using ManagerIface = sdbusplus::com::ibm::VPD::server::Manager;
-
/** @class Manager
* @brief OpenBMC VPD Manager implementation.
*
- * A concrete implementation for the
- * com.ibm.vpd.Manager
+ * Implements methods under interface com.ibm.vpd.Manager.
*/
-class Manager : public ServerObject<ManagerIface>
+class Manager
{
public:
/* Define all of the basic class operations:
@@ -54,14 +40,14 @@
sd_bus_unref(sdBus);
}
- /** @brief Constructor to put object onto bus at a dbus path.
- * @param[in] bus - Bus connection.
- * @param[in] busName - Name to be requested on Bus
- * @param[in] objPath - Path to attach at.
- * @param[in] iFace - interface to implement
+ /** @brief Constructor.
+ * @param[in] ioCon - IO context.
+ * @param[in] iFace - interface to implement.
+ * @param[in] connection - Dbus Connection.
*/
- Manager(sdbusplus::bus_t&& bus, const char* busName, const char* objPath,
- const char* iFace);
+ Manager(std::shared_ptr<boost::asio::io_context>& ioCon,
+ std::shared_ptr<sdbusplus::asio::dbus_interface>& iFace,
+ std::shared_ptr<sdbusplus::asio::connection>& conn);
/** @brief Implementation for WriteKeyword
* Api to update the keyword value for a given inventory.
@@ -72,9 +58,9 @@
* @param[in] keyword - keyword whose value needs to be updated
* @param[in] value - value that needs to be updated
*/
- void writeKeyword(const sdbusplus::message::object_path path,
- const std::string recordName, const std::string keyword,
- const Binary value);
+ void writeKeyword(const sdbusplus::message::object_path& path,
+ const std::string& recordName, const std::string& keyword,
+ const Binary& value);
/** @brief Implementation for GetFRUsByUnexpandedLocationCode
* A method to get list of FRU D-BUS object paths for a given unexpanded
@@ -89,7 +75,7 @@
* List of all the FRUs D-Bus object paths for the given location code.
*/
inventory::ListOfPaths
- getFRUsByUnexpandedLocationCode(const std::string locationCode,
+ getFRUsByUnexpandedLocationCode(const std::string& locationCode,
const uint16_t nodeNumber);
/** @brief Implementation for GetFRUsByExpandedLocationCode
@@ -103,7 +89,7 @@
* List of all the FRUs D-Bus object path for the given location code.
*/
inventory::ListOfPaths
- getFRUsByExpandedLocationCode(const std::string locationCode);
+ getFRUsByExpandedLocationCode(const std::string& locationCode);
/** @brief Implementation for GetExpandedLocationCode
* An API to get expanded location code corresponding to a given
@@ -115,12 +101,9 @@
*
* @return locationCode[std::string] - Location code in expanded format.
*/
- std::string getExpandedLocationCode(const std::string locationCode,
+ std::string getExpandedLocationCode(const std::string& locationCode,
const uint16_t nodeNumber);
- /** @brief Start processing DBus messages. */
- void run();
-
/** @brief Api to perform VPD recollection.
* This api will trigger parser to perform VPD recollection for FRUs that
* can be replaced at standby.
@@ -128,6 +111,11 @@
void performVPDRecollection();
private:
+ /**
+ * @brief An api to process some initial requirements.
+ */
+ void initManager();
+
/** @brief process the given JSON file
*/
void processJSON();
@@ -169,11 +157,14 @@
*/
void checkEssentialFrus();
- /** @brief Persistent sdbusplus DBus bus connection. */
- sdbusplus::bus_t _bus;
+ // Shared pointer to asio context object.
+ std::shared_ptr<boost::asio::io_context>& ioContext;
- /** @brief sdbusplus org.freedesktop.DBus.ObjectManager reference. */
- sdbusplus::server::manager_t _manager;
+ // Shared pointer to Dbus interface class.
+ std::shared_ptr<sdbusplus::asio::dbus_interface>& interface;
+
+ // Shared pointer to bus connection.
+ std::shared_ptr<sdbusplus::asio::connection>& conn;
// file to store parsed json
nlohmann::json jsonFile;
@@ -188,6 +179,12 @@
// map to hold FRUs which can be replaced at standby
inventory::ReplaceableFrus replaceableFrus;
+ // Shared pointer to gpio monitor object.
+ std::shared_ptr<GpioMonitor> gpioMon;
+
+ // Shared pointer to instance of the BIOS handler.
+ std::shared_ptr<BiosHandler> biosHandler;
+
// List of FRUs marked as essential in the system.
inventory::EssentialFrus essentialFrus;
diff --git a/vpd-manager/manager_main.cpp b/vpd-manager/manager_main.cpp
index fce02b4..bf8c0d9 100644
--- a/vpd-manager/manager_main.cpp
+++ b/vpd-manager/manager_main.cpp
@@ -2,18 +2,29 @@
#include "manager.hpp"
-#include <cstdlib>
-#include <exception>
-#include <iostream>
-#include <sdbusplus/bus.hpp>
+#include <sdbusplus/asio/connection.hpp>
int main(int /*argc*/, char** /*argv*/)
{
try
{
- openpower::vpd::manager::Manager vpdManager(
- sdbusplus::bus::new_system(), BUSNAME, OBJPATH, IFACE);
- vpdManager.run();
+ auto io_con = std::make_shared<boost::asio::io_context>();
+ auto connection =
+ std::make_shared<sdbusplus::asio::connection>(*io_con);
+ connection->request_name(BUSNAME);
+
+ auto server = sdbusplus::asio::object_server(connection);
+
+ std::shared_ptr<sdbusplus::asio::dbus_interface> interface =
+ server.add_interface(OBJPATH, IFACE);
+
+ auto vpdManager = std::make_shared<openpower::vpd::manager::Manager>(
+ io_con, interface, connection);
+ interface->initialize();
+
+ // Start event loop.
+ io_con->run();
+
exit(EXIT_SUCCESS);
}
catch (const std::exception& e)
diff --git a/vpd-manager/meson.build b/vpd-manager/meson.build
index 772b3c4..74bc567 100644
--- a/vpd-manager/meson.build
+++ b/vpd-manager/meson.build
@@ -1,12 +1,10 @@
systemd = dependency('libsystemd', version: '>= 221')
-phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
sdeventplus = dependency('sdeventplus')
configuration_inc = include_directories('.', '../', '../vpd-parser/')
vpd_manager_SOURCES =['manager_main.cpp',
'manager.cpp',
- 'server.cpp',
'error.cpp',
'editor_impl.cpp',
'reader_impl.cpp',
@@ -21,10 +19,8 @@
'../vpd-parser/parser_factory.cpp'
]
-vpd_manager_dependencies =[sdbusplus,
- phosphor_logging,
+vpd_manager_dependencies =[phosphor_logging,
systemd,
- phosphor_dbus_interfaces,
libgpiodcxx,
sdeventplus,
]
diff --git a/vpd-manager/server.cpp b/vpd-manager/server.cpp
deleted file mode 100644
index 14d2151..0000000
--- a/vpd-manager/server.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-#include <algorithm>
-#include <com/ibm/VPD/Manager/server.hpp>
-#include <com/ibm/VPD/error.hpp>
-#include <map>
-#include <sdbusplus/exception.hpp>
-#include <sdbusplus/sdbus.hpp>
-#include <sdbusplus/sdbuspp_support/server.hpp>
-#include <sdbusplus/server.hpp>
-#include <string>
-#include <tuple>
-#include <xyz/openbmc_project/Common/error.hpp>
-
-namespace sdbusplus
-{
-namespace com
-{
-namespace ibm
-{
-namespace VPD
-{
-namespace server
-{
-
-Manager::Manager(bus_t& bus, const char* path) :
- _com_ibm_VPD_Manager_interface(bus, path, interface, _vtable, this),
- _intf(bus.getInterface())
-{
-}
-
-int Manager::_callback_WriteKeyword(sd_bus_message* msg, void* context,
- sd_bus_error* error)
-{
- auto o = static_cast<Manager*>(context);
-
- try
- {
- return sdbusplus::sdbuspp::method_callback(
- msg, o->_intf, error,
- std::function([=](sdbusplus::message::object_path&& path,
- std::string&& record, std::string&& keyword,
- std::vector<uint8_t>&& value) {
- return o->writeKeyword(path, record, keyword, value);
- }));
- }
- catch (
- const sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument&
- e)
- {
- return o->_intf->sd_bus_error_set(error, e.name(), e.description());
- }
- catch (const sdbusplus::com::ibm::VPD::Error::PathNotFound& e)
- {
- return o->_intf->sd_bus_error_set(error, e.name(), e.description());
- }
- catch (const sdbusplus::com::ibm::VPD::Error::RecordNotFound& e)
- {
- return o->_intf->sd_bus_error_set(error, e.name(), e.description());
- }
- catch (const sdbusplus::com::ibm::VPD::Error::KeywordNotFound& e)
- {
- return o->_intf->sd_bus_error_set(error, e.name(), e.description());
- }
-
- return 0;
-}
-
-namespace details
-{
-namespace Manager
-{
-static const auto _param_WriteKeyword = utility::tuple_to_array(
- message::types::type_id<sdbusplus::message::object_path, std::string,
- std::string, std::vector<uint8_t>>());
-static const auto _return_WriteKeyword =
- utility::tuple_to_array(std::make_tuple('\0'));
-} // namespace Manager
-} // namespace details
-
-int Manager::_callback_GetFRUsByUnexpandedLocationCode(sd_bus_message* msg,
- void* context,
- sd_bus_error* error)
-{
- auto o = static_cast<Manager*>(context);
-
- try
- {
- return sdbusplus::sdbuspp::method_callback(
- msg, o->_intf, error,
- std::function(
- [=](std::string&& locationCode, uint16_t&& nodeNumber) {
- return o->getFRUsByUnexpandedLocationCode(locationCode,
- nodeNumber);
- }));
- }
- catch (
- const sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument&
- e)
- {
- return o->_intf->sd_bus_error_set(error, e.name(), e.description());
- }
- catch (const sdbusplus::com::ibm::VPD::Error::LocationNotFound& e)
- {
- return o->_intf->sd_bus_error_set(error, e.name(), e.description());
- }
- catch (const sdbusplus::com::ibm::VPD::Error::NodeNotFound& e)
- {
- return o->_intf->sd_bus_error_set(error, e.name(), e.description());
- }
-
- return 0;
-}
-
-namespace details
-{
-namespace Manager
-{
-static const auto _param_GetFRUsByUnexpandedLocationCode =
- utility::tuple_to_array(message::types::type_id<std::string, uint16_t>());
-static const auto _return_GetFRUsByUnexpandedLocationCode =
- utility::tuple_to_array(message::types::type_id<
- std::vector<sdbusplus::message::object_path>>());
-} // namespace Manager
-} // namespace details
-
-int Manager::_callback_GetFRUsByExpandedLocationCode(sd_bus_message* msg,
- void* context,
- sd_bus_error* error)
-{
- auto o = static_cast<Manager*>(context);
-
- try
- {
- return sdbusplus::sdbuspp::method_callback(
- msg, o->_intf, error,
- std::function([=](std::string&& locationCode) {
- return o->getFRUsByExpandedLocationCode(locationCode);
- }));
- }
- catch (
- const sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument&
- e)
- {
- return o->_intf->sd_bus_error_set(error, e.name(), e.description());
- }
- catch (const sdbusplus::com::ibm::VPD::Error::LocationNotFound& e)
- {
- return o->_intf->sd_bus_error_set(error, e.name(), e.description());
- }
- catch (const sdbusplus::com::ibm::VPD::Error::NodeNotFound& e)
- {
- return o->_intf->sd_bus_error_set(error, e.name(), e.description());
- }
-
- return 0;
-}
-
-namespace details
-{
-namespace Manager
-{
-static const auto _param_GetFRUsByExpandedLocationCode =
- utility::tuple_to_array(message::types::type_id<std::string>());
-static const auto _return_GetFRUsByExpandedLocationCode =
- utility::tuple_to_array(message::types::type_id<
- std::vector<sdbusplus::message::object_path>>());
-} // namespace Manager
-} // namespace details
-
-int Manager::_callback_GetExpandedLocationCode(sd_bus_message* msg,
- void* context,
- sd_bus_error* error)
-{
- auto o = static_cast<Manager*>(context);
-
- try
- {
- return sdbusplus::sdbuspp::method_callback(
- msg, o->_intf, error,
- std::function(
- [=](std::string&& locationCode, uint16_t&& nodeNumber) {
- return o->getExpandedLocationCode(locationCode, nodeNumber);
- }));
- }
- catch (
- const sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument&
- e)
- {
- return o->_intf->sd_bus_error_set(error, e.name(), e.description());
- }
- catch (const sdbusplus::com::ibm::VPD::Error::LocationNotFound& e)
- {
- return o->_intf->sd_bus_error_set(error, e.name(), e.description());
- }
- catch (const sdbusplus::com::ibm::VPD::Error::NodeNotFound& e)
- {
- return o->_intf->sd_bus_error_set(error, e.name(), e.description());
- }
-
- return 0;
-}
-
-namespace details
-{
-namespace Manager
-{
-static const auto _param_GetExpandedLocationCode =
- utility::tuple_to_array(message::types::type_id<std::string, uint16_t>());
-static const auto _return_GetExpandedLocationCode =
- utility::tuple_to_array(message::types::type_id<std::string>());
-} // namespace Manager
-} // namespace details
-
-int Manager::_callback_PerformVPDRecollection(sd_bus_message* msg,
- void* context,
- sd_bus_error* error)
-{
- auto o = static_cast<Manager*>(context);
-
- try
- {
- return sdbusplus::sdbuspp::method_callback(
- msg, o->_intf, error,
- std::function([=]() { return o->performVPDRecollection(); }));
- }
- catch (
- const sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument&
- e)
- {
- return o->_intf->sd_bus_error_set(error, e.name(), e.description());
- }
-
- return 0;
-}
-
-namespace details
-{
-namespace Manager
-{
-static const auto _param_PerformVPDRecollection =
- utility::tuple_to_array(std::make_tuple('\0'));
-static const auto _return_PerformVPDRecollection =
- utility::tuple_to_array(std::make_tuple('\0'));
-} // namespace Manager
-} // namespace details
-
-const vtable::vtable_t Manager::_vtable[] = {
- vtable::start(),
-
- vtable::method("WriteKeyword", details::Manager::_param_WriteKeyword.data(),
- details::Manager::_return_WriteKeyword.data(),
- _callback_WriteKeyword),
-
- vtable::method(
- "GetFRUsByUnexpandedLocationCode",
- details::Manager::_param_GetFRUsByUnexpandedLocationCode.data(),
- details::Manager::_return_GetFRUsByUnexpandedLocationCode.data(),
- _callback_GetFRUsByUnexpandedLocationCode),
-
- vtable::method(
- "GetFRUsByExpandedLocationCode",
- details::Manager::_param_GetFRUsByExpandedLocationCode.data(),
- details::Manager::_return_GetFRUsByExpandedLocationCode.data(),
- _callback_GetFRUsByExpandedLocationCode),
-
- vtable::method("GetExpandedLocationCode",
- details::Manager::_param_GetExpandedLocationCode.data(),
- details::Manager::_return_GetExpandedLocationCode.data(),
- _callback_GetExpandedLocationCode),
-
- vtable::method("PerformVPDRecollection",
- details::Manager::_param_PerformVPDRecollection.data(),
- details::Manager::_return_PerformVPDRecollection.data(),
- _callback_PerformVPDRecollection),
- vtable::end()};
-
-} // namespace server
-} // namespace VPD
-} // namespace ibm
-} // namespace com
-} // namespace sdbusplus