summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunnySrivastava1984 <sunnsr25@in.ibm.com>2020-10-28 10:20:30 +0300
committersunnsr25 <sunnsr25@in.ibm.com>2021-02-17 19:00:35 +0300
commit071d8fdf75e78f189cf4d670854eb9a22f5e484c (patch)
treeb7a6467a718a580cfeab5340d993e692e2adc158
parent086d32c5a61a29e92ac441e66fd4a53df4f2c8ec (diff)
downloadbmcweb-071d8fdf75e78f189cf4d670854eb9a22f5e484c.tar.xz
Add additional Redfish Manager properties
This commit adds the following inventory properties for the BMC resource: a) LocationCode, a free form, implementation-defined string to provide the location of the BMC. This is needed so an implementation can identify the BMC via system diagrams and such. b) Model, maps to a CCIN/Card ID for IBM's implementation, is a string for the manufacturer's part model. For IBM's implementation, it is a four-digit value assigned for each possible FRU. c) SparePartNumber, also field-replaceable unit (FRU) Part Number, is a part number that identifies the FRU for replacement specifically ordering of a new part. For some manufacturers the BMC is soldered down, this is not the case for all manufacturers. For our systems, the BMC can be replaced and these properties are essential to locate and replace the BMC. Redfish validator has been executed on this change and no new error was found. Sample Output: { "@odata.id": "/redfish/v1/Managers/bmc", "@odata.type": "#Manager.v1_11_0.Manager", "Actions": { "#Manager.Reset": { "@Redfish.ActionInfo": "/redfish/v1/Managers/bmc/ResetActionInfo", "target": "/redfish/v1/Managers/bmc/Actions/Manager.Reset" }, "#Manager.ResetToDefaults": { "ResetType@Redfish.AllowableValues": [ "ResetAll" ], "target": "/redfish/v1/Managers/bmc/Actions/Manager.ResetToDefaults" } }, "DateTime": "2020-12-18T07:37:34+00:00", "Description": "Baseboard Management Controller", "EthernetInterfaces": { "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces" }, "FirmwareVersion": "fw1020.00-12.1-10-g60fee5936", "GraphicalConsole": { "ConnectTypesSupported": [ "KVMIP" ], "MaxConcurrentSessions": 4, "ServiceEnabled": true }, "Id": "bmc", "LastResetTime": "2020-12-09T17:21:20+00:00", "Links": { "ActiveSoftwareImage": { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/e7522a84" }, "ManagerForChassis": [ { "@odata.id": "/redfish/v1/Chassis/Nisqually_Backplane" } ], "ManagerForChassis@odata.count": 1, "ManagerForServers": [ { "@odata.id": "/redfish/v1/Systems/system" } ], "ManagerForServers@odata.count": 1, "ManagerInChassis": { "@odata.id": "/redfish/v1/Chassis/Nisqually_Backplane" }, "SoftwareImages": [ { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/e7522a84" } ], "SoftwareImages@odata.count": 1 }, "Location": { "PartLocation": { "ServiceLabel": "U78DA.ND1.1234567-P0-C5" } }, "LogServices": { "@odata.id": "/redfish/v1/Managers/bmc/LogServices" }, "ManagerType": "BMC", "Manufacturer": "", "Model": "", "Name": "OpenBmc Manager", "NetworkProtocol": { "@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol" }, "Oem": { "@odata.id": "/redfish/v1/Managers/bmc#/Oem", "@odata.type": "#OemManager.Oem", "OpenBmc": { "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc", "@odata.type": "#OemManager.OpenBmc", "Certificates": { "@odata.id": "/redfish/v1/Managers/bmc/Truststore/Certificates" } } }, "PartNumber": "PN12345", "PowerState": "On", "SerialConsole": { "ConnectTypesSupported": [ "IPMI", "SSH" ], "MaxConcurrentSessions": 15, "ServiceEnabled": true }, "SerialNumber": "YL6B58010000", "ServiceEntryPointUUID": "280c3750-fa95-42cd-96aa-7834853bd922", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" }, "UUID": "35d98d20-cf67-4575-8aaa-0c40c398efdf" } Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com> Change-Id: I53044fb0173be8fce7a13aadc2cf5c2903529486
-rw-r--r--redfish-core/lib/managers.hpp130
1 files changed, 96 insertions, 34 deletions
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 6347caf661..8953d7a46b 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -1686,6 +1686,49 @@ struct SetPIDValues : std::enable_shared_from_this<SetPIDValues>
size_t objectCount = 0;
};
+/**
+ * @brief Retrieves BMC manager location data over DBus
+ *
+ * @param[in] aResp Shared pointer for completing asynchronous calls
+ * @param[in] connectionName - service name
+ * @param[in] path - object path
+ * @return none
+ */
+inline void getLocation(const std::shared_ptr<AsyncResp>& aResp,
+ const std::string& connectionName,
+ const std::string& path)
+{
+ BMCWEB_LOG_DEBUG << "Get BMC manager Location data.";
+
+ crow::connections::systemBus->async_method_call(
+ [aResp](const boost::system::error_code ec,
+ const std::variant<std::string>& property) {
+ if (ec)
+ {
+ BMCWEB_LOG_DEBUG << "DBUS response error for "
+ "Location";
+ messages::internalError(aResp->res);
+ return;
+ }
+
+ const std::string* value = std::get_if<std::string>(&property);
+
+ if (value == nullptr)
+ {
+ // illegal value
+ messages::internalError(aResp->res);
+ return;
+ }
+
+ aResp->res.jsonValue["Location"]["PartLocation"]["ServiceLabel"] =
+ *value;
+ },
+ connectionName, path, "org.freedesktop.DBus.Properties", "Get",
+ "xyz.openbmc_project.Inventory.Decorator."
+ "LocationCode",
+ "LocationCode");
+}
+
class Manager : public Node
{
public:
@@ -1707,7 +1750,7 @@ class Manager : public Node
const std::vector<std::string>&) override
{
res.jsonValue["@odata.id"] = "/redfish/v1/Managers/bmc";
- res.jsonValue["@odata.type"] = "#Manager.v1_9_0.Manager";
+ res.jsonValue["@odata.type"] = "#Manager.v1_11_0.Manager";
res.jsonValue["Id"] = "bmc";
res.jsonValue["Name"] = "OpenBmc Manager";
res.jsonValue["Description"] = "Baseboard Management Controller";
@@ -1871,41 +1914,60 @@ class Manager : public Node
const std::string& path = subtree[0].first;
const std::string& connectionName = subtree[0].second[0].first;
- crow::connections::systemBus->async_method_call(
- [asyncResp](
- const boost::system::error_code ec,
- const std::vector<
- std::pair<std::string, std::variant<std::string>>>&
- propertiesList) {
- if (ec)
- {
- BMCWEB_LOG_DEBUG << "Can't get bmc asset!";
- return;
- }
- for (const std::pair<std::string,
- std::variant<std::string>>&
- property : propertiesList)
- {
- const std::string& propertyName = property.first;
-
- if ((propertyName == "PartNumber") ||
- (propertyName == "SerialNumber") ||
- (propertyName == "Manufacturer"))
- {
- const std::string* value =
- std::get_if<std::string>(&property.second);
- if (value == nullptr)
+ for (const auto& interfaceName : subtree[0].second[0].second)
+ {
+ if (interfaceName ==
+ "xyz.openbmc_project.Inventory.Decorator.Asset")
+ {
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](
+ const boost::system::error_code ec,
+ const std::vector<std::pair<
+ std::string, std::variant<std::string>>>&
+ propertiesList) {
+ if (ec)
{
- // illegal property
- messages::internalError(asyncResp->res);
- continue;
+ BMCWEB_LOG_DEBUG << "Can't get bmc asset!";
+ return;
}
- asyncResp->res.jsonValue[propertyName] = *value;
- }
- }
- },
- connectionName, path, "org.freedesktop.DBus.Properties",
- "GetAll", "xyz.openbmc_project.Inventory.Decorator.Asset");
+ for (const std::pair<std::string,
+ std::variant<std::string>>&
+ property : propertiesList)
+ {
+ const std::string& propertyName =
+ property.first;
+
+ if ((propertyName == "PartNumber") ||
+ (propertyName == "SerialNumber") ||
+ (propertyName == "Manufacturer") ||
+ (propertyName == "Model") ||
+ (propertyName == "SparePartNumber"))
+ {
+ const std::string* value =
+ std::get_if<std::string>(
+ &property.second);
+ if (value == nullptr)
+ {
+ // illegal property
+ messages::internalError(
+ asyncResp->res);
+ continue;
+ }
+ asyncResp->res.jsonValue[propertyName] =
+ *value;
+ }
+ }
+ },
+ connectionName, path,
+ "org.freedesktop.DBus.Properties", "GetAll",
+ "xyz.openbmc_project.Inventory.Decorator.Asset");
+ }
+ else if (interfaceName == "xyz.openbmc_project.Inventory."
+ "Decorator.LocationCode")
+ {
+ getLocation(asyncResp, connectionName, path);
+ }
+ }
},
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",