diff options
author | Carol Wang <wangkair@cn.ibm.com> | 2019-10-23 10:14:54 +0300 |
---|---|---|
committer | Carol Wang <wangkair@cn.ibm.com> | 2019-10-31 05:14:33 +0300 |
commit | fc41ff6e941a1052a45c47a1de9568219b387283 (patch) | |
tree | 48a27f59f6cabd487f580d1fcb08e9cfaf7f0e6c | |
parent | a6349918ad2c88533c6d09bb876812375a19f2c4 (diff) | |
download | bmcweb-fc41ff6e941a1052a45c47a1de9568219b387283.tar.xz |
Redfish: Fix System IndicatorLED
xyz.openbmc_project.LED.Controller.identify does not exist in all systems.
Checking LED group enclosure_identify is generic and is expected to
indicate the Indicator LED state.
Remove LED physical identify related code to make it generic for all systems.
Tested:
$curl -k -H "X-Auth-Token: $token" -d "{\"data\": true}" -X PUT https://${bmc}/xyz/openbmc_project/led/groups/enclosure_identify/attr/Asserted
{
"data": null,
"message": "200 OK",
"status": "ok"
}
$ curl -k -H "X-Auth-Token: $token" X GET https://${bmc}/redfish/v1/Systems/system
{
"@odata.context": "/redfish/v1/$metadata#ComputerSystem.ComputerSystem",
"@odata.id": "/redfish/v1/Systems/system",
"@odata.type": "#ComputerSystem.v1_6_0.ComputerSystem",
"Actions": {
"#ComputerSystem.Reset": {
"ResetType@Redfish.AllowableValues": [
"On",
"ForceOff",
"ForceOn",
"ForceRestart",
"GracefulRestart",
"GracefulShutdown",
"PowerCycle",
"Nmi"
],
"target": "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset"
}
},
"AssetTag": "",
"BiosVersion": "open-power-witherspoon-v2.3-rc2-390-g8db7a9e",
"Boot": {
"BootSourceOverrideEnabled": "Disabled",
"BootSourceOverrideMode": "Legacy",
"BootSourceOverrideTarget": "None",
"BootSourceOverrideTarget@Redfish.AllowableValues": [
"None",
"Pxe",
"Hdd",
"Cd",
"Diags",
"BiosSetup",
"Usb"
]
},
"Description": "Computer System",
"Id": "1069A8T ",
"IndicatorLED": "On",
"Links": {
"Chassis": [
{
"@odata.id": "/redfish/v1/Chassis/chassis"
}
],
"ManagedBy": [
{
"@odata.id": "/redfish/v1/Managers/bmc"
}
]
},
"LogServices": {
"@odata.id": "/redfish/v1/Systems/system/LogServices"
},
"Manufacturer": "",
"Memory": {
"@odata.id": "/redfish/v1/Systems/system/Memory"
},
"MemorySummary": {
"Status": {
"State": "Enabled"
},
"TotalSystemMemoryGiB": 0
},
"Model": "8286-42B ",
"Name": "system",
"PartNumber": "",
"PowerState": "Off",
"ProcessorSummary": {
"Count": 2,
"Status": {
"State": "Enabled"
}
},
"Processors": {
"@odata.id": "/redfish/v1/Systems/system/Processors"
},
"SerialNumber": "1069A8T ",
"Status": {
"Health": "OK",
"HealthRollup": "OK",
"State": "Disabled"
},
"SystemType": "Physical"
}
The result of redfish Validator tool:
Counter Optional': 2480, 'metadataNamespaces': 1602, 'passGet': 191, 'serviceNamespaces': 69, 'invalidPropertyValue': 10, 'warningPresent': 6, 'passAction': 6, 'optionalAction': 5, 'warnDeprecated': 2, 'unverifiedComplexAdditional': 1})
Validation has succeeded.
Change-Id: Ie4b7931404fd072df4c6f215656436f07d3e4cde
Signed-off-by: Carol Wang <wangkair@cn.ibm.com>
-rw-r--r-- | redfish-core/lib/systems.hpp | 67 |
1 files changed, 2 insertions, 65 deletions
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp index d15a510602..c51f37d5fa 100644 --- a/redfish-core/lib/systems.hpp +++ b/redfish-core/lib/systems.hpp @@ -612,60 +612,6 @@ void getLedGroupIdentify(std::shared_ptr<AsyncResp> aResp, "GetManagedObjects"); } -template <typename CallbackFunc> -void getLedIdentify(std::shared_ptr<AsyncResp> aResp, CallbackFunc &&callback) -{ - BMCWEB_LOG_DEBUG << "Get identify led properties"; - crow::connections::systemBus->async_method_call( - [aResp, - callback{std::move(callback)}](const boost::system::error_code ec, - const PropertiesType &properties) { - if (ec) - { - BMCWEB_LOG_DEBUG << "DBUS response error " << ec; - messages::internalError(aResp->res); - return; - } - BMCWEB_LOG_DEBUG << "Got " << properties.size() - << " led properties."; - std::string output; - for (const auto &property : properties) - { - if (property.first == "State") - { - const std::string *s = - std::get_if<std::string>(&property.second); - if (nullptr != s) - { - BMCWEB_LOG_DEBUG << "Identify Led State: " << *s; - const auto pos = s->rfind('.'); - if (pos != std::string::npos) - { - auto led = s->substr(pos + 1); - for (const std::pair<const char *, const char *> - &p : - std::array< - std::pair<const char *, const char *>, 3>{ - {{"On", "Lit"}, - {"Blink", "Blinking"}, - {"Off", "Off"}}}) - { - if (led == p.first) - { - output = p.second; - } - } - } - } - } - } - callback(output, aResp); - }, - "xyz.openbmc_project.LED.Controller.identify", - "/xyz/openbmc_project/led/physical/identify", - "org.freedesktop.DBus.Properties", "GetAll", - "xyz.openbmc_project.Led.Physical"); -} /** * @brief Retrieves host state properties over dbus * @@ -1712,19 +1658,10 @@ class Systems : public Node }); getLedGroupIdentify( asyncResp, - [](const bool &asserted, const std::shared_ptr<AsyncResp> aRsp) { + [](bool asserted, const std::shared_ptr<AsyncResp> aRsp) { if (asserted) { - // If led group is asserted, then another call is needed to - // get led status - getLedIdentify( - aRsp, [](const std::string &ledStatus, - const std::shared_ptr<AsyncResp> aRsp) { - if (!ledStatus.empty()) - { - aRsp->res.jsonValue["IndicatorLED"] = ledStatus; - } - }); + aRsp->res.jsonValue["IndicatorLED"] = "On"; } else { |