GetLan: Support for get/set of ipsrc parameter
Change-Id: Id9c52bb0963c5924f80f9e273b53ed5556b16a2c
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
diff --git a/utils.cpp b/utils.cpp
index 2e6c5e7..d81bf76 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -276,6 +276,51 @@
}
}
+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
{