blob: c2bdb0dce2e6d2484e60a6b7f1ef130aed6f6a49 [file] [log] [blame]
Sampa Misra032bd502019-03-06 05:03:22 -06001#pragma once
2
Sampa Misraaea5dde2020-08-31 08:33:47 -05003#include "types.hpp"
4
George Liuc453e162022-12-21 17:16:23 +08005#include <libpldm/base.h>
6#include <libpldm/bios.h>
George Liudf9a6d32020-12-22 16:27:16 +08007#include <libpldm/entity.h>
8#include <libpldm/pdr.h>
George Liuc453e162022-12-21 17:16:23 +08009#include <libpldm/platform.h>
10#include <libpldm/utils.h>
Sampa Misra032bd502019-03-06 05:03:22 -060011#include <stdint.h>
12#include <systemd/sd-bus.h>
Jinu Joy Thomasf666db12019-05-29 05:22:31 -050013#include <unistd.h>
Sampa Misra032bd502019-03-06 05:03:22 -060014
George Liu6492f522020-06-16 10:34:05 +080015#include <nlohmann/json.hpp>
16#include <sdbusplus/server.hpp>
Riya Dixit754041d2024-02-20 06:15:49 -060017#include <xyz/openbmc_project/Inventory/Manager/client.hpp>
George Liu6492f522020-06-16 10:34:05 +080018#include <xyz/openbmc_project/Logging/Entry/server.hpp>
19
George Liudf9a6d32020-12-22 16:27:16 +080020#include <deque>
Sampa Misraa2fa0702019-05-31 01:28:55 -050021#include <exception>
Deepak Kodihalli3cd61812020-03-10 06:38:45 -050022#include <filesystem>
Sampa Misraaa8ae722019-12-12 03:20:40 -060023#include <iostream>
George Liudf9a6d32020-12-22 16:27:16 +080024#include <map>
Sampa Misra032bd502019-03-06 05:03:22 -060025#include <string>
Sampa Misraa2fa0702019-05-31 01:28:55 -050026#include <variant>
27#include <vector>
Sampa Misra032bd502019-03-06 05:03:22 -060028
vkaverap@in.ibm.com5b71b862023-08-21 05:19:04 +000029constexpr uint64_t dbusTimeout =
30 std::chrono::duration_cast<std::chrono::microseconds>(
31 std::chrono::seconds(DBUS_TIMEOUT))
32 .count();
33
Sampa Misra032bd502019-03-06 05:03:22 -060034namespace pldm
35{
Jinu Joy Thomasf666db12019-05-29 05:22:31 -050036namespace utils
37{
Deepak Kodihalli3cd61812020-03-10 06:38:45 -050038namespace fs = std::filesystem;
Tom Joseph250c4752020-04-15 10:32:45 +053039using Json = nlohmann::json;
Tom Josephe5268cd2021-09-07 13:04:03 +053040constexpr bool Tx = true;
41constexpr bool Rx = false;
Deepak Kodihalli3cd61812020-03-10 06:38:45 -050042
George Liudf9a6d32020-12-22 16:27:16 +080043using EntityName = std::string;
44using EntityType = uint16_t;
45
46using Entities = std::vector<pldm_entity_node*>;
47using EntityAssociations = std::vector<Entities>;
48using ObjectPathMaps = std::map<fs::path, pldm_entity_node*>;
49
50const std::map<EntityType, EntityName> entityMaps = {
51 {PLDM_ENTITY_SYSTEM_CHASSIS, "chassis"},
52 {PLDM_ENTITY_BOARD, "io_board"},
53 {PLDM_ENTITY_SYS_BOARD, "motherboard"},
54 {PLDM_ENTITY_POWER_SUPPLY, "powersupply"},
55 {PLDM_ENTITY_PROC, "cpu"},
56 {PLDM_ENTITY_SYSTEM_CHASSIS | 0x8000, "system"},
57 {PLDM_ENTITY_PROC_MODULE, "dcm"},
58 {PLDM_ENTITY_PROC | 0x8000, "core"},
59 {PLDM_ENTITY_IO_MODULE, "io_module"},
60 {PLDM_ENTITY_FAN, "fan"},
61 {PLDM_ENTITY_SYS_MGMT_MODULE, "system_management_module"},
62 {PLDM_ENTITY_POWER_CONVERTER, "power_converter"},
63 {PLDM_ENTITY_SLOT, "slot"},
64 {PLDM_ENTITY_CONNECTOR, "connector"}};
65
66/** @brief Vector a entity name to pldm_entity from entity association tree
67 * @param[in] entityAssoc - Vector of associated pldm entities
68 * @param[in] entityTree - entity association tree
69 * @param[out] objPathMap - maps an object path to pldm_entity from the
70 * BMC's entity association tree
71 * @return
72 */
73void updateEntityAssociation(const EntityAssociations& entityAssoc,
74 pldm_entity_association_tree* entityTree,
75 ObjectPathMaps& objPathMap);
76
Jinu Joy Thomasf666db12019-05-29 05:22:31 -050077/** @struct CustomFD
78 *
79 * RAII wrapper for file descriptor.
80 */
81struct CustomFD
82{
83 CustomFD(const CustomFD&) = delete;
84 CustomFD& operator=(const CustomFD&) = delete;
85 CustomFD(CustomFD&&) = delete;
86 CustomFD& operator=(CustomFD&&) = delete;
87
Patrick Williams6da4f912023-05-10 07:50:53 -050088 CustomFD(int fd) : fd(fd) {}
Jinu Joy Thomasf666db12019-05-29 05:22:31 -050089
90 ~CustomFD()
91 {
92 if (fd >= 0)
93 {
94 close(fd);
95 }
96 }
97
98 int operator()() const
99 {
100 return fd;
101 }
102
103 private:
104 int fd = -1;
105};
106
Sampa Misrab37be312019-07-03 02:26:41 -0500107/** @brief Calculate the pad for PLDM data
108 *
109 * @param[in] data - Length of the data
110 * @return - uint8_t - number of pad bytes
111 */
112uint8_t getNumPadBytes(uint32_t data);
113
George Liu83409572019-12-24 18:42:54 +0800114/** @brief Convert uint64 to date
115 *
116 * @param[in] data - time date of uint64
117 * @param[out] year - year number in dec
118 * @param[out] month - month number in dec
119 * @param[out] day - day of the month in dec
120 * @param[out] hour - number of hours in dec
121 * @param[out] min - number of minutes in dec
122 * @param[out] sec - number of seconds in dec
123 * @return true if decode success, false if decode faild
124 */
125bool uintToDate(uint64_t data, uint16_t* year, uint8_t* month, uint8_t* day,
126 uint8_t* hour, uint8_t* min, uint8_t* sec);
127
128/** @brief Convert effecter data to structure of set_effecter_state_field
129 *
130 * @param[in] effecterData - the date of effecter
George Liuba4c1fb2020-02-05 14:13:30 +0800131 * @param[in] effecterCount - the number of individual sets of effecter
132 * information
133 * @return[out] parse success and get a valid set_effecter_state_field
134 * structure, return nullopt means parse failed
George Liu83409572019-12-24 18:42:54 +0800135 */
George Liuba4c1fb2020-02-05 14:13:30 +0800136std::optional<std::vector<set_effecter_state_field>>
137 parseEffecterData(const std::vector<uint8_t>& effecterData,
138 uint8_t effecterCount);
Sampa Misra032bd502019-03-06 05:03:22 -0600139
140/**
Sampa Misraaa8ae722019-12-12 03:20:40 -0600141 * @brief creates an error log
142 * @param[in] errorMsg - the error message
143 */
Manojkiran Eda92fb0b52024-04-17 10:48:17 +0530144void reportError(const char* errorMsg);
Sampa Misraaa8ae722019-12-12 03:20:40 -0600145
Sampa Misra032bd502019-03-06 05:03:22 -0600146/** @brief Convert any Decimal number to BCD
147 *
148 * @tparam[in] decimal - Decimal number
149 * @return Corresponding BCD number
150 */
151template <typename T>
152T decimalToBcd(T decimal)
153{
154 T bcd = 0;
155 T rem = 0;
156 auto cnt = 0;
157
158 while (decimal)
159 {
160 rem = decimal % 10;
161 bcd = bcd + (rem << cnt);
162 decimal = decimal / 10;
163 cnt += 4;
164 }
165
166 return bcd;
167}
168
Riya Dixit754041d2024-02-20 06:15:49 -0600169using inventoryManager =
170 sdbusplus::client::xyz::openbmc_project::inventory::Manager<>;
171
Sampa Misraa2fa0702019-05-31 01:28:55 -0500172constexpr auto dbusProperties = "org.freedesktop.DBus.Properties";
Pavithra Barithaya47180ac2020-10-28 02:12:05 -0500173constexpr auto mapperService = "xyz.openbmc_project.ObjectMapper";
Riya Dixit754041d2024-02-20 06:15:49 -0600174constexpr auto inventoryPath = "/xyz/openbmc_project/inventory";
Sampa Misraa2fa0702019-05-31 01:28:55 -0500175
George Liu1e44c732020-02-28 20:20:06 +0800176struct DBusMapping
177{
178 std::string objectPath; //!< D-Bus object path
179 std::string interface; //!< D-Bus interface
180 std::string propertyName; //!< D-Bus property name
181 std::string propertyType; //!< D-Bus property type
182};
183
184using PropertyValue =
185 std::variant<bool, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t,
Riya Dixit754041d2024-02-20 06:15:49 -0600186 uint64_t, double, std::string, std::vector<uint8_t>,
187 std::vector<std::string>>;
Deepak Kodihalli6b1d1ca2020-04-27 07:24:51 -0500188using DbusProp = std::string;
189using DbusChangedProps = std::map<DbusProp, PropertyValue>;
Sampa Misraaea5dde2020-08-31 08:33:47 -0500190using DBusInterfaceAdded = std::vector<
191 std::pair<pldm::dbus::Interface,
192 std::vector<std::pair<pldm::dbus::Property,
193 std::variant<pldm::dbus::Property>>>>>;
Manojkiran Eda1ef62c32021-04-24 07:23:18 +0530194using ObjectPath = std::string;
195using ServiceName = std::string;
196using Interfaces = std::vector<std::string>;
197using MapperServiceMap = std::vector<std::pair<ServiceName, Interfaces>>;
198using GetSubTreeResponse = std::vector<std::pair<ObjectPath, MapperServiceMap>>;
Sridevi Ramesheefe49b2022-06-27 11:51:02 -0500199using PropertyMap = std::map<std::string, PropertyValue>;
200using InterfaceMap = std::map<std::string, PropertyMap>;
Riya Dixit754041d2024-02-20 06:15:49 -0600201using ObjectValueTree = std::map<sdbusplus::message::object_path, InterfaceMap>;
George Liu1e44c732020-02-28 20:20:06 +0800202
203/**
204 * @brief The interface for DBusHandler
205 */
206class DBusHandlerInterface
207{
208 public:
209 virtual ~DBusHandlerInterface() = default;
210
George Liu36e81352020-07-01 14:40:30 +0800211 virtual std::string getService(const char* path,
212 const char* interface) const = 0;
Manojkiran Eda1ef62c32021-04-24 07:23:18 +0530213 virtual GetSubTreeResponse
214 getSubtree(const std::string& path, int depth,
215 const std::vector<std::string>& ifaceList) const = 0;
George Liu36e81352020-07-01 14:40:30 +0800216
George Liu1e44c732020-02-28 20:20:06 +0800217 virtual void setDbusProperty(const DBusMapping& dBusMap,
218 const PropertyValue& value) const = 0;
John Wang9e242422020-03-05 08:37:50 +0800219
220 virtual PropertyValue
221 getDbusPropertyVariant(const char* objPath, const char* dbusProp,
222 const char* dbusInterface) const = 0;
George Liu1e44c732020-02-28 20:20:06 +0800223};
224
Sampa Misraa2fa0702019-05-31 01:28:55 -0500225/**
226 * @class DBusHandler
227 *
228 * Wrapper class to handle the D-Bus calls
229 *
230 * This class contains the APIs to handle the D-Bus calls
231 * to cater the request from pldm requester.
232 * A class is created to mock the apis in the test cases
233 */
George Liu1e44c732020-02-28 20:20:06 +0800234class DBusHandler : public DBusHandlerInterface
Sampa Misraa2fa0702019-05-31 01:28:55 -0500235{
236 public:
George Liu0e02c322020-01-01 09:41:51 +0800237 /** @brief Get the bus connection. */
238 static auto& getBus()
239 {
240 static auto bus = sdbusplus::bus::new_default();
241 return bus;
242 }
243
244 /**
245 * @brief Get the DBUS Service name for the input dbus path
John Wang9e242422020-03-05 08:37:50 +0800246 *
George Liu0e02c322020-01-01 09:41:51 +0800247 * @param[in] path - DBUS object path
248 * @param[in] interface - DBUS Interface
John Wang9e242422020-03-05 08:37:50 +0800249 *
George Liu0e02c322020-01-01 09:41:51 +0800250 * @return std::string - the dbus service name
John Wang9e242422020-03-05 08:37:50 +0800251 *
Patrick Williams84b790c2022-07-22 19:26:56 -0500252 * @throw sdbusplus::exception_t when it fails
George Liu0e02c322020-01-01 09:41:51 +0800253 */
George Liu36e81352020-07-01 14:40:30 +0800254 std::string getService(const char* path,
255 const char* interface) const override;
George Liu0e02c322020-01-01 09:41:51 +0800256
Manojkiran Eda1ef62c32021-04-24 07:23:18 +0530257 /**
258 * @brief Get the Subtree response from the mapper
259 *
260 * @param[in] path - DBUS object path
261 * @param[in] depth - Search depth
262 * @param[in] ifaceList - list of the interface that are being
263 * queried from the mapper
264 *
265 * @return GetSubTreeResponse - the mapper subtree response
266 *
Patrick Williams84b790c2022-07-22 19:26:56 -0500267 * @throw sdbusplus::exception_t when it fails
Manojkiran Eda1ef62c32021-04-24 07:23:18 +0530268 */
269 GetSubTreeResponse
270 getSubtree(const std::string& path, int depth,
271 const std::vector<std::string>& ifaceList) const override;
272
John Wang9e242422020-03-05 08:37:50 +0800273 /** @brief Get property(type: variant) from the requested dbus
274 *
275 * @param[in] objPath - The Dbus object path
276 * @param[in] dbusProp - The property name to get
277 * @param[in] dbusInterface - The Dbus interface
278 *
279 * @return The value of the property(type: variant)
280 *
Patrick Williams84b790c2022-07-22 19:26:56 -0500281 * @throw sdbusplus::exception_t when it fails
John Wang9e242422020-03-05 08:37:50 +0800282 */
283 PropertyValue
284 getDbusPropertyVariant(const char* objPath, const char* dbusProp,
285 const char* dbusInterface) const override;
George Liu0e02c322020-01-01 09:41:51 +0800286
John Wang9e242422020-03-05 08:37:50 +0800287 /** @brief The template function to get property from the requested dbus
288 * path
289 *
290 * @tparam Property - Excepted type of the property on dbus
291 *
292 * @param[in] objPath - The Dbus object path
293 * @param[in] dbusProp - The property name to get
294 * @param[in] dbusInterface - The Dbus interface
295 *
296 * @return The value of the property
297 *
Patrick Williams84b790c2022-07-22 19:26:56 -0500298 * @throw sdbusplus::exception_t when dbus request fails
John Wang9e242422020-03-05 08:37:50 +0800299 * std::bad_variant_access when \p Property and property on dbus do
300 * not match
301 */
John Wang92b3c972019-10-17 11:06:41 +0800302 template <typename Property>
303 auto getDbusProperty(const char* objPath, const char* dbusProp,
304 const char* dbusInterface)
305 {
Patrick Williams6da4f912023-05-10 07:50:53 -0500306 auto VariantValue = getDbusPropertyVariant(objPath, dbusProp,
307 dbusInterface);
John Wang92b3c972019-10-17 11:06:41 +0800308 return std::get<Property>(VariantValue);
309 }
George Liu1e44c732020-02-28 20:20:06 +0800310
311 /** @brief Set Dbus property
312 *
313 * @param[in] dBusMap - Object path, property name, interface and property
314 * type for the D-Bus object
315 * @param[in] value - The value to be set
John Wang9e242422020-03-05 08:37:50 +0800316 *
Patrick Williams84b790c2022-07-22 19:26:56 -0500317 * @throw sdbusplus::exception_t when it fails
George Liu1e44c732020-02-28 20:20:06 +0800318 */
319 void setDbusProperty(const DBusMapping& dBusMap,
320 const PropertyValue& value) const override;
Riya Dixit754041d2024-02-20 06:15:49 -0600321
322 /** @brief This function retrieves the properties of an object managed
323 * by the specified D-Bus service located at the given object path.
324 *
325 * @param[in] service - The D-Bus service providing the managed object
326 * @param[in] value - The object path of the managed object
327 *
328 * @return A hierarchical structure representing the properties of the
329 * managed object.
Patrick Williams897b0f82024-04-14 02:31:48 -0500330 * @throw sdbusplus::exception_t when it fails
Riya Dixit754041d2024-02-20 06:15:49 -0600331 */
332 static ObjectValueTree getManagedObj(const char* service, const char* path);
333
334 /** @brief Retrieve the inventory objects managed by a specified class.
335 * The retrieved inventory objects are cached statically
336 * and returned upon subsequent calls to this function.
337 *
338 * @tparam ClassType - The class type that manages the inventory objects.
339 *
340 * @return A reference to the cached inventory objects.
341 */
342 template <typename ClassType>
343 static auto& getInventoryObjects()
344 {
345 static ObjectValueTree object = ClassType::getManagedObj(
346 inventoryManager::interface, inventoryPath);
347 return object;
348 }
Sampa Misraa2fa0702019-05-31 01:28:55 -0500349};
350
Deepak Kodihalli3cd61812020-03-10 06:38:45 -0500351/** @brief Fetch parent D-Bus object based on pathname
352 *
353 * @param[in] dbusObj - child D-Bus object
354 *
355 * @return std::string - the parent D-Bus object path
356 */
357inline std::string findParent(const std::string& dbusObj)
358{
359 fs::path p(dbusObj);
360 return p.parent_path().string();
361}
362
Pavithra Barithaya51efaf82020-04-02 02:42:27 -0500363/** @brief Read (static) MCTP EID of host firmware from a file
364 *
365 * @return uint8_t - MCTP EID
366 */
367uint8_t readHostEID();
Tom Joseph250c4752020-04-15 10:32:45 +0530368
TOM JOSEPHd4d97a52020-03-23 14:36:34 +0530369/** @brief Convert a value in the JSON to a D-Bus property value
370 *
371 * @param[in] type - type of the D-Bus property
372 * @param[in] value - value in the JSON file
373 *
374 * @return PropertyValue - the D-Bus property value
375 */
376PropertyValue jsonEntryToDbusVal(std::string_view type,
377 const nlohmann::json& value);
Pavithra Barithaya51efaf82020-04-02 02:42:27 -0500378
Pavithra Barithaya0f74c982020-04-27 02:17:10 -0500379/** @brief Find State Effecter PDR
380 * @param[in] tid - PLDM terminus ID.
381 * @param[in] entityID - entity that can be associated with PLDM State set.
382 * @param[in] stateSetId - value that identifies PLDM State set.
383 * @param[in] repo - pointer to BMC's primary PDR repo.
384 * @return array[array[uint8_t]] - StateEffecterPDRs
385 */
386std::vector<std::vector<uint8_t>> findStateEffecterPDR(uint8_t tid,
387 uint16_t entityID,
388 uint16_t stateSetId,
389 const pldm_pdr* repo);
Chicago Duan738e4d82020-05-28 16:39:19 +0800390/** @brief Find State Sensor PDR
391 * @param[in] tid - PLDM terminus ID.
392 * @param[in] entityID - entity that can be associated with PLDM State set.
393 * @param[in] stateSetId - value that identifies PLDM State set.
394 * @param[in] repo - pointer to BMC's primary PDR repo.
395 * @return array[array[uint8_t]] - StateSensorPDRs
396 */
397std::vector<std::vector<uint8_t>> findStateSensorPDR(uint8_t tid,
398 uint16_t entityID,
399 uint16_t stateSetId,
400 const pldm_pdr* repo);
Pavithra Barithaya0f74c982020-04-27 02:17:10 -0500401
Sampa Misra3a0e3b92020-10-21 05:58:00 -0500402/** @brief Find sensor id from a state sensor PDR
403 *
404 * @param[in] pdrRepo - PDR repository
405 * @param[in] tid - terminus id
406 * @param[in] entityType - entity type
407 * @param[in] entityInstance - entity instance number
408 * @param[in] containerId - container id
409 * @param[in] stateSetId - state set id
410 *
411 * @return uint16_t - the sensor id
412 */
413uint16_t findStateSensorId(const pldm_pdr* pdrRepo, uint8_t tid,
414 uint16_t entityType, uint16_t entityInstance,
415 uint16_t containerId, uint16_t stateSetId);
416
Tom Joseph250c4752020-04-15 10:32:45 +0530417/** @brief Find effecter id from a state effecter pdr
418 * @param[in] pdrRepo - PDR repository
419 * @param[in] entityType - entity type
420 * @param[in] entityInstance - entity instance number
421 * @param[in] containerId - container id
422 * @param[in] stateSetId - state set id
Sampa Misraa4a96162020-07-14 05:33:46 -0500423 * @param[in] localOrRemote - true for checking local repo and false for remote
424 * repo
Tom Joseph250c4752020-04-15 10:32:45 +0530425 *
426 * @return uint16_t - the effecter id
427 */
428uint16_t findStateEffecterId(const pldm_pdr* pdrRepo, uint16_t entityType,
429 uint16_t entityInstance, uint16_t containerId,
Sampa Misraa4a96162020-07-14 05:33:46 -0500430 uint16_t stateSetId, bool localOrRemote);
Tom Joseph250c4752020-04-15 10:32:45 +0530431
Chicago Duanfe4d88b2020-06-12 16:44:13 +0800432/** @brief Emit the sensor event signal
433 *
434 * @param[in] tid - the terminus id
435 * @param[in] sensorId - sensorID value of the sensor
436 * @param[in] sensorOffset - Identifies which state sensor within a
437 * composite state sensor the event is being returned for
438 * @param[in] eventState - The event state value from the state change that
439 * triggered the event message
440 * @param[in] previousEventState - The event state value for the state from
441 * which the present event state was entered.
442 * @return PLDM completion code
443 */
444int emitStateSensorEventSignal(uint8_t tid, uint16_t sensorId,
445 uint8_t sensorOffset, uint8_t eventState,
446 uint8_t previousEventState);
447
Sridevi Rameshae28bc72020-12-10 07:21:16 -0600448/** @brief Print the buffer
449 *
Tom Josephe5268cd2021-09-07 13:04:03 +0530450 * @param[in] isTx - True if the buffer is an outgoing PLDM message, false if
451 the buffer is an incoming PLDM message
452 * @param[in] buffer - Buffer to print
Sridevi Rameshae28bc72020-12-10 07:21:16 -0600453 *
454 * @return - None
455 */
Tom Josephe5268cd2021-09-07 13:04:03 +0530456void printBuffer(bool isTx, const std::vector<uint8_t>& buffer);
Sridevi Rameshae28bc72020-12-10 07:21:16 -0600457
Tom Joseph54922072021-06-19 02:45:46 -0700458/** @brief Convert the buffer to std::string
459 *
460 * If there are characters that are not printable characters, it is replaced
461 * with space(0x20).
462 *
463 * @param[in] var - pointer to data and length of the data
464 *
465 * @return std::string equivalent of variable field
466 */
467std::string toString(const struct variable_field& var);
468
George Liu872f0f62021-11-25 16:26:16 +0800469/** @brief Split strings according to special identifiers
470 *
471 * We can split the string according to the custom identifier(';', ',', '&' or
472 * others) and store it to vector.
473 *
474 * @param[in] srcStr - The string to be split
475 * @param[in] delim - The custom identifier
476 * @param[in] trimStr - The first and last string to be trimmed
477 *
478 * @return std::vector<std::string> Vectors are used to store strings
479 */
480std::vector<std::string> split(std::string_view srcStr, std::string_view delim,
481 std::string_view trimStr = "");
Manojkiran Edaef773052021-07-29 09:29:28 +0530482/** @brief Get the current system time in readable format
483 *
484 * @return - std::string equivalent of the system time
485 */
486std::string getCurrentSystemTime();
George Liu872f0f62021-11-25 16:26:16 +0800487
Sridevi Ramesheefe49b2022-06-27 11:51:02 -0500488/** @brief checks if the FRU is actually present.
489 * @param[in] objPath - FRU object path.
490 *
491 * @return bool to indicate presence or absence of FRU.
492 */
493bool checkForFruPresence(const std::string& objPath);
494
Sagar Srinivas5db6e872023-12-01 10:03:30 -0600495/** @brief Method to check if the logical bit is set
496 *
497 * @param[containerId] - container id of the entity
498 *
499 * @return true or false based on the logic bit set
500 */
501bool checkIfLogicalBitSet(const uint16_t& containerId);
Pavithra Barithaya5e542be2021-08-13 00:33:31 -0500502
503/** @brief setting the present property
504 *
505 * @param[in] objPath - the object path of the fru
506 * @param[in] present - status to set either true/false
507 */
508void setFruPresence(const std::string& fruObjPath, bool present);
George Liu83409572019-12-24 18:42:54 +0800509} // namespace utils
Sampa Misra032bd502019-03-06 05:03:22 -0600510} // namespace pldm