diff options
author | Ratan Gupta <ratagupt@in.ibm.com> | 2017-09-01 23:06:25 +0530 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-09-08 17:30:39 +0000 |
commit | cc6cdbf1d4111b0f29cc3dd37c61317a7abff58f (patch) | |
tree | efb2948f0ab6738ba8be78f9d8ece193210ce29f /utils.cpp | |
parent | 558184ea80cd34bb62052e885b64ab38a3edf950 (diff) | |
download | phosphor-host-ipmid-cc6cdbf1d4111b0f29cc3dd37c61317a7abff58f.tar.gz phosphor-host-ipmid-cc6cdbf1d4111b0f29cc3dd37c61317a7abff58f.zip |
GetLan: Support for get/set of ipsrc parameter
Change-Id: Id9c52bb0963c5924f80f9e273b53ed5556b16a2c
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
Diffstat (limited to 'utils.cpp')
-rw-r--r-- | utils.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
@@ -276,6 +276,51 @@ void deleteAllDbusObjects(sdbusplus::bus::bus& bus, } } +ObjectTree getAllAncestors(sdbusplus::bus::bus& bus, + const std::string& path, + InterfaceList&& interfaces) +{ + auto convertToString = [](InterfaceList& interfaces) -> std::string + { + std::string intfStr; + for (const auto& intf : interfaces) + { + intfStr += "," + intf; + } + return intfStr; + }; + + auto mapperCall = bus.new_method_call(MAPPER_BUS_NAME, + MAPPER_OBJ, + MAPPER_INTF, + "GetAncestors"); + mapperCall.append(path, interfaces); + + auto mapperReply = bus.call(mapperCall); + if (mapperReply.is_method_error()) + { + log<level::ERR>("Error in mapper call", + entry("PATH=%s", path.c_str()), + entry("INTERFACES=%s", + convertToString(interfaces).c_str())); + + elog<InternalFailure>(); + } + + ObjectTree objectTree; + mapperReply.read(objectTree); + + if (objectTree.empty()) + { + log<level::ERR>("No Object has impelmented the interface", + entry("PATH=%s", path.c_str()), + entry("INTERFACES=%s", + convertToString(interfaces).c_str())); + elog<InternalFailure>(); + } + + return objectTree; +} namespace method_no_args { |