From 1fc0d70f658da30091bcd49f9bf29aecd6b99ba7 Mon Sep 17 00:00:00 2001 From: "Jason M. Bills" Date: Thu, 6 Jan 2022 13:50:19 -0800 Subject: Update to internal 0.86 Signed-off-by: Jason M. Bills --- ...-Define-Redfish-interface-Registries-Bios.patch | 260 +++++++++++---------- .../0003-Add-support-to-ResetBios-action.patch | 64 ++--- ...0004-Add-support-to-ChangePassword-action.patch | 39 ++-- ...fix-for-broken-feature-Pending-Attributes.patch | 149 ++++++------ 4 files changed, 267 insertions(+), 245 deletions(-) (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig') diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch index 93bbb7494..19a392873 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch @@ -1,7 +1,7 @@ -From 501003876765f51799152bace657d97b7fa2b60e Mon Sep 17 00:00:00 2001 +From bde7f728d5a87522674bcd5515baaa02bf7b9373 Mon Sep 17 00:00:00 2001 From: Kuiying Wang Date: Fri, 4 Sep 2020 19:24:25 +0800 -Subject: [PATCH 1/5] Define Redfish interface "/Registries/Bios" and enable +Subject: [PATCH] Define Redfish interface "/Registries/Bios" and enable Attributes property 1. Define Redfish interface "/Registries/Bios" for BIOS Attribute Registry @@ -225,33 +225,36 @@ Oem - Resource.Oem No Optional Change-Id: Iecc61018c350f0b8c89df59b2864b941508b1916 Signed-off-by: Kuiying Wang +Signed-off-by: Snehalatha Venkatesh --- - redfish-core/include/redfish.hpp | 2 + - .../include/registries/bios_registry.hpp | 31 + - redfish-core/lib/bios.hpp | 528 ++++++++++++++++++ - redfish-core/lib/message_registries.hpp | 6 + - 4 files changed, 567 insertions(+) + redfish-core/include/redfish.hpp | 3 + + .../include/registries/bios_registry.hpp | 41 ++ + redfish-core/lib/bios.hpp | 511 ++++++++++++++++++ + redfish-core/lib/message_registries.hpp | 11 +- + 4 files changed, 565 insertions(+), 1 deletion(-) create mode 100644 redfish-core/include/registries/bios_registry.hpp diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp -index c15062d..3388498 100644 +index 0a97150..07a9417 100644 --- a/redfish-core/include/redfish.hpp +++ b/redfish-core/include/redfish.hpp -@@ -152,6 +152,8 @@ class RedfishService +@@ -148,7 +148,10 @@ class RedfishService requestRoutesSystemActionsReset(app); requestRoutesSystemResetActionInfo(app); requestRoutesBiosService(app); + requestRoutesBiosSettings(app); + requestRoutesBiosAttributeRegistry(app); requestRoutesBiosReset(app); ++ requestRoutesBiosChangePassword(app); #ifdef BMCWEB_ENABLE_VM_NBDPROXY + requestNBDVirtualMediaRoutes(app); diff --git a/redfish-core/include/registries/bios_registry.hpp b/redfish-core/include/registries/bios_registry.hpp new file mode 100644 -index 0000000..88ef782 +index 0000000..c80937a --- /dev/null +++ b/redfish-core/include/registries/bios_registry.hpp -@@ -0,0 +1,31 @@ +@@ -0,0 +1,41 @@ +/* +// Copyright (c) 2020 Intel Corporation +// @@ -268,6 +271,7 @@ index 0000000..88ef782 +// limitations under the License. +*/ +#pragma once ++#include + +namespace redfish::message_registries::bios +{ @@ -282,10 +286,18 @@ index 0000000..88ef782 + "1.0.0", + "OpenBMC", +}; ++// BiosAttributeRegistry registry is not defined in DMTF, We should use ++// OEM defined registries for this purpose. ++// Below link is wrong - We need to define OEM registries and use ++// appropriate data here. ++constexpr const char* url = ++ "https://redfish.dmtf.org/registries/BiosAttributeRegistry.1.0.0.json"; ++ ++constexpr std::array registry = { ++}; +} // namespace redfish::message_registries::bios -\ No newline at end of file diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index 604b8e7..c1a5c56 100644 +index c2fb284..87536d6 100644 --- a/redfish-core/lib/bios.hpp +++ b/redfish-core/lib/bios.hpp @@ -3,8 +3,140 @@ @@ -429,109 +441,96 @@ index 604b8e7..c1a5c56 100644 /** * BiosService class supports handle get method for bios. */ -@@ -29,8 +161,404 @@ inline void requestRoutesBiosService(App& app) - // Get the ActiveSoftwareImage and SoftwareImages - fw_util::populateFirmwareInformation( - asyncResp, fw_util::biosPurpose, "", true); -+ asyncResp->res.jsonValue["@Redfish.Settings"] = { -+ {"@odata.type", "#Settings.v1_3_0.Settings"}, -+ {"SettingsObject", -+ {{"@odata.id", -+ "/redfish/v1/Systems/system/Bios/Settings"}}}}; -+ asyncResp->res.jsonValue["AttributeRegistry"] = -+ "BiosAttributeRegistry"; -+ asyncResp->res.jsonValue["Attributes"] = {}; +@@ -23,6 +155,85 @@ inline void + // Get the ActiveSoftwareImage and SoftwareImages + fw_util::populateFirmwareInformation(asyncResp, fw_util::biosPurpose, "", + true); + -+ crow::connections::systemBus->async_method_call( -+ [asyncResp](const boost::system::error_code ec, -+ const GetObjectType& getObjectType) { -+ if (ec) ++ asyncResp->res.jsonValue["@Redfish.Settings"] = { ++ {"@odata.type", "#Settings.v1_3_0.Settings"}, ++ {"SettingsObject", ++ {{"@odata.id", "/redfish/v1/Systems/system/Bios/Settings"}}}}; ++ asyncResp->res.jsonValue["AttributeRegistry"] = "BiosAttributeRegistry"; ++ asyncResp->res.jsonValue["Attributes"] = {}; ++ ++ crow::connections::systemBus->async_method_call( ++ [asyncResp](const boost::system::error_code ec, ++ const GetObjectType& getObjectType) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " ++ << ec; ++ messages::internalError(asyncResp->res); ++ ++ return; ++ } ++ const std::string& service = getObjectType.begin()->first; ++ ++ crow::connections::systemBus->async_method_call( ++ [asyncResp]( ++ const boost::system::error_code ec, ++ const std::variant& retBiosTable) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "getBiosAttributes DBUS error: " ++ << ec; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ const BiosBaseTableType* baseBiosTable = ++ std::get_if(&retBiosTable); ++ nlohmann::json& attributesJson = ++ asyncResp->res.jsonValue["Attributes"]; ++ if (baseBiosTable == nullptr) ++ { ++ BMCWEB_LOG_ERROR << "baseBiosTable == nullptr "; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ for (const BiosBaseTableItemType& item : *baseBiosTable) ++ { ++ const std::string& key = item.first; ++ const std::string& itemType = ++ std::get(item.second); ++ std::string attrType = mapAttrTypeToRedfish(itemType); ++ if (attrType == "String") + { -+ BMCWEB_LOG_ERROR -+ << "ObjectMapper::GetObject call failed: " -+ << ec; ++ const std::string* currValue = ++ std::get_if( ++ &std::get(item.second)); ++ attributesJson.emplace( ++ key, currValue != nullptr ? *currValue : ""); ++ } ++ else if (attrType == "Integer") ++ { ++ const int64_t* currValue = std::get_if( ++ &std::get(item.second)); ++ attributesJson.emplace( ++ key, currValue != nullptr ? *currValue : 0); ++ } ++ else ++ { ++ BMCWEB_LOG_ERROR << "Unsupported attribute type."; + messages::internalError(asyncResp->res); -+ -+ return; + } -+ const std::string& service = -+ getObjectType.begin()->first; -+ -+ crow::connections::systemBus->async_method_call( -+ [asyncResp](const boost::system::error_code ec, -+ const std::variant& -+ retBiosTable) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR -+ << "getBiosAttributes DBUS error: " -+ << ec; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ const BiosBaseTableType* baseBiosTable = -+ std::get_if( -+ &retBiosTable); -+ nlohmann::json& attributesJson = -+ asyncResp->res.jsonValue["Attributes"]; -+ if (baseBiosTable == nullptr) -+ { -+ BMCWEB_LOG_ERROR -+ << "baseBiosTable == nullptr "; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ for (const BiosBaseTableItemType& item : -+ *baseBiosTable) -+ { -+ const std::string& key = item.first; -+ const std::string& itemType = -+ std::get(item.second); -+ std::string attrType = -+ mapAttrTypeToRedfish(itemType); -+ if (attrType == "String") -+ { -+ const std::string* currValue = -+ std::get_if( -+ &std::get( -+ item.second)); -+ attributesJson.emplace( -+ key, currValue != nullptr -+ ? *currValue -+ : ""); -+ } -+ else if (attrType == "Integer") -+ { -+ const int64_t* currValue = -+ std::get_if( -+ &std::get( -+ item.second)); -+ attributesJson.emplace( -+ key, currValue != nullptr -+ ? *currValue -+ : 0); -+ } -+ else -+ { -+ BMCWEB_LOG_ERROR -+ << "Unsupported attribute type."; -+ messages::internalError(asyncResp->res); -+ } -+ } -+ }, -+ service, "/xyz/openbmc_project/bios_config/manager", -+ "org.freedesktop.DBus.Properties", "Get", -+ "xyz.openbmc_project.BIOSConfig.Manager", -+ "BaseBIOSTable"); -+ }, -+ "xyz.openbmc_project.ObjectMapper", -+ "/xyz/openbmc_project/object_mapper", -+ "xyz.openbmc_project.ObjectMapper", "GetObject", -+ "/xyz/openbmc_project/bios_config/manager", -+ std::array()); - }); ++ } ++ }, ++ service, "/xyz/openbmc_project/bios_config/manager", ++ "org.freedesktop.DBus.Properties", "Get", ++ "xyz.openbmc_project.BIOSConfig.Manager", "BaseBIOSTable"); ++ }, ++ "xyz.openbmc_project.ObjectMapper", ++ "/xyz/openbmc_project/object_mapper", ++ "xyz.openbmc_project.ObjectMapper", "GetObject", ++ "/xyz/openbmc_project/bios_config/manager", ++ std::array()); } -+ + inline void requestRoutesBiosService(App& app) + { +@@ -31,6 +242,306 @@ inline void requestRoutesBiosService(App& app) + .methods(boost::beast::http::verb::get)(handleBiosServiceGet); + } + +/** + * BiosSettings class supports handle GET/PATCH method for + * BIOS configuration pending settings. @@ -831,11 +830,12 @@ index 604b8e7..c1a5c56 100644 + std::array()); + }); +} ++ /** * BiosReset class supports handle POST method for Reset bios. * The class retrieves and sends data directly to D-Bus. diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp -index e3bd5bf..f1f130a 100644 +index 43359e3..b2fb43c 100644 --- a/redfish-core/lib/message_registries.hpp +++ b/redfish-core/lib/message_registries.hpp @@ -17,6 +17,7 @@ @@ -846,18 +846,30 @@ index e3bd5bf..f1f130a 100644 #include "registries/openbmc_message_registry.hpp" #include "registries/resource_event_message_registry.hpp" #include "registries/task_event_message_registry.hpp" -@@ -87,6 +88,11 @@ inline void requestRoutesMessageRegistryFile(App& app) - header = &message_registries::resource_event::header; - url = message_registries::resource_event::url; - } -+ else if (registry == "BiosAttributeRegistry") -+ { -+ header = &message_registries::bios::header; -+ dmtf.clear(); -+ } - else - { - messages::resourceNotFound( +@@ -125,7 +126,6 @@ inline void requestRoutesMessageRegistryFile(App& app) + inline void handleMessageRegistryGet( + const crow::Request&, const std::shared_ptr& asyncResp, + const std::string& registry, const std::string& registryMatch) +- + { + const message_registries::Header* header; + std::vector registryEntries; +@@ -165,6 +165,15 @@ inline void handleMessageRegistryGet( + registryEntries.emplace_back(&entry); + } + } ++ else if (registry == "BiosAttributeRegistry") ++ { ++ header = &message_registries::bios::header; ++ for (const message_registries::MessageEntry& entry : ++ message_registries::bios::registry) ++ { ++ registryEntries.emplace_back(&entry); ++ } ++ } + else + { + messages::resourceNotFound( -- 2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch index a5c55afd1..5ed92cc3e 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch @@ -1,6 +1,6 @@ -From 415b5079ff45c1dabad15e0f751001a6265412e4 Mon Sep 17 00:00:00 2001 +From b7adca60dd69ac9566dc8f417065e244198fc711 Mon Sep 17 00:00:00 2001 From: AppaRao Puli -Date: Fri, 27 Aug 2021 13:02:20 +0000 +Date: Wed, 6 Oct 2021 22:27:20 +0000 Subject: [PATCH] Add support to ResetBios action Tested: @@ -10,44 +10,44 @@ POST https://IP_ADDR/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios Change-Id: Ic719c55705e5f634539b3dd858b60922e505a8d0 Signed-off-by: Kuiying Wang +Signed-off-by: AppaRao Puli + Signed-off-by: AppaRao Puli --- - redfish-core/lib/bios.hpp | 14 ++++++++++---- - 1 file changed, 10 insertions(+), 4 deletions(-) + redfish-core/lib/bios.hpp | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index 85ccaaa..360a749 100644 +index f5aa7b7..f613613 100644 --- a/redfish-core/lib/bios.hpp +++ b/redfish-core/lib/bios.hpp -@@ -737,18 +737,24 @@ inline void requestRoutesBiosReset(App& app) - .methods(boost::beast::http::verb::post)( - [](const crow::Request&, - const std::shared_ptr& asyncResp) { -+ std::string resetFlag = "xyz.openbmc_project.BIOSConfig." -+ "Manager.ResetFlag.FactoryDefaults"; +@@ -648,17 +648,23 @@ inline void + handleBiosResetPost(const crow::Request&, + const std::shared_ptr& asyncResp) + { ++ std::string resetFlag = ++ "xyz.openbmc_project.BIOSConfig.Manager.ResetFlag.FactoryDefaults"; + - crow::connections::systemBus->async_method_call( - [asyncResp](const boost::system::error_code ec) { - if (ec) - { -- BMCWEB_LOG_ERROR << "Failed to reset bios: " << ec; -+ BMCWEB_LOG_ERROR << "doPost bios reset got error " -+ << ec; - messages::internalError(asyncResp->res); - return; - } - }, -- "org.open_power.Software.Host.Updater", -- "/xyz/openbmc_project/software", -- "xyz.openbmc_project.Common.FactoryReset", "Reset"); -+ "xyz.openbmc_project.BIOSConfigManager", -+ "/xyz/openbmc_project/bios_config/manager", -+ "org.freedesktop.DBus.Properties", "Set", -+ "xyz.openbmc_project.BIOSConfig.Manager", -+ "ResetBIOSSettings", std::variant(resetFlag)); - }); + crow::connections::systemBus->async_method_call( + [asyncResp](const boost::system::error_code ec) { + if (ec) + { +- BMCWEB_LOG_ERROR << "Failed to reset bios: " << ec; ++ BMCWEB_LOG_ERROR << "doPost bios reset got error " << ec; + messages::internalError(asyncResp->res); + return; + } + }, +- "org.open_power.Software.Host.Updater", "/xyz/openbmc_project/software", +- "xyz.openbmc_project.Common.FactoryReset", "Reset"); ++ "xyz.openbmc_project.BIOSConfigManager", ++ "/xyz/openbmc_project/bios_config/manager", ++ "org.freedesktop.DBus.Properties", "Set", ++ "xyz.openbmc_project.BIOSConfig.Manager", "ResetBIOSSettings", ++ std::variant(resetFlag)); } - } // namespace redfish + + inline void requestRoutesBiosReset(App& app) -- 2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch index 9a2fada9e..4bfca3006 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch @@ -1,7 +1,7 @@ -From 34f8680b21a134e2133bdcf41e1e83e4b4a05d28 Mon Sep 17 00:00:00 2001 -From: Krzysztof Grobelny -Date: Wed, 30 Jun 2021 15:37:47 +0000 -Subject: [PATCH 4/5] Add support to ChangePassword action +From 22956921a228f6f1cbbbd3045a3cc3969732dca3 Mon Sep 17 00:00:00 2001 +From: Arun Lal K M +Date: Fri, 8 Oct 2021 20:56:00 +0000 +Subject: [PATCH] Add support to ChangePassword action Tested: @@ -29,28 +29,29 @@ root@intel-obmc:~# cat /var/lib/bios-settings-manager/passwordData "UserName": "Administrator" } -Change-Id: I90319a68da0b0a7f9c5cd65a8cb8cf52269a5f52 +Signed-off-by: Arun Lal K M Signed-off-by: Kuiying Wang --- - redfish-core/lib/bios.hpp | 58 +++++++++++++++++++++++++++++++++++++++ - 1 file changed, 58 insertions(+) + redfish-core/lib/bios.hpp | 59 +++++++++++++++++++++++++++++++++++++++ + 1 file changed, 59 insertions(+) diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index 49c0fd0..0250c59 100644 +index f613613..b06a904 100644 --- a/redfish-core/lib/bios.hpp +++ b/redfish-core/lib/bios.hpp -@@ -180,6 +180,9 @@ inline void requestRoutesBiosService(App& app) - asyncResp->res.jsonValue["Actions"]["#Bios.ResetBios"] = { - {"target", - "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios"}}; -+ asyncResp->res.jsonValue["Actions"]["#Bios.ChangePassword"] = { -+ {"target", "/redfish/v1/Systems/system/Bios/Actions/" -+ "Bios.ChangePassword"}}; +@@ -175,6 +175,10 @@ inline void + asyncResp->res.jsonValue["Actions"]["#Bios.ResetBios"] = { + {"target", "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios"}}; - // Get the ActiveSoftwareImage and SoftwareImages - fw_util::populateFirmwareInformation( -@@ -283,6 +286,61 @@ inline void requestRoutesBiosService(App& app) - }); ++ asyncResp->res.jsonValue["Actions"]["#Bios.ChangePassword"] = { ++ {"target", "/redfish/v1/Systems/system/Bios/Actions/" ++ "Bios.ChangePassword"}}; ++ + // Get the ActiveSoftwareImage and SoftwareImages + fw_util::populateFirmwareInformation(asyncResp, fw_util::biosPurpose, "", + true); +@@ -265,6 +269,61 @@ inline void requestRoutesBiosService(App& app) + .methods(boost::beast::http::verb::get)(handleBiosServiceGet); } +/** diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0006-Add-fix-for-broken-feature-Pending-Attributes.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0006-Add-fix-for-broken-feature-Pending-Attributes.patch index 0e4fc4903..2e72a639d 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0006-Add-fix-for-broken-feature-Pending-Attributes.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0006-Add-fix-for-broken-feature-Pending-Attributes.patch @@ -1,6 +1,6 @@ -From 9814f83f36afafffa55bd19481654c064840e73d Mon Sep 17 00:00:00 2001 +From f75beb0472a42d5af512661470aadf12ac460470 Mon Sep 17 00:00:00 2001 From: Arun Lal K M -Date: Mon, 16 Aug 2021 17:49:11 +0000 +Date: Fri, 8 Oct 2021 21:30:33 +0000 Subject: [PATCH] Add fix for broken feature 'Pending Attributes'. Fix is added for the following: @@ -8,6 +8,8 @@ Fix is added for the following: 2) PATCH to 'redfish/v1/Systems/system/Bios/Settings'. 3) GET to 'redfish/v1/Systems/system/Bios/Settings'. 4) Fix for incremental duplicate values in BiosAttributeRegistry. +5) POST to '/redfish/v1/Systems/system/Bios/Actions + /Bios.ChangePassword/'. Tested: By giving PATCH to 'redfish/v1/Systems/system/Bios/Settings' @@ -105,6 +107,10 @@ Response: "Name": "Bios Settings Version 1" } +By giving POST to '/redfish/v1/Systems/system/Bios/Actions +/Bios.ChangePassword/' +Response: Success + By running Redfish-Service-Validator Result: Elapsed time: 0:09:36 @@ -124,14 +130,14 @@ warnDeprecated: 230 warningPresent: 54 Validation has succeeded. -Change-Id: Ib92eb7a1b81bef5adaf432b9225a183d7a78ebef Signed-off-by: Arun Lal K M +Signed-off-by: Snehalatha Venkatesh --- - redfish-core/lib/bios.hpp | 583 ++++++++++++++++++++++++-------------- - 1 file changed, 374 insertions(+), 209 deletions(-) + redfish-core/lib/bios.hpp | 586 ++++++++++++++++++++++++-------------- + 1 file changed, 376 insertions(+), 210 deletions(-) diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index 360a749..a927772 100644 +index 0bb0b9e..de79be2 100644 --- a/redfish-core/lib/bios.hpp +++ b/redfish-core/lib/bios.hpp @@ -12,13 +12,15 @@ map{attributeName,struct{attributeType,readonlyStatus,displayname, @@ -249,49 +255,52 @@ index 360a749..a927772 100644 static std::string mapBoundTypeToRedfish(const std::string_view typeDbus) { std::string ret; -@@ -208,6 +170,15 @@ inline void requestRoutesBiosService(App& app) +@@ -201,6 +163,15 @@ inline void - return; - } + return; + } + -+ if (getObjectType.empty()) -+ { -+ BMCWEB_LOG_ERROR << "getObjectType is empty."; -+ messages::internalError(asyncResp->res); ++ if (getObjectType.empty()) ++ { ++ BMCWEB_LOG_ERROR << "getObjectType is empty."; ++ messages::internalError(asyncResp->res); + -+ return; -+ } ++ return; ++ } + - const std::string& service = - getObjectType.begin()->first; + const std::string& service = getObjectType.begin()->first; -@@ -231,7 +202,7 @@ inline void requestRoutesBiosService(App& app) - if (baseBiosTable == nullptr) - { - BMCWEB_LOG_ERROR -- << "baseBiosTable == nullptr "; -+ << "baseBiosTable is empty"; - messages::internalError(asyncResp->res); - return; - } -@@ -269,7 +240,6 @@ inline void requestRoutesBiosService(App& app) - { - BMCWEB_LOG_ERROR - << "Unsupported attribute type."; -- messages::internalError(asyncResp->res); - } - } - }, -@@ -293,7 +263,7 @@ inline void requestRoutesBiosService(App& app) + crow::connections::systemBus->async_method_call( +@@ -220,7 +191,7 @@ inline void + asyncResp->res.jsonValue["Attributes"]; + if (baseBiosTable == nullptr) + { +- BMCWEB_LOG_ERROR << "baseBiosTable == nullptr "; ++ BMCWEB_LOG_ERROR << "baseBiosTable is empty"; + messages::internalError(asyncResp->res); + return; + } +@@ -248,7 +219,6 @@ inline void + else + { + BMCWEB_LOG_ERROR << "Unsupported attribute type."; +- messages::internalError(asyncResp->res); + } + } + }, +@@ -275,8 +245,9 @@ inline void requestRoutesBiosService(App& app) + */ inline void requestRoutesBiosChangePassword(App& app) { - BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Bios/") +- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Bios/") - .privileges({{"ConfigureComponents"}}) ++ BMCWEB_ROUTE(app, ++ "/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword/") + .privileges(redfish::privileges::postBios) .methods(boost::beast::http::verb::post)( [](const crow::Request& req, const std::shared_ptr& asyncResp) { -@@ -359,180 +329,298 @@ inline void requestRoutesBiosSettings(App& app) +@@ -342,180 +313,298 @@ inline void requestRoutesBiosSettings(App& app) { BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Bios/Settings") .privileges(redfish::privileges::getBios) @@ -341,9 +350,7 @@ index 360a749..a927772 100644 - return; - } - std::string service = getObjectType.begin()->first; -+ return; -+ } - +- - crow::connections::systemBus->async_method_call( - [asyncResp]( - const boost::system::error_code ec, @@ -372,6 +379,9 @@ index 360a749..a927772 100644 - } - for (const PendingAttributesItemType& item : - *pendingAttributes) ++ return; ++ } ++ + if (getObjectType.empty()) + { + BMCWEB_LOG_ERROR << "getObjectType is empty."; @@ -525,32 +535,24 @@ index 360a749..a927772 100644 - [](const crow::Request& req, - const std::shared_ptr& asyncResp) { - nlohmann::json inpJson; -- -- if (!redfish::json_util::readJson(req, asyncResp->res, "data", -- inpJson)) -- { -- return; -- } + .privileges(redfish::privileges::patchBios) + .methods( + boost::beast::http::verb:: + patch)([](const crow::Request& req, + const std::shared_ptr& asyncResp) { + nlohmann::json inpJson; -+ + +- if (!redfish::json_util::readJson(req, asyncResp->res, "data", +- inpJson)) +- { +- return; +- } + if (!redfish::json_util::readJson(req, asyncResp->res, "data", + inpJson)) + { + BMCWEB_LOG_ERROR << "No 'data' in req!"; + return; + } -+ -+ if (inpJson.empty()) -+ { -+ messages::invalidObject(asyncResp->res, "data"); -+ BMCWEB_LOG_ERROR << "No input in req!"; -+ return; -+ } - for (auto& attrInfo : inpJson) - { @@ -573,6 +575,13 @@ index 360a749..a927772 100644 - } - if (!json_util::getValueFromJsonObject( - attrInfo, "AttributeValue", attrValue)) ++ if (inpJson.empty()) ++ { ++ messages::invalidObject(asyncResp->res, "data"); ++ BMCWEB_LOG_ERROR << "No input in req!"; ++ return; ++ } ++ + crow::connections::systemBus->async_method_call( + [asyncResp, inpJson](const boost::system::error_code ec, + const GetObjectType& getObjectType) { @@ -616,9 +625,9 @@ index 360a749..a927772 100644 BMCWEB_LOG_ERROR - << "doPatch resp_handler got error " << ec; + << "getBiosAttributes DBUS error: " << ec; - messages::internalError(asyncResp->res); - return; - } ++ messages::internalError(asyncResp->res); ++ return; ++ } + + const BiosBaseTableType* baseBiosTable = + std::get_if(&retBiosTable); @@ -626,9 +635,9 @@ index 360a749..a927772 100644 + if (baseBiosTable == nullptr) + { + BMCWEB_LOG_ERROR << "baseBiosTable is empty."; -+ messages::internalError(asyncResp->res); -+ return; -+ } + messages::internalError(asyncResp->res); + return; + } + + PendingAttributesType pendingAttributes{}; + @@ -732,7 +741,7 @@ index 360a749..a927772 100644 } /** * BiosAttributeRegistry class supports handle get method for BIOS attribute -@@ -572,6 +660,15 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -555,6 +644,15 @@ inline void requestRoutesBiosAttributeRegistry(App& app) return; } @@ -748,7 +757,7 @@ index 360a749..a927772 100644 std::string service = getObjectType.begin()->first; crow::connections::systemBus->async_method_call( -@@ -592,8 +689,6 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -575,8 +673,6 @@ inline void requestRoutesBiosAttributeRegistry(App& app) nlohmann::json& attributeArray = asyncResp->res .jsonValue["RegistryEntries"]["Attributes"]; @@ -757,7 +766,7 @@ index 360a749..a927772 100644 if (baseBiosTable == nullptr) { BMCWEB_LOG_ERROR << "baseBiosTable == nullptr "; -@@ -609,10 +704,11 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -592,10 +688,11 @@ inline void requestRoutesBiosAttributeRegistry(App& app) mapAttrTypeToRedfish(itemType); if (attrType == "UNKNOWN") { @@ -772,7 +781,7 @@ index 360a749..a927772 100644 nlohmann::json attributeItem; attributeItem["AttributeName"] = item.first; attributeItem["Type"] = attrType; -@@ -632,10 +728,30 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -615,10 +712,30 @@ inline void requestRoutesBiosAttributeRegistry(App& app) std::get_if( &std::get( item.second)); @@ -803,7 +812,7 @@ index 360a749..a927772 100644 attributeItem["CurrentValue"] = currValue != nullptr ? *currValue : ""; attributeItem["DefaultValue"] = -@@ -647,10 +763,30 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -630,10 +747,30 @@ inline void requestRoutesBiosAttributeRegistry(App& app) std::get_if( &std::get( item.second)); @@ -834,7 +843,7 @@ index 360a749..a927772 100644 attributeItem["CurrentValue"] = currValue != nullptr ? *currValue : 0; attributeItem["DefaultValue"] = -@@ -658,12 +794,13 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -641,12 +778,13 @@ inline void requestRoutesBiosAttributeRegistry(App& app) } else { @@ -852,7 +861,7 @@ index 360a749..a927772 100644 const std::vector& optionsVector = std::get(item.second); -@@ -678,9 +815,9 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -661,9 +799,9 @@ inline void requestRoutesBiosAttributeRegistry(App& app) if (optItemTypeRedfish == "UNKNOWN") { BMCWEB_LOG_ERROR @@ -865,7 +874,7 @@ index 360a749..a927772 100644 } if (optItemTypeRedfish == "OneOf") { -@@ -688,6 +825,17 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -671,6 +809,17 @@ inline void requestRoutesBiosAttributeRegistry(App& app) std::get_if( &std::get( optItem)); @@ -883,7 +892,7 @@ index 360a749..a927772 100644 optItemJson[optItemTypeRedfish] = currValue != nullptr ? *currValue : ""; -@@ -698,6 +846,17 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -681,6 +830,17 @@ inline void requestRoutesBiosAttributeRegistry(App& app) std::get_if( &std::get( optItem)); @@ -901,7 +910,7 @@ index 360a749..a927772 100644 optItemJson[optItemTypeRedfish] = currValue != nullptr ? *currValue : 0; -@@ -706,6 +865,12 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -689,6 +849,12 @@ inline void requestRoutesBiosAttributeRegistry(App& app) optionsArray.push_back(optItemJson); } -- cgit v1.2.3