summaryrefslogtreecommitdiff
path: root/redfish-core/lib
diff options
context:
space:
mode:
authorLakshmi Yadlapati <lakshmiy@us.ibm.com>2023-09-27 07:53:28 +0300
committerLakshmi Yadlapati <lakshmiy@us.ibm.com>2023-09-28 09:24:41 +0300
commit36b5f1ed97fe5806c53e0eb5b2f9a07e9a8acd5f (patch)
treec9275c091aa3811c28de4f02b51d5f96d25f871a /redfish-core/lib
parentf42e859032d9a28752108b327f02340be4de8de2 (diff)
downloadbmcweb-36b5f1ed97fe5806c53e0eb5b2f9a07e9a8acd5f.tar.xz
Refactor getCollectionMembers
This commit refactors the getCollectionMembers function into smaller functions. Additionally, the 'subtree' parameter is no longer a default parameter but is explicitly required in the function. All calls to getCollectionMembers have been updated to pass the 'subtree' parameter. Tested: Validator passed ''' curl -k https://$bmc/redfish/v1/Systems/system/Storage { "@odata.id": "/redfish/v1/Systems/system/Storage", "@odata.type": "#StorageCollection.StorageCollection", "Members": [ { "@odata.id": "/redfish/v1/Systems/system/Storage/1" } ], "Members@odata.count": 1, "Name": "Storage Collection" } curl -k https://$bmc/redfish/v1/Cables { "@odata.id": "/redfish/v1/Cables", "@odata.type": "#CableCollection.CableCollection", "Description": "Collection of Cable Entries", "Members": [ { "@odata.id": "/redfish/v1/Cables/dp0_cable0" }, { "@odata.id": "/redfish/v1/Cables/dp0_cable1" }, { "@odata.id": "/redfish/v1/Cables/dp0_cable2" }, { "@odata.id": "/redfish/v1/Cables/dp0_cable3" } ], "Members@odata.count": 4, "Name": "Cable Collection" } curl -k https://$bmc/redfish/v1/Chassis { "@odata.id": "/redfish/v1/Chassis", "@odata.type": "#ChassisCollection.ChassisCollection", "Members": [ { "@odata.id": "/redfish/v1/Chassis/chassis" } ], "Members@odata.count": 1, "Name": "Chassis Collection" } curl -k https://$bmc/redfish/v1/Systems/system/Memory { "@odata.id": "/redfish/v1/Systems/system/Memory", "@odata.type": "#MemoryCollection.MemoryCollection", "Members": [ { "@odata.id": "/redfish/v1/Systems/system/Memory/dimm0" }, { "@odata.id": "/redfish/v1/Systems/system/Memory/dimm1" }, ...... { "@odata.id": "/redfish/v1/Systems/system/Memory/dimm31" } ], "Members@odata.count": 32, "Name": "Memory Module Collection" } ''' Change-Id: If5091431b548f371bff03b2897fd0aaf8b0ef203 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
Diffstat (limited to 'redfish-core/lib')
-rw-r--r--redfish-core/lib/cable.hpp3
-rw-r--r--redfish-core/lib/chassis.hpp3
-rw-r--r--redfish-core/lib/fabric_adapters.hpp2
-rw-r--r--redfish-core/lib/memory.hpp2
-rw-r--r--redfish-core/lib/processor.hpp4
-rw-r--r--redfish-core/lib/storage.hpp5
6 files changed, 11 insertions, 8 deletions
diff --git a/redfish-core/lib/cable.hpp b/redfish-core/lib/cable.hpp
index 28031e13b2..a39d00a355 100644
--- a/redfish-core/lib/cable.hpp
+++ b/redfish-core/lib/cable.hpp
@@ -210,7 +210,8 @@ inline void requestRoutesCableCollection(App& app)
constexpr std::array<std::string_view, 1> interfaces{
"xyz.openbmc_project.Inventory.Item.Cable"};
collection_util::getCollectionMembers(
- asyncResp, boost::urls::url("/redfish/v1/Cables"), interfaces);
+ asyncResp, boost::urls::url("/redfish/v1/Cables"), interfaces,
+ "/xyz/openbmc_project/inventory");
});
}
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 969973fc6e..0d14d4ef1d 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -209,7 +209,8 @@ inline void handleChassisCollectionGet(
"xyz.openbmc_project.Inventory.Item.Board",
"xyz.openbmc_project.Inventory.Item.Chassis"};
collection_util::getCollectionMembers(
- asyncResp, boost::urls::url("/redfish/v1/Chassis"), interfaces);
+ asyncResp, boost::urls::url("/redfish/v1/Chassis"), interfaces,
+ "/xyz/openbmc_project/inventory");
}
inline void getChassisContainedBy(
diff --git a/redfish-core/lib/fabric_adapters.hpp b/redfish-core/lib/fabric_adapters.hpp
index 2a85f42d2c..317348f760 100644
--- a/redfish-core/lib/fabric_adapters.hpp
+++ b/redfish-core/lib/fabric_adapters.hpp
@@ -309,7 +309,7 @@ inline void handleFabricAdapterCollectionGet(
collection_util::getCollectionMembers(
asyncResp,
boost::urls::url("/redfish/v1/Systems/system/FabricAdapters"),
- interfaces);
+ interfaces, "/xyz/openbmc_project/inventory");
}
inline void handleFabricAdapterCollectionHead(
diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
index 551a5790a1..45a3789f82 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -810,7 +810,7 @@ inline void requestRoutesMemoryCollection(App& app)
"xyz.openbmc_project.Inventory.Item.Dimm"};
collection_util::getCollectionMembers(
asyncResp, boost::urls::url("/redfish/v1/Systems/system/Memory"),
- interfaces);
+ interfaces, "/xyz/openbmc_project/inventory");
});
}
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index 78f25d4064..988d5cc256 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -1232,7 +1232,7 @@ inline void requestRoutesOperatingConfigCollection(App& app)
boost::urls::format(
"/redfish/v1/Systems/system/Processors/{}/OperatingConfigs",
cpuName),
- interface, object.c_str());
+ interface, object);
return;
}
});
@@ -1362,7 +1362,7 @@ inline void requestRoutesProcessorCollection(App& app)
collection_util::getCollectionMembers(
asyncResp,
boost::urls::url("/redfish/v1/Systems/system/Processors"),
- processorInterfaces);
+ processorInterfaces, "/xyz/openbmc_project/inventory");
});
}
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index 389a20b953..74c88f7bce 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -69,7 +69,7 @@ inline void handleSystemsStorageCollectionGet(
};
collection_util::getCollectionMembers(
asyncResp, boost::urls::format("/redfish/v1/Systems/system/Storage"),
- interface);
+ interface, "/xyz/openbmc_project/inventory");
}
inline void handleStorageCollectionGet(
@@ -88,7 +88,8 @@ inline void handleStorageCollectionGet(
"xyz.openbmc_project.Inventory.Item.Storage"
};
collection_util::getCollectionMembers(
- asyncResp, boost::urls::format("/redfish/v1/Storage"), interface);
+ asyncResp, boost::urls::format("/redfish/v1/Storage"), interface,
+ "/xyz/openbmc_project/inventory");
}
inline void requestRoutesStorageCollection(App& app)