Update CollectionMembers to use UrlFromPieces
Refactor getCollectionMembers to make sure all Url created with dbus
paths are generated via UrlFromPieces helper function. This allow us to
manage all URL generated from dbus in one place and allow us to make
future changes to affect all resources.
We can make changes to all resources easier if they are all managed by
one function.
Tested:
Redfish Validator Passed. All Collections working as expected and match
previous implmentation.
Change-Id: I5d3b2b32f047ce4f20a2287a36a3e099efd6eace
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index 8bc8cf0..ecf1c65 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -1074,8 +1074,9 @@
// Collection of all Config objects under this CPU.
collection_util::getCollectionMembers(
asyncResp,
- "/redfish/v1/Systems/system/Processors/" + cpuName +
- "/OperatingConfigs",
+ crow::utility::urlFromPieces("redfish", "v1", "Systems",
+ "system", "Processors",
+ cpuName, "OperatingConfigs"),
{"xyz.openbmc_project.Inventory.Item.Cpu.OperatingConfig"},
object.c_str());
return;
@@ -1181,7 +1182,8 @@
"/redfish/v1/Systems/system/Processors";
collection_util::getCollectionMembers(
- asyncResp, "/redfish/v1/Systems/system/Processors",
+ asyncResp,
+ boost::urls::url("/redfish/v1/Systems/system/Processors"),
std::vector<const char*>(processorInterfaces.begin(),
processorInterfaces.end()));
});