Support multiple D-Bus interfaces in getSubTree()
The utility function getSubTree() only allows a single D-Bus interface
to be specified.
This does not match the corresponding GetSubTree D-Bus method, which
allows multiple D-Bus interfaces to be specified.
Add a getSubTree() overload that accepts multiple D-Bus interfaces.
Tested:
* Existing getSubTree() function
* Test where it is successful
* Test where it fails due to a D-Bus error
* New getSubTree() function
* Test where zero interfaces are specified
* Test where one interface is specified
* Test where multiple interfaces are specified
* Test where it is successful
* Test where it fails due to a D-Bus error
Change-Id: I56e124c13bec633f7a3af80ff6d5b2014454bfb8
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
diff --git a/utility.cpp b/utility.cpp
index 74ee75b..a14dec0 100644
--- a/utility.cpp
+++ b/utility.cpp
@@ -90,11 +90,18 @@
DbusSubtree getSubTree(sdbusplus::bus_t& bus, const std::string& path,
const std::string& interface, int32_t depth)
{
+ return getSubTree(bus, path, std::vector<std::string>({interface}), depth);
+}
+
+DbusSubtree getSubTree(sdbusplus::bus_t& bus, const std::string& path,
+ const std::vector<std::string>& interfaces,
+ int32_t depth)
+{
auto mapperCall = bus.new_method_call(MAPPER_BUSNAME, MAPPER_PATH,
MAPPER_INTERFACE, "GetSubTree");
mapperCall.append(path);
mapperCall.append(depth);
- mapperCall.append(std::vector<std::string>({interface}));
+ mapperCall.append(interfaces);
auto reply = bus.call(mapperCall);