bmcweb: Add/Move common typedefs to dbus utility
The following typedefs that are commonly used by redfish services
to get dbus subtree objects:
MapperServiceMap =
std::vector<std::pair<std::string, std::vector<std::string>>>
MapperGetSubTreeResponse =
std::vector<std::pair<std::string, MapperServiceMap>>
This commit adds the above mentioned typedefs to dbus utility namespace
and removes locally defined typedefs in processor.hpp.
Testing:
Validator: No errors
Few sample outputs from curl command:
$ curl -k -X GET https://{$bmc}/redfish/v1/Systems/system/Processors
{
"@odata.id": "/redfish/v1/Systems/system/Processors",
"@odata.type": "#ProcessorCollection.ProcessorCollection",
"Members": [
{
"@odata.id": "/redfish/v1/Systems/system/Processors/dcm0-cpu0"
},
{
"@odata.id": "/redfish/v1/Systems/system/Processors/dcm0-cpu1"
},
{
"@odata.id": "/redfish/v1/Systems/system/Processors/dcm1-cpu0"
},
{
"@odata.id": "/redfish/v1/Systems/system/Processors/dcm1-cpu1"
}
],
"Members@odata.count": 4,
"Name": "Processor Collection"
}
$ curl -k -X GET
https://{$bmc}/redfish/v1/Systems/system/Processors/dcm0-cpu0
{
"@odata.id": "/redfish/v1/Systems/system/Processors/dcm0-cpu0",
"@odata.type": "#Processor.v1_12_0.Processor",
"Id": "dcm0-cpu0",
"Location": {
"PartLocation": {
"ServiceLabel": "U78DA.ND0.WZS004K-P0-C15"
}
},
"LocationIndicatorActive": false,
"Manufacturer": "",
"MaxSpeedMHz": 0,
"Model": "5C67",
"Name": "PROCESSOR MODULE",
"PartNumber": "03JM290",
"ProcessorId": {
"EffectiveFamily": ""
},
"ProcessorType": "CPU",
"SerialNumber": "YA3936061828",
"Socket": "",
"SparePartNumber": "F210110",
"Status": {
"Health": "OK",
"State": "Enabled"
},
"SubProcessors": {
"@odata.id":
"/redfish/v1/Systems/system/Processors/dcm0-cpu0/SubProcessors"
},
"TotalCores": 8,
"TotalThreads": 0
}
$ curl -k -X GET
https://{$bmc}/redfish/v1/Systems/system/Processors/dcm0-cpu0/SubProcessors
{
"@odata.id":
"/redfish/v1/Systems/system/Processors/dcm0-cpu0/SubProcessors",
"@odata.type": "#ProcessorCollection.ProcessorCollection",
"Members": [],
"Members@odata.count": 0,
"Name": "SubProcessor Collection"
}
Signed-off-by: Shantappa Teekappanavar <sbteeks@yahoo.com>
Change-Id: I297c763af38fa5b13ef297e911b338f406b7c6e6
diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp
index 872ca61..75bda08 100644
--- a/include/dbus_utility.hpp
+++ b/include/dbus_utility.hpp
@@ -66,6 +66,14 @@
boost::container::flat_map<
std::string, boost::container::flat_map<std::string, DbusVariantType>>>;
+// Map of service name to list of interfaces
+using MapperServiceMap =
+ std::vector<std::pair<std::string, std::vector<std::string>>>;
+
+// Map of object paths to MapperServiceMaps
+using MapperGetSubTreeResponse =
+ std::vector<std::pair<std::string, MapperServiceMap>>;
+
inline void escapePathForDbus(std::string& path)
{
const std::regex reg("[^A-Za-z0-9_/]");