diff options
author | jmbills <jason.m.bills@intel.com> | 2022-01-18 21:55:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-18 21:55:05 +0300 |
commit | 7cf0c1cd0ce835d1833509b7b911e8a97380278b (patch) | |
tree | 0b45c3beaa9874facc4ed1a2395a31e42be0135d /meta-openbmc-mods/meta-common/recipes-phosphor | |
parent | 4dac5fcd49b5e2de1074f1363775ec0f19041072 (diff) | |
parent | 1fc0d70f658da30091bcd49f9bf29aecd6b99ba7 (diff) | |
download | openbmc-7cf0c1cd0ce835d1833509b7b911e8a97380278b.tar.xz |
Merge pull request #76 from Intel-BMC/update1-0.86
Update
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor')
83 files changed, 2527 insertions, 2096 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/biosconfig-manager/biosconfig-manager_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/biosconfig-manager/biosconfig-manager_git.bb index 53ba2eeac..711e4eced 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/biosconfig-manager/biosconfig-manager_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/biosconfig-manager/biosconfig-manager_git.bb @@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fe inherit meson systemd SRC_URI = "git://github.com/openbmc/bios-settings-mgr.git" -SRCREV = "b5984b87eb93f57f8bc2c123717527076a560753" +SRCREV = "29656f07b7e81c0bb13ca119b4c6ef62f5e79a18" SYSTEMD_SERVICE:${PN} += " \ xyz.openbmc_project.biosconfig_manager.service \ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0007-Add-HSBP-FRU-details-in-json-configuration.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0007-Add-HSBP-FRU-details-in-json-configuration.patch new file mode 100644 index 000000000..9ad2641bc --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0007-Add-HSBP-FRU-details-in-json-configuration.patch @@ -0,0 +1,78 @@ +From ff4b6cab1dead31bad114321c211797ac28b36b1 Mon Sep 17 00:00:00 2001 +From: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> +Date: Wed, 10 Nov 2021 15:17:13 +0000 +Subject: [PATCH] Add HSBP FRU details in json configuration + +Added Intel specific HSBP CPLD FRU details in json configuration file. + +Tested: +1. Detected and read the HSBP FRU with new address on reworked board. +2. busctl tree xyz.openbmc_project.HsbpManager +└─/xyz + └─/xyz/openbmc_project + ├─/xyz/openbmc_project/inventory + │ └─/xyz/openbmc_project/inventory/item + │ ├─/xyz/openbmc_project/inventory/item/drive + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_1 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_10 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_11 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_12 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_13 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_14 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_15 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_16 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_2 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_3 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_4 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_5 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_6 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_7 + │ │ ├─/xyz/openbmc_project/inventory/item/drive/Drive_8 + │ │ └─/xyz/openbmc_project/inventory/item/drive/Drive_9 + │ └─/xyz/openbmc_project/inventory/item/hsbp + │ ├─/xyz/openbmc_project/inventory/item/hsbp/HSBP_1 + │ └─/xyz/openbmc_project/inventory/item/hsbp/HSBP_2 + └─/xyz/openbmc_project/software + ├─/xyz/openbmc_project/software/HSBP_1 + └─/xyz/openbmc_project/software/HSBP_2 + +Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> +--- + configurations/F2U8X25 HSBP.json | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/configurations/F2U8X25 HSBP.json b/configurations/F2U8X25 HSBP.json +index 60e7817..cdf9076 100644 +--- a/configurations/F2U8X25 HSBP.json ++++ b/configurations/F2U8X25 HSBP.json +@@ -7,6 +7,13 @@ + "Name": "F2U8X25 HSBP1 FRU", + "Type": "EEPROM" + }, ++ { ++ "Address": "0x68", ++ "Bus": "$bus", ++ "Index": 1, ++ "Name": "HSBP 1", ++ "Type": "Intel HSBP CPLD" ++ }, + { + "Address": "0x70", + "Bus": "$bus", +@@ -84,6 +91,13 @@ + "Name": "F2U8X25 HSBP2 FRU", + "Type": "EEPROM" + }, ++ { ++ "Address": "0x69", ++ "Bus": "$bus", ++ "Index": 2, ++ "Name": "HSBP 2", ++ "Type": "Intel HSBP CPLD" ++ }, + { + "Address": "0x73", + "Bus": "$bus", +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend index a31b5ba93..ba51f9454 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend @@ -1,6 +1,6 @@ # this is here just to bump faster than upstream # SRC_URI = "git://github.com/openbmc/entity-manager.git" -SRCREV = "8bb94ed6c9d64042ef367b5ff679336ff4d75093" +SRCREV = "2c412eef8eb76bf2a998c9d193f2dc92aaec39f8" FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" @@ -9,5 +9,6 @@ SRC_URI += " file://0002-Entity-manager-Add-support-to-update-assetTag.patch \ file://0004-Adding-MUX-and-Drives-present-in-HSBP-in-json-config.patch \ file://0005-Allow-MUX-idle-state-to-be-configured-as-DISCONNECT.patch \ file://0006-Change-HSBP-FRU-address-and-add-MUX-mode-configurati.patch \ + file://0007-Add-HSBP-FRU-details-in-json-configuration.patch \ " diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/console/obmc-console/obmc-console@.service b/meta-openbmc-mods/meta-common/recipes-phosphor/console/obmc-console/obmc-console@.service index a242dba08..4ec453d9e 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/console/obmc-console/obmc-console@.service +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/console/obmc-console/obmc-console@.service @@ -6,7 +6,7 @@ After=dev-%i.device [Service] ExecStartPre=/usr/bin/sol-option-check.sh ExecStart=/usr/bin/env obmc-console-server --config {sysconfdir}/obmc-console.conf %i -ExecStopPost=/bin/sh -c 'echo -n "0" > /sys/bus/platform/drivers/aspeed-uart-routing/1e78909c.uart_routing/raw' +ExecStopPost=/bin/sh -c 'echo -n "0" > /sys/bus/platform/drivers/aspeed-uart-routing/1e789098.uart-routing/hicra' SyslogIdentifier=obmc-console-server Restart=always diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend index ba07f4736..b8e0e7741 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend @@ -1,7 +1,7 @@ # Keep this as a comment to enable the auto-bump script without # stomping on SRC_URI from previous .bbappend files #SRC_URI = "git://github.com/openbmc/phosphor-dbus-interfaces.git" -SRCREV = "3a665b28dcc0d9f6926a1f5eb20bc0d9d768418d" +SRCREV = "e0764cf41d16b823a519e9d4f508b588e3e84aba" FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend index 41e824545..328176aca 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend @@ -5,7 +5,7 @@ SYSTEMD_SERVICE:${PN} = "phosphor-pid-control.service" EXTRA_OECONF = "--enable-configure-dbus=yes" SRC_URI = "git://github.com/openbmc/phosphor-pid-control.git" -SRCREV = "e7507a8b55136accc501408d691bd816abc4833f" +SRCREV = "cca9c659889d149c06e95bab4b8808db4f1e3eab" SRC_URI += "\ file://0001-allow-dbus-sensors-without-thresholds.patch \ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0019-log-redfish-errors-on-all-pfr-image-auth-failures.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0019-log-redfish-errors-on-all-pfr-image-auth-failures.patch new file mode 100644 index 000000000..3a245c944 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0019-log-redfish-errors-on-all-pfr-image-auth-failures.patch @@ -0,0 +1,100 @@ +From 8d3eb2a57a70715b2cc6088904e8be007ab921b2 Mon Sep 17 00:00:00 2001 +From: Vernon Mauery <vernon.mauery@intel.com> +Date: Fri, 27 Aug 2021 11:44:02 -0700 +Subject: [PATCH 1/4] log redfish errors on all pfr image auth failures + +Previous code was doing a 'mtd-util pfr authenticate' prior to manually +calculating and comparing the hashes. This is incorrect behavior. There +is no need to manually calculate hashes since that is part of the pfr +authentication process. + +An unintended side effect of this is that if pfr authenticate fails for +some reason other than hash compare, the redfish log does not happen. + +Tested: phosphor-version-software-mananger logs a redfish log on rom id + mismatch as expected. + +Signed-off-by: Vernon Mauery <vernon.mauery@intel.com> +--- + pfr_image_manager.cpp | 51 +++++-------------------------------------- + 1 file changed, 5 insertions(+), 46 deletions(-) + +diff --git a/pfr_image_manager.cpp b/pfr_image_manager.cpp +index ce850cb..aa96a99 100644 +--- a/pfr_image_manager.cpp ++++ b/pfr_image_manager.cpp +@@ -53,13 +53,10 @@ int Manager::verifyImage(const std::filesystem::path imgPath, + uint8_t imgType = 0; + uint32_t imgMagic = 0; + uint8_t verData[2] = {0}; +- uint32_t hashLen = 0; + struct pfrImgBlock0 block0Data = {}; + + std::string imageName; + +- EVP_MD_CTX* ctx; +- + if (std::filesystem::exists(imgPath)) + { + try +@@ -227,52 +224,14 @@ int Manager::verifyImage(const std::filesystem::path imgPath, + ImageFail::FAIL( + "Security violation: image authentication failure"), + ImageFail::PATH(imgPath.c_str())); +- return -1; +- } +- +- imgFile.seekg(pfmPos, +- std::ios::beg); // Version is at 0x806 in the PFM +- imgFile.read(reinterpret_cast<char*>(&verData), sizeof(verData)); +- imgFile.close(); +- +- auto size = std::filesystem::file_size(imgPath); +- +- phosphor::logging::log<phosphor::logging::level::INFO>( +- "Image Size", phosphor::logging::entry("IMAGESIZE=0x%x", +- static_cast<int>(size))); +- +- // Adds all digest algorithms to the internal table +- OpenSSL_add_all_digests(); +- +- ctx = EVP_MD_CTX_create(); +- EVP_DigestInit(ctx, EVP_sha256()); + +- // Hash the image file and update the digest +- auto dataPtr = mapFile(imgPath, size); +- +- EVP_DigestUpdate(ctx, ((uint8_t*)dataPtr() + lengthBlk0Blk1), +- (size - lengthBlk0Blk1)); +- +- std::vector<uint8_t> digest(EVP_MD_size(EVP_sha256())); +- std::vector<uint8_t> expectedDigest(block0Data.hash256, +- &block0Data.hash256[0] + 32); +- +- EVP_DigestFinal(ctx, digest.data(), &hashLen); +- EVP_MD_CTX_destroy(ctx); +- +- std::string redfishMsgID = "OpenBMC.0.1"; +- +- if (expectedDigest != digest) +- { +- redfishMsgID += ".GeneralFirmwareSecurityViolation"; ++ constexpr const char* redfishMsgID = ++ "OpenBMC.0.1.GeneralFirmwareSecurityViolation"; + sd_journal_send("MESSAGE=%s", +- "Firmware image HASH verification failed", ++ "Firmware image authentication failed", + "PRIORITY=%i", LOG_ERR, "REDFISH_MESSAGE_ID=%s", +- redfishMsgID.c_str(), "REDFISH_MESSAGE_ARGS=%s", +- "Image HASH check fail", NULL); +- phosphor::logging::report<ImageFailure>( +- ImageFail::FAIL("Security violation: hash mismatch"), +- ImageFail::PATH(imgPath.c_str())); ++ redfishMsgID, "REDFISH_MESSAGE_ARGS=%s", ++ "Image authentication check fail", NULL); + return -1; + } + +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend index 5745cb87c..53d09387b 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend @@ -24,6 +24,7 @@ SRC_URI_PFR = " \ file://0016-Process-PLDM-image-type.patch \ file://0017-Fix-build-error.patch \ file://0018-Fix-delete-image-by-ID-and-inhibit-removal-of-bmc_ac.patch \ + file://0019-log-redfish-errors-on-all-pfr-image-auth-failures.patch \ " SRC_URI += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', SRC_URI_PFR, '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/host/phosphor-host-postd_git.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/host/phosphor-host-postd_git.bbappend index ff30bacfb..0c97b0b86 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/host/phosphor-host-postd_git.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/host/phosphor-host-postd_git.bbappend @@ -1,4 +1,4 @@ DEPENDS += " gtest" #SRC_URI = "git://github.com/openbmc/phosphor-host-postd.git" -SRCREV = "2a744b2d70ce9de8519a7c716da5009cb049db17" +SRCREV = "996facb65d554f7c0f14c10e3c9252d67a01e21a" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch index b689748ea..6621d2512 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch @@ -1,4 +1,4 @@ -From c65d6f4a6d2939335608957fba25e5c8a445813e Mon Sep 17 00:00:00 2001 +From 7c005c318a12c53ed887b3081bd4b34ea0213053 Mon Sep 17 00:00:00 2001 From: Vikram Bodireddy <vikram.bodireddy@intel.com> Date: Mon, 28 Jun 2021 21:56:18 +0530 Subject: [PATCH] Firmware update configuration changes @@ -39,18 +39,20 @@ Tested: - Successfully ran redfish validater with no new errors. +Change-Id: I25ef6d64af3f1dcea3acba93d7fd2b505130142e Signed-off-by: Vikram Bodireddy <vikram.bodireddy@intel.com> +Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> --- - redfish-core/lib/update_service.hpp | 456 ++++++++++++++---- + redfish-core/lib/update_service.hpp | 462 ++++++++++++++---- static/redfish/v1/$metadata/index.xml | 3 + .../JsonSchemas/OemUpdateService/index.json | 69 +++ .../redfish/v1/schema/OemUpdateService_v1.xml | 40 ++ - 4 files changed, 481 insertions(+), 87 deletions(-) + 4 files changed, 484 insertions(+), 90 deletions(-) create mode 100644 static/redfish/v1/JsonSchemas/OemUpdateService/index.json create mode 100644 static/redfish/v1/schema/OemUpdateService_v1.xml diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp -index 663d48b..70c58d4 100644 +index e420130..b3270f0 100644 --- a/redfish-core/lib/update_service.hpp +++ b/redfish-core/lib/update_service.hpp @@ -26,7 +26,9 @@ @@ -211,9 +213,9 @@ index 663d48b..70c58d4 100644 softwareInterfaceAdded(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::vector<std::string> imgUriTargets, sdbusplus::message::message& m, - const crow::Request& req) + task::Payload&& payload) { -@@ -76,22 +181,24 @@ static void +@@ -76,23 +181,25 @@ static void m.read(objPath, interfacesProperties); @@ -228,11 +230,15 @@ index 663d48b..70c58d4 100644 { // Retrieve service and activate crow::connections::systemBus->async_method_call( -- [objPath, asyncResp, +- [objPath, asyncResp, payload(std::move(payload))]( + [objPath, asyncResp, imgTargets{imgUriTargets}, - req](const boost::system::error_code errorCode, - const std::vector<std::pair< - std::string, std::vector<std::string>>>& objInfo) { ++ payload(std::move(payload))]( + const boost::system::error_code errorCode, +- const std::vector< +- std::pair<std::string, std::vector<std::string>>>& +- objInfo) mutable { ++ const std::vector<std::pair< ++ std::string, std::vector<std::string>>>& objInfo) { if (errorCode) { - BMCWEB_LOG_DEBUG << "error_code = " << errorCode; @@ -242,7 +248,7 @@ index 663d48b..70c58d4 100644 BMCWEB_LOG_DEBUG << "error msg = " << errorCode.message(); if (asyncResp) -@@ -118,7 +225,7 @@ static void +@@ -119,7 +226,7 @@ static void // is added fwAvailableTimer = nullptr; @@ -251,7 +257,7 @@ index 663d48b..70c58d4 100644 if (asyncResp) { std::shared_ptr<task::TaskData> task = -@@ -250,8 +357,7 @@ static void +@@ -251,8 +358,7 @@ static void "xyz.openbmc_project.ObjectMapper", "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetObject", objPath.str, @@ -261,7 +267,7 @@ index 663d48b..70c58d4 100644 } } } -@@ -261,7 +367,7 @@ static void +@@ -262,7 +368,7 @@ static void static void monitorForSoftwareAvailable( const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const crow::Request& req, const std::string& url, @@ -270,20 +276,22 @@ index 663d48b..70c58d4 100644 { // Only allow one FW update at a time if (fwUpdateInProgress != false) -@@ -301,9 +407,10 @@ static void monitorForSoftwareAvailable( +@@ -301,11 +407,12 @@ static void monitorForSoftwareAvailable( + redfish::messages::internalError(asyncResp->res); } }); - -- auto callback = [asyncResp, req](sdbusplus::message::message& m) { ++ + task::Payload payload(req); +- auto callback = [asyncResp, + auto callback = [asyncResp, imgTargets{imgUriTargets}, -+ req](sdbusplus::message::message& m) { + payload](sdbusplus::message::message& m) mutable { BMCWEB_LOG_DEBUG << "Match fired"; -- softwareInterfaceAdded(asyncResp, m, req); -+ softwareInterfaceAdded(asyncResp, imgTargets, m, req); +- softwareInterfaceAdded(asyncResp, m, std::move(payload)); ++ softwareInterfaceAdded(asyncResp, imgTargets, m, std::move(payload)); }; fwUpdateInProgress = true; -@@ -468,12 +575,15 @@ inline void requestRoutesUpdateServiceActionsSimpleUpdate(App& app) +@@ -470,12 +577,15 @@ inline void requestRoutesUpdateServiceActionsSimpleUpdate(App& app) std::string fwFile = imageURI.substr(separator + 1); BMCWEB_LOG_DEBUG << "Server: " << tftpServer + " File: " << fwFile; @@ -300,7 +308,7 @@ index 663d48b..70c58d4 100644 // TFTP can take up to 10 minutes depending on image size and // connection speed. Return to caller as soon as the TFTP operation -@@ -522,6 +632,9 @@ inline void requestRoutesUpdateService(App& app) +@@ -524,6 +634,9 @@ inline void requestRoutesUpdateService(App& app) asyncResp->res.jsonValue["Name"] = "Update Service"; asyncResp->res.jsonValue["HttpPushUri"] = "/redfish/v1/UpdateService"; @@ -310,7 +318,7 @@ index 663d48b..70c58d4 100644 // UpdateService cannot be disabled asyncResp->res.jsonValue["ServiceEnabled"] = true; asyncResp->res.jsonValue["FirmwareInventory"] = { -@@ -536,7 +649,8 @@ inline void requestRoutesUpdateService(App& app) +@@ -538,7 +651,8 @@ inline void requestRoutesUpdateService(App& app) asyncResp->res .jsonValue["Actions"]["#UpdateService.SimpleUpdate"]; updateSvcSimpleUpdate["target"] = @@ -320,7 +328,7 @@ index 663d48b..70c58d4 100644 updateSvcSimpleUpdate["TransferProtocol@Redfish.AllowableValues"] = {"TFTP"}; #endif -@@ -578,89 +692,258 @@ inline void requestRoutesUpdateService(App& app) +@@ -580,89 +694,258 @@ inline void requestRoutesUpdateService(App& app) "/xyz/openbmc_project/software/apply_time", "org.freedesktop.DBus.Properties", "Get", "xyz.openbmc_project.Software.ApplyTime", "RequestedApplyTime"); @@ -457,13 +465,13 @@ index 663d48b..70c58d4 100644 - applyTime)) + std::string applyTimeNewVal; + if (applyTime == "Immediate") -+ { + { + applyTimeNewVal = + "xyz.openbmc_project.Software.ApplyTime." + "RequestedApplyTimes.Immediate"; + } + else if (applyTime == "OnReset") - { ++ { + applyTimeNewVal = + "xyz.openbmc_project.Software.ApplyTime." + "RequestedApplyTimes.OnReset"; @@ -636,7 +644,7 @@ index 663d48b..70c58d4 100644 BMCWEB_ROUTE(app, "/redfish/v1/UpdateService/") .privileges(redfish::privileges::postUpdateService) .methods(boost::beast::http::verb::post)( -@@ -670,7 +953,8 @@ inline void requestRoutesUpdateService(App& app) +@@ -672,7 +955,8 @@ inline void requestRoutesUpdateService(App& app) // Setup callback for when new software detected monitorForSoftwareAvailable(asyncResp, req, @@ -646,7 +654,7 @@ index 663d48b..70c58d4 100644 std::string filepath("/tmp/images/" + boost::uuids::to_string( -@@ -683,7 +967,7 @@ inline void requestRoutesUpdateService(App& app) +@@ -685,7 +969,7 @@ inline void requestRoutesUpdateService(App& app) out.close(); BMCWEB_LOG_DEBUG << "file upload complete!!"; }); @@ -655,7 +663,7 @@ index 663d48b..70c58d4 100644 inline void requestRoutesSoftwareInventoryCollection(App& app) { -@@ -746,8 +1030,7 @@ inline void requestRoutesSoftwareInventoryCollection(App& app) +@@ -748,8 +1032,7 @@ inline void requestRoutesSoftwareInventoryCollection(App& app) "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/xyz/openbmc_project/software", static_cast<int32_t>(0), @@ -665,7 +673,7 @@ index 663d48b..70c58d4 100644 }); } /* Fill related item links (i.e. bmc, bios) in for inventory */ -@@ -911,7 +1194,7 @@ inline void requestRoutesSoftwareInventory(App& app) +@@ -913,7 +1196,7 @@ inline void requestRoutesSoftwareInventory(App& app) }, obj.second[0].first, obj.first, "org.freedesktop.DBus.Properties", "GetAll", @@ -674,7 +682,7 @@ index 663d48b..70c58d4 100644 } if (!found) { -@@ -935,8 +1218,7 @@ inline void requestRoutesSoftwareInventory(App& app) +@@ -937,8 +1220,7 @@ inline void requestRoutesSoftwareInventory(App& app) "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/", static_cast<int32_t>(0), @@ -685,10 +693,10 @@ index 663d48b..70c58d4 100644 } diff --git a/static/redfish/v1/$metadata/index.xml b/static/redfish/v1/$metadata/index.xml -index eba38bf..876ebfb 100644 +index 66b6faf..f0919c9 100644 --- a/static/redfish/v1/$metadata/index.xml +++ b/static/redfish/v1/$metadata/index.xml -@@ -2346,6 +2346,9 @@ +@@ -2444,6 +2444,9 @@ <edmx:Reference Uri="/redfish/v1/schema/OemComputerSystem_v1.xml"> <edmx:Include Namespace="OemComputerSystem"/> </edmx:Reference> diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0013-Add-UART-routing-logic-into-host-console-connection-.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0013-Add-UART-routing-logic-into-host-console-connection-.patch index 8b0d90fe0..41acb6057 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0013-Add-UART-routing-logic-into-host-console-connection-.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0013-Add-UART-routing-logic-into-host-console-connection-.patch @@ -25,7 +25,7 @@ index cdb19901e82d..9c4ae8821074 100644 static bool doingWrite = false; -+constexpr char const* uartMuxCtrlPath = "/sys/bus/platform/drivers/aspeed-uart-routing/1e78909c.uart_routing/raw"; ++constexpr char const* uartMuxCtrlPath = "/sys/bus/platform/drivers/aspeed-uart-routing/1e789098.uart-routing/hicra"; +constexpr char const* uartMuxCtrlVal = "0x03450003"; + inline void doWrite() diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0015-Add-state-sensor-messages-to-the-registry.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0015-Add-state-sensor-messages-to-the-registry.patch index b171a8b2c..1193fe9d1 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0015-Add-state-sensor-messages-to-the-registry.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0015-Add-state-sensor-messages-to-the-registry.patch @@ -1,4 +1,4 @@ -From df571ddf0596f73c0318da3a90b9813e6df19dd9 Mon Sep 17 00:00:00 2001 +From b468b508176dfffe2e8e4adb3052577b9ff70d2f Mon Sep 17 00:00:00 2001 From: "Arun P. Mohanan" <arun.p.m@linux.intel.com> Date: Wed, 27 Jan 2021 18:22:58 +0530 Subject: [PATCH] Add state sensor messages to the registry @@ -34,19 +34,19 @@ Signed-off-by: Arun P. Mohanan <arun.p.m@linux.intel.com> 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/redfish-core/include/registries/openbmc_message_registry.hpp b/redfish-core/include/registries/openbmc_message_registry.hpp -index 5eb9380..dbea97c 100644 +index 6cf503f..87b2913 100644 --- a/redfish-core/include/registries/openbmc_message_registry.hpp +++ b/redfish-core/include/registries/openbmc_message_registry.hpp @@ -29,7 +29,7 @@ const Header header = { - "0.1.0", + "0.2.0", "OpenBMC", }; --constexpr std::array<MessageEntry, 187> registry = { -+constexpr std::array<MessageEntry, 190> registry = { +-constexpr std::array<MessageEntry, 188> registry = { ++constexpr std::array<MessageEntry, 191> registry = { MessageEntry{ "ADDDCCorrectable", { -@@ -2318,6 +2318,39 @@ constexpr std::array<MessageEntry, 187> registry = { +@@ -2331,6 +2331,39 @@ constexpr std::array<MessageEntry, 188> registry = { {}, "None.", }}, @@ -86,7 +86,7 @@ index 5eb9380..dbea97c 100644 MessageEntry{"SystemInterfaceDisabledProvisioned", { "Indicates that the system interface is in the disabled " -@@ -2410,6 +2443,5 @@ constexpr std::array<MessageEntry, 187> registry = { +@@ -2423,6 +2456,5 @@ constexpr std::array<MessageEntry, 188> registry = { {"string"}, "None.", }}, diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0017-Add-msg-registry-for-subscription-related-actions.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0017-Add-msg-registry-for-subscription-related-actions.patch index d0cfd1c44..35ac7a114 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0017-Add-msg-registry-for-subscription-related-actions.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0017-Add-msg-registry-for-subscription-related-actions.patch @@ -1,4 +1,4 @@ -From 7282ab7756cdb8c844bef9affd8a8e894828678c Mon Sep 17 00:00:00 2001 +From 40895934bdedb978e8cfd47930ae5a190e19b440 Mon Sep 17 00:00:00 2001 From: Ayushi Smriti <smriti.ayushi@intel.com> Date: Mon, 10 May 2021 12:32:30 +0530 Subject: [PATCH] Add msg registry for subscription related actions @@ -18,19 +18,19 @@ Signed-off-by: Ayushi Smriti <smriti.ayushi@intel.com> 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/redfish-core/include/registries/openbmc_message_registry.hpp b/redfish-core/include/registries/openbmc_message_registry.hpp -index e12a138..2f981db 100644 +index 87b2913..1e493ca 100644 --- a/redfish-core/include/registries/openbmc_message_registry.hpp +++ b/redfish-core/include/registries/openbmc_message_registry.hpp @@ -29,7 +29,7 @@ const Header header = { "0.2.0", "OpenBMC", }; --constexpr std::array<MessageEntry, 190> registry = { -+constexpr std::array<MessageEntry, 193> registry = { +-constexpr std::array<MessageEntry, 191> registry = { ++constexpr std::array<MessageEntry, 194> registry = { MessageEntry{ "ADDDCCorrectable", { -@@ -417,6 +417,45 @@ constexpr std::array<MessageEntry, 190> registry = { +@@ -417,6 +417,45 @@ constexpr std::array<MessageEntry, 191> registry = { {}, "None.", }}, diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0018-bmcweb-Add-BMC-Time-update-log-to-the-registry.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0018-bmcweb-Add-BMC-Time-update-log-to-the-registry.patch index 829384305..54636cb3d 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0018-bmcweb-Add-BMC-Time-update-log-to-the-registry.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0018-bmcweb-Add-BMC-Time-update-log-to-the-registry.patch @@ -1,7 +1,7 @@ -From 3ec1f79d1cb29724e345586f0baefca81d98d3ae Mon Sep 17 00:00:00 2001 +From eeac51ebaaad82bb4ac65a029c81c221e32b33ea Mon Sep 17 00:00:00 2001 From: mansijos <mansi.joshi@intel.com> Date: Wed, 26 May 2021 17:40:04 +0530 -Subject: [PATCH] [bmcweb] Add BMC Time update log to the registry +Subject: [PATCH] Add BMC Time update log to the registry Add message in registry to log an event that indicates BMC time is set via NTP, Host or Manually. @@ -20,19 +20,19 @@ Signed-off-by: mansijos <mansi.joshi@intel.com> 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/redfish-core/include/registries/openbmc_message_registry.hpp b/redfish-core/include/registries/openbmc_message_registry.hpp -index 2f981db..a00d235 100644 +index 1e493ca..967713f 100644 --- a/redfish-core/include/registries/openbmc_message_registry.hpp +++ b/redfish-core/include/registries/openbmc_message_registry.hpp @@ -29,7 +29,7 @@ const Header header = { "0.2.0", "OpenBMC", }; --constexpr std::array<MessageEntry, 193> registry = { -+constexpr std::array<MessageEntry, 196> registry = { +-constexpr std::array<MessageEntry, 194> registry = { ++constexpr std::array<MessageEntry, 197> registry = { MessageEntry{ "ADDDCCorrectable", { -@@ -286,6 +286,39 @@ constexpr std::array<MessageEntry, 193> registry = { +@@ -286,6 +286,39 @@ constexpr std::array<MessageEntry, 194> registry = { {}, "None.", }}, diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0019-Add-generic-message-PropertySizeExceeded.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0019-Add-generic-message-PropertySizeExceeded.patch index 028119249..522f04886 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0019-Add-generic-message-PropertySizeExceeded.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0019-Add-generic-message-PropertySizeExceeded.patch @@ -1,6 +1,6 @@ -From 2b865ad20ce0616b79a453d1571976bb2303050c Mon Sep 17 00:00:00 2001 -From: Krzysztof Grobelny <krzysztof.grobelny@intel.com> -Date: Wed, 14 Jul 2021 13:55:27 +0000 +From 6bc3ec77e062e8f2108f755e9f0089a014031f91 Mon Sep 17 00:00:00 2001 +From: AppaRao Puli <apparao.puli@linux.intel.com> +Date: Wed, 6 Oct 2021 21:51:16 +0000 Subject: [PATCH] Add generic message - PropertySizeExceeded Adding a generic error message "PropertySizeExceeded" @@ -12,6 +12,7 @@ Verified by explicitly sending this message as a response. Change-Id: I0e9f85f82a69c598e169fc8e9a68c3f66c0084d8 Signed-off-by: Nitin Wankhade <nitinx.arunrao.wankhade@intel.com> +Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> --- redfish-core/include/error_messages.hpp | 12 +++++++++ .../registries/base_message_registry.hpp | 17 +++++++++++- @@ -19,7 +20,7 @@ Signed-off-by: Nitin Wankhade <nitinx.arunrao.wankhade@intel.com> 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp -index 922dae9..f29e326 100644 +index 3d11cc4..051cff1 100644 --- a/redfish-core/include/error_messages.hpp +++ b/redfish-core/include/error_messages.hpp @@ -222,6 +222,18 @@ nlohmann::json propertyValueFormatError(const std::string& arg1, @@ -42,19 +43,19 @@ index 922dae9..f29e326 100644 * @brief Formats PropertyValueNotInList message into JSON * Message body: "The value <arg1> for the property <arg2> is not in the list of diff --git a/redfish-core/include/registries/base_message_registry.hpp b/redfish-core/include/registries/base_message_registry.hpp -index 58156c8..ab9b046 100644 +index 702cd6f..193df16 100644 --- a/redfish-core/include/registries/base_message_registry.hpp +++ b/redfish-core/include/registries/base_message_registry.hpp -@@ -36,7 +36,7 @@ const Header header = { +@@ -22,7 +22,7 @@ const Header header = { constexpr const char* url = - "https://redfish.dmtf.org/registries/Base.1.10.0.json"; + "https://redfish.dmtf.org/registries/Base.1.11.0.json"; --constexpr std::array<MessageEntry, 87> registry = { -+constexpr std::array<MessageEntry, 88> registry = { +-constexpr std::array<MessageEntry, 93> registry = { ++constexpr std::array<MessageEntry, 94> registry = { MessageEntry{ "AccessDenied", { -@@ -664,6 +664,21 @@ constexpr std::array<MessageEntry, 87> registry = { +@@ -692,6 +692,21 @@ constexpr std::array<MessageEntry, 93> registry = { "Remove the property from the request body and resubmit " "the request if the operation failed.", }}, @@ -77,7 +78,7 @@ index 58156c8..ab9b046 100644 { "Indicates that an unknown property was included in the " diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp -index 409adb1..bebb6d8 100644 +index 9c28e8f..854a1a5 100644 --- a/redfish-core/src/error_messages.cpp +++ b/redfish-core/src/error_messages.cpp @@ -514,6 +514,33 @@ void propertyValueFormatError(crow::Response& res, const std::string& arg1, @@ -115,5 +116,5 @@ index 409adb1..bebb6d8 100644 * @internal * @brief Formats PropertyValueNotInList message into JSON for the specified -- -2.25.1 +2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0021-Add-message-registry-entry-for-FirmwareResiliencyErr.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0021-Add-message-registry-entry-for-FirmwareResiliencyErr.patch deleted file mode 100644 index 2b8f8987c..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0021-Add-message-registry-entry-for-FirmwareResiliencyErr.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 35c9f6f0f4e1254f0512154cc46116d8047fe19b Mon Sep 17 00:00:00 2001 -From: Chalapathi Venkataramashetty <chalapathix.venkataramashetty@intel.com> -Date: Wed, 14 Jul 2021 20:44:06 +0000 -Subject: [PATCH] Add message registry entry for FirmwareResiliencyError - -Add an event log in redfish when firmware update failed due to -FirmwareResiliencyError. - -The existing message entries BMCFirmwareResiliencyError(for BMC update -failures) and BIOSFirmwareResiliencyError(for BIOS update failures) are -not useful for the new platform. The new platform's CPLD report common -error code for BMC, PCH or CPLD firmware update failures. Hence a common -message entry is required to capture the firmware update failure events. - -This event is Implemented in the following review. -https://gerrit.openbmc-project.xyz/c/openbmc/pfr-manager/+/43281 - -Tested: -Redfish Service Validator passed for this change. - -Update BMC firmware with mismatched SVN -POST: https://<BMC_IP>/redfish/v1/UpdateService/ - with <BMC_Update_Capsule> binary file -After BMC reboots check for Event log in Redfish -Command: GET: https://<BMC_IP>/redfish/v1/Systems/system/LogServices/ - EventLog/Entries -Response: -{ - "@odata.id": "/redfish/v1/Systems/system/LogServices/ - EventLog/Entries/1621435142_1", - "@odata.type": "#LogEntry.v1_4_0.LogEntry", - "Created": "2021-05-19T14:39:02+00:00", - "EntryType": "Event", - "Id": "1621435142_1", - "Message": "Firmware resiliency error. Error reason: - Firmware update failed(MinorCode:0x02).", - "MessageArgs": [ - "Firmware update failed(MinorCode:0x02)" - ], - "MessageId": "OpenBMC.0.1.FirmwareResiliencyError", - "Name": "System Event Log Entry", - "Severity": "Critical" - }, - -Signed-off-by: Chalapathi Venkataramashetty <chalapathix.venkataramashetty@intel.com> ---- - .../registries/openbmc_message_registry.hpp | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) - -diff --git a/redfish-core/include/registries/openbmc_message_registry.hpp b/redfish-core/include/registries/openbmc_message_registry.hpp -index a00d235..967713f 100644 ---- a/redfish-core/include/registries/openbmc_message_registry.hpp -+++ b/redfish-core/include/registries/openbmc_message_registry.hpp -@@ -29,7 +29,7 @@ const Header header = { - "0.2.0", - "OpenBMC", - }; --constexpr std::array<MessageEntry, 196> registry = { -+constexpr std::array<MessageEntry, 197> registry = { - MessageEntry{ - "ADDDCCorrectable", - { -@@ -560,6 +560,18 @@ constexpr std::array<MessageEntry, 196> registry = { - {"string"}, - "None.", - }}, -+ MessageEntry{"FirmwareResiliencyError", -+ { -+ "Indicates firmware encountered resilience error.", -+ "Firmware resiliency error. Error reason: %1.", -+ "Critical", -+ "Critical", -+ 1, -+ { -+ "string", -+ }, -+ "None.", -+ }}, - MessageEntry{"FirmwareUpdateCompleted", - { - "Indicates a firmware update has completed successfully.", --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0024-Add-count-sensor-type.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0024-Add-count-sensor-type.patch index a9a4ab151..22ae05fa3 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0024-Add-count-sensor-type.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0024-Add-count-sensor-type.patch @@ -1,4 +1,4 @@ -From fb337f868543f72bd8ba24db3c4b09b4c1d888ab Mon Sep 17 00:00:00 2001 +From 94a0ae774933b7801d0c8d843b3ac3a39a5e5646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Ambro=C5=BCewicz?= <adrian.ambrozewicz@intel.com> Date: Fri, 30 Jul 2021 15:25:29 +0200 Subject: [PATCH] Add 'count' sensor type @@ -13,7 +13,7 @@ Testing: 1 file changed, 1 insertion(+) diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp -index cb7ea15..d72a572 100644 +index 45a1eb6..7405e5a 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -63,6 +63,7 @@ static const boost::container::flat_map<std::string_view, @@ -22,8 +22,8 @@ index cb7ea15..d72a572 100644 "/xyz/openbmc_project/sensors/current", + "/xyz/openbmc_project/sensors/count", "/xyz/openbmc_project/sensors/airflow", - "/xyz/openbmc_project/sensors/utilization"}}, - {node::thermal, + #ifdef BMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM + "/xyz/openbmc_project/sensors/voltage", -- -2.25.1 +2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0025-Add-Model-CoreCount-to-ProcessorSummary.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0025-Add-Model-CoreCount-to-ProcessorSummary.patch new file mode 100644 index 000000000..edf4d219e --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0025-Add-Model-CoreCount-to-ProcessorSummary.patch @@ -0,0 +1,288 @@ +From f4f15a52610d1a199ddac948c8f849df05d86151 Mon Sep 17 00:00:00 2001 +From: Ali Ahmed <ama213000@gmail.com> +Date: Fri, 3 Sep 2021 02:33:43 -0500 +Subject: [PATCH] Add Model & CoreCount to ProcessorSummary + +In Redfish ComputerSystem schema, the ProcessorSummary parameter +lists summary information of the Processors on the system. This commit +adds the 'Model' and 'CoreCount' properties to ProcessorSummary. + +If the CPU Models are different, then the 'Model' field takes the first +entry in alphabetical order. + +Testing: +1. Redfish Validator Testing successfully passed. +2. Curl testing: + +curl -k -H "X-Auth-Token: $tok" https://$bmc/redfish/v1/Systems/system + +... + "ProcessorSummary": { + "CoreCount": 24, + "Count": 2, + "Model": "test_name", + "Status": { + "Health": "OK", + "HealthRollup": "OK", + "State": "Disabled" + } + }, +... + +Change-Id: I39cbf6ed35c35ce3a3551c9689237d5023775326 +Signed-off-by: Ali Ahmed <ama213000@gmail.com> +Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> +--- + redfish-core/lib/systems.hpp | 229 ++++++++++++++++++++++------------- + 1 file changed, 147 insertions(+), 82 deletions(-) + +diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp +index 680a0ee..3b5f9e4 100644 +--- a/redfish-core/lib/systems.hpp ++++ b/redfish-core/lib/systems.hpp +@@ -139,6 +139,152 @@ inline void + } + } + ++inline void getProcessorProperties( ++ const std::shared_ptr<bmcweb::AsyncResp>& aResp, const std::string& service, ++ const std::string& path, ++ const std::vector<std::pair< ++ std::string, std::variant<std::string, uint64_t, uint32_t, uint16_t>>>& ++ properties) ++{ ++ ++ BMCWEB_LOG_DEBUG << "Got " << properties.size() << " Cpu properties."; ++ ++ auto getCpuPresenceState = ++ [aResp](const boost::system::error_code ec3, ++ const std::variant<bool>& cpuPresenceCheck) { ++ if (ec3) ++ { ++ BMCWEB_LOG_ERROR << "DBUS response error " << ec3; ++ return; ++ } ++ modifyCpuPresenceState(aResp, cpuPresenceCheck); ++ }; ++ ++ auto getCpuFunctionalState = ++ [aResp](const boost::system::error_code ec3, ++ const std::variant<bool>& cpuFunctionalCheck) { ++ if (ec3) ++ { ++ BMCWEB_LOG_ERROR << "DBUS response error " << ec3; ++ return; ++ } ++ modifyCpuFunctionalState(aResp, cpuFunctionalCheck); ++ }; ++ ++ // Get the Presence of CPU ++ crow::connections::systemBus->async_method_call( ++ std::move(getCpuPresenceState), service, path, ++ "org.freedesktop.DBus.Properties", "Get", ++ "xyz.openbmc_project.Inventory.Item", "Present"); ++ ++ // Get the Functional State ++ crow::connections::systemBus->async_method_call( ++ std::move(getCpuFunctionalState), service, path, ++ "org.freedesktop.DBus.Properties", "Get", ++ "xyz.openbmc_project.State.Decorator.OperationalStatus", "Functional"); ++ ++ for (const auto& property : properties) ++ { ++ if (property.first == "Family") ++ { ++ // Get the CPU Model ++ const std::string* modelStr = ++ std::get_if<std::string>(&property.second); ++ if (!modelStr) ++ { ++ BMCWEB_LOG_DEBUG << "Failed to get CPU Family"; ++ // Skip it and continue with other properties ++ continue; ++ } ++ if ((*modelStr).size() < 1) ++ { ++ BMCWEB_LOG_DEBUG << "Empty CPU Family info, skipping..."; ++ continue; ++ } ++ nlohmann::json& prevModel = ++ aResp->res.jsonValue["ProcessorSummary"]["Model"]; ++ std::string* prevModelPtr = prevModel.get_ptr<std::string*>(); ++ ++ // If CPU Models are different, use the first entry in ++ // alphabetical order ++ ++ // If Model has never been set ++ // before, set it to *modelStr ++ if (prevModelPtr == nullptr) ++ { ++ prevModel = *modelStr; ++ } ++ // If Model has been set before, only change if new Model is ++ // higher in alphabetical order ++ else ++ { ++ if (*modelStr < *prevModelPtr) ++ { ++ prevModel = *modelStr; ++ } ++ } ++ } ++ else if (property.first == "CoreCount") ++ { ++ // Get CPU CoreCount and add it to the total ++ const uint16_t* coreCountVal = ++ std::get_if<uint16_t>(&property.second); ++ ++ if (!coreCountVal) ++ { ++ BMCWEB_LOG_DEBUG << "Failed to get CPU Core count"; ++ // Skip it and continue with other properties ++ continue; ++ } ++ ++ nlohmann::json& coreCount = ++ aResp->res.jsonValue["ProcessorSummary"]["CoreCount"]; ++ uint64_t* coreCountPtr = coreCount.get_ptr<uint64_t*>(); ++ ++ if (coreCountPtr == nullptr) ++ { ++ coreCount = *coreCountVal; ++ } ++ else ++ { ++ *coreCountPtr += *coreCountVal; ++ } ++ } ++ } ++} ++ ++/* ++ * @brief Get ProcessorSummary fields ++ * ++ * @param[in] aResp Shared pointer for completing asynchronous calls ++ * @param[in] service dbus service for Cpu Information ++ * @param[in] path dbus path for Cpu ++ * ++ * @return None. ++ */ ++inline void getProcessorSummary(const std::shared_ptr<bmcweb::AsyncResp>& aResp, ++ const std::string& service, ++ const std::string& path) ++{ ++ ++ crow::connections::systemBus->async_method_call( ++ [aResp, service, ++ path](const boost::system::error_code ec2, ++ const std::vector<std::pair< ++ std::string, std::variant<std::string, uint64_t, uint32_t, ++ uint16_t>>>& properties) { ++ if (ec2) ++ { ++ BMCWEB_LOG_ERROR << "DBUS response error " << ec2; ++ messages::internalError(aResp->res); ++ return; ++ } ++ getProcessorProperties(aResp, service, path, properties); ++ }, ++ service, path, "org.freedesktop.DBus.Properties", "GetAll", ++ "xyz.openbmc_project.Inventory.Item.Cpu"); ++} ++ + /* + * @brief Retrieves computer system properties over dbus + * +@@ -309,88 +455,7 @@ inline void + BMCWEB_LOG_DEBUG + << "Found Cpu, now get its properties."; + +- crow::connections::systemBus->async_method_call( +- [aResp, service{connection.first}, +- path](const boost::system::error_code ec2, +- const std::vector< +- std::pair<std::string, VariantType>>& +- properties) { +- if (ec2) +- { +- BMCWEB_LOG_ERROR +- << "DBUS response error " << ec2; +- messages::internalError(aResp->res); +- return; +- } +- BMCWEB_LOG_DEBUG << "Got " +- << properties.size() +- << " Cpu properties."; +- +- auto getCpuPresenceState = +- [aResp]( +- const boost::system::error_code ec3, +- const std::variant<bool>& +- cpuPresenceCheck) { +- if (ec3) +- { +- BMCWEB_LOG_ERROR +- << "DBUS response error " +- << ec3; +- return; +- } +- modifyCpuPresenceState( +- aResp, cpuPresenceCheck); +- }; +- +- auto getCpuFunctionalState = +- [aResp]( +- const boost::system::error_code ec3, +- const std::variant<bool>& +- cpuFunctionalCheck) { +- if (ec3) +- { +- BMCWEB_LOG_ERROR +- << "DBUS response error " +- << ec3; +- return; +- } +- modifyCpuFunctionalState( +- aResp, cpuFunctionalCheck); +- }; +- +- // Get the Presence of CPU +- crow::connections::systemBus +- ->async_method_call( +- std::move(getCpuPresenceState), +- service, path, +- "org.freedesktop.DBus." +- "Properties", +- "Get", +- "xyz.openbmc_project.Inventory." +- "Item", +- "Present"); +- +- // Get the Functional State +- crow::connections::systemBus +- ->async_method_call( +- std::move(getCpuFunctionalState), +- service, path, +- "org.freedesktop.DBus." +- "Properties", +- "Get", +- "xyz.openbmc_project.State." +- "Decorator." +- "OperationalStatus", +- "Functional"); +- +- // Get the MODEL from +- // xyz.openbmc_project.Inventory.Decorator.Asset +- // support it later as Model is Empty +- // currently. +- }, +- connection.first, path, +- "org.freedesktop.DBus.Properties", "GetAll", +- "xyz.openbmc_project.Inventory.Item.Cpu"); ++ getProcessorSummary(aResp, connection.first, path); + + cpuHealth->inventory.emplace_back(path); + } +-- +2.17.1 + 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 <kuiying.wang@intel.com> 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 <kuiying.wang@intel.com> +Signed-off-by: Snehalatha Venkatesh <snehalathax.v@intel.com> --- - 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 <registries.hpp> + +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<MessageEntry, 0> 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<BiosBaseTableType>& retBiosTable) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "getBiosAttributes DBUS error: " ++ << ec; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ const BiosBaseTableType* baseBiosTable = ++ std::get_if<BiosBaseTableType>(&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<biosBaseAttrType>(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::string>( ++ &std::get<biosBaseCurrValue>(item.second)); ++ attributesJson.emplace( ++ key, currValue != nullptr ? *currValue : ""); ++ } ++ else if (attrType == "Integer") ++ { ++ const int64_t* currValue = std::get_if<int64_t>( ++ &std::get<biosBaseCurrValue>(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<BiosBaseTableType>& -+ retBiosTable) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR -+ << "getBiosAttributes DBUS error: " -+ << ec; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ const BiosBaseTableType* baseBiosTable = -+ std::get_if<BiosBaseTableType>( -+ &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<biosBaseAttrType>(item.second); -+ std::string attrType = -+ mapAttrTypeToRedfish(itemType); -+ if (attrType == "String") -+ { -+ const std::string* currValue = -+ std::get_if<std::string>( -+ &std::get<biosBaseCurrValue>( -+ item.second)); -+ attributesJson.emplace( -+ key, currValue != nullptr -+ ? *currValue -+ : ""); -+ } -+ else if (attrType == "Integer") -+ { -+ const int64_t* currValue = -+ std::get_if<int64_t>( -+ &std::get<biosBaseCurrValue>( -+ 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<const char*, 0>()); - }); ++ } ++ }, ++ 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<const char*, 0>()); } -+ + 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<const char*, 0>()); + }); +} ++ /** * 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<bmcweb::AsyncResp>& asyncResp, + const std::string& registry, const std::string& registryMatch) +- + { + const message_registries::Header* header; + std::vector<const message_registries::MessageEntry*> 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 <apparao.puli@linux.intel.com> -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: @@ -11,43 +11,43 @@ POST https://IP_ADDR/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios Change-Id: Ic719c55705e5f634539b3dd858b60922e505a8d0 Signed-off-by: Kuiying Wang <kuiying.wang@intel.com> Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> + +Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> --- - 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<bmcweb::AsyncResp>& 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<bmcweb::AsyncResp>& 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<std::string>(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<std::string>(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 <krzysztof.grobelny@intel.com> -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 <arun.lal@intel.com> +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 <arun.lal@intel.com> Signed-off-by: Kuiying Wang <kuiying.wang@intel.com> --- - 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 <arun.lal@intel.com> -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 <arun.lal@intel.com> +Signed-off-by: Snehalatha Venkatesh <snehalathax.v@intel.com> --- - 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<bmcweb::AsyncResp>& 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<bmcweb::AsyncResp>& 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<bmcweb::AsyncResp>& 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<BiosBaseTableType>(&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::string>( &std::get<biosBaseCurrValue>( 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<int64_t>( &std::get<biosBaseCurrValue>( 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<OptionsItemType>& optionsVector = std::get<biosBaseOptions>(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::string>( &std::get<optItemValue>( 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<int64_t>( &std::get<optItemValue>( 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); } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-Add-unmerged-changes-for-http-retry-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-Add-unmerged-changes-for-http-retry-support.patch new file mode 100644 index 000000000..52135e255 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-Add-unmerged-changes-for-http-retry-support.patch @@ -0,0 +1,121 @@ +From 6ff897d2b5513f15445f18aae16d8439ed94f377 Mon Sep 17 00:00:00 2001 +From: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +Date: Mon, 11 Oct 2021 18:41:27 +0530 +Subject: [PATCH] Add unmerged changes for http retry support + +The http retry support added upstream as a single patch was slpit into +3 patches, but only 2 of them was merged. +This commit pulls in the differentail changes required to complete the +entire http retry support. and also allow for other subsequent patches +to be appplied easily. + +Change-Id: Id8ccd991b7ffc505196b1a92b23e1cd51e00bc89 +Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +--- + http/http_client.hpp | 44 +++++++++++-------- + .../include/event_service_manager.hpp | 2 +- + 2 files changed, 27 insertions(+), 19 deletions(-) + +diff --git a/http/http_client.hpp b/http/http_client.hpp +index ab20eb0..aad1cce 100644 +--- a/http/http_client.hpp ++++ b/http/http_client.hpp +@@ -68,7 +68,6 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> + std::optional< + boost::beast::http::response_parser<boost::beast::http::string_body>> + parser; +- std::vector<std::pair<std::string, std::string>> headers; + boost::circular_buffer_space_optimized<std::string> requestDataQueue{}; + + ConnState state; +@@ -137,18 +136,6 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> + + BMCWEB_LOG_DEBUG << __FUNCTION__ << "(): " << host << ":" << port; + +- req.version(static_cast<int>(11)); // HTTP 1.1 +- req.target(uri); +- req.method(boost::beast::http::verb::post); +- +- // Set headers +- for (const auto& [key, value] : headers) +- { +- req.set(key, value); +- } +- req.set(boost::beast::http::field::host, host); +- req.keep_alive(true); +- + req.body() = data; + req.prepare_payload(); + +@@ -204,6 +191,17 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> + BMCWEB_LOG_DEBUG << "recvMessage() data: " + << self->parser->get(); + ++ // Check if the response and header are received ++ if (!self->parser->is_done()) ++ { ++ // The parser failed to receive the response ++ BMCWEB_LOG_ERROR ++ << "recvMessage() parser failed to receive response"; ++ self->state = ConnState::recvFailed; ++ self->handleConnState(); ++ return; ++ } ++ + unsigned int respCode = self->parser->get().result_int(); + BMCWEB_LOG_DEBUG << "recvMessage() Header Response Code: " + << respCode; +@@ -398,11 +396,17 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> + const std::string& destIP, const std::string& destPort, + const std::string& destUri) : + conn(ioc), +- timer(ioc), subId(id), host(destIP), port(destPort), uri(destUri), +- retryCount(0), maxRetryAttempts(5), retryIntervalSecs(0), ++ timer(ioc), req(boost::beast::http::verb::post, destUri, 11), ++ state(ConnState::initialized), subId(id), host(destIP), port(destPort), ++ uri(destUri), retryCount(0), maxRetryAttempts(5), retryIntervalSecs(0), + retryPolicyAction("TerminateAfterRetries"), runningTimer(false) + { +- state = ConnState::initialized; ++ // Set the request header ++ req.set(boost::beast::http::field::host, host); ++ req.set(boost::beast::http::field::content_type, "application/json"); ++ req.keep_alive(true); ++ ++ requestDataQueue.set_capacity(maxRequestQueueSize); + } + + void sendData(const std::string& data) +@@ -425,10 +429,14 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> + return; + } + +- void setHeaders( ++ void addHeaders( + const std::vector<std::pair<std::string, std::string>>& httpHeaders) + { +- headers = httpHeaders; ++ // Set custom headers ++ for (const auto& [key, value] : httpHeaders) ++ { ++ req.set(key, value); ++ } + } + + void setRetryConfig(const uint32_t retryAttempts, +diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp +index 8042803..0a63b8c 100644 +--- a/redfish-core/include/event_service_manager.hpp ++++ b/redfish-core/include/event_service_manager.hpp +@@ -412,7 +412,7 @@ class Subscription : public persistent_data::UserSubscription + reqHeaders.emplace_back(std::pair(key, val)); + } + } +- conn->setHeaders(reqHeaders); ++ conn->addHeaders(reqHeaders); + conn->sendData(msg); + this->eventSeqNum++; + } +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch deleted file mode 100644 index 7a6818008..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch +++ /dev/null @@ -1,546 +0,0 @@ -From f74393a9bca899e353be3d0e2dc5c224539fe432 Mon Sep 17 00:00:00 2001 -From: Sunitha Harish <sunithaharish04@gmail.com> -Date: Fri, 19 Feb 2021 13:38:31 +0530 -Subject: [PATCH] EventService : Fix retry handling for http-client - -When the event send/receive is failed, the bmcweb does not handle -the failure to tear-down the complete connection and start a fresh - -The keep-alive header from the event listener is read to update -the connection states, so that the connection will be kept alive -or closed as per the subscriber's specifications - -Updated the connection state machine to handle retry logic properly. -Avoided multiple simultaneous async calls which crashes the bmcweb. So -added connBusy flag which protects simultaneous async calls. - -Used boost http response parser as parser for producing the response -message. Set the parser skip option to handle the empty response message -from listening server. - -Tested by: - - Subscribe for the events at BMC using DMTF event listener - - Generate an event and see the same is received at the listener's console - - Update the listner to change the keep-alive to true/false and - observe the http-client connection states at bmcweb - - Changed listener client to return non success HTTP status code - and observed retry logic gets trigrred in http-client. - - Gave wrong fqdn and observed async resolve failure and retry logc. - - Stopped listener after connect and verified timeouts on http-client - side. - -Change-Id: Ibb45691f139916ba2954da37beda9d4f91c7cef3 -Signed-off-by: Sunitha Harish <sunithaharish04@gmail.com> -Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> ---- - http/http_client.hpp | 288 ++++++++++-------- - .../include/event_service_manager.hpp | 2 +- - 2 files changed, 162 insertions(+), 128 deletions(-) - -diff --git a/http/http_client.hpp b/http/http_client.hpp -index 992ac2b..feabbba 100644 ---- a/http/http_client.hpp -+++ b/http/http_client.hpp -@@ -34,22 +34,28 @@ namespace crow - { - - static constexpr uint8_t maxRequestQueueSize = 50; -+static constexpr unsigned int httpReadBodyLimit = 8192; - - enum class ConnState - { - initialized, - resolveInProgress, - resolveFailed, -+ resolved, - connectInProgress, - connectFailed, - connected, - sendInProgress, - sendFailed, -+ recvInProgress, - recvFailed, - idle, -- suspended, -+ closeInProgress, - closed, -- terminated -+ suspended, -+ terminated, -+ abortConnection, -+ retry - }; - - class HttpClient : public std::enable_shared_from_this<HttpClient> -@@ -58,11 +64,13 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> - crow::async_resolve::Resolver resolver; - boost::beast::tcp_stream conn; - boost::asio::steady_timer timer; -- boost::beast::flat_buffer buffer; -+ boost::beast::flat_static_buffer<httpReadBodyLimit> buffer; - boost::beast::http::request<boost::beast::http::string_body> req; -- boost::beast::http::response<boost::beast::http::string_body> res; -- std::vector<std::pair<std::string, std::string>> headers; -- std::queue<std::string> requestDataQueue; -+ std::optional< -+ boost::beast::http::response_parser<boost::beast::http::string_body>> -+ parser; -+ boost::circular_buffer_space_optimized<std::string> requestDataQueue{}; -+ std::vector<boost::asio::ip::tcp::endpoint> endPoints; - ConnState state; - std::string subId; - std::string host; -@@ -76,12 +84,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> - - void doResolve() - { -- if (state == ConnState::resolveInProgress) -- { -- return; -- } - state = ConnState::resolveInProgress; -- - BMCWEB_LOG_DEBUG << "Trying to resolve: " << host << ":" << port; - - auto respHandler = -@@ -89,78 +92,56 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> - const boost::beast::error_code ec, - const std::vector<boost::asio::ip::tcp::endpoint>& - endpointList) { -- if (ec) -+ if (ec || (endpointList.size() == 0)) - { - BMCWEB_LOG_ERROR << "Resolve failed: " << ec.message(); - self->state = ConnState::resolveFailed; -- self->checkQueue(); -+ self->handleConnState(); - return; - } - BMCWEB_LOG_DEBUG << "Resolved"; -- self->doConnect(endpointList); -+ self->endPoints.assign(endpointList.begin(), -+ endpointList.end()); -+ self->state = ConnState::resolved; -+ self->handleConnState(); - }; - resolver.asyncResolve(host, port, std::move(respHandler)); - } - -- void doConnect( -- const std::vector<boost::asio::ip::tcp::endpoint>& endpointList) -+ void doConnect() - { -- if (state == ConnState::connectInProgress) -- { -- return; -- } - state = ConnState::connectInProgress; - - BMCWEB_LOG_DEBUG << "Trying to connect to: " << host << ":" << port; - - conn.expires_after(std::chrono::seconds(30)); - conn.async_connect( -- endpointList, [self(shared_from_this())]( -- const boost::beast::error_code ec, -- const boost::asio::ip::tcp::endpoint& endpoint) { -+ endPoints, [self(shared_from_this())]( -+ const boost::beast::error_code ec, -+ const boost::asio::ip::tcp::endpoint& endpoint) { - if (ec) - { - BMCWEB_LOG_ERROR << "Connect " << endpoint - << " failed: " << ec.message(); - self->state = ConnState::connectFailed; -- self->checkQueue(); -+ self->handleConnState(); - return; - } -- self->state = ConnState::connected; - BMCWEB_LOG_DEBUG << "Connected to: " << endpoint; -- -- self->checkQueue(); -+ self->state = ConnState::connected; -+ self->handleConnState(); - }); - } - - void sendMessage(const std::string& data) - { -- if (state == ConnState::sendInProgress) -- { -- return; -- } - state = ConnState::sendInProgress; - - BMCWEB_LOG_DEBUG << __FUNCTION__ << "(): " << host << ":" << port; - -- req.version(static_cast<int>(11)); // HTTP 1.1 -- req.target(uri); -- req.method(boost::beast::http::verb::post); -- -- // Set headers -- for (const auto& [key, value] : headers) -- { -- req.set(key, value); -- } -- req.set(boost::beast::http::field::host, host); -- req.keep_alive(true); -- - req.body() = data; - req.prepare_payload(); - -- // Set a timeout on the operation -- conn.expires_after(std::chrono::seconds(30)); -- - // Send the HTTP request to the remote host - boost::beast::http::async_write( - conn, req, -@@ -171,7 +152,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> - BMCWEB_LOG_ERROR << "sendMessage() failed: " - << ec.message(); - self->state = ConnState::sendFailed; -- self->checkQueue(); -+ self->handleConnState(); - return; - } - BMCWEB_LOG_DEBUG << "sendMessage() bytes transferred: " -@@ -184,9 +165,17 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> - - void recvMessage() - { -+ state = ConnState::recvInProgress; -+ -+ parser.emplace(std::piecewise_construct, std::make_tuple()); -+ parser->body_limit(httpReadBodyLimit); -+ -+ // Check only for the response header -+ parser->skip(true); -+ - // Receive the HTTP response - boost::beast::http::async_read( -- conn, buffer, res, -+ conn, buffer, *parser, - [self(shared_from_this())](const boost::beast::error_code& ec, - const std::size_t& bytesTransferred) { - if (ec) -@@ -194,30 +183,47 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> - BMCWEB_LOG_ERROR << "recvMessage() failed: " - << ec.message(); - self->state = ConnState::recvFailed; -- self->checkQueue(); -+ self->handleConnState(); - return; - } - BMCWEB_LOG_DEBUG << "recvMessage() bytes transferred: " - << bytesTransferred; -- boost::ignore_unused(bytesTransferred); -- -- // Discard received data. We are not interested. -- BMCWEB_LOG_DEBUG << "recvMessage() data: " << self->res; -+ BMCWEB_LOG_DEBUG << "recvMessage() data: " -+ << self->parser->get(); - - // Send is successful, Lets remove data from queue - // check for next request data in queue. -- self->requestDataQueue.pop(); -+ if (!self->requestDataQueue.empty()) -+ { -+ self->requestDataQueue.pop_front(); -+ } - self->state = ConnState::idle; -- self->checkQueue(); -+ -+ // Keep the connection alive if server supports it -+ // Else close the connection -+ BMCWEB_LOG_DEBUG << "recvMessage() keepalive : " -+ << self->parser->keep_alive(); -+ if (!self->parser->keep_alive()) -+ { -+ // Abort the connection since server is not keep-alive -+ // enabled -+ self->state = ConnState::abortConnection; -+ } -+ -+ // Returns ownership of the parsed message -+ self->parser->release(); -+ -+ self->handleConnState(); - }); - } - - void doClose() - { -+ state = ConnState::closeInProgress; - boost::beast::error_code ec; - conn.socket().shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec); -+ conn.close(); - -- state = ConnState::closed; - // not_connected happens sometimes so don't bother reporting it. - if (ec && ec != boost::beast::errc::not_connected) - { -@@ -225,112 +231,139 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> - return; - } - BMCWEB_LOG_DEBUG << "Connection closed gracefully"; -- } -- -- void checkQueue(const bool newRecord = false) -- { -- if (requestDataQueue.empty()) -+ if ((state != ConnState::suspended) && (state != ConnState::terminated)) - { -- // TODO: Having issue in keeping connection alive. So lets close if -- // nothing to be transferred. -- doClose(); -- -- BMCWEB_LOG_DEBUG << "requestDataQueue is empty\n"; -- return; -+ state = ConnState::closed; -+ handleConnState(); - } -+ } - -+ void waitAndRetry() -+ { - if (retryCount >= maxRetryAttempts) - { -- BMCWEB_LOG_ERROR << "Maximum number of retries is reached."; -+ BMCWEB_LOG_ERROR << "Maximum number of retries reached."; - - // Clear queue. - while (!requestDataQueue.empty()) - { -- requestDataQueue.pop(); -+ requestDataQueue.pop_front(); - } - -- BMCWEB_LOG_DEBUG << "Retry policy is set to " << retryPolicyAction; -+ BMCWEB_LOG_DEBUG << "Retry policy: " << retryPolicyAction; - if (retryPolicyAction == "TerminateAfterRetries") - { - // TODO: delete subscription - state = ConnState::terminated; -- return; - } - if (retryPolicyAction == "SuspendRetries") - { - state = ConnState::suspended; -- return; - } -- // keep retrying, reset count and continue. -+ // Reset the retrycount to zero so that client can try connecting -+ // again if needed - retryCount = 0; -+ handleConnState(); -+ return; - } - -- if ((state == ConnState::connectFailed) || -- (state == ConnState::sendFailed) || -- (state == ConnState::recvFailed)) -+ if (runningTimer) - { -- if (newRecord) -- { -- // We are already running async wait and retry. -- // Since record is added to queue, it gets the -- // turn in FIFO. -- return; -- } -- -- if (runningTimer) -- { -- BMCWEB_LOG_DEBUG << "Retry timer is already running."; -- return; -- } -- runningTimer = true; -- -- retryCount++; -- -- BMCWEB_LOG_DEBUG << "Attempt retry after " << retryIntervalSecs -- << " seconds. RetryCount = " << retryCount; -- timer.expires_after(std::chrono::seconds(retryIntervalSecs)); -- timer.async_wait( -- [self = shared_from_this()](const boost::system::error_code&) { -- self->runningTimer = false; -- self->connStateCheck(); -- }); -+ BMCWEB_LOG_DEBUG << "Retry timer is already running."; - return; - } -- // reset retry count. -- retryCount = 0; -- connStateCheck(); -+ runningTimer = true; -+ -+ retryCount++; -+ -+ BMCWEB_LOG_DEBUG << "Attempt retry after " << retryIntervalSecs -+ << " seconds. RetryCount = " << retryCount; -+ timer.expires_after(std::chrono::seconds(retryIntervalSecs)); -+ timer.async_wait( -+ [self = shared_from_this()](const boost::system::error_code ec) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "async_wait failed: " << ec.message(); -+ // Ignore the error and continue the retry loop to attempt -+ // sending the event as per the retry policy -+ } -+ self->runningTimer = false; - -+ // Lets close connection and start from resolve. -+ self->doClose(); -+ }); - return; - } - -- void connStateCheck() -+ void handleConnState() - { - switch (state) - { - case ConnState::resolveInProgress: - case ConnState::connectInProgress: - case ConnState::sendInProgress: -- case ConnState::suspended: -- case ConnState::terminated: -- // do nothing -+ case ConnState::recvInProgress: -+ case ConnState::closeInProgress: -+ { -+ BMCWEB_LOG_DEBUG << "Async operation is already in progress"; - break; -+ } - case ConnState::initialized: - case ConnState::closed: -+ { -+ if (requestDataQueue.empty()) -+ { -+ BMCWEB_LOG_DEBUG << "requestDataQueue is empty"; -+ return; -+ } -+ doResolve(); -+ break; -+ } -+ case ConnState::resolved: -+ { -+ doConnect(); -+ break; -+ } -+ case ConnState::suspended: -+ case ConnState::terminated: -+ { -+ doClose(); -+ break; -+ } -+ case ConnState::resolveFailed: - case ConnState::connectFailed: - case ConnState::sendFailed: - case ConnState::recvFailed: -- case ConnState::resolveFailed: -+ case ConnState::retry: - { -- doResolve(); -+ // In case of failures during connect and handshake -+ // the retry policy will be applied -+ waitAndRetry(); - break; - } - case ConnState::connected: - case ConnState::idle: - { -+ // State idle means, previous attempt is successful -+ // State connected means, client connection is established -+ // successfully -+ if (requestDataQueue.empty()) -+ { -+ BMCWEB_LOG_DEBUG << "requestDataQueue is empty"; -+ return; -+ } - std::string data = requestDataQueue.front(); - sendMessage(data); - break; - } -+ case ConnState::abortConnection: -+ { -+ // Server did not want to keep alive the session -+ doClose(); -+ break; -+ } -+ default: -+ break; - } - } - -@@ -339,37 +372,38 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> - const std::string& destIP, const std::string& destPort, - const std::string& destUri) : - conn(ioc), -- timer(ioc), subId(id), host(destIP), port(destPort), uri(destUri), -- retryCount(0), maxRetryAttempts(5), retryIntervalSecs(0), -+ timer(ioc), req(boost::beast::http::verb::post, destUri, 11), -+ state(ConnState::initialized), subId(id), host(destIP), port(destPort), -+ uri(destUri), retryCount(0), maxRetryAttempts(5), retryIntervalSecs(0), - retryPolicyAction("TerminateAfterRetries"), runningTimer(false) - { -- state = ConnState::initialized; -+ // Set the request header -+ req.set(boost::beast::http::field::host, host); -+ req.set(boost::beast::http::field::content_type, "application/json"); -+ req.keep_alive(true); -+ -+ requestDataQueue.set_capacity(maxRequestQueueSize); - } - - void sendData(const std::string& data) - { -- if (state == ConnState::suspended) -+ if ((state == ConnState::suspended) || (state == ConnState::terminated)) - { - return; - } -- -- if (requestDataQueue.size() <= maxRequestQueueSize) -- { -- requestDataQueue.push(data); -- checkQueue(true); -- } -- else -- { -- BMCWEB_LOG_ERROR << "Request queue is full. So ignoring data."; -- } -- -+ requestDataQueue.push_back(data); -+ handleConnState(); - return; - } - -- void setHeaders( -+ void addHeaders( - const std::vector<std::pair<std::string, std::string>>& httpHeaders) - { -- headers = httpHeaders; -+ // Set custom headers -+ for (const auto& [key, value] : httpHeaders) -+ { -+ req.set(key, value); -+ } - } - - void setRetryConfig(const uint32_t retryAttempts, -diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index 11190ef..a8f7517 100644 ---- a/redfish-core/include/event_service_manager.hpp -+++ b/redfish-core/include/event_service_manager.hpp -@@ -422,7 +422,7 @@ class Subscription - reqHeaders.emplace_back(std::pair(key, val)); - } - } -- conn->setHeaders(reqHeaders); -+ conn->addHeaders(reqHeaders); - conn->sendData(msg); - this->eventSeqNum++; - } --- -2.25.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch index eef0ff065..aeeafc421 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch @@ -1,28 +1,27 @@ -From 4df4a36d6d2cc11c51cc9d53cd441178cc97e39b Mon Sep 17 00:00:00 2001 +From 3f2ad28e6e124249cde3df50c9e18c283fbcbf3e Mon Sep 17 00:00:00 2001 From: AppaRao Puli <apparao.puli@linux.intel.com> Date: Mon, 22 Feb 2021 17:07:47 +0000 Subject: [PATCH] EventService: https client support -Add https client support for push style -eventing. Using this BMC can push the event -logs/telemetry data to event listener over -secure http channel. +Add https client support for push style eventing. Using this BMC can +push the event logs/telemetry data to event listener over secure http +channel. Tested: - - Created subscription with https destination - url. Using SubmitTestEvent action set the - event and can see event on event listener. + - Created subscription with https destination url. Using + SubmitTestEvent action set the event and can see event on event + listener. - Validator passed. Change-Id: I44c3918b39baa2eb5fddda9d635f99aa280a422a Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> --- - http/http_client.hpp | 257 ++++++++++++------ + http/http_client.hpp | 307 ++++++++++++------ .../include/event_service_manager.hpp | 2 +- - 2 files changed, 176 insertions(+), 83 deletions(-) + 2 files changed, 202 insertions(+), 107 deletions(-) diff --git a/http/http_client.hpp b/http/http_client.hpp -index feabbba..aaf1b2d 100644 +index aad1cce..5e7ff47 100644 --- a/http/http_client.hpp +++ b/http/http_client.hpp @@ -20,6 +20,7 @@ @@ -33,8 +32,8 @@ index feabbba..aaf1b2d 100644 #include <boost/beast/version.hpp> #include <include/async_resolve.hpp> -@@ -44,6 +45,8 @@ enum class ConnState - resolved, +@@ -43,6 +44,8 @@ enum class ConnState + resolveFailed, connectInProgress, connectFailed, + handshakeInProgress, @@ -42,7 +41,7 @@ index feabbba..aaf1b2d 100644 connected, sendInProgress, sendFailed, -@@ -62,7 +65,9 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -61,7 +64,9 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> { private: crow::async_resolve::Resolver resolver; @@ -52,8 +51,8 @@ index feabbba..aaf1b2d 100644 boost::asio::steady_timer timer; boost::beast::flat_static_buffer<httpReadBodyLimit> buffer; boost::beast::http::request<boost::beast::http::string_body> req; -@@ -111,23 +116,52 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> - void doConnect() +@@ -108,23 +113,52 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> + const std::vector<boost::asio::ip::tcp::endpoint>& endpointList) { state = ConnState::connectInProgress; + sslConn.emplace(conn, ctx); @@ -83,10 +82,10 @@ index feabbba..aaf1b2d 100644 + }; conn.expires_after(std::chrono::seconds(30)); - conn.async_connect( -- endPoints, [self(shared_from_this())]( -- const boost::beast::error_code ec, -- const boost::asio::ip::tcp::endpoint& endpoint) { -+ conn.async_connect(endPoints, std::move(respHandler)); +- endpointList, [self(shared_from_this())]( +- const boost::beast::error_code ec, +- const boost::asio::ip::tcp::endpoint& endpoint) { ++ conn.async_connect(endpointList, std::move(respHandler)); + } + + void performHandshake() @@ -113,7 +112,7 @@ index feabbba..aaf1b2d 100644 self->state = ConnState::connected; self->handleConnState(); }); -@@ -135,106 +169,159 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -132,132 +166,187 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> void sendMessage(const std::string& data) { @@ -125,6 +124,19 @@ index feabbba..aaf1b2d 100644 req.body() = data; req.prepare_payload(); +- // Set a timeout on the operation +- conn.expires_after(std::chrono::seconds(30)); ++ auto respHandler = [self(shared_from_this())]( ++ const boost::beast::error_code ec, ++ const std::size_t& bytesTransferred) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "sendMessage() failed: " << ec.message(); ++ self->state = ConnState::sendFailed; ++ self->handleConnState(); ++ return; ++ } + - // Send the HTTP request to the remote host - boost::beast::http::async_write( - conn, req, @@ -141,26 +153,15 @@ index feabbba..aaf1b2d 100644 - BMCWEB_LOG_DEBUG << "sendMessage() bytes transferred: " - << bytesTransferred; - boost::ignore_unused(bytesTransferred); -+ auto respHandler = [self(shared_from_this())]( -+ const boost::beast::error_code ec, -+ const std::size_t& bytesTransferred) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "sendMessage() failed: " << ec.message(); -+ self->state = ConnState::sendFailed; -+ self->handleConnState(); -+ return; -+ } - -- self->recvMessage(); -- }); -- } + BMCWEB_LOG_DEBUG << "sendMessage() bytes transferred: " + << bytesTransferred; + boost::ignore_unused(bytesTransferred); + self->recvMessage(); + }; +- self->recvMessage(); +- }); ++ // Set a timeout on the operation + conn.expires_after(std::chrono::seconds(30)); + if (sslConn) + { @@ -171,7 +172,8 @@ index feabbba..aaf1b2d 100644 + { + boost::beast::http::async_write(conn, req, std::move(respHandler)); + } -+ } + } +- void recvMessage() { state = ConnState::recvInProgress; @@ -191,6 +193,33 @@ index feabbba..aaf1b2d 100644 + BMCWEB_LOG_DEBUG << "recvMessage() bytes transferred: " + << bytesTransferred; + boost::ignore_unused(bytesTransferred); ++ ++ // Check if the response and header are received ++ if (!self->parser->is_done()) ++ { ++ // The parser failed to receive the response ++ BMCWEB_LOG_ERROR ++ << "recvMessage() parser failed to receive response"; ++ self->state = ConnState::recvFailed; ++ self->handleConnState(); ++ return; ++ } ++ ++ unsigned int respCode = self->parser->get().result_int(); ++ BMCWEB_LOG_DEBUG << "recvMessage() Header Response Code: " ++ << respCode; ++ ++ // 2XX response is considered to be successful ++ if ((respCode < 200) || (respCode >= 300)) ++ { ++ // The listener failed to receive the Sent-Event ++ BMCWEB_LOG_ERROR << "recvMessage() Listener Failed to " ++ "receive Sent-Event"; ++ self->state = ConnState::recvFailed; ++ self->handleConnState(); ++ return; ++ } ++ + // Send is successful, Lets remove data from queue + // check for next request data in queue. + if (!self->requestDataQueue.empty()) @@ -271,34 +300,56 @@ index feabbba..aaf1b2d 100644 - BMCWEB_LOG_DEBUG << "recvMessage() data: " - << self->parser->get(); - -- // Send is successful, Lets remove data from queue -- // check for next request data in queue. -- if (!self->requestDataQueue.empty()) +- // Check if the response and header are received +- if (!self->parser->is_done()) + else { -- self->requestDataQueue.pop_front(); +- // The parser failed to receive the response +- BMCWEB_LOG_ERROR +- << "recvMessage() parser failed to receive response"; +- self->state = ConnState::recvFailed; +- self->handleConnState(); +- return; + BMCWEB_LOG_DEBUG << "Connection closed gracefully..."; } -- self->state = ConnState::idle; + self->conn.close(); +- unsigned int respCode = self->parser->get().result_int(); +- BMCWEB_LOG_DEBUG << "recvMessage() Header Response Code: " +- << respCode; +- +- // 2XX response is considered to be successful +- if ((respCode < 200) || (respCode >= 300)) ++ if ((self->state != ConnState::suspended) && ++ (self->state != ConnState::terminated)) + { +- // The listener failed to receive the Sent-Event +- BMCWEB_LOG_ERROR << "recvMessage() Listener Failed to " +- "receive Sent-Event"; +- self->state = ConnState::recvFailed; ++ self->state = ConnState::closed; + self->handleConnState(); +- return; + } +- +- // Send is successful, Lets remove data from queue +- // check for next request data in queue. +- if (!self->requestDataQueue.empty()) +- { +- self->requestDataQueue.pop_front(); +- } +- self->state = ConnState::idle; +- - // Keep the connection alive if server supports it - // Else close the connection - BMCWEB_LOG_DEBUG << "recvMessage() keepalive : " - << self->parser->keep_alive(); - if (!self->parser->keep_alive()) -+ if ((self->state != ConnState::suspended) && -+ (self->state != ConnState::terminated)) - { +- { - // Abort the connection since server is not keep-alive - // enabled - self->state = ConnState::abortConnection; -+ self->state = ConnState::closed; -+ self->handleConnState(); - } -- -- // Returns ownership of the parsed message -- self->parser->release(); +- } - - self->handleConnState(); }); @@ -345,7 +396,7 @@ index feabbba..aaf1b2d 100644 } } -@@ -301,6 +388,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -330,6 +419,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> { case ConnState::resolveInProgress: case ConnState::connectInProgress: @@ -353,7 +404,7 @@ index feabbba..aaf1b2d 100644 case ConnState::sendInProgress: case ConnState::recvInProgress: case ConnState::closeInProgress: -@@ -332,6 +420,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -356,6 +446,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> } case ConnState::resolveFailed: case ConnState::connectFailed: @@ -361,7 +412,7 @@ index feabbba..aaf1b2d 100644 case ConnState::sendFailed: case ConnState::recvFailed: case ConnState::retry: -@@ -370,7 +459,8 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -394,7 +485,8 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> public: explicit HttpClient(boost::asio::io_context& ioc, const std::string& id, const std::string& destIP, const std::string& destPort, @@ -371,7 +422,7 @@ index feabbba..aaf1b2d 100644 conn(ioc), timer(ioc), req(boost::beast::http::verb::post, destUri, 11), state(ConnState::initialized), subId(id), host(destIP), port(destPort), -@@ -383,8 +473,11 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -407,8 +499,11 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> req.keep_alive(true); requestDataQueue.set_capacity(maxRequestQueueSize); @@ -385,10 +436,10 @@ index feabbba..aaf1b2d 100644 { if ((state == ConnState::suspended) || (state == ConnState::terminated)) diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index a8f7517..d4a5bc5 100644 +index 08d0b98..f1ce0c0 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp -@@ -397,7 +397,7 @@ class Subscription +@@ -385,7 +385,7 @@ class Subscription : public persistent_data::UserSubscription { conn = std::make_shared<crow::HttpClient>( crow::connections::systemBus->get_io_context(), id, host, port, @@ -398,4 +449,5 @@ index a8f7517..d4a5bc5 100644 Subscription(const std::shared_ptr<boost::beast::tcp_stream>& adaptor) : -- -2.25.1 +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch index da281467e..ea521a7e4 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch @@ -1,4 +1,4 @@ -From 54bdd897bd416fef4c043224b398b1b6d47fd271 Mon Sep 17 00:00:00 2001 +From d7a2660f200c38e74bfcbfe55b8da1b8bed08833 Mon Sep 17 00:00:00 2001 From: AppaRao Puli <apparao.puli@linux.intel.com> Date: Fri, 12 Mar 2021 18:53:25 +0000 Subject: [PATCH] Add Server-Sent-Events support @@ -21,47 +21,37 @@ Tested: Change-Id: I36956565cbba30c2007852c9471f477f6d1736e9 Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> +Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> --- - http/http_connection.hpp | 14 +- + http/http_connection.hpp | 10 +- http/http_response.hpp | 7 +- http/routing.hpp | 71 ++++++++++ http/server_sent_event.hpp | 279 +++++++++++++++++++++++++++++++++++++ - 4 files changed, 365 insertions(+), 6 deletions(-) + 4 files changed, 362 insertions(+), 5 deletions(-) create mode 100644 http/server_sent_event.hpp diff --git a/http/http_connection.hpp b/http/http_connection.hpp -index a1a7045..90535c5 100644 +index 8e53afa..a1bbfce 100644 --- a/http/http_connection.hpp +++ b/http/http_connection.hpp -@@ -331,7 +331,7 @@ class Connection : - BMCWEB_LOG_INFO << "Request: " - << " " << this << " HTTP/" << req->version() / 10 << "." - << req->version() % 10 << ' ' << req->methodString() -- << " " << req->target() << " " << req->ipAddress; -+ << " " << req->url << " " << req->ipAddress; +@@ -378,11 +378,13 @@ class Connection : + [self] { self->completeRequest(); }); + }); - needToCallAfterHandlers = false; - -@@ -350,11 +350,15 @@ class Connection : - boost::asio::post(self->adaptor.get_executor(), - [self] { self->completeRequest(); }); - }); -- if (req->isUpgrade() && -- boost::iequals( -- req->getHeaderValue(boost::beast::http::field::upgrade), -- "websocket")) -+ -+ if ((req->isUpgrade() && -+ boost::iequals(req->getHeaderValue( -+ boost::beast::http::field::upgrade), -+ "websocket")) || -+ (req->url == "/sse")) - { -+ BMCWEB_LOG_DEBUG << "Request: " << this -+ << " is getting upgraded"; - handler->handleUpgrade(*req, res, std::move(adaptor)); - // delete lambda with self shared_ptr - // to enable connection destruction +- if (thisReq.isUpgrade() && +- boost::iequals( +- thisReq.getHeaderValue(boost::beast::http::field::upgrade), +- "websocket")) ++ if ((thisReq.isUpgrade() && ++ boost::iequals( ++ thisReq.getHeaderValue(boost::beast::http::field::upgrade), ++ "websocket")) || ++ (req->url == "/sse")) + { ++ BMCWEB_LOG_DEBUG << "Request: " << this << " is getting upgraded"; + handler->handleUpgrade(thisReq, res, std::move(adaptor)); + // delete lambda with self shared_ptr + // to enable connection destruction diff --git a/http/http_response.hpp b/http/http_response.hpp index a983d4a..07b0265 100644 --- a/http/http_response.hpp @@ -93,7 +83,7 @@ index a983d4a..07b0265 100644 // In case of a JSON object, set the Content-Type header void jsonMode() diff --git a/http/routing.hpp b/http/routing.hpp -index d2a10b2..25e4ce8 100644 +index 5d9c8e3..bfff107 100644 --- a/http/routing.hpp +++ b/http/routing.hpp @@ -6,6 +6,7 @@ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch index 42a1ebbf0..ee69081ef 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch @@ -1,4 +1,4 @@ -From 36c1391749e19e4a25ca6e57d369457f48e6bb11 Mon Sep 17 00:00:00 2001 +From 799e47842e179f7c752712004f0e96d3219eee11 Mon Sep 17 00:00:00 2001 From: AppaRao Puli <apparao.puli@linux.intel.com> Date: Tue, 16 Mar 2021 15:37:24 +0000 Subject: [PATCH] Add SSE style subscription support to eventservice @@ -18,33 +18,33 @@ Tested: response. - Ran RedfishValidation and its passed. -Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> -Signed-off-by: Nitin Wankhade <nitinx.arunrao.wankhade@intel.com> Change-Id: I7f4b7a34974080739c4ba968ed570489af0474de +Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> +Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> --- http/http_connection.hpp | 2 +- include/eventservice_sse.hpp | 75 +++++ - .../include/event_service_manager.hpp | 111 +++++-- + .../include/event_service_manager.hpp | 109 +++++-- redfish-core/include/server_sent_events.hpp | 290 ------------------ redfish-core/lib/event_service.hpp | 8 +- src/webserver_main.cpp | 2 + - 6 files changed, 165 insertions(+), 323 deletions(-) + 6 files changed, 164 insertions(+), 322 deletions(-) create mode 100644 include/eventservice_sse.hpp delete mode 100644 redfish-core/include/server_sent_events.hpp diff --git a/http/http_connection.hpp b/http/http_connection.hpp -index 90535c5..37c0a0b 100644 +index a1bbfce..2d08501 100644 --- a/http/http_connection.hpp +++ b/http/http_connection.hpp -@@ -355,7 +355,7 @@ class Connection : - boost::iequals(req->getHeaderValue( - boost::beast::http::field::upgrade), - "websocket")) || -- (req->url == "/sse")) -+ (req->url == "/redfish/v1/EventService/Subscriptions/SSE")) - { - BMCWEB_LOG_DEBUG << "Request: " << this - << " is getting upgraded"; +@@ -382,7 +382,7 @@ class Connection : + boost::iequals( + thisReq.getHeaderValue(boost::beast::http::field::upgrade), + "websocket")) || +- (req->url == "/sse")) ++ (req->url == "/redfish/v1/EventService/Subscriptions/SSE")) + { + BMCWEB_LOG_DEBUG << "Request: " << this << " is getting upgraded"; + handler->handleUpgrade(thisReq, res, std::move(adaptor)); diff --git a/include/eventservice_sse.hpp b/include/eventservice_sse.hpp new file mode 100644 index 0000000..14daf00 @@ -127,7 +127,7 @@ index 0000000..14daf00 +} // namespace eventservice_sse +} // namespace redfish diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index ca46aa7..9397271 100644 +index 3f398d7..dd833ce 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -22,15 +22,17 @@ @@ -217,23 +217,23 @@ index ca46aa7..9397271 100644 ~Subscription() = default; -@@ -412,13 +412,14 @@ class Subscription : public persistent_data::UserSubscription - } - conn->addHeaders(reqHeaders); - conn->sendData(msg); -- this->eventSeqNum++; - } +@@ -417,7 +417,7 @@ class Subscription : public persistent_data::UserSubscription if (sseConn != nullptr) { - sseConn->sendData(eventSeqNum, msg); + sseConn->sendEvent(std::to_string(eventSeqNum), msg); } -+ + } + +@@ -508,6 +508,7 @@ class Subscription : public persistent_data::UserSubscription + + this->sendEvent( + msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace)); + this->eventSeqNum++; } + #endif - void sendTestEventLog() @@ -578,14 +579,39 @@ class Subscription : public persistent_data::UserSubscription return eventSeqNum; } @@ -622,7 +622,7 @@ index 7613d7b..0000000 - -} // namespace crow diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp -index 67ad014..f8a2dac 100644 +index 8609862..249e594 100644 --- a/redfish-core/lib/event_service.hpp +++ b/redfish-core/lib/event_service.hpp @@ -37,8 +37,6 @@ static constexpr const std::array<const char*, 1> supportedResourceTypes = { diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch index 9043bd0b9..3914cc81a 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch @@ -1,4 +1,4 @@ -From 22c6b6cfb468f8de9ff3ea051dffdba05778645e Mon Sep 17 00:00:00 2001 +From 769f0e20d0a7e786d7091ffb7ee57d35204dfa28 Mon Sep 17 00:00:00 2001 From: AppaRao Puli <apparao.puli@linux.intel.com> Date: Wed, 17 Mar 2021 01:16:50 +0000 Subject: [PATCH] Add EventService SSE filter support @@ -41,7 +41,7 @@ Change-Id: I55c6f53bb5e57aa1f2d1601f1a16525a33b13bd2 5 files changed, 181 insertions(+), 9 deletions(-) diff --git a/include/eventservice_sse.hpp b/include/eventservice_sse.hpp -index 14daf00..2f22f98 100644 +index 14daf00..fed7fec 100644 --- a/include/eventservice_sse.hpp +++ b/include/eventservice_sse.hpp @@ -23,16 +23,153 @@ static bool createSubscription(std::shared_ptr<crow::SseConnection>& conn, @@ -203,7 +203,7 @@ index 14daf00..2f22f98 100644 std::string id = redfish::EventServiceManager::getInstance().addSubscription(subValue, diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp -index 10567d1..f29e326 100644 +index 3d11cc4..90084e3 100644 --- a/redfish-core/include/error_messages.hpp +++ b/redfish-core/include/error_messages.hpp @@ -971,6 +971,15 @@ nlohmann::json mutualExclusiveProperties(const std::string& arg1, @@ -223,10 +223,10 @@ index 10567d1..f29e326 100644 } // namespace redfish diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index 5886d81..c3e7f61 100644 +index dd833ce..861f4cb 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp -@@ -56,6 +56,11 @@ static constexpr const char* eventServiceFile = +@@ -55,6 +55,11 @@ static constexpr const char* eventServiceFile = static constexpr const uint8_t maxNoOfSubscriptions = 20; static constexpr const uint8_t maxNoOfSSESubscriptions = 10; @@ -239,10 +239,10 @@ index 5886d81..c3e7f61 100644 static std::optional<boost::asio::posix::stream_descriptor> inotifyConn; static constexpr const char* redfishEventLogDir = "/var/log"; diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp -index 2e7c3f3..9def549 100644 +index 249e594..6f01707 100644 --- a/redfish-core/lib/event_service.hpp +++ b/redfish-core/lib/event_service.hpp -@@ -25,11 +25,6 @@ +@@ -21,11 +21,6 @@ namespace redfish { @@ -255,10 +255,10 @@ index 2e7c3f3..9def549 100644 "TerminateAfterRetries", "SuspendRetries", "RetryForever"}; diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp -index 48edaf1..bebb6d8 100644 +index 9c28e8f..2394398 100644 --- a/redfish-core/src/error_messages.cpp +++ b/redfish-core/src/error_messages.cpp -@@ -2174,6 +2174,32 @@ void mutualExclusiveProperties(crow::Response& res, const std::string& arg1, +@@ -2173,6 +2173,32 @@ void mutualExclusiveProperties(crow::Response& res, const std::string& arg1, addMessageToErrorJson(res.jsonValue, mutualExclusiveProperties(arg1, arg2)); } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0010-Remove-Terminated-Event-Subscriptions.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0010-Remove-Terminated-Event-Subscriptions.patch index 7fcc235d2..9af5a066b 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0010-Remove-Terminated-Event-Subscriptions.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0010-Remove-Terminated-Event-Subscriptions.patch @@ -1,6 +1,6 @@ -From adaa5cb4c494148430b90edb248260eb2e66bca7 Mon Sep 17 00:00:00 2001 -From: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> -Date: Wed, 8 Sep 2021 15:42:52 +0530 +From f665ba085bb2310f008b7534f827fb401ad973c2 Mon Sep 17 00:00:00 2001 +From: Krzysztof Grobelny <krzysztof.grobelny@intel.com> +Date: Tue, 12 Oct 2021 08:19:51 +0000 Subject: [PATCH] Delete/Remove Terminated Event Subscription(s) Added functionality to delete/remove event subscription(s) which are @@ -23,14 +23,14 @@ Change-Id: If447acb2db74fb29a5d1cfe6194b77cda82bc8a1 Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> --- http/http_client.hpp | 43 +++++++++++++++---- - .../include/event_service_manager.hpp | 37 ++++++++++++++++ - 2 files changed, 71 insertions(+), 9 deletions(-) + .../include/event_service_manager.hpp | 36 ++++++++++++++++ + 2 files changed, 70 insertions(+), 9 deletions(-) diff --git a/http/http_client.hpp b/http/http_client.hpp -index aaf1b2d..4f62c40 100644 +index 5e7ff47..54ae2c3 100644 --- a/http/http_client.hpp +++ b/http/http_client.hpp -@@ -56,6 +56,8 @@ enum class ConnState +@@ -55,6 +55,8 @@ enum class ConnState closeInProgress, closed, suspended, @@ -39,7 +39,7 @@ index aaf1b2d..4f62c40 100644 terminated, abortConnection, retry -@@ -263,7 +265,14 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -288,7 +290,14 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> } void doClose() { @@ -55,7 +55,7 @@ index aaf1b2d..4f62c40 100644 // Set the timeout on the tcp stream socket for the async operation conn.expires_after(std::chrono::seconds(30)); -@@ -293,8 +302,11 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -318,8 +327,11 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> } self->conn.close(); @@ -69,7 +69,7 @@ index aaf1b2d..4f62c40 100644 { self->state = ConnState::closed; self->handleConnState(); -@@ -316,8 +328,11 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -341,8 +353,11 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> } conn.close(); @@ -83,7 +83,7 @@ index aaf1b2d..4f62c40 100644 { state = ConnState::closed; handleConnState(); -@@ -340,8 +355,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -365,8 +380,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> BMCWEB_LOG_DEBUG << "Retry policy: " << retryPolicyAction; if (retryPolicyAction == "TerminateAfterRetries") { @@ -93,7 +93,7 @@ index aaf1b2d..4f62c40 100644 } if (retryPolicyAction == "SuspendRetries") { -@@ -392,6 +406,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -423,6 +437,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> case ConnState::sendInProgress: case ConnState::recvInProgress: case ConnState::closeInProgress: @@ -101,7 +101,7 @@ index aaf1b2d..4f62c40 100644 { BMCWEB_LOG_DEBUG << "Async operation is already in progress"; break; -@@ -413,7 +428,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -439,7 +454,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> break; } case ConnState::suspended: @@ -110,7 +110,7 @@ index aaf1b2d..4f62c40 100644 { doClose(); break; -@@ -480,7 +495,8 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -506,7 +521,8 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> } void sendData(const std::string& data) { @@ -120,7 +120,7 @@ index aaf1b2d..4f62c40 100644 { return; } -@@ -489,6 +505,15 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -524,6 +540,15 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> return; } @@ -137,7 +137,7 @@ index aaf1b2d..4f62c40 100644 const std::vector<std::pair<std::string, std::string>>& httpHeaders) { diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index 8d7067b..79618f6 100644 +index 6f60a31..363adb0 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -591,6 +591,14 @@ class Subscription : public persistent_data::UserSubscription @@ -254,5 +254,5 @@ index 8d7067b..79618f6 100644 { std::shared_ptr<Subscription> entry = it.second; -- -2.17.1 +2.25.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0011-Fix-bmcweb-crash-while-deleting-terminated-subscriptions.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0011-Fix-bmcweb-crash-while-deleting-terminated-subscriptions.patch new file mode 100644 index 000000000..585f7bf09 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0011-Fix-bmcweb-crash-while-deleting-terminated-subscriptions.patch @@ -0,0 +1,141 @@ +From 5b87bb61b58e92a8c5af37a7959347747409a65c Mon Sep 17 00:00:00 2001 +From: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +Date: Thu, 14 Oct 2021 02:56:11 +0530 +Subject: [PATCH] Fix bmcweb crash while deleting terminated subscriptions + +This commit fixes bmcweb crash while deleting the terminated +subscriptions. In the earlier implementation, detection of subscription +to be deleted and the deletion(erase) was happening in the same loop. +Due to this, if the Subscription to be deleted is the last one in the +list, the loop will enter into infinite loop. The fix is to keep the +detection and deletion loop separate. +Also, this commit adds code to : + - Delete from persistent storage + - Add journal entry for deleted entry + - update number of subcribers and update persistent storage. + +Apart from this, this commit also moves the retry timer check to the top +to avoid multiple calls to close when the retry count is 3 and timer is +running. + +Tested: + - Checked journal logs to confirm each retry is actually spanned to be + 30 secs + - Verified Journal entry for deleted subscription after retires. + - Verified Event service functionality by making three subscriptions: + retry for ever, terminate after retires and suspend after retries. + +Change-Id: I425a6c749923ce86c457a36394deb0fbbee232db +Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +--- + http/http_client.hpp | 11 ++-- + .../include/event_service_manager.hpp | 59 ++++++++++++++++--- + 2 files changed, 58 insertions(+), 12 deletions(-) + +diff --git a/http/http_client.hpp b/http/http_client.hpp +index 54ae2c3..162cb09 100644 +--- a/http/http_client.hpp ++++ b/http/http_client.hpp +@@ -367,6 +367,12 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> + + void waitAndRetry() + { ++ if (runningTimer) ++ { ++ BMCWEB_LOG_DEBUG << "Retry timer is already running."; ++ return; ++ } ++ + if (retryCount >= maxRetryAttempts) + { + BMCWEB_LOG_ERROR << "Maximum number of retries reached."; +@@ -393,11 +399,6 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> + return; + } + +- if (runningTimer) +- { +- BMCWEB_LOG_DEBUG << "Retry timer is already running."; +- return; +- } + runningTimer = true; + + retryCount++; +diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp +index 363adb0..7af7a4d 100644 +--- a/redfish-core/include/event_service_manager.hpp ++++ b/redfish-core/include/event_service_manager.hpp +@@ -857,18 +857,63 @@ class EventServiceManager + + void deleteTerminatedSubcriptions() + { +- boost::container::flat_map<std::string, +- std::shared_ptr<Subscription>>::iterator it = +- subscriptionsMap.begin(); +- while (it != subscriptionsMap.end()) ++ BMCWEB_LOG_ERROR << "Map size Before Delete : " ++ << subscriptionsMap.size(); ++ ++ std::vector<std::string> deleteIds; ++ ++ // Determine Subscription ID's to be deleted. ++ for (const auto& it : subscriptionsMap) + { +- std::shared_ptr<Subscription> entry = it->second; ++ std::shared_ptr<Subscription> entry = it.second; + if (entry->isTerminated()) + { +- subscriptionsMap.erase(it); ++ deleteIds.emplace_back(it.first); ++ } ++ } ++ ++ // Delete the Terminated Subcriptions ++ for (std::string& id : deleteIds) ++ { ++ auto map1 = subscriptionsMap.find(id); ++ if (map1 != subscriptionsMap.end()) ++ { ++ subscriptionsMap.erase(map1); ++ auto map2 = persistent_data::EventServiceStore::getInstance() ++ .subscriptionsConfigMap.find(id); ++ if (map2 != persistent_data::EventServiceStore::getInstance() ++ .subscriptionsConfigMap.end()) ++ { ++ persistent_data::EventServiceStore::getInstance() ++ .subscriptionsConfigMap.erase(map2); ++ } ++ else ++ { ++ BMCWEB_LOG_ERROR << "Couldn't find ID: " << id ++ << " in subscriptionsConfigMap"; ++ } ++ ++ /* Log event for subscription delete. */ ++ sd_journal_send("MESSAGE=Event subscription removed.(Id = %s)", ++ id.c_str(), "PRIORITY=%i", LOG_INFO, ++ "REDFISH_MESSAGE_ID=%s", ++ "OpenBMC.0.1.EventSubscriptionRemoved", ++ "REDFISH_MESSAGE_ARGS=%s", id.c_str(), NULL); ++ } ++ else ++ { ++ BMCWEB_LOG_ERROR << "Couldn't find ID: " << id ++ << " in subscriptionsMap"; + } +- it++; + } ++ if (deleteIds.size()) ++ { ++ updateNoOfSubscribersCount(); ++ persistSubscriptionData(); ++ } ++ ++ BMCWEB_LOG_ERROR << "Map size After Delete : " ++ << subscriptionsMap.size(); + } + + void updateNoOfSubscribersCount() +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README index cd2e1c2bc..c09967456 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README @@ -3,26 +3,32 @@ the upstream patches. These will be remove as soon as thee gets merged upstream. Upstream revision information: - - EventService : Fix retry handling for http-client - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/40731/21 + - EventService : Add unmerged changes for http retry support (Downstream patch) + file://eventservice/0001-Add-unmerged-changes-for-http-retry-support.patch - EventService: https client support - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31735/40 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31735/40 (Rebased on latest bmcweb) - Add Server-Sent-Events support - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41258/7 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41258/9 - Add SSE style subscription support to eventservice - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41319/8 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41319/10 - Add EventService SSE filter support - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41349/5 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41349/7 (Modified boost::urls::query_params_view to boost::urls::url_view::params_type) - - EventService Log events for subscription actions - file://telemetry/0007-EventService-Log-events-for-subscription-actions.patch + - EventService Log events for subscription actions (Downstream patch) + file://eventservice/0007-EventService-Log-events-for-subscription-actions.patch - - Add checks on Event-Subscription input parameters - file://telemetry/0008-Add-checks-on-Event-Subscription-input-parameters.patch + - Add checks on Event-Subscription input parameters (Downstream patch) + file://eventservice//0008-Add-checks-on-Event-Subscription-input-parameters.patch - Restructure Redifsh EventLog Transmit code flow - file://telemetry/0009-Restructure-Redifsh-EventLog-Transmit-code-flow.patch + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/44449/3 + + - Remove Terminated Event Subscriptions (Downstream patch) + file://eventservice/0010-Remove-Terminated-Event-Subscriptions.patch + + - Fix bmcweb crash while deleting terminated subscriptions (Downstream patch) + file://eventservice/0011-Fix-bmcweb-crash-while-deleting-terminated-subscriptions.patch diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0001-Add-asyncResp-support-during-handleUpgrade.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0001-Add-asyncResp-support-during-handleUpgrade.patch new file mode 100644 index 000000000..b3aa11774 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0001-Add-asyncResp-support-during-handleUpgrade.patch @@ -0,0 +1,202 @@ +From f2c3271c8eb405a05a3ec383791e1adc3c4a7f86 Mon Sep 17 00:00:00 2001 +From: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +Date: Mon, 18 Oct 2021 22:45:37 +0530 +Subject: [PATCH] Add asyncResp support during handleUpgrade + +The current implementation uses the earlier method of using the response +object and calling response.end() to initiate completion handler. +This commit modifies the implementation to use asyncResp, where the +completion handler gets called asynchronously as the response object +goes out of scope. + +Tested : + - websocket_test.py Passed + - KVM was functional in WebUI. + - POST to /redfish/v1/EventService/Subscriptions/SSE returned an error + message as expected and the connection was kept alive. + - GET on /redfish/v1/EventService/Subscriptions/SSE (SSE subscription) + was successful. The existing connection was successfully closed and + upgraded to SSE connection. + +Change-Id: I2d76b34a49a6432c507d939b21b37c1ced761f8e +Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +--- + http/app.hpp | 6 ++++-- + http/http_connection.hpp | 30 +++++++++++++++++++++++++----- + http/routing.hpp | 37 +++++++++++++++++++++---------------- + 3 files changed, 50 insertions(+), 23 deletions(-) + +diff --git a/http/app.hpp b/http/app.hpp +index 4735197..c46dcf7 100644 +--- a/http/app.hpp ++++ b/http/app.hpp +@@ -45,9 +45,11 @@ class App + } + + template <typename Adaptor> +- void handleUpgrade(const Request& req, Response& res, Adaptor&& adaptor) ++ void handleUpgrade(const Request& req, ++ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, ++ Adaptor&& adaptor) + { +- router.handleUpgrade(req, res, std::move(adaptor)); ++ router.handleUpgrade(req, asyncResp, std::move(adaptor)); + } + + void handle(Request& req, +diff --git a/http/http_connection.hpp b/http/http_connection.hpp +index 9d53c17..cdd3707 100644 +--- a/http/http_connection.hpp ++++ b/http/http_connection.hpp +@@ -361,6 +361,7 @@ class Connection : + boost::asio::post(self->adaptor.get_executor(), + [self] { self->completeRequest(); }); + }); ++ auto asyncResp = std::make_shared<bmcweb::AsyncResp>(res); + + if ((thisReq.isUpgrade() && + boost::iequals( +@@ -369,13 +370,32 @@ class Connection : + (req->url == "/redfish/v1/EventService/Subscriptions/SSE")) + { + BMCWEB_LOG_DEBUG << "Request: " << this << " is getting upgraded"; +- handler->handleUpgrade(thisReq, res, std::move(adaptor)); +- // delete lambda with self shared_ptr +- // to enable connection destruction +- res.setCompleteRequestHandler(nullptr); ++ res.setCompleteRequestHandler([self(shared_from_this())] { ++ if (self->res.resultInt() != 200) ++ { ++ // When any error occurs during handle upgradation, ++ // the result in response will be set to respective ++ // error. By default the Result will be OK (200), ++ // which implies successful handle upgrade. Response ++ // needs to be sent over this connection only on ++ // failure. ++ boost::asio::post(self->adaptor.get_executor(), ++ [self] { self->completeRequest(); }); ++ } ++ else ++ { ++ // Set Complete request handler to NULL to remove ++ // the shared pointer of connection to enable ++ // connection destruction. As the connection would ++ // get upgraded, we wouldn't need this connection ++ // any longer ++ self->res.setCompleteRequestHandler(nullptr); ++ } ++ }); ++ handler->handleUpgrade(thisReq, asyncResp, std::move(adaptor)); + return; + } +- auto asyncResp = std::make_shared<bmcweb::AsyncResp>(res); ++ + handler->handle(thisReq, asyncResp); + } + +diff --git a/http/routing.hpp b/http/routing.hpp +index 25e4ce8..858f146 100644 +--- a/http/routing.hpp ++++ b/http/routing.hpp +@@ -1202,12 +1202,13 @@ class Router + } + + template <typename Adaptor> +- void handleUpgrade(const Request& req, Response& res, Adaptor&& adaptor) ++ void handleUpgrade(const Request& req, ++ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, ++ Adaptor&& adaptor) + { + if (static_cast<size_t>(req.method()) >= perMethods.size()) + { +- res.result(boost::beast::http::status::not_found); +- res.end(); ++ asyncResp->res.result(boost::beast::http::status::not_found); + return; + } + +@@ -1220,8 +1221,7 @@ class Router + if (!ruleIndex) + { + BMCWEB_LOG_DEBUG << "Cannot match rules " << req.url; +- res.result(boost::beast::http::status::not_found); +- res.end(); ++ asyncResp->res.result(boost::beast::http::status::not_found); + return; + } + +@@ -1234,23 +1234,24 @@ class Router + { + BMCWEB_LOG_INFO << "Redirecting to a url with trailing slash: " + << req.url; +- res.result(boost::beast::http::status::moved_permanently); ++ asyncResp->res.result( ++ boost::beast::http::status::moved_permanently); + + // TODO absolute url building + if (req.getHeaderValue("Host").empty()) + { +- res.addHeader("Location", std::string(req.url) + "/"); ++ asyncResp->res.addHeader("Location", ++ std::string(req.url) + "/"); + } + else + { +- res.addHeader( ++ asyncResp->res.addHeader( + "Location", + req.isSecure + ? "https://" + : "http://" + std::string(req.getHeaderValue("Host")) + + std::string(req.url) + "/"); + } +- res.end(); + return; + } + +@@ -1261,8 +1262,7 @@ class Router + << " with " << req.methodString() << "(" + << static_cast<uint32_t>(req.method()) << ") / " + << rules[ruleIndex]->getMethods(); +- res.result(boost::beast::http::status::not_found); +- res.end(); ++ asyncResp->res.result(boost::beast::http::status::not_found); + return; + } + +@@ -1273,13 +1273,18 @@ class Router + // any uncaught exceptions become 500s + try + { +- rules[ruleIndex]->handleUpgrade(req, res, std::move(adaptor)); ++ // Creating temporary response object to call handleUpgrade ++ // We cannot pass the asyncResp as it will be destroyed ++ // The response object is not initialized as handleUpgrade wouldn't ++ // be using this object ++ crow::Response resp; ++ rules[ruleIndex]->handleUpgrade(req, resp, std::move(adaptor)); + } + catch (std::exception& e) + { + BMCWEB_LOG_ERROR << "An uncaught exception occurred: " << e.what(); +- res.result(boost::beast::http::status::internal_server_error); +- res.end(); ++ asyncResp->res.result( ++ boost::beast::http::status::internal_server_error); + return; + } + catch (...) +@@ -1287,8 +1292,8 @@ class Router + BMCWEB_LOG_ERROR + << "An uncaught exception occurred. The type was unknown " + "so no information was available."; +- res.result(boost::beast::http::status::internal_server_error); +- res.end(); ++ asyncResp->res.result( ++ boost::beast::http::status::internal_server_error); + return; + } + } +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0002-Move-privileges-to-separate-entity.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0002-Move-privileges-to-separate-entity.patch new file mode 100644 index 000000000..1217147b4 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0002-Move-privileges-to-separate-entity.patch @@ -0,0 +1,109 @@ +From 6483f0af926391e8d1f256ba0f23f3640260cfd1 Mon Sep 17 00:00:00 2001 +From: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +Date: Mon, 18 Oct 2021 22:52:17 +0530 +Subject: [PATCH] Move privileges to separate entity + +The privilege property of a rule is currently part of RuleParameterTraits +structure. Moving this property (member function) out into a separate +entity PrivilegeParameterTraits. +This move is required to enable inheriting this entity into Weksockets +and SseSockets. + +Tested: + - bmcweb is functional and is responding to Redfish URI's + - User Privilege check for URI's is functional. + +Change-Id: I288ab12258c15ae5a626f4409fc3b4a9cc574ea3 +Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +--- + http/routing.hpp | 53 +++++++++++++++++++++++++++--------------------- + 1 file changed, 30 insertions(+), 23 deletions(-) + +diff --git a/http/routing.hpp b/http/routing.hpp +index 858f146..acc99dc 100644 +--- a/http/routing.hpp ++++ b/http/routing.hpp +@@ -102,6 +102,8 @@ class BaseRule + friend class Router; + template <typename T> + friend struct RuleParameterTraits; ++ template <typename T> ++ friend struct PrivilegeParameterTraits; + }; + + namespace detail +@@ -316,6 +318,33 @@ struct Wrapped + } // namespace routing_handler_call_helper + } // namespace detail + ++template <typename T> ++struct PrivilegeParameterTraits ++{ ++ using self_t = T; ++ self_t& privileges( ++ const std::initializer_list<std::initializer_list<const char*>>& p) ++ { ++ self_t* self = static_cast<self_t*>(this); ++ for (const std::initializer_list<const char*>& privilege : p) ++ { ++ self->privilegesSet.emplace_back(privilege); ++ } ++ return *self; ++ } ++ ++ template <size_t N, typename... MethodArgs> ++ self_t& privileges(const std::array<redfish::Privileges, N>& p) ++ { ++ self_t* self = static_cast<self_t*>(this); ++ for (const redfish::Privileges& privilege : p) ++ { ++ self->privilegesSet.emplace_back(privilege); ++ } ++ return *self; ++ } ++}; ++ + class WebSocketRule : public BaseRule + { + using self_t = WebSocketRule; +@@ -462,7 +491,7 @@ class SseSocketRule : public BaseRule + }; + + template <typename T> +-struct RuleParameterTraits ++struct RuleParameterTraits : public PrivilegeParameterTraits<T> + { + using self_t = T; + WebSocketRule& websocket() +@@ -503,28 +532,6 @@ struct RuleParameterTraits + self->methodsBitfield |= 1U << static_cast<size_t>(method); + return *self; + } +- +- self_t& privileges( +- const std::initializer_list<std::initializer_list<const char*>>& p) +- { +- self_t* self = static_cast<self_t*>(this); +- for (const std::initializer_list<const char*>& privilege : p) +- { +- self->privilegesSet.emplace_back(privilege); +- } +- return *self; +- } +- +- template <size_t N, typename... MethodArgs> +- self_t& privileges(const std::array<redfish::Privileges, N>& p) +- { +- self_t* self = static_cast<self_t*>(this); +- for (const redfish::Privileges& privilege : p) +- { +- self->privilegesSet.emplace_back(privilege); +- } +- return *self; +- } + }; + + class DynamicRule : public BaseRule, public RuleParameterTraits<DynamicRule> +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0003-Add-Support-for-privilege-check-in-handleUpgrade.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0003-Add-Support-for-privilege-check-in-handleUpgrade.patch new file mode 100644 index 000000000..1ba584616 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0003-Add-Support-for-privilege-check-in-handleUpgrade.patch @@ -0,0 +1,218 @@ +From aabe4718b8e6c1f7b91af29cbaf85d5fa1fa0a99 Mon Sep 17 00:00:00 2001 +From: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +Date: Mon, 18 Oct 2021 22:55:38 +0530 +Subject: [PATCH] Add Support for privilege check in handleUpgrade + +This commit enables privilege check for user(s) in case of upgraded +connections. +Currently users with no privileges will also be able to access +Websockets connections (Ex: KVM). + +Tested: + - websocket_test.py Passed + - Admin and Operator users were able to access KVM on WebUI + - Readonly User was unable to access KVM on WebUI + +Change-Id: Id9d33aeca24d8fafb2e9dcc28c46a48930740cd6 +Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +--- + http/app.hpp | 2 +- + http/routing.hpp | 162 +++++++++++++++++++++++++++++++++++++++-------- + 2 files changed, 136 insertions(+), 28 deletions(-) + +diff --git a/http/app.hpp b/http/app.hpp +index c46dcf7..dd51eee 100644 +--- a/http/app.hpp ++++ b/http/app.hpp +@@ -45,7 +45,7 @@ class App + } + + template <typename Adaptor> +- void handleUpgrade(const Request& req, ++ void handleUpgrade(Request& req, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + Adaptor&& adaptor) + { +diff --git a/http/routing.hpp b/http/routing.hpp +index acc99dc..e2a8fbb 100644 +--- a/http/routing.hpp ++++ b/http/routing.hpp +@@ -1209,7 +1209,7 @@ class Router + } + + template <typename Adaptor> +- void handleUpgrade(const Request& req, ++ void handleUpgrade(Request& req, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + Adaptor&& adaptor) + { +@@ -1277,32 +1277,140 @@ class Router + << "' " << static_cast<uint32_t>(req.method()) << " / " + << rules[ruleIndex]->getMethods(); + +- // any uncaught exceptions become 500s +- try +- { +- // Creating temporary response object to call handleUpgrade +- // We cannot pass the asyncResp as it will be destroyed +- // The response object is not initialized as handleUpgrade wouldn't +- // be using this object +- crow::Response resp; +- rules[ruleIndex]->handleUpgrade(req, resp, std::move(adaptor)); +- } +- catch (std::exception& e) +- { +- BMCWEB_LOG_ERROR << "An uncaught exception occurred: " << e.what(); +- asyncResp->res.result( +- boost::beast::http::status::internal_server_error); +- return; +- } +- catch (...) +- { +- BMCWEB_LOG_ERROR +- << "An uncaught exception occurred. The type was unknown " +- "so no information was available."; +- asyncResp->res.result( +- boost::beast::http::status::internal_server_error); +- return; +- } ++ crow::connections::systemBus->async_method_call( ++ [&req, asyncResp, &rules, ruleIndex, &adaptor]( ++ const boost::system::error_code ec, ++ std::map<std::string, std::variant<bool, std::string, ++ std::vector<std::string>>> ++ userInfo) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "GetUserInfo failed..."; ++ asyncResp->res.result( ++ boost::beast::http::status::internal_server_error); ++ return; ++ } ++ ++ const std::string* userRolePtr = nullptr; ++ auto userInfoIter = userInfo.find("UserPrivilege"); ++ if (userInfoIter != userInfo.end()) ++ { ++ userRolePtr = ++ std::get_if<std::string>(&userInfoIter->second); ++ } ++ ++ std::string userRole{}; ++ if (userRolePtr != nullptr) ++ { ++ userRole = *userRolePtr; ++ BMCWEB_LOG_DEBUG << "userName = " << req.session->username ++ << " userRole = " << *userRolePtr; ++ } ++ ++ bool* remoteUserPtr = nullptr; ++ auto remoteUserIter = userInfo.find("RemoteUser"); ++ if (remoteUserIter != userInfo.end()) ++ { ++ remoteUserPtr = std::get_if<bool>(&remoteUserIter->second); ++ } ++ if (remoteUserPtr == nullptr) ++ { ++ BMCWEB_LOG_ERROR ++ << "RemoteUser property missing or wrong type"; ++ asyncResp->res.result( ++ boost::beast::http::status::internal_server_error); ++ return; ++ } ++ bool remoteUser = *remoteUserPtr; ++ ++ bool passwordExpired = false; // default for remote user ++ if (!remoteUser) ++ { ++ bool* passwordExpiredPtr = nullptr; ++ auto passwordExpiredIter = ++ userInfo.find("UserPasswordExpired"); ++ if (passwordExpiredIter != userInfo.end()) ++ { ++ passwordExpiredPtr = ++ std::get_if<bool>(&passwordExpiredIter->second); ++ } ++ if (passwordExpiredPtr != nullptr) ++ { ++ passwordExpired = *passwordExpiredPtr; ++ } ++ else ++ { ++ BMCWEB_LOG_ERROR ++ << "UserPasswordExpired property is expected for" ++ " local user but is missing or wrong type"; ++ asyncResp->res.result( ++ boost::beast::http::status::internal_server_error); ++ return; ++ } ++ } ++ ++ // Get the userprivileges from the role ++ redfish::Privileges userPrivileges = ++ redfish::getUserPrivileges(userRole); ++ ++ // Set isConfigureSelfOnly based on D-Bus results. This ++ // ignores the results from both pamAuthenticateUser and the ++ // value from any previous use of this session. ++ req.session->isConfigureSelfOnly = passwordExpired; ++ ++ // Modifyprivileges if isConfigureSelfOnly. ++ if (req.session->isConfigureSelfOnly) ++ { ++ // Remove allprivileges except ConfigureSelf ++ userPrivileges = userPrivileges.intersection( ++ redfish::Privileges{"ConfigureSelf"}); ++ BMCWEB_LOG_DEBUG << "Operation limited to ConfigureSelf"; ++ } ++ ++ if (!rules[ruleIndex]->checkPrivileges(userPrivileges)) ++ { ++ asyncResp->res.result( ++ boost::beast::http::status::forbidden); ++ if (req.session->isConfigureSelfOnly) ++ { ++ redfish::messages::passwordChangeRequired( ++ asyncResp->res, ++ "/redfish/v1/AccountService/Accounts/" + ++ req.session->username); ++ } ++ return; ++ } ++ ++ req.userRole = userRole; ++ ++ // any uncaught exceptions become 500s ++ try ++ { ++ crow::Response resp; ++ rules[ruleIndex]->handleUpgrade(req, resp, ++ std::move(adaptor)); ++ } ++ catch (std::exception& e) ++ { ++ BMCWEB_LOG_ERROR << "An uncaught exception occurred: " ++ << e.what(); ++ asyncResp->res.result( ++ boost::beast::http::status::internal_server_error); ++ return; ++ } ++ catch (...) ++ { ++ BMCWEB_LOG_ERROR ++ << "An uncaught exception occurred. The type was " ++ "unknown so no information was available."; ++ asyncResp->res.result( ++ boost::beast::http::status::internal_server_error); ++ return; ++ } ++ }, ++ "xyz.openbmc_project.User.Manager", "/xyz/openbmc_project/user", ++ "xyz.openbmc_project.User.Manager", "GetUserInfo", ++ req.session->username); + } + + void handle(Request& req, +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0004-Add-Privileges-to-Websockets.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0004-Add-Privileges-to-Websockets.patch new file mode 100644 index 000000000..64e235ce3 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0004-Add-Privileges-to-Websockets.patch @@ -0,0 +1,140 @@ +From 9b27d3e7c1670d53cfb1c0a88cc75155ebfba71a Mon Sep 17 00:00:00 2001 +From: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +Date: Mon, 18 Oct 2021 22:58:29 +0530 +Subject: [PATCH] Add Privileges to Websockets + +This commit adds Privileges to Websockets. +In the current implementation, once a rule is upgraded (i.e. from +BaseRule to WebSocket), there is no provosion to add priviliges. +In this commit, WebSocket inherits PrivilegeParameterTraits to enable +privileges. + +Also, in the earlier implementation, .privilege() was called after +BMCWEB_ROUTE(). This results in adding those privileges to the Base rule +that is created. By moving the privileges() below websocket(), the +privileges are applied to the websocket. + +Tested: + - websocket_test.py Passed + - Admin and Operator users were able to access KVM on WebUI + - Readonly User was unable to access KVM on WebUI + +Change-Id: Iff2051dbb7d363c902fd463fa446f280adc6d648 +Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +--- + http/routing.hpp | 4 +++- + include/dbus_monitor.hpp | 3 ++- + include/kvm_websocket.hpp | 4 +++- + include/obmc_console.hpp | 4 +++- + include/vm_websocket.hpp | 4 +++- + 5 files changed, 14 insertions(+), 5 deletions(-) + +diff --git a/http/routing.hpp b/http/routing.hpp +index e2a8fbb..6ea3185 100644 +--- a/http/routing.hpp ++++ b/http/routing.hpp +@@ -345,7 +345,9 @@ struct PrivilegeParameterTraits + } + }; + +-class WebSocketRule : public BaseRule ++class WebSocketRule : ++ public BaseRule, ++ public PrivilegeParameterTraits<WebSocketRule> + { + using self_t = WebSocketRule; + +diff --git a/include/dbus_monitor.hpp b/include/dbus_monitor.hpp +index a6c86c6..163f884 100644 +--- a/include/dbus_monitor.hpp ++++ b/include/dbus_monitor.hpp +@@ -5,6 +5,7 @@ + #include <boost/container/flat_set.hpp> + #include <dbus_singleton.hpp> + #include <openbmc_dbus_rest.hpp> ++#include <registries/privilege_registry.hpp> + #include <sdbusplus/bus/match.hpp> + #include <sdbusplus/message/types.hpp> + #include <websocket.hpp> +@@ -105,8 +106,8 @@ inline int onPropertyUpdate(sd_bus_message* m, void* userdata, + inline void requestRoutes(App& app) + { + BMCWEB_ROUTE(app, "/subscribe") +- .privileges({{"Login"}}) + .websocket() ++ .privileges(redfish::privileges::privilegeSetLogin) + .onopen([&](crow::websocket::Connection& conn, + const std::shared_ptr<bmcweb::AsyncResp>&) { + BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened"; +diff --git a/include/kvm_websocket.hpp b/include/kvm_websocket.hpp +index a9dc8ea..3f124a2 100644 +--- a/include/kvm_websocket.hpp ++++ b/include/kvm_websocket.hpp +@@ -4,6 +4,7 @@ + #include <app.hpp> + #include <async_resp.hpp> + #include <boost/container/flat_map.hpp> ++#include <registries/privilege_registry.hpp> + #include <websocket.hpp> + + namespace crow +@@ -159,8 +160,9 @@ inline void requestRoutes(App& app) + sessions.reserve(maxSessions); + + BMCWEB_ROUTE(app, "/kvm/0") +- .privileges({{"ConfigureComponents", "ConfigureManager"}}) + .websocket() ++ .privileges(redfish::privileges:: ++ privilegeSetConfigureManagerOrConfigureComponents) + .onopen([](crow::websocket::Connection& conn, + const std::shared_ptr<bmcweb::AsyncResp>&) { + BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened"; +diff --git a/include/obmc_console.hpp b/include/obmc_console.hpp +index ff0a51f..22a49a8 100644 +--- a/include/obmc_console.hpp ++++ b/include/obmc_console.hpp +@@ -6,6 +6,7 @@ + #include <boost/asio/local/stream_protocol.hpp> + #include <boost/container/flat_map.hpp> + #include <boost/container/flat_set.hpp> ++#include <registries/privilege_registry.hpp> + #include <websocket.hpp> + + namespace crow +@@ -136,8 +137,9 @@ inline void connectHandler(const boost::system::error_code& ec) + inline void requestRoutes(App& app) + { + BMCWEB_ROUTE(app, "/console0") +- .privileges({{"ConfigureComponents", "ConfigureManager"}}) + .websocket() ++ .privileges(redfish::privileges:: ++ privilegeSetConfigureManagerOrConfigureComponents) + .onopen([](crow::websocket::Connection& conn, + const std::shared_ptr<bmcweb::AsyncResp>&) { + BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened"; +diff --git a/include/vm_websocket.hpp b/include/vm_websocket.hpp +index 02f958a..ebbe68f 100644 +--- a/include/vm_websocket.hpp ++++ b/include/vm_websocket.hpp +@@ -3,6 +3,7 @@ + #include <app.hpp> + #include <boost/beast/core/flat_static_buffer.hpp> + #include <boost/process.hpp> ++#include <registries/privilege_registry.hpp> + #include <websocket.hpp> + + #include <csignal> +@@ -156,8 +157,9 @@ static std::shared_ptr<Handler> handler; + inline void requestRoutes(App& app) + { + BMCWEB_ROUTE(app, "/vm/0/0") +- .privileges({{"ConfigureComponents", "ConfigureManager"}}) + .websocket() ++ .privileges(redfish::privileges:: ++ privilegeSetConfigureManagerOrConfigureComponents) + .onopen([](crow::websocket::Connection& conn, + const std::shared_ptr<bmcweb::AsyncResp>&) { + BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened"; +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0005-Add-Privileges-to-SseSockets.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0005-Add-Privileges-to-SseSockets.patch new file mode 100644 index 000000000..06ffb3a46 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/http_routing/0005-Add-Privileges-to-SseSockets.patch @@ -0,0 +1,63 @@ +From 0ceb343809ff498cbfa389c54a158d255a2cca88 Mon Sep 17 00:00:00 2001 +From: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +Date: Mon, 18 Oct 2021 23:02:00 +0530 +Subject: [PATCH] Add Privileges to SseSockets + +This commit adds Privileges to Ssesockets. +In the current implementation, once a rule is upgraded (i.e. from +BaseRule to SseSocket), there is no provision to add priviliges. +In this commit, SseSocket inherits PrivilegeParameterTraits to +enable privileges. + +Also, in the earlier implementation, .privilege() was called after +BMCWEB_ROUTE(). This results in adding those privileges to the Base +rule that is created. By moving the privileges() below websocket(), +the privileges are applied to the Ssesocket. + +Tested: + - SSE Subscription was successful with Admin and Operator Users + - SSE Subscription was rejected while using Readonly User + - websocket_test.py Passed + - Admin and Operator users were able to access KVM on WebUI + - Readonly User was unable to access KVM on WebUI + +Change-Id: I41739401893b1c2bf718e11ec7676d69f954c98f +Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +--- + http/routing.hpp | 4 +++- + include/eventservice_sse.hpp | 3 ++- + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/http/routing.hpp b/http/routing.hpp +index 6ea3185..13174b2 100644 +--- a/http/routing.hpp ++++ b/http/routing.hpp +@@ -430,7 +430,9 @@ class WebSocketRule : + std::function<void(crow::websocket::Connection&)> errorHandler; + }; + +-class SseSocketRule : public BaseRule ++class SseSocketRule : ++ public BaseRule, ++ public PrivilegeParameterTraits<SseSocketRule> + { + using self_t = SseSocketRule; + +diff --git a/include/eventservice_sse.hpp b/include/eventservice_sse.hpp +index 2f22f98..f880344 100644 +--- a/include/eventservice_sse.hpp ++++ b/include/eventservice_sse.hpp +@@ -192,8 +192,9 @@ static void deleteSubscription(std::shared_ptr<crow::SseConnection>& conn) + inline void requestRoutes(App& app) + { + BMCWEB_ROUTE(app, "/redfish/v1/EventService/Subscriptions/SSE") +- .privileges({{"ConfigureComponents", "ConfigureManager"}}) + .serverSentEvent() ++ .privileges(redfish::privileges:: ++ privilegeSetConfigureManagerOrConfigureComponents) + .onopen([](std::shared_ptr<crow::SseConnection>& conn, + const crow::Request& req, crow::Response& res) { + BMCWEB_LOG_DEBUG << "Connection " << conn << " opened."; +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Add-support-for-MetricDefinition-scheme.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Add-support-for-MetricDefinition-scheme.patch index c19691cdc..f5226fe6e 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Add-support-for-MetricDefinition-scheme.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Add-support-for-MetricDefinition-scheme.patch @@ -1,4 +1,4 @@ -From 80608f0d72da62426bb00e03a42fbf5daed931c9 Mon Sep 17 00:00:00 2001 +From 32e557279450226ed9c06312649d90b802f3d4c5 Mon Sep 17 00:00:00 2001 From: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Date: Tue, 13 Apr 2021 13:00:18 +0000 Subject: [PATCH] Add support for MetricDefinition scheme @@ -11,10 +11,11 @@ MetricDefinitions contains all physical sensors supported by redfish, algorithm iterates through all chassis and collects results for each node available in that chassis (Power, Thermal, Sensors). -When https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/40169 will -be merge it will be possible to optimize this algorithm to only get -sensors from Sensors node. Currently Sensors node doesn't contain all -available sensors. +When BMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM will be enabled by +default (meson option redfish-new-powersubsystem-thermalsubsystem) it +will be possible to optimize this algorithm to only get sensors from +Sensors node. Currently Sensors node doesn't contain all available +sensors. Tested: - MetricDefinitions response is filled with existing sensors, it works @@ -30,47 +31,54 @@ GET /redfish/v1/TelemetryService/MetricDefinitions "@odata.type": "#MetricDefinitionCollection.MetricDefinitionCollection", "Members": [ { - "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Rotational" + "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Fan_Pwm" }, { - "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Percent" + "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Fan_Tach" }, { - "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Temperature" + "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/HostCpuUtilization" }, { - "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Power" + "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/HostMemoryBandwidthUtilization" }, { - "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/AirFlow" + "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/HostPciBandwidthUtilization" + }, + { + "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Inlet_BRD_Temp" + }, + { + "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Left_Rear_Board_Temp" } ], - "Members@odata.count": 5, + "Members@odata.count": 7, "Name": "Metric Definition Collection" } -GET /redfish/v1/TelemetryService/MetricDefinitions/Rotational +GET /redfish/v1/TelemetryService/MetricDefinitions/Fan_Tach { - "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Rotational", + "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Fan_Tach", "@odata.type": "#MetricDefinition.v1_0_3.MetricDefinition", - "Id": "Rotational", - "Implementation": "PhysicalSensor", + "Id": "Fan_Tach", "IsLinear": true, + "MaxReadingRange": 25000.0, "MetricDataType": "Decimal", "MetricProperties": [ - "/redfish/v1/Chassis/Chassis0/Thermal#/Fans/0/Reading", - "/redfish/v1/Chassis/Chassis0/Thermal#/Fans/1/Reading", - "/redfish/v1/Chassis/Chassis0/Thermal#/Fans/2/Reading", - "/redfish/v1/Chassis/Chassis0/Thermal#/Fans/3/Reading", - "/redfish/v1/Chassis/Chassis0/Thermal#/Fans/4/Reading", - "/redfish/v1/Chassis/Chassis0/Thermal#/Fans/5/Reading", - "/redfish/v1/Chassis/Chassis0/Thermal#/Fans/6/Reading", - "/redfish/v1/Chassis/Chassis0/Thermal#/Fans/7/Reading", - "/redfish/v1/Chassis/Chassis0/Thermal#/Fans/8/Reading", - "/redfish/v1/Chassis/Chassis0/Thermal#/Fans/9/Reading" + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/0/Reading", + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/1/Reading", + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/2/Reading", + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/3/Reading", + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/4/Reading", + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/5/Reading", + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/6/Reading", + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/7/Reading", + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/8/Reading", + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/9/Reading" ], - "MetricType": "Numeric", - "Name": "Rotational", + "MetricType": "Gauge", + "MinReadingRange": 0.0, + "Name": "Fan_Tach", "Units": "RPM" } @@ -109,16 +117,16 @@ Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Change-Id: I3086e1302e1ba2e5442d1367939fd5507a0cbc00 --- redfish-core/include/redfish.hpp | 3 + - .../include/utils/get_chassis_names.hpp | 58 ++++ + .../include/utils/get_chassis_names.hpp | 58 +++ .../include/utils/telemetry_utils.hpp | 2 + - redfish-core/lib/metric_definition.hpp | 258 ++++++++++++++++++ - redfish-core/lib/telemetry_service.hpp | 2 + - 5 files changed, 323 insertions(+) + redfish-core/lib/metric_definition.hpp | 368 ++++++++++++++++++ + redfish-core/lib/telemetry_service.hpp | 3 +- + 5 files changed, 433 insertions(+), 1 deletion(-) create mode 100644 redfish-core/include/utils/get_chassis_names.hpp create mode 100644 redfish-core/lib/metric_definition.hpp diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp -index 1c7b695..9983b88 100644 +index 0a97150..67c5af2 100644 --- a/redfish-core/include/redfish.hpp +++ b/redfish-core/include/redfish.hpp @@ -26,6 +26,7 @@ @@ -129,7 +137,7 @@ index 1c7b695..9983b88 100644 #include "../lib/metric_report.hpp" #include "../lib/metric_report_definition.hpp" #include "../lib/network_protocol.hpp" -@@ -199,6 +200,8 @@ class RedfishService +@@ -200,6 +201,8 @@ class RedfishService requestRoutesMetricReportDefinition(app); requestRoutesMetricReportCollection(app); requestRoutesMetricReport(app); @@ -217,10 +225,10 @@ index 5872350..1b4f75d 100644 constexpr const char* metricReportUri = diff --git a/redfish-core/lib/metric_definition.hpp b/redfish-core/lib/metric_definition.hpp new file mode 100644 -index 0000000..019168b +index 0000000..347c297 --- /dev/null +++ b/redfish-core/lib/metric_definition.hpp -@@ -0,0 +1,258 @@ +@@ -0,0 +1,368 @@ +#pragma once + +#include "async_resp.hpp" @@ -236,55 +244,160 @@ index 0000000..019168b +namespace telemetry +{ + -+bool containsOdata(const nlohmann::json& json, const std::string& odataId) ++struct ValueVisitor +{ -+ const auto it = std::find_if( -+ json.begin(), json.end(), [&odataId](const nlohmann::json& item) { -+ auto kt = item.find("@odata.id"); -+ if (kt == item.end()) ++ ValueVisitor(boost::system::error_code& ec) : ec(ec) ++ {} ++ ++ template <class T> ++ double operator()(T value) const ++ { ++ return static_cast<double>(value); ++ } ++ ++ double operator()(std::monostate) const ++ { ++ ec = boost::system::errc::make_error_code( ++ boost::system::errc::invalid_argument); ++ return double{}; ++ } ++ ++ boost::system::error_code& ec; ++}; ++ ++inline void getReadingRange( ++ const std::string& service, const std::string& path, ++ const std::string& property, ++ std::function<void(boost::system::error_code, double)> callback) ++{ ++ crow::connections::systemBus->async_method_call( ++ [callback = std::move(callback)]( ++ boost::system::error_code ec, ++ const std::variant<std::monostate, double, uint64_t, int64_t, ++ uint32_t, int32_t, uint16_t, int16_t>& ++ valueVariant) { ++ if (ec) + { -+ return false; ++ callback(ec, double{}); ++ return; + } -+ const std::string* value = kt->get_ptr<const std::string*>(); -+ if (!value) ++ ++ const double value = std::visit(ValueVisitor(ec), valueVariant); ++ ++ callback(ec, value); ++ }, ++ service, path, "org.freedesktop.DBus.Properties", "Get", ++ "xyz.openbmc_project.Sensor.Value", property); ++} ++ ++inline void ++ fillMinMaxReadingRange(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, ++ const std::string& serviceName, ++ const std::string& sensorPath) ++{ ++ asyncResp->res.jsonValue["MetricType"] = "Numeric"; ++ ++ telemetry::getReadingRange( ++ serviceName, sensorPath, "MinValue", ++ [asyncResp](boost::system::error_code ec, double readingRange) { ++ if (ec) + { -+ return false; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ ++ if (std::isfinite(readingRange)) ++ { ++ asyncResp->res.jsonValue["MetricType"] = "Gauge"; ++ ++ asyncResp->res.jsonValue["MinReadingRange"] = readingRange; + } -+ return *value == odataId; + }); + -+ return it != json.end(); ++ telemetry::getReadingRange( ++ serviceName, sensorPath, "MaxValue", ++ [asyncResp](boost::system::error_code ec, double readingRange) { ++ if (ec) ++ { ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ ++ if (std::isfinite(readingRange)) ++ { ++ asyncResp->res.jsonValue["MetricType"] = "Gauge"; ++ ++ asyncResp->res.jsonValue["MaxReadingRange"] = readingRange; ++ } ++ }); +} + -+void addMembers(crow::Response& res, -+ const boost::container::flat_map<std::string, std::string>& el) ++inline void getSensorService( ++ const std::string& sensorPath, ++ std::function<void(boost::system::error_code, const std::string&)> callback) +{ -+ for (const auto& [_, dbusSensor] : el) -+ { -+ sdbusplus::message::object_path path(dbusSensor); -+ sdbusplus::message::object_path parentPath = path.parent_path(); -+ const std::string type = parentPath.filename(); ++ using ResultType = std::pair< ++ std::string, ++ std::vector<std::pair<std::string, std::vector<std::string>>>>; + -+ if (type.empty()) -+ { -+ BMCWEB_LOG_ERROR << "Received invalid DBus Sensor Path = " -+ << dbusSensor; -+ continue; -+ } ++ crow::connections::systemBus->async_method_call( ++ [sensorPath, callback = std::move(callback)]( ++ boost::system::error_code ec, ++ const std::vector<ResultType>& result) { ++ if (ec) ++ { ++ callback(ec, std::string{}); ++ return; ++ } ++ ++ for (const auto& [path, serviceToInterfaces] : result) ++ { ++ if (path == sensorPath) ++ { ++ for (const auto& [service, interfaces] : ++ serviceToInterfaces) ++ { ++ callback(boost::system::errc::make_error_code( ++ boost::system::errc::success), ++ service); ++ return; ++ } ++ } ++ } + -+ nlohmann::json& members = res.jsonValue["Members"]; ++ callback(boost::system::errc::make_error_code( ++ boost::system::errc::no_such_file_or_directory), ++ std::string{}); ++ }, ++ "xyz.openbmc_project.ObjectMapper", ++ "/xyz/openbmc_project/object_mapper", ++ "xyz.openbmc_project.ObjectMapper", "GetSubTree", ++ "/xyz/openbmc_project/sensors", 2, ++ std::array{"xyz.openbmc_project.Sensor.Value"}); ++} + -+ const std::string odataId = -+ std::string(telemetry::metricDefinitionUri) + -+ sensors::toReadingType(type); ++constexpr auto metricDefinitionMapping = std::array{ ++ std::pair{"fan_pwm", "Fan_Pwm"}, std::pair{"fan_tach", "Fan_Tach"}}; + -+ if (!containsOdata(members, odataId)) -+ { -+ members.push_back({{"@odata.id", odataId}}); -+ } ++std::string mapSensorToMetricDefinition(const std::string& sensorPath) ++{ ++ sdbusplus::message::object_path sensorObjectPath{sensorPath}; ++ ++ const auto it = std::find_if( ++ metricDefinitionMapping.begin(), metricDefinitionMapping.end(), ++ [&sensorObjectPath](const auto& item) { ++ return item.first == sensorObjectPath.parent_path().filename(); ++ }); ++ ++ const char* metricDefinitionPath = ++ "/redfish/v1/TelemetryService/MetricDefinitions/"; + -+ res.jsonValue["Members@odata.count"] = members.size(); ++ if (it != metricDefinitionMapping.end()) ++ { ++ return std::string{metricDefinitionPath} + it->second; + } ++ ++ return metricDefinitionPath + sensorObjectPath.filename(); +} + +template <class Callback> @@ -300,8 +413,11 @@ index 0000000..019168b + return; + } + ++ auto counter = std::make_shared<std::pair< ++ boost::container::flat_map<std::string, std::string>, size_t>>(); ++ + auto handleRetrieveUriToDbusMap = -+ [callback = std::move(callback)]( ++ [counter, callback = std::move(callback)]( + const boost::beast::http::status status, + const boost::container::flat_map<std::string, std::string>& + uriToDbus) { @@ -310,21 +426,31 @@ index 0000000..019168b + BMCWEB_LOG_ERROR << "Failed to retrieve URI to dbus " + "sensors map with err " + << static_cast<unsigned>(status); ++ counter->second = 0u; + callback(boost::system::errc::make_error_code( + boost::system::errc::io_error), + {}); + return; + } + -+ callback(boost::system::errc::make_error_code( -+ boost::system::errc::success), -+ uriToDbus); ++ for (const auto& [key, value] : uriToDbus) ++ { ++ counter->first[key] = value; ++ } ++ ++ if (--counter->second == 0u) ++ { ++ callback(boost::system::errc::make_error_code( ++ boost::system::errc::success), ++ counter->first); ++ } + }; + + for (const std::string& chassisName : chassisNames) + { + for (const auto& [sensorNode, dbusPaths] : sensors::dbus::paths) + { ++ ++counter->second; + retrieveUriToDbusMap(chassisName, sensorNode.data(), + handleRetrieveUriToDbusMap); + } @@ -354,7 +480,23 @@ index 0000000..019168b + return; + } + -+ telemetry::addMembers(asyncResp->res, uriToDbus); ++ std::set<std::string> members; ++ ++ for (const auto& [uri, dbusPath] : uriToDbus) ++ { ++ members.insert( ++ telemetry::mapSensorToMetricDefinition( ++ dbusPath)); ++ } ++ ++ for (const std::string& odataId : members) ++ { ++ asyncResp->res.jsonValue["Members"].push_back( ++ {{"@odata.id", odataId}}); ++ } ++ ++ asyncResp->res.jsonValue["Members@odata.count"] = ++ asyncResp->res.jsonValue["Members"].size(); + }); + + asyncResp->res.jsonValue["@odata.type"] = @@ -369,128 +511,109 @@ index 0000000..019168b + }); +} + -+namespace telemetry -+{ -+ -+bool isSensorIdSupported(std::string_view readingType) -+{ -+ for (const std::pair<std::string_view, std::vector<const char*>>& -+ typeToPaths : sensors::dbus::paths) -+ { -+ for (const char* supportedPath : typeToPaths.second) -+ { -+ if (readingType == -+ sensors::toReadingType( -+ sdbusplus::message::object_path(supportedPath).filename())) -+ { -+ return true; -+ } -+ } -+ } -+ return false; -+} -+ -+void addMetricProperty( -+ bmcweb::AsyncResp& asyncResp, const std::string& readingType, -+ const boost::container::flat_map<std::string, std::string>& el) -+{ -+ nlohmann::json& metricProperties = -+ asyncResp.res.jsonValue["MetricProperties"]; -+ -+ for (const auto& [redfishSensor, dbusSensor] : el) -+ { -+ std::string sensorId; -+ if (dbus::utility::getNthStringFromPath(dbusSensor, 3, sensorId)) -+ { -+ if (sensors::toReadingType(sensorId) == readingType) -+ { -+ metricProperties.push_back(redfishSensor); -+ } -+ } -+ } -+} -+ -+inline const char* readingTypeToReadingUnits(const std::string& readingType) -+{ -+ for (const auto& [node, paths] : sensors::dbus::paths) -+ { -+ for (const char* path : paths) -+ { -+ const sdbusplus::message::object_path sensorPath = -+ sdbusplus::message::object_path(path); -+ if (sensors::toReadingType(sensorPath.filename()) == readingType) -+ { -+ return sensors::toReadingUnits(sensorPath.filename()); -+ } -+ } -+ } -+ return ""; -+} -+ -+} // namespace telemetry -+ +inline void requestRoutesMetricDefinition(App& app) +{ + BMCWEB_ROUTE(app, "/redfish/v1/TelemetryService/MetricDefinitions/<str>/") + .privileges(privileges::getTelemetryService) -+ .methods(boost::beast::http::verb::get)( -+ [](const crow::Request&, -+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, -+ const std::string& readingType) { -+ if (!telemetry::isSensorIdSupported(readingType)) -+ { -+ messages::resourceNotFound(asyncResp->res, -+ "MetricDefinition", readingType); -+ return; -+ } -+ -+ telemetry::mapRedfishUriToDbusPath( -+ [asyncResp, -+ readingType](boost::system::error_code ec, -+ const boost::container::flat_map< -+ std::string, std::string>& uriToDbus) { -+ if (ec) ++ .methods( ++ boost::beast::http::verb::get)([](const crow::Request&, ++ const std::shared_ptr< ++ bmcweb::AsyncResp>& asyncResp, ++ const std::string& name) { ++ telemetry::mapRedfishUriToDbusPath( ++ [asyncResp, name]( ++ boost::system::error_code ec, ++ const boost::container::flat_map<std::string, std::string>& ++ uriToDbus) { ++ if (ec) ++ { ++ messages::internalError(asyncResp->res); ++ BMCWEB_LOG_ERROR << "mapRedfishUriToDbusPath error: " ++ << ec.value(); ++ return; ++ } ++ ++ std::string odataId = telemetry::metricDefinitionUri + name; ++ boost::container::flat_map<std::string, std::string> ++ matchingUris; ++ ++ for (const auto& [uri, dbusPath] : uriToDbus) ++ { ++ if (telemetry::mapSensorToMetricDefinition(dbusPath) == ++ odataId) + { -+ messages::internalError(asyncResp->res); -+ BMCWEB_LOG_ERROR -+ << "mapRedfishUriToDbusPath error: " -+ << ec.value(); -+ return; ++ matchingUris.emplace(uri, dbusPath); + } -+ -+ asyncResp->res.jsonValue["Id"] = readingType; -+ asyncResp->res.jsonValue["Name"] = readingType; -+ asyncResp->res.jsonValue["@odata.id"] = -+ telemetry::metricDefinitionUri + readingType; -+ asyncResp->res.jsonValue["@odata.type"] = -+ "#MetricDefinition.v1_0_3.MetricDefinition"; -+ asyncResp->res.jsonValue["MetricDataType"] = "Decimal"; -+ asyncResp->res.jsonValue["MetricType"] = "Numeric"; -+ asyncResp->res.jsonValue["IsLinear"] = true; -+ asyncResp->res.jsonValue["Implementation"] = -+ "PhysicalSensor"; -+ asyncResp->res.jsonValue["Units"] = -+ telemetry::readingTypeToReadingUnits(readingType); -+ -+ telemetry::addMetricProperty(*asyncResp, readingType, -+ uriToDbus); -+ }); -+ }); ++ } ++ ++ if (matchingUris.empty()) ++ { ++ messages::resourceNotFound(asyncResp->res, ++ "MetricDefinition", name); ++ return; ++ } ++ ++ std::string sensorPath = matchingUris.begin()->second; ++ ++ telemetry::getSensorService( ++ sensorPath, ++ [asyncResp, name, odataId = std::move(odataId), ++ sensorPath, matchingUris = std::move(matchingUris)]( ++ boost::system::error_code ec, ++ const std::string& serviceName) { ++ if (ec) ++ { ++ messages::internalError(asyncResp->res); ++ BMCWEB_LOG_ERROR << "getServiceSensorFailed: " ++ << ec.value(); ++ return; ++ } ++ ++ asyncResp->res.jsonValue["Id"] = name; ++ asyncResp->res.jsonValue["Name"] = name; ++ asyncResp->res.jsonValue["@odata.id"] = odataId; ++ asyncResp->res.jsonValue["@odata.type"] = ++ "#MetricDefinition.v1_0_3.MetricDefinition"; ++ asyncResp->res.jsonValue["MetricDataType"] = ++ "Decimal"; ++ asyncResp->res.jsonValue["IsLinear"] = true; ++ asyncResp->res.jsonValue["Units"] = ++ sensors::toReadingUnits( ++ sdbusplus::message::object_path{sensorPath} ++ .parent_path() ++ .filename()); ++ ++ for (const auto& [uri, dbusPath] : matchingUris) ++ { ++ asyncResp->res.jsonValue["MetricProperties"] ++ .push_back(uri); ++ } ++ ++ telemetry::fillMinMaxReadingRange( ++ asyncResp, serviceName, sensorPath); ++ }); ++ }); ++ }); +} + +} // namespace redfish diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp -index ad86d5c..c4962e9 100644 +index 8ecc591..027b51b 100644 --- a/redfish-core/lib/telemetry_service.hpp +++ b/redfish-core/lib/telemetry_service.hpp -@@ -29,6 +29,8 @@ inline void requestRoutesTelemetryService(App& app) - "/redfish/v1/TelemetryService/MetricReportDefinitions"; - asyncResp->res.jsonValue["MetricReports"]["@odata.id"] = - "/redfish/v1/TelemetryService/MetricReports"; -+ asyncResp->res.jsonValue["MetricDefinitions"]["@odata.id"] = -+ "/redfish/v1/TelemetryService/MetricDefinitions"; +@@ -18,11 +18,12 @@ inline void handleTelemetryServiceGet( + asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/TelemetryService"; + asyncResp->res.jsonValue["Id"] = "TelemetryService"; + asyncResp->res.jsonValue["Name"] = "Telemetry Service"; +- + asyncResp->res.jsonValue["MetricReportDefinitions"]["@odata.id"] = + "/redfish/v1/TelemetryService/MetricReportDefinitions"; + asyncResp->res.jsonValue["MetricReports"]["@odata.id"] = + "/redfish/v1/TelemetryService/MetricReports"; ++ asyncResp->res.jsonValue["MetricDefinitions"]["@odata.id"] = ++ "/redfish/v1/TelemetryService/MetricDefinitions"; - crow::connections::systemBus->async_method_call( - [asyncResp]( + crow::connections::systemBus->async_method_call( + [asyncResp](const boost::system::error_code ec, -- 2.25.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Sync-Telmetry-service-with-EventService.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Sync-Telmetry-service-with-EventService.patch index d32c85356..3088a7f9d 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Sync-Telmetry-service-with-EventService.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Sync-Telmetry-service-with-EventService.patch @@ -1,4 +1,4 @@ -From 77e8a0b5037a555b1520823b667595ac8780c675 Mon Sep 17 00:00:00 2001 +From 541353a4e4b06de42b6a9a400629f5a5fba04e86 Mon Sep 17 00:00:00 2001 From: "Wludzik, Jozef" <jozef.wludzik@intel.com> Date: Tue, 15 Dec 2020 12:30:31 +0100 Subject: [PATCH] Sync Telmetry service with EventService @@ -16,13 +16,14 @@ Tested: Change-Id: I2fc1841a6c9259a8bff30b34bddc0d4aabd41912 Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com> +Signed-off-by: Lukasz Kazmierczak <lukasz.kazmierczak@intel.com> --- .../include/event_service_manager.hpp | 156 ++++++------------ redfish-core/lib/metric_report.hpp | 28 ++-- 2 files changed, 69 insertions(+), 115 deletions(-) diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index d89b789..4faaddd 100644 +index 3f398d7..cf9f658 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -14,6 +14,7 @@ @@ -212,12 +213,12 @@ index d89b789..4faaddd 100644 + }); + if (found == props.end()) + { -+ BMCWEB_LOG_ERROR ++ BMCWEB_LOG_INFO + << "Failed to get Readings from Report properties"; + return; + } + -+ std::variant<telemetry::TimestampReadings>& readings = ++ const std::variant<telemetry::TimestampReadings>& readings = + found->second; + for (const auto& it : + EventServiceManager::getInstance().subscriptionsMap) diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Switched-bmcweb-to-use-new-telemetry-service-API.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Switched-bmcweb-to-use-new-telemetry-service-API.patch index 20bcbabfa..5dd2f51bc 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Switched-bmcweb-to-use-new-telemetry-service-API.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Switched-bmcweb-to-use-new-telemetry-service-API.patch @@ -1,4 +1,4 @@ -From fca6f5b951a363916a83a25f6578f95a6cf32a3e Mon Sep 17 00:00:00 2001 +From 8ba1bcc3503cafb33b1a06356d4f8f92ae23e39a Mon Sep 17 00:00:00 2001 From: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Date: Thu, 17 Jun 2021 13:37:57 +0000 Subject: [PATCH] Switched bmcweb to use new telemetry service API diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-MetricDefinition-property-in-MetricReport.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-MetricDefinition-property-in-MetricReport.patch index 3d60ae293..bf5a09d9d 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-MetricDefinition-property-in-MetricReport.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-MetricDefinition-property-in-MetricReport.patch @@ -1,6 +1,6 @@ -From 79b3d35b864a2b545b4c9b2ac9390ea5dec169f5 Mon Sep 17 00:00:00 2001 -From: Szymon Dompke <szymon.dompke@intel.com> -Date: Mon, 28 Jun 2021 11:10:23 +0200 +From dab3c96f9e39a89d7c359e22655650c7c16952ec Mon Sep 17 00:00:00 2001 +From: Krzysztof Grobelny <krzysztof.grobelny@intel.com> +Date: Tue, 12 Oct 2021 08:06:13 +0000 Subject: [PATCH] Add support for MetricDefinition property in MetricReport Added MetricDefinition as part of MetricValues array returned by @@ -73,19 +73,19 @@ Signed-off-by: Szymon Dompke <szymon.dompke@intel.com> 4 files changed, 95 insertions(+), 15 deletions(-) diff --git a/meson.build b/meson.build -index f6a66f1..6b5d9af 100644 +index 6b6a8ab..218ea49 100644 --- a/meson.build +++ b/meson.build -@@ -355,6 +355,8 @@ srcfiles_unittest = ['include/ut/dbus_utility_test.cpp', - 'redfish-core/ut/time_utils_test.cpp', - 'http/ut/utility_test.cpp'] +@@ -377,6 +377,8 @@ srcfiles_unittest = [ + 'http/ut/utility_test.cpp' + ] -+srcfiles_unittest_dependencies = ['redfish-core/src/error_messages.cpp'] ++srcfiles_unittest_dependencies = ['redfish-core/src/error_messages.cpp', 'src/boost_url.cpp'] + # Gather the Configuration data conf_data = configuration_data() -@@ -412,7 +414,7 @@ executable('bmcweb',srcfiles_bmcweb, +@@ -434,7 +436,7 @@ executable('bmcweb',srcfiles_bmcweb, if(get_option('tests').enabled()) foreach src_test : srcfiles_unittest testname = src_test.split('/')[-1].split('.')[0] @@ -251,7 +251,7 @@ index 7fe281d..13bf792 100644 } } // namespace telemetry diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp -index cb7ea15..44c2129 100644 +index 7405e5a..9850b24 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -21,6 +21,8 @@ @@ -265,3 +265,4 @@ index cb7ea15..44c2129 100644 -- 2.25.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0006-Revert-Remove-LogService-from-TelemetryService.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0006-Revert-Remove-LogService-from-TelemetryService.patch index 987a43b4c..a80ac61c7 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0006-Revert-Remove-LogService-from-TelemetryService.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0006-Revert-Remove-LogService-from-TelemetryService.patch @@ -1,6 +1,6 @@ -From 472ac5f15a19917042852b243e8b668b3ab49e32 Mon Sep 17 00:00:00 2001 +From da575aaf0bdcb15be261d58314cf7bbbcd92dd74 Mon Sep 17 00:00:00 2001 From: Krzysztof Grobelny <krzysztof.grobelny@intel.com> -Date: Tue, 22 Jun 2021 13:59:48 +0000 +Date: Tue, 12 Oct 2021 08:08:06 +0000 Subject: [PATCH] Revert "Remove LogService from TelemetryService" This reverts commit 2b3da45876aac57a36d3093379a992d699e7e396. @@ -9,18 +9,18 @@ This reverts commit 2b3da45876aac57a36d3093379a992d699e7e396. 1 file changed, 2 insertions(+) diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp -index 37221c3..f3a1efb 100644 +index 027b51b..49471fe 100644 --- a/redfish-core/lib/telemetry_service.hpp +++ b/redfish-core/lib/telemetry_service.hpp -@@ -30,6 +30,8 @@ inline void requestRoutesTelemetryService(App& app) - "/redfish/v1/TelemetryService/MetricReports"; - asyncResp->res.jsonValue["MetricDefinitions"]["@odata.id"] = - "/redfish/v1/TelemetryService/MetricDefinitions"; -+ asyncResp->res.jsonValue["LogService"]["@odata.id"] = -+ "/redfish/v1/Managers/bmc/LogServices/Journal"; +@@ -24,6 +24,8 @@ inline void handleTelemetryServiceGet( + "/redfish/v1/TelemetryService/MetricReports"; + asyncResp->res.jsonValue["MetricDefinitions"]["@odata.id"] = + "/redfish/v1/TelemetryService/MetricDefinitions"; ++ asyncResp->res.jsonValue["LogService"]["@odata.id"] = ++ "/redfish/v1/Managers/bmc/LogServices/Journal"; - crow::connections::systemBus->async_method_call( - [asyncResp]( + crow::connections::systemBus->async_method_call( + [asyncResp](const boost::system::error_code ec, -- 2.25.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0008-Generalize-ReadingType-in-MetricDefinition.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0008-Generalize-ReadingType-in-MetricDefinition.patch deleted file mode 100644 index bd6e64346..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0008-Generalize-ReadingType-in-MetricDefinition.patch +++ /dev/null @@ -1,93 +0,0 @@ -From d9baec3ccdff5ed4d1620f374a252c769de5b45b Mon Sep 17 00:00:00 2001 -From: Krzysztof Grobelny <krzysztof.grobelny@intel.com> -Date: Thu, 19 Aug 2021 10:55:38 +0000 -Subject: [PATCH] Generalize ReadingType in MetricDefinition - -Recent addition of PMT required adding new type of sensor 'count', which -doesnt comply with any of Redfish-defined Sensor.ReadingType values. - -To support property of this kind MetricDefinition implementation was -altered to support sensor types not covered by Redfish types by -a 'fallback' to direct usage of sensor type. Populating 'Units' was also -modified, so it won't be shown if value does not have any units mapped. - -Testing: -- PMT counters are shown properly in MetricDefinitions/Count -- Redfish Validator passes ---- - redfish-core/lib/metric_definition.hpp | 25 ++++++++++++++++++------- - 1 file changed, 18 insertions(+), 7 deletions(-) - -diff --git a/redfish-core/lib/metric_definition.hpp b/redfish-core/lib/metric_definition.hpp -index 019168b..df29b65 100644 ---- a/redfish-core/lib/metric_definition.hpp -+++ b/redfish-core/lib/metric_definition.hpp -@@ -33,6 +33,18 @@ bool containsOdata(const nlohmann::json& json, const std::string& odataId) - return it != json.end(); - } - -+std::string groupName(const std::string& sensorType) -+{ -+ std::string group = sensors::toReadingType(sensorType); -+ if (group.empty()) -+ { -+ // Fallback for types not covered by standard Redfish Sensor.ReadingType -+ group = sensorType; -+ group[0] = static_cast<char>(std::toupper(group[0])); -+ } -+ return group; -+} -+ - void addMembers(crow::Response& res, - const boost::container::flat_map<std::string, std::string>& el) - { -@@ -52,8 +64,7 @@ void addMembers(crow::Response& res, - nlohmann::json& members = res.jsonValue["Members"]; - - const std::string odataId = -- std::string(telemetry::metricDefinitionUri) + -- sensors::toReadingType(type); -+ std::string(telemetry::metricDefinitionUri) + groupName(type); - - if (!containsOdata(members, odataId)) - { -@@ -149,15 +160,15 @@ inline void requestRoutesMetricDefinitionCollection(App& app) - namespace telemetry - { - --bool isSensorIdSupported(std::string_view readingType) -+bool isSensorIdSupported(std::string_view group) - { - for (const std::pair<std::string_view, std::vector<const char*>>& - typeToPaths : sensors::dbus::paths) - { - for (const char* supportedPath : typeToPaths.second) - { -- if (readingType == -- sensors::toReadingType( -+ if (group == -+ groupName( - sdbusplus::message::object_path(supportedPath).filename())) - { - return true; -@@ -168,7 +179,7 @@ bool isSensorIdSupported(std::string_view readingType) - } - - void addMetricProperty( -- bmcweb::AsyncResp& asyncResp, const std::string& readingType, -+ bmcweb::AsyncResp& asyncResp, const std::string& group, - const boost::container::flat_map<std::string, std::string>& el) - { - nlohmann::json& metricProperties = -@@ -179,7 +190,7 @@ void addMetricProperty( - std::string sensorId; - if (dbus::utility::getNthStringFromPath(dbusSensor, 3, sensorId)) - { -- if (sensors::toReadingType(sensorId) == readingType) -+ if (groupName(sensorId) == group) - { - metricProperties.push_back(redfishSensor); - } --- -2.25.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README index fd88e9e18..90916ecec 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README @@ -3,16 +3,16 @@ Until change is integrated they will be manually merged here to enable feature i Current revisions: - Add support for MetricDefinition scheme - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/33363/93 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/33363/102 - Sync Telmetry service with EventService - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38798/40 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38798/53 - Switched bmcweb to use new telemetry service API - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/44270/5 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/44270/19 - Add support for MetricDefinition property in MetricReport - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/44512/9 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/44512/24 - Add GET method for TriggerCollection file://telemetry/0005-Add-GET-method-for-TriggerCollection.patch diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch index d41383836..de316c4fa 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch @@ -1,4 +1,4 @@ -From 3ee7fe58b2acec0a6ae4eabad91a9dd609268870 Mon Sep 17 00:00:00 2001 +From b6863f9a0c1c36705eba0c3181541f67cd1a202a Mon Sep 17 00:00:00 2001 From: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Date: Wed, 14 Jul 2021 09:04:42 +0000 Subject: [PATCH] Revert "Disable nbd proxy from the build" @@ -15,21 +15,21 @@ Change-Id: I19a88b30c1074dd376f2df8f5668245b638b881f 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/meson.build b/meson.build -index bdc514b..19364a8 100644 +index 650a5ec..5738b10 100644 --- a/meson.build +++ b/meson.build -@@ -78,7 +78,8 @@ feature_map = { - 'rest' : '-DBMCWEB_ENABLE_DBUS_REST', - 'static-hosting' : '-DBMCWEB_ENABLE_STATIC_HOSTING', - 'insecure-tftp-update' : '-DBMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE', --#'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY', -+'validate-unsecure-feature' : '-DBMCWEB_ENABLE_VALIDATION_UNSECURE_FEATURE', -+'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY', - 'vm-websocket' : '-DBMCWEB_ENABLE_VM_WEBSOCKET', +@@ -83,7 +83,8 @@ feature_map = { + 'rest' : '-DBMCWEB_ENABLE_DBUS_REST', + 'static-hosting' : '-DBMCWEB_ENABLE_STATIC_HOSTING', + 'insecure-tftp-update' : '-DBMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE', +- #'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY', ++ 'validate-unsecure-feature' : '-DBMCWEB_ENABLE_VALIDATION_UNSECURE_FEATURE', ++ 'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY', + 'vm-websocket' : '-DBMCWEB_ENABLE_VM_WEBSOCKET', } diff --git a/meson_options.txt b/meson_options.txt -index 0ab31b8..ea0f2fc 100644 +index ff5b887..645f224 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -3,14 +3,7 @@ option('yocto-deps', type: 'feature', value: 'disabled', description : 'Use YOCT @@ -48,7 +48,7 @@ index 0ab31b8..ea0f2fc 100644 option('rest', type : 'feature', value : 'enabled', description : '''Enable Phosphor REST (D-Bus) APIs. Paths directly map Phosphor D-Bus object paths, for example, \'/xyz/openbmc_project/logging/entry/enumerate\'. See https://github.com/openbmc/docs/blob/master/rest-api.md.''') option('redfish', type : 'feature',value : 'enabled', description: 'Enable Redfish APIs. Paths are under \'/redfish/v1/\'. See https://github.com/openbmc/bmcweb/blob/master/DEVELOPING.md#redfish.') option('host-serial-socket', type : 'feature', value : 'enabled', description : 'Enable host serial console WebSocket. Path is \'/console0\'. See https://github.com/openbmc/docs/blob/master/console.md.') -@@ -37,6 +30,7 @@ option ('https_port', type : 'integer', min : 1, max : 65535, value : 443, descr +@@ -39,6 +32,7 @@ option ('https_port', type : 'integer', min : 1, max : 65535, value : 443, descr # the implications of doing so.In general, enabling these options will cause security # problems of varying degrees @@ -57,5 +57,5 @@ index 0ab31b8..ea0f2fc 100644 option ('insecure-disable-ssl', type : 'feature', value : 'disabled', description : 'Disable SSL ports. Should be set to false for production systems.') option ('insecure-disable-auth', type : 'feature', value : 'disabled', description : 'Disable authentication on all ports. Should be set to false for production systems') -- -2.25.1 +2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch index 41c1c9836..c8af3a659 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch @@ -1,4 +1,4 @@ -From d303bfdd6778c43096401ff78fab70f9041cd4cf Mon Sep 17 00:00:00 2001 +From 1abf9a1d336eed835472fe933210d3be7ad5ba7a Mon Sep 17 00:00:00 2001 From: Karol Wachowski <karol.wachowski@intel.com> Date: Thu, 11 Feb 2021 08:35:41 +0000 Subject: [PATCH] Add ConnectedVia property to virtual media item template @@ -12,12 +12,12 @@ Signed-off-by: Karol Wachowski <karol.wachowski@intel.com> 1 file changed, 1 insertion(+) diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index c45fed2..aa7c639 100644 +index 57c2bd2..de1cc94 100644 --- a/redfish-core/lib/virtual_media.hpp +++ b/redfish-core/lib/virtual_media.hpp -@@ -193,6 +193,7 @@ static nlohmann::json vmItemTemplate(const std::string& name, - item["@odata.id"] = - "/redfish/v1/Managers/" + name + "/VirtualMedia/" + resName; +@@ -200,6 +200,7 @@ inline nlohmann::json vmItemTemplate(const std::string& name, + item["@odata.id"] = std::move(id); + item["@odata.type"] = "#VirtualMedia.v1_3_0.VirtualMedia"; + item["ConnectedVia"] = "NotConnected"; item["Name"] = "Virtual Removable Media"; diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend index 7806b5481..a716e612d 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend @@ -1,8 +1,7 @@ SRC_URI = "git://github.com/openbmc/bmcweb.git" -SRCREV = "abb93cdd0a49be03bf2fe95f07823686b289ecd5" +SRCREV = "b7ff344535c42af074c60bfb272ef66a2ba157b4" DEPENDS += "boost-url" -RDEPENDS:${PN} += "phosphor-nslcd-authority-cert-config" FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" @@ -25,9 +24,9 @@ SRC_URI += "file://0001-Firmware-update-configuration-changes.patch \ file://0018-bmcweb-Add-BMC-Time-update-log-to-the-registry.patch \ file://0019-Add-generic-message-PropertySizeExceeded.patch \ file://0020-Redfish-Deny-set-AccountLockDuration-to-zero.patch \ - file://0021-Add-message-registry-entry-for-FirmwareResiliencyErr.patch \ file://0023-Add-get-IPMI-session-id-s-to-Redfish.patch \ file://0024-Add-count-sensor-type.patch \ + file://0025-Add-Model-CoreCount-to-ProcessorSummary.patch \ " # OOB Bios Config: @@ -50,7 +49,7 @@ SRC_URI += "file://vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch \ " # EventService: Temporary pulled to downstream. See eventservice\README for details -SRC_URI += "file://eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch \ +SRC_URI += "file://eventservice/0001-Add-unmerged-changes-for-http-retry-support.patch \ file://eventservice/0002-EventService-https-client-support.patch \ file://eventservice/0004-Add-Server-Sent-Events-support.patch \ file://eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch \ @@ -59,6 +58,7 @@ SRC_URI += "file://eventservice/0001-EventService-Fix-retry-handling-for-http-cl file://eventservice/0008-Add-checks-on-Event-Subscription-input-parameters.patch \ file://eventservice/0009-Restructure-Redifsh-EventLog-Transmit-code-flow.patch \ file://eventservice/0010-Remove-Terminated-Event-Subscriptions.patch \ + file://eventservice/0011-Fix-bmcweb-crash-while-deleting-terminated-subscriptions.patch \ " # Temporary downstream mirror of upstream patches, see telemetry\README for details @@ -69,20 +69,23 @@ SRC_URI += " file://telemetry/0001-Add-support-for-MetricDefinition-scheme.patch file://telemetry/0005-Add-GET-method-for-TriggerCollection.patch \ file://telemetry/0006-Revert-Remove-LogService-from-TelemetryService.patch \ file://telemetry/0007-event-service-fix-added-Context-field-to-response.patch \ - file://telemetry/0008-Generalize-ReadingType-in-MetricDefinition.patch \ file://telemetry/0009-Add-support-for-deleting-terminated-subscriptions.patch \ " +# Temporary downstream patch for routing and privilege changes +SRC_URI += " file://http_routing/0001-Add-asyncResp-support-during-handleUpgrade.patch \ + file://http_routing/0002-Move-privileges-to-separate-entity.patch \ + file://http_routing/0003-Add-Support-for-privilege-check-in-handleUpgrade.patch \ + file://http_routing/0004-Add-Privileges-to-Websockets.patch \ + file://http_routing/0005-Add-Privileges-to-SseSockets.patch \ +" + # Temporary fix: Move it to service file do_install:append() { install -d ${D}/var/lib/bmcweb install -d ${D}/etc/ssl/certs/authority } -# Temporary fix:Enable new power and thermal subsystem -EXTRA_OEMESON += " -Dredfish-new-powersubsystem-thermalsubsystem=enabled" -EXTRA_OEMESON += " -Dredfish-allow-deprecated-power-thermal=disabled" - # Enable PFR support EXTRA_OEMESON += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', '-Dredfish-provisioning-feature=enabled', '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend index fd45b0e1c..87aab6f79 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend @@ -1,6 +1,9 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" PROJECT_SRC_DIR := "${THISDIR}/${PN}" +#SRC_URI += "git://github.com/openbmc/phosphor-host-ipmid" +SRCREV = "78fe1b14f60d55ae335369fb2c6e81ed9ac6d865" + SRC_URI += "file://phosphor-ipmi-host.service \ file://0010-fix-get-system-GUID-ipmi-command.patch \ file://0053-Fix-keep-looping-issue-when-entering-OS.patch \ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend index 1ddd13477..caf25fdd6 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend @@ -1,5 +1,5 @@ SRC_URI = "git://github.com/openbmc/ipmbbridge.git" -SRCREV = "bd78df6be9f677136ca190d50101c328267ddcd2" +SRCREV = "8227626764edf13350c5f5a5857298a905fb43f7" FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" SRC_URI += "file://0001-Add-dbus-method-SlotIpmbRequest.patch \ file://0002-Add-log-count-limitation-to-requestAdd.patch \ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend index 08b96ad71..fd1677543 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend @@ -11,7 +11,7 @@ SMM_DEVICE = "ipmi_kcs4" SYSTEMD_SERVICE:${PN}:append = " ${PN}@${SMM_DEVICE}.service " SRC_URI = "git://github.com/openbmc/kcsbridge.git" -SRCREV = "03e6defcbca99c9c00cd37c4afb1d2b415a92acd" +SRCREV = "7580a8e60d868b5bcb1a8f8d276374afe7c0983a" SRC_URI += "file://99-ipmi-kcs.rules" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend index bde839859..a0b507cb8 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend @@ -3,7 +3,7 @@ inherit useradd # TODO: This should be removed, once up-stream bump up # issue is resolved SRC_URI += "git://github.com/openbmc/phosphor-net-ipmid" -SRCREV = "1c5b3ab05817d62a11f75c2a90b6891b18bf62cc" +SRCREV = "5819666c23ee1d01a54fc5fb2c068bb1da1f29c7" USERADD_PACKAGES = "${PN}" # add a group called ipmi diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb index 3be0d30b4..14093cf3e 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb @@ -3,7 +3,7 @@ DESCRIPTION = "The Node Manager Proxy provides a simple interface for communicat with Management Engine via IPMB" SRC_URI = "git://github.com/Intel-BMC/node-manager;protocol=ssh" -SRCREV = "928d0994c7d8c1cc20dc69b763ecd62dcf8ab276" +SRCREV = "9aca80fa2a405938de99aae777e6cfcf08525563" PV = "0.1+git${SRCPV}" LICENSE = "Apache-2.0" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/network/phosphor-snmp_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/network/phosphor-snmp_%.bbappend new file mode 100644 index 000000000..6d9294635 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/network/phosphor-snmp_%.bbappend @@ -0,0 +1,4 @@ +FILESEXTRAPATHS:append := ":${THISDIR}/${PN}" + +# SRC_URI = "git://github.com/openbmc/phosphor-snmp" +SRCREV = "d560529eb7e22c0b78fb0def20f57c6f35be9dfe" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/peci/peci-pcie_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/peci/peci-pcie_%.bbappend index 119cd9657..e7c5d1af3 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/peci/peci-pcie_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/peci/peci-pcie_%.bbappend @@ -1,5 +1,5 @@ SRC_URI = "git://github.com/openbmc/peci-pcie" -SRCREV = "8e96603605eebd574bb00cd35e7fa118071aeeae" +SRCREV = "de624395a587be555463a14a3db90500b4e0521c" EXTRA_OECMAKE += "-DWAIT_FOR_OS_STANDBY=1 -DUSE_RDENDPOINTCFG=1" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb index 770870f1e..592d6ae0c 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb @@ -2,7 +2,7 @@ SUMMARY = "libmctp:intel" DESCRIPTION = "Implementation of MCTP(DMTF DSP0236)" SRC_URI = "git://github.com/Intel-BMC/libmctp.git;protocol=ssh" -SRCREV = "52117fa04e6afabe8eb1285c702f1400fecfb992" +SRCREV = "d530c2271e1f9ff5d76a170c0abd64bd03ef40fd" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb index 3e2bfc603..162b4ed74 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb @@ -2,7 +2,7 @@ SUMMARY = "libpldm_intel" DESCRIPTION = "Provides encode/decode APIs for PLDM specifications" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "c76742e725d7a1ebbee8a2d95168da8a53f0b2e1" +SRCREV = "94437a678a1d23b22dc179b5cb7b165e52a429c0" S = "${WORKDIR}/git/libpldm_intel" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb index 128f6b544..fda4d6b79 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=bcd9ada3a943f58551867d72893cc9ab" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "c76742e725d7a1ebbee8a2d95168da8a53f0b2e1" +SRCREV = "94437a678a1d23b22dc179b5cb7b165e52a429c0" S = "${WORKDIR}/git/mctp_emulator" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb index 10dd1cf29..05e64ed46 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=bcd9ada3a943f58551867d72893cc9ab" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "c76742e725d7a1ebbee8a2d95168da8a53f0b2e1" +SRCREV = "94437a678a1d23b22dc179b5cb7b165e52a429c0" S = "${WORKDIR}/git/mctp_wrapper" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb index 4ab99cae9..8b088be23 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://${PN}/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "c76742e725d7a1ebbee8a2d95168da8a53f0b2e1" +SRCREV = "94437a678a1d23b22dc179b5cb7b165e52a429c0" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb index 87ac63624..b1c40ab61 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=615045c30a05cde5c0e924854d43c327" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "c76742e725d7a1ebbee8a2d95168da8a53f0b2e1" +SRCREV = "94437a678a1d23b22dc179b5cb7b165e52a429c0" S = "${WORKDIR}/git/mctpwplus" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/nvmemi-daemon.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/nvmemi-daemon.bb index 351d584d1..84c2c8066 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/nvmemi-daemon.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/nvmemi-daemon.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" SRC_URI = "git://github.com/Intel-BMC/nvme-mi.git;protocol=ssh" -SRCREV = "29b49789236b89910af816e4606aab4126a56a4b" +SRCREV = "c3d5021fb60cd46d5c948c69f3d57ac9648b5be5" S = "${WORKDIR}/git" PV = "1.0+git${SRCPV}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb index 091865b39..16253b5d0 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" SRC_URI += "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "c76742e725d7a1ebbee8a2d95168da8a53f0b2e1" +SRCREV = "94437a678a1d23b22dc179b5cb7b165e52a429c0" S = "${WORKDIR}/git/pldmd" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb index dc4c03ae8..c640c5664 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "c76742e725d7a1ebbee8a2d95168da8a53f0b2e1" +SRCREV = "94437a678a1d23b22dc179b5cb7b165e52a429c0" S = "${WORKDIR}/git/pmci_launcher" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/prov-mode-mgr/prov-mode-mgr_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/prov-mode-mgr/prov-mode-mgr_git.bb index a7df530cd..79971942a 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/prov-mode-mgr/prov-mode-mgr_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/prov-mode-mgr/prov-mode-mgr_git.bb @@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/provisioning-mode-manager.git;protocol=ssh" -SRCREV = "ea03e4e87f5d5f0d873624b46ebc3deabb8d6ebe" +SRCREV = "0aca01b4ce9b303e12ba0f757f56390da139c8bb" inherit cmake systemd SYSTEMD_SERVICE:${PN} = "xyz.openbmc_project.RestrictionMode.Manager.service" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend index 1fcbd958e..8c2eeb83f 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sel-logger/phosphor-sel-logger_%.bbappend @@ -1,4 +1,4 @@ # Enable downstream autobump SRC_URI = "git://github.com/openbmc/phosphor-sel-logger.git" -SRCREV = "a138ebd3c759f95c53d61170c05e69bf31718114" +SRCREV = "87e3fcf439f2b943272365e1d294984f39bb52b8" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0004-Fan-Tach-Sensor-Threshold-Ignore-Zero.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0004-Fan-Tach-Sensor-Threshold-Ignore-Zero.patch index 65558aba5..214fbe888 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0004-Fan-Tach-Sensor-Threshold-Ignore-Zero.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0004-Fan-Tach-Sensor-Threshold-Ignore-Zero.patch @@ -1,4 +1,4 @@ -From 8f850ea8745aa7aafcb504aa50686ba00fdfcfee Mon Sep 17 00:00:00 2001 +From 221aaf1431a01fefb5e7df2461a1c691738a50a7 Mon Sep 17 00:00:00 2001 From: Zhikui Ren <zhikui.ren@intel.com> Date: Fri, 19 Feb 2021 12:14:05 -0800 Subject: [PATCH] Fan Tach Sensor Threshold Ignore Zero @@ -22,22 +22,18 @@ No cr event for the missing fans. Signed-off-by: Zhikui Ren <zhikui.ren@intel.com> --- - src/TachSensor.cpp | 16 +++++++++++----- - 1 file changed, 11 insertions(+), 5 deletions(-) + src/TachSensor.cpp | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/TachSensor.cpp b/src/TachSensor.cpp -index 1ec979f..b17be98 100644 +index c375dbf..e85a2a2 100644 --- a/src/TachSensor.cpp +++ b/src/TachSensor.cpp -@@ -185,12 +185,18 @@ void TachSensor::handleResponse(const boost::system::error_code& err) +@@ -186,10 +186,16 @@ void TachSensor::checkThresholds(void) + // WA - treat value <= 0 as not present + bool status = false; - void TachSensor::checkThresholds(void) - { -- bool status = thresholds::checkThresholds(this); -- - if (redundancy && *redundancy) -+ // WA - treat value <= 0 as not present -+ bool status = false; + if (value > 0) { - (*redundancy) diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0006-CPUSensor-create-RequirediTempSensor-if-defined.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0006-CPUSensor-create-RequirediTempSensor-if-defined.patch index 0a6e73708..2083adfef 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0006-CPUSensor-create-RequirediTempSensor-if-defined.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0006-CPUSensor-create-RequirediTempSensor-if-defined.patch @@ -1,4 +1,4 @@ -From ba069b63307352ae0dc0a94a837306dc0bc51e94 Mon Sep 17 00:00:00 2001 +From 6ace96be5a7b6763545c1dfc572f8e2790d99d4b Mon Sep 17 00:00:00 2001 From: Zhikui Ren <zhikui.ren@intel.com> Date: Tue, 11 May 2021 11:14:55 -0700 Subject: [PATCH] CPUSensor: create RequiredTempSensor if defined @@ -23,12 +23,12 @@ failure case. More work will follow to support a more generic Signed-off-by: Zhikui Ren <zhikui.ren@intel.com> --- include/CPUSensor.hpp | 9 ++++++ - src/CPUSensor.cpp | 69 +++++++++++++++++++++++++++++++++++++++++++ - src/CPUSensorMain.cpp | 54 ++++++++++++++++++++++++++++----- - 3 files changed, 124 insertions(+), 8 deletions(-) + src/CPUSensor.cpp | 68 +++++++++++++++++++++++++++++++++++++++++++ + src/CPUSensorMain.cpp | 54 +++++++++++++++++++++++++++++----- + 3 files changed, 123 insertions(+), 8 deletions(-) diff --git a/include/CPUSensor.hpp b/include/CPUSensor.hpp -index 29b8209..5d09e4e 100644 +index 8b51b76..93b7fcc 100644 --- a/include/CPUSensor.hpp +++ b/include/CPUSensor.hpp @@ -26,6 +26,15 @@ class CPUSensor : public Sensor @@ -48,10 +48,10 @@ index 29b8209..5d09e4e 100644 static constexpr unsigned int sensorScaleFactor = 1000; static constexpr unsigned int sensorPollMs = 1000; diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp -index c882698..277dd3f 100644 +index c330088..3861ade 100644 --- a/src/CPUSensor.cpp +++ b/src/CPUSensor.cpp -@@ -99,6 +99,75 @@ CPUSensor::CPUSensor(const std::string& path, const std::string& objectType, +@@ -98,6 +98,74 @@ CPUSensor::CPUSensor(const std::string& path, const std::string& objectType, setupRead(); } @@ -64,9 +64,8 @@ index c882698..277dd3f 100644 + boost::asio::io_service& io, const std::string& sensorName, + std::vector<thresholds::Threshold>&& thresholdsIn, + const std::string& sensorConfiguration) : -+ Sensor(boost::replace_all_copy(sensorName, " ", "_"), -+ std::move(thresholdsIn), sensorConfiguration, objectType, false, 0, -+ 0, conn, PowerState::on), ++ Sensor(escapeName(sensorName), std::move(thresholdsIn), sensorConfiguration, ++ objectType, false, false, 0, 0, conn, PowerState::on), + objServer(objectServer), inputDev(io), waitTimer(io), + privTcontrol(std::numeric_limits<double>::quiet_NaN()), dtsOffset(0), + show(true), pollTime(CPUSensor::sensorPollMs), minMaxReadCounter(0) @@ -128,10 +127,10 @@ index c882698..277dd3f 100644 { // close the input dev to cancel async operations diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp -index c565890..a28a5be 100644 +index 0d94e4b..1d12fa6 100644 --- a/src/CPUSensorMain.cpp +++ b/src/CPUSensorMain.cpp -@@ -333,10 +333,9 @@ bool createSensors(boost::asio::io_service& io, +@@ -332,10 +332,9 @@ bool createSensors(boost::asio::io_service& io, { if (debug) { @@ -144,7 +143,7 @@ index c565890..a28a5be 100644 } // check hidden properties -@@ -637,9 +636,9 @@ void detectCpuAsync( +@@ -636,9 +635,9 @@ void detectCpuAsync( }); } @@ -156,7 +155,7 @@ index c565890..a28a5be 100644 sdbusplus::asio::object_server& objectServer) { bool useCache = false; -@@ -701,6 +700,45 @@ bool getCpuConfig(const std::shared_ptr<sdbusplus::asio::connection>& systemBus, +@@ -700,6 +699,45 @@ bool getCpuConfig(const std::shared_ptr<sdbusplus::asio::connection>& systemBus, iface->register_property("Present", *present); iface->initialize(); inventoryIfaces[name] = std::move(iface); @@ -202,7 +201,7 @@ index c565890..a28a5be 100644 } auto findBus = config.second.find("Bus"); -@@ -729,7 +767,6 @@ bool getCpuConfig(const std::shared_ptr<sdbusplus::asio::connection>& systemBus, +@@ -728,7 +766,6 @@ bool getCpuConfig(const std::shared_ptr<sdbusplus::asio::connection>& systemBus, std::cout << "name: " << name << "\n"; std::cout << "type: " << type << "\n"; } @@ -210,7 +209,7 @@ index c565890..a28a5be 100644 cpuConfigs.emplace(bus, addr, name, State::OFF); } } -@@ -765,7 +802,8 @@ int main() +@@ -764,7 +801,8 @@ int main() return; // we're being canceled } @@ -220,7 +219,7 @@ index c565890..a28a5be 100644 { detectCpuAsync(pingTimer, creationTimer, io, objectServer, systemBus, cpuConfigs, sensorConfigs); -@@ -793,7 +831,7 @@ int main() +@@ -792,7 +830,7 @@ int main() return; // we're being canceled } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0007-Add-support-for-the-energy-hwmon-type.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0007-Add-support-for-the-energy-hwmon-type.patch index dbe851fde..daaca7fae 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0007-Add-support-for-the-energy-hwmon-type.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0007-Add-support-for-the-energy-hwmon-type.patch @@ -1,4 +1,4 @@ -From b839028a4dda6fcec027f3a26887e0de0e8172bb Mon Sep 17 00:00:00 2001 +From 9f5ef2e8d9c34d9d9ddce34d450aaedd5c122b22 Mon Sep 17 00:00:00 2001 From: Szymon Dompke <szymon.dompke@intel.com> Date: Tue, 18 May 2021 05:22:33 +0200 Subject: [PATCH] Add support for the energy hwmon type @@ -31,13 +31,13 @@ Tested: Authored-by: Zbigniew Kurzynski <zbigniew.kurzynski@intel.com> Signed-off-by: Szymon Dompke <szymon.dompke@intel.com> --- - include/CPUSensor.hpp | 13 ++++++-- - src/CPUSensor.cpp | 69 +++++++++++++++---------------------------- + include/CPUSensor.hpp | 13 +++++++-- + src/CPUSensor.cpp | 68 +++++++++++++++---------------------------- src/CPUSensorMain.cpp | 30 ++++++++++++++++--- - 3 files changed, 60 insertions(+), 52 deletions(-) + 3 files changed, 60 insertions(+), 51 deletions(-) diff --git a/include/CPUSensor.hpp b/include/CPUSensor.hpp -index 5d09e4e..cb3742a 100644 +index 93b7fcc..76e43dc 100644 --- a/include/CPUSensor.hpp +++ b/include/CPUSensor.hpp @@ -16,6 +16,15 @@ @@ -82,21 +82,20 @@ index 5d09e4e..cb3742a 100644 void handleResponse(const boost::system::error_code& err); void checkThresholds(void) override; diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp -index 277dd3f..0621e04 100644 +index 3861ade..6737151 100644 --- a/src/CPUSensor.cpp +++ b/src/CPUSensor.cpp -@@ -39,59 +39,37 @@ CPUSensor::CPUSensor(const std::string& path, const std::string& objectType, +@@ -39,58 +39,37 @@ CPUSensor::CPUSensor(const std::string& path, const std::string& objectType, boost::asio::io_service& io, const std::string& sensorName, std::vector<thresholds::Threshold>&& thresholdsIn, const std::string& sensorConfiguration, int cpuId, - bool show, double dtsOffset) : + bool show, double dtsOffset, + const SensorProperties& sensorProperties) : - Sensor(boost::replace_all_copy(sensorName, " ", "_"), -- std::move(thresholdsIn), sensorConfiguration, objectType, false, 0, -- 0, conn, PowerState::on), -+ std::move(thresholdsIn), sensorConfiguration, objectType, false, -+ sensorProperties.max, sensorProperties.min, conn, PowerState::on), + Sensor(escapeName(sensorName), std::move(thresholdsIn), sensorConfiguration, +- objectType, false, false, 0, 0, conn, PowerState::on), ++ objectType, false, false, sensorProperties.max, sensorProperties.min, ++ conn, PowerState::on), objServer(objectServer), inputDev(io), waitTimer(io), path(path), privTcontrol(std::numeric_limits<double>::quiet_NaN()), dtsOffset(dtsOffset), show(show), pollTime(CPUSensor::sensorPollMs), @@ -152,12 +151,12 @@ index 277dd3f..0621e04 100644 - setInitialProperties(conn, units); + thresholdInterfaceWarning = objectServer.add_interface( + interfacePath, "xyz.openbmc_project.Sensor.Threshold.Warning"); -+ } + } + if (thresholds::hasCriticalInterface(thresholds)) + { + thresholdInterfaceCritical = objectServer.add_interface( + interfacePath, "xyz.openbmc_project.Sensor.Threshold.Critical"); - } ++ } + association = + objectServer.add_interface(interfacePath, association::interface); + @@ -165,7 +164,7 @@ index 277dd3f..0621e04 100644 } // call setup always as not all sensors call setInitialProperties -@@ -248,7 +226,7 @@ void CPUSensor::updateMinMaxValues(void) +@@ -248,7 +227,7 @@ void CPUSensor::updateMinMaxValues(void) auto& [suffix, oldValue, dbusName, newValue] = vectorItem; auto attrPath = boost::replace_all_copy(path, fileItem, suffix); @@ -174,7 +173,7 @@ index 277dd3f..0621e04 100644 { newValue.get() = *tmp; } -@@ -302,7 +280,7 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) +@@ -302,7 +281,7 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) std::getline(responseStream, response); rawValue = std::stod(response); responseStream.clear(); @@ -183,7 +182,7 @@ index 277dd3f..0621e04 100644 if (show) { -@@ -328,8 +306,7 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) +@@ -328,8 +307,7 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) { std::vector<thresholds::Threshold> newThresholds; if (parseThresholdsFromAttr(newThresholds, path, @@ -194,12 +193,12 @@ index 277dd3f..0621e04 100644 if (!std::equal(thresholds.begin(), thresholds.end(), newThresholds.begin(), diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp -index a28a5be..baa2bb6 100644 +index 1d12fa6..e348aa7 100644 --- a/src/CPUSensorMain.cpp +++ b/src/CPUSensorMain.cpp -@@ -94,6 +94,18 @@ static constexpr std::array<const char*, 1> sensorTypes = {"XeonCPU"}; - static constexpr std::array<const char*, 3> hiddenProps = { - CPUSensor::labelTcontrol, "Tthrottle", "Tjmax"}; +@@ -94,6 +94,18 @@ static constexpr auto sensorTypes{std::to_array<const char*>({"XeonCPU"})}; + static constexpr auto hiddenProps{std::to_array<const char*>( + {CPUSensor::labelTcontrol, "Tthrottle", "Tjmax"})}; +static const boost::container::flat_map<std::string, SensorProperties> + sensorPropertiesMap = { @@ -216,7 +215,7 @@ index a28a5be..baa2bb6 100644 void detectCpuAsync( boost::asio::deadline_timer& pingTimer, boost::asio::deadline_timer& creationTimer, boost::asio::io_service& io, -@@ -297,7 +309,8 @@ bool createSensors(boost::asio::io_service& io, +@@ -296,7 +308,8 @@ bool createSensors(boost::asio::io_service& io, auto directory = hwmonNamePath.parent_path(); std::vector<fs::path> inputPaths; @@ -226,7 +225,7 @@ index a28a5be..baa2bb6 100644 inputPaths, 0)) { std::cerr << "No temperature sensors in system\n"; -@@ -365,6 +378,16 @@ bool createSensors(boost::asio::io_service& io, +@@ -364,6 +377,16 @@ bool createSensors(boost::asio::io_service& io, } } @@ -243,7 +242,7 @@ index a28a5be..baa2bb6 100644 std::vector<thresholds::Threshold> sensorThresholds; std::string labelHead = label.substr(0, label.find(' ')); parseThresholdsFromConfig(*sensorData, sensorThresholds, -@@ -372,8 +395,7 @@ bool createSensors(boost::asio::io_service& io, +@@ -371,8 +394,7 @@ bool createSensors(boost::asio::io_service& io, if (sensorThresholds.empty()) { if (!parseThresholdsFromAttr(sensorThresholds, inputPathStr, @@ -253,7 +252,7 @@ index a28a5be..baa2bb6 100644 { std::cerr << "error populating thresholds for " << sensorName << "\n"; -@@ -385,7 +407,7 @@ bool createSensors(boost::asio::io_service& io, +@@ -384,7 +406,7 @@ bool createSensors(boost::asio::io_service& io, sensorPtr = std::make_unique<CPUSensor>( inputPathStr, sensorType, objectServer, dbusConnection, io, sensorName, std::move(sensorThresholds), *interfacePath, cpuId, diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend index ccffb1e58..765ad3739 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend @@ -1,7 +1,7 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" PROJECT_SRC_DIR := "${THISDIR}/${PN}" -SRCREV = "1e34cecad498e89fb52b4c73cb19e62a297f2329" +SRCREV = "77518b28db824e01af18351094680a99b1ba3cae" #SRC_URI = "git://github.com/openbmc/dbus-sensors.git" SRC_URI += "\ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb index 7820d805b..d17aebf00 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb @@ -9,7 +9,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/special-mode-manager.git;protocol=ssh" -SRCREV = "5f413eec673f3e6e5e754e2c55048abf0a146e5b" +SRCREV = "42a0ba3c61ae38cc84b06705159065860492fc2e" EXTRA_OECMAKE += "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'validation-unsecure', '-DBMC_VALIDATION_UNSECURE_FEATURE=ON', '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/state/phosphor-post-code-manager_git.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/state/phosphor-post-code-manager_git.bbappend index 8732ccd40..a4e894cbc 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/state/phosphor-post-code-manager_git.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/state/phosphor-post-code-manager_git.bbappend @@ -1,2 +1,2 @@ #SRC_URI = "git://github.com/openbmc/phosphor-post-code-manager.git" -SRCREV = "aed7b3de090005433b16ca986ed3df4dbc81446f" +SRCREV = "9ce5a645f50c0ab94e582abbf95474f636aba678" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb index 0483ced61..b123ddb35 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb @@ -7,7 +7,7 @@ inherit cmake systemd DEPENDS = "boost sdbusplus" PV = "0.1+git${SRCPV}" -SRCREV = "1a9dde9b193a34392ab11a14d9cd0310f9abb930" +SRCREV = "0c5059f685f6df0704a4b773f2e617cf10d03210" S = "${WORKDIR}/git/callback-manager" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend index 68e8ee6ac..ebd808168 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend @@ -1,5 +1,5 @@ SRC_URI = "git://github.com/openbmc/telemetry.git" -SRCREV = "93064d8fcef2c6fde1f61c0cedacb46b21eab039" +SRCREV = "e28aa53dc1492f09a64dc9f1dbfd5b6dba06e31f" EXTRA_OEMESON += " -Dmax-reports=10" EXTRA_OEMESON += " -Dmax-reading-parameters=200" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend index 718829194..21c7991bd 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend @@ -1,7 +1,7 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" SRC_URI = "git://github.com/openbmc/phosphor-user-manager" -SRCREV = "372c5668c0ed893f53edc0f9fa880cb50b48f203" +SRCREV = "c0760c9109a0d847fd77d54c6b7948322a375d1d" EXTRA_OECONF += "${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'allow-root-login' ], '', '--disable-root_user_mgmt', d)}" @@ -10,7 +10,7 @@ SRC_URI += " \ file://0006-Use-groupmems-instead-of-getgrnam_r-due-to-overlay.patch \ " -FILES:${PN} += "/dbus-1/system.d/phosphor-nslcd-cert-config.conf" +FILES:${PN} += "${datadir}/dbus-1/system.d/phosphor-nslcd-cert-config.conf" FILES:${PN} += "/usr/share/phosphor-certificate-manager/nslcd" FILES:${PN} += "\ - /lib/systemd/system/multi-user.target.wants/phosphor-certificate-manager@nslcd.service"
\ No newline at end of file + /lib/systemd/system/multi-user.target.wants/phosphor-certificate-manager@nslcd.service" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog.bb deleted file mode 100644 index f8ddf7892..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog.bb +++ /dev/null @@ -1,31 +0,0 @@ - -SUMMARY = "FRB2 timer service" -DESCRIPTION = "The FRB2 timer service will monitor the mailbox register 0\ -and start a watchdog for FRB2 if the data is 1(BIOS will write this value)" - -SRC_URI = "\ - file://CMakeLists.txt;subdir=${BP} \ - file://frb2-watchdog.cpp;subdir=${BP} \ - " -PV = "0.1" - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" - -inherit cmake -inherit pkgconfig - -DEPENDS += " \ - systemd \ - sdbusplus \ - phosphor-logging \ - phosphor-dbus-interfaces \ - boost \ - " - -RDEPENDS:${PN} += " \ - libsystemd \ - sdbusplus \ - phosphor-logging \ - phosphor-dbus-interfaces \ - " diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/.clang-format b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/.clang-format deleted file mode 100644 index dd2770837..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/.clang-format +++ /dev/null @@ -1,98 +0,0 @@ ---- -Language: Cpp -# BasedOnStyle: LLVM -AccessModifierOffset: -2 -AlignAfterOpenBracket: Align -AlignConsecutiveAssignments: false -AlignConsecutiveDeclarations: false -AlignEscapedNewlinesLeft: false -AlignOperands: true -AlignTrailingComments: true -AllowAllParametersOfDeclarationOnNextLine: true -AllowShortBlocksOnASingleLine: false -AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: None -AllowShortIfStatementsOnASingleLine: false -AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: false -BinPackArguments: true -BinPackParameters: true -BraceWrapping: - AfterClass: true - AfterControlStatement: true - AfterEnum: true - AfterFunction: true - AfterNamespace: true - AfterObjCDeclaration: true - AfterStruct: true - AfterUnion: true - BeforeCatch: true - BeforeElse: true - IndentBraces: false -BreakBeforeBinaryOperators: None -BreakBeforeBraces: Custom -BreakBeforeTernaryOperators: true -BreakConstructorInitializers: AfterColon -ColumnLimit: 80 -CommentPragmas: '^ IWYU pragma:' -ConstructorInitializerAllOnOneLineOrOnePerLine: false -ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 4 -Cpp11BracedListStyle: true -DerivePointerAlignment: true -PointerAlignment: Left -DisableFormat: false -ExperimentalAutoDetectBinPacking: false -FixNamespaceComments: true -ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] -IncludeBlocks: Regroup -IncludeCategories: - - Regex: '^[<"](gtest|gmock)' - Priority: 5 - - Regex: '^"config.h"' - Priority: -1 - - Regex: '^".*\.hpp"' - Priority: 1 - - Regex: '^<.*\.h>' - Priority: 2 - - Regex: '^<.*' - Priority: 3 - - Regex: '.*' - Priority: 4 -IndentCaseLabels: true -IndentWidth: 4 -IndentWrappedFunctionNames: true -KeepEmptyLinesAtTheStartOfBlocks: true -MacroBlockBegin: '' -MacroBlockEnd: '' -MaxEmptyLinesToKeep: 1 -NamespaceIndentation: None -ObjCBlockIndentWidth: 2 -ObjCSpaceAfterProperty: false -ObjCSpaceBeforeProtocolList: true -PenaltyBreakBeforeFirstCallParameter: 19 -PenaltyBreakComment: 300 -PenaltyBreakFirstLessLess: 120 -PenaltyBreakString: 1000 -PenaltyExcessCharacter: 1000000 -PenaltyReturnTypeOnItsOwnLine: 60 -PointerAlignment: Right -ReflowComments: true -SortIncludes: true -SpaceAfterCStyleCast: false -SpaceBeforeAssignmentOperators: true -SpaceBeforeParens: ControlStatements -SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 1 -SpacesInAngles: false -SpacesInContainerLiterals: true -SpacesInCStyleCastParentheses: false -SpacesInParentheses: false -SpacesInSquareBrackets: false -Standard: Cpp11 -TabWidth: 4 -UseTab: Never -... diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/CMakeLists.txt b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/CMakeLists.txt deleted file mode 100644 index bd5567d31..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/CMakeLists.txt +++ /dev/null @@ -1,52 +0,0 @@ -cmake_minimum_required (VERSION 3.5 FATAL_ERROR) -project (frb2-watchdog CXX) -set (CMAKE_CXX_STANDARD 17) -set (CMAKE_CXX_STANDARD_REQUIRED ON) -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") -set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti") - -include_directories (${CMAKE_CURRENT_SOURCE_DIR}) - -# boost support -find_package (Boost REQUIRED) -# pkg_check_modules(Boost boost REQUIRED) -include_directories (${Boost_INCLUDE_DIRS}) -add_definitions (-DBOOST_ERROR_CODE_HEADER_ONLY) -add_definitions (-DBOOST_SYSTEM_NO_DEPRECATED) -add_definitions (-DBOOST_ALL_NO_LIB) -add_definitions (-DBOOST_NO_RTTI) -add_definitions (-DBOOST_NO_TYPEID) -add_definitions (-DBOOST_ASIO_DISABLE_THREADS) - -# import libsystemd -find_package (PkgConfig REQUIRED) -pkg_check_modules (SYSTEMD libsystemd REQUIRED) -include_directories (${SYSTEMD_INCLUDE_DIRS}) -link_directories (${SYSTEMD_LIBRARY_DIRS}) - -# import sdbusplus -find_package (PkgConfig REQUIRED) -pkg_check_modules (SDBUSPLUSPLUS sdbusplus REQUIRED) -include_directories (${SDBUSPLUSPLUS_INCLUDE_DIRS}) -link_directories (${SDBUSPLUSPLUS_LIBRARY_DIRS}) - -# import phosphor-logging -find_package (PkgConfig REQUIRED) -pkg_check_modules (LOGGING phosphor-logging REQUIRED) -include_directories (${LOGGING_INCLUDE_DIRS}) -link_directories (${LOGGING_LIBRARY_DIRS}) - -# import phosphor-dbus-interfaces -find_package (PkgConfig REQUIRED) -pkg_check_modules (DBUSINTERFACE phosphor-dbus-interfaces REQUIRED) -include_directories (${DBUSINTERFACE_INCLUDE_DIRS}) -link_directories (${DBUSINTERFACE_LIBRARY_DIRS}) - -add_executable (frb2-watchdog frb2-watchdog.cpp) - -target_link_libraries (${PROJECT_NAME} systemd) -target_link_libraries (${PROJECT_NAME} ${Boost_LIBRARIES}) -target_link_libraries (${PROJECT_NAME} ${SDBUSPLUSPLUS_LIBRARIES}) -target_link_libraries (${PROJECT_NAME} ${DBUSINTERFACE_LIBRARIES} - phosphor_logging) -install (TARGETS frb2-watchdog DESTINATION bin) diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/cmake-format.json b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/cmake-format.json deleted file mode 100644 index 583c255a3..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/cmake-format.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "enum_char": ".", - "line_ending": "unix", - "bullet_char": "*", - "max_subargs_per_line": 99, - "command_case": "lower", - "tab_size": 4, - "line_width": 80, - "separate_fn_name_with_space": true, - "dangle_parens": true, - "separate_ctrl_name_with_space": true -}
\ No newline at end of file diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/frb2-watchdog.cpp b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/frb2-watchdog.cpp deleted file mode 100644 index bae54f335..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/frb2-watchdog/frb2-watchdog.cpp +++ /dev/null @@ -1,264 +0,0 @@ -/* Copyright 2018 Intel - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <fcntl.h> -#include <stdlib.h> -#include <sys/ioctl.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <unistd.h> - -#include <boost/asio/buffers_iterator.hpp> -#include <boost/asio/deadline_timer.hpp> -#include <boost/asio/io_service.hpp> -#include <boost/asio/ip/tcp.hpp> -#include <boost/asio/posix/stream_descriptor.hpp> -#include <boost/asio/read_until.hpp> -#include <boost/asio/streambuf.hpp> -#include <boost/container/flat_set.hpp> -#include <cassert> -#include <cstdint> -#include <cstring> -#include <iostream> -#include <memory> -#include <optional> -#include <phosphor-logging/log.hpp> -#include <sdbusplus/asio/object_server.hpp> -#include <sdbusplus/bus.hpp> -#include <sdbusplus/bus/match.hpp> -#include <sdbusplus/message.hpp> -#include <sdbusplus/timer.hpp> -#include <vector> -#include <xyz/openbmc_project/State/Watchdog/server.hpp> - -void handleResponse(const boost::system::error_code &err, - std::size_t bytes_transferred); - -static int mailboxDevFd = -1; - -static boost::asio::io_service io; -static auto conn = std::make_shared<sdbusplus::asio::connection>(io); -boost::asio::ip::tcp::socket mailBoxDevSocket(io); -boost::asio::deadline_timer pollTimer(io); -boost::asio::posix::stream_descriptor inputDevice(io); - -// mailbox registre data[0:0] for FRB2 enable bit -boost::asio::streambuf readBuf(1); -std::string dataRead; - -// FRB2 watchdog timeout is 6 minutes -static constexpr unsigned int frb2TimerIntervalMs = 360 * 1000; - -// mailbox device polling time interval is 2 seconds -static constexpr unsigned int pollMs = 2000; - -static constexpr unsigned int frb2Started = 1; -static constexpr unsigned int frb2Stopped = 0; - -// FRB2 status -static uint8_t frb2Status = frb2Stopped; - -static constexpr const char *mailboxDevName = "/dev/aspeed-mbox"; - -static constexpr const char frb2Bus[] = "xyz.openbmc_project.FRB2"; -static constexpr const char frb2Obj[] = "/xyz/openbmc_project/FRB2"; -static constexpr const char frb2Intf[] = "xyz.openbmc_project.FRB2"; - -static constexpr char powerBus[] = "xyz.openbmc_project.Chassis.Control.Power"; -static constexpr char powerPath[] = - "/xyz/openbmc_project/Chassis/Control/Power0"; -static constexpr char powerIntf[] = "xyz.openbmc_project.Chassis.Control.Power"; - -static constexpr char wdBus[] = "xyz.openbmc_project.Watchdog"; -static constexpr char wdPath[] = "/xyz/openbmc_project/watchdog/host0"; -static constexpr char wdIntf[] = "xyz.openbmc_project.State.Watchdog"; -static constexpr char propIntf[] = "org.freedesktop.DBus.Properties"; - -typedef boost::asio::buffers_iterator<boost::asio::const_buffers_1> iterator; - -// check if FRB2 bit is 0x1 -std::pair<iterator, bool> matchFRB2(iterator begin, iterator end) -{ - unsigned char ch = 0; - iterator i = begin; - - while (i != end) - { - ch = static_cast<unsigned char>(*i); - if (ch & 0x1) - { - return std::make_pair(i, true); - } - i++; - } - - return std::make_pair(i, false); -} - -static void startRead() -{ - boost::asio::async_read_until(inputDevice, readBuf, matchFRB2, - [&](const boost::system::error_code &ec, - std::size_t bytes_transferred) { - handleResponse(ec, bytes_transferred); - }); -} - -template <typename T> void setProperty(const std::string &key, const T &val) -{ - phosphor::logging::log<phosphor::logging::level::DEBUG>( - "setProperty", phosphor::logging::entry("KEY=%s", key.c_str())); - - try - { - conn->async_method_call( - [](const boost::system::error_code &err) { - if (err) - { - phosphor::logging::log<phosphor::logging::level::ERR>( - "async_method_call error!", - phosphor::logging::entry( - "ERROR=%s", - boost::system::system_error(err).what())); - } - }, - wdBus, wdPath, propIntf, "Set", wdIntf, key, std::variant<T>(val)); - } - catch (sdbusplus::exception::SdBusError &e) - { - phosphor::logging::log<phosphor::logging::level::ERR>( - "Dbus error!", phosphor::logging::entry("ERROR=%s", e.what())); - } -} -void handleResponse(const boost::system::error_code &err, - std::size_t bytes_transferred) -{ - std::istream responseStream(&readBuf); - std::string response; - int n = 0; - uint64_t interval = frb2TimerIntervalMs; - - std::getline(responseStream, response); - responseStream.clear(); - - if (err == boost::system::errc::bad_file_descriptor) - { - - phosphor::logging::log<phosphor::logging::level::DEBUG>( - "bad file descriptor"); - return; // we're being destroyed - } - - if (!err) - { - // FRB2 is set by BIOS - if (frb2Stopped == frb2Status) - { - // start FRB2 watchdog - frb2Status = frb2Started; - phosphor::logging::log<phosphor::logging::level::DEBUG>( - "FRB2 enable, start FRB2 watchdog"); - setProperty( - "ExpireAction", - std::string( - "xyz.openbmc_project.State.Watchdog.Action.HardReset")); - setProperty("Interval", interval); - setProperty("TimeRemaining", interval); - setProperty("Initialized", true); - setProperty("Enabled", true); - } - } - else if (err == boost::asio::error::misc_errors::not_found) - { - // FRB2 is clear, stop FRB2 watchdog if it is started - if (frb2Started == frb2Status) - { - frb2Status = frb2Stopped; - phosphor::logging::log<phosphor::logging::level::DEBUG>( - "FRB2 is unset, stop FRB2 watchdog"); - setProperty("Enabled", false); - } - } - else - { - phosphor::logging::log<phosphor::logging::level::ERR>( - "handleResponse error!", - phosphor::logging::entry("ERROR=%s", - boost::system::system_error(err).what())); - } - - pollTimer.expires_from_now(boost::posix_time::milliseconds(pollMs)); - pollTimer.async_wait( - [](const boost::system::error_code &ec) { startRead(); }); -} - -int main(int argc, char **argv) -{ - phosphor::logging::log<phosphor::logging::level::DEBUG>( - "Monitor FRB2 signal"); - - sdbusplus::bus::match_t biosPostSignal( - static_cast<sdbusplus::bus::bus &>(*conn), - sdbusplus::bus::match::rules::type::signal() + - sdbusplus::bus::match::rules::member("PostCompleted") + - sdbusplus::bus::match::rules::path(powerPath) + - sdbusplus::bus::match::rules::interface(powerIntf), - [](sdbusplus::message::message &msg) { - uint8_t value = 0; - ssize_t rc = 0; - phosphor::logging::log<phosphor::logging::level::INFO>( - "BIOS post completed signal"); - // stop FRB2 and clean mailbox - value = 0; - rc = ::pwrite(mailboxDevFd, &value, 1, 0); - if (rc != 1) - { - phosphor::logging::log<phosphor::logging::level::ERR>( - "mailbox write error!"); - } - setProperty("Enabled", false); - frb2Status = frb2Stopped; - return; - }); - - conn->request_name(frb2Bus); - - auto server = sdbusplus::asio::object_server(conn); - - std::shared_ptr<sdbusplus::asio::dbus_interface> frb2Iface = - server.add_interface(frb2Obj, frb2Intf); - - frb2Iface->register_property("frb2Status", frb2Status); - - frb2Iface->initialize(); - - mailboxDevFd = ::open(mailboxDevName, O_RDWR | O_CLOEXEC); - if (mailboxDevFd < 0) - { - phosphor::logging::log<phosphor::logging::level::ERR>( - "mailbox device open fail!"); - return -1; - } - - inputDevice.assign(mailboxDevFd); - - startRead(); - - io.run(); - - ::close(mailboxDevFd); - - return 0; -} diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend index a403c4ec8..19db93805 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend @@ -1,4 +1,4 @@ SRC_URI = "git://github.com/Intel-BMC/phosphor-webui;protocol=ssh;branch=intel2" FILESEXTRAPATHS:prepend:intel := "${THISDIR}/${PN}:" -SRCREV = "2397c142c0d75c7705757a52848945b00928232d" +SRCREV = "b5707d7648de19350b3f308b9602c888c6418d6f" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue/0001-Undo-the-unrelated-package-changes-from-the-axios-up.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue/0001-Undo-the-unrelated-package-changes-from-the-axios-up.patch deleted file mode 100644 index 1068f8518..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue/0001-Undo-the-unrelated-package-changes-from-the-axios-up.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 3b32612a73088b48486d38f46c780dfe3b8d463f Mon Sep 17 00:00:00 2001 -From: "Jason M. Bills" <jason.m.bills@linux.intel.com> -Date: Fri, 24 Sep 2021 14:46:36 -0700 -Subject: [PATCH] Undo the unrelated package changes from the axios update - -When I pushed the update to axios, the npm commands changed other -packages as well. I assumed this was expected but have since been -seeing issues with nlf able to get license information. - -This reverts the non-axios changes from the previous update. - -Tested: -Built and logged into the web UI successfully. Also successfully -ran nlf a few times to get node license info. - -Change-Id: Idc03c1154861ccd493322e226814b20cc988bb00 -Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com> ---- - package-lock.json | 62 ++++++++++++++++++++--------------------------- - 1 file changed, 26 insertions(+), 36 deletions(-) - -diff --git a/package-lock.json b/package-lock.json -index df71815..413dd62 100644 ---- a/package-lock.json -+++ b/package-lock.json -@@ -4155,6 +4155,18 @@ - "supports-color": "^7.0.0" - } - }, -+ "loader-utils": { -+ "version": "2.0.0", -+ "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz", -+ "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==", -+ "dev": true, -+ "optional": true, -+ "requires": { -+ "big.js": "^5.2.2", -+ "emojis-list": "^3.0.0", -+ "json5": "^2.1.2" -+ } -+ }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", -@@ -4188,6 +4200,18 @@ - "webpack-sources": "^1.4.3" - } - }, -+ "vue-loader-v16": { -+ "version": "npm:vue-loader@16.1.2", -+ "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.1.2.tgz", -+ "integrity": "sha512-8QTxh+Fd+HB6fiL52iEVLKqE9N1JSlMXLR92Ijm6g8PZrwIxckgpqjPDWRP5TWxdiPaHR+alUWsnu1ShQOwt+Q==", -+ "dev": true, -+ "optional": true, -+ "requires": { -+ "chalk": "^4.1.0", -+ "hash-sum": "^2.0.0", -+ "loader-utils": "^2.0.0" -+ } -+ }, - "wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", -@@ -5552,14 +5576,7 @@ - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", - "requires": { -- "follow-redirects": "^1.14.0" -- }, -- "dependencies": { -- "follow-redirects": { -- "version": "1.14.4", -- "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.4.tgz", -- "integrity": "sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g==" -- } -+ "follow-redirects": "^1.10.0" - } - }, - "babel-code-frame": { -@@ -10030,8 +10047,7 @@ - "follow-redirects": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.1.tgz", -- "integrity": "sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg==", -- "dev": true -+ "integrity": "sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg==" - }, - "for-each": { - "version": "0.3.3", -@@ -19486,32 +19502,6 @@ - } - } - }, -- "vue-loader-v16": { -- "version": "npm:vue-loader@16.8.1", -- "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.1.tgz", -- "integrity": "sha512-V53TJbHmzjBhCG5OYI2JWy/aYDspz4oVHKxS43Iy212GjGIG1T3EsB3+GWXFm/1z5VwjdjLmdZUFYM70y77vtQ==", -- "dev": true, -- "optional": true, -- "requires": { -- "chalk": "^4.1.0", -- "hash-sum": "^2.0.0", -- "loader-utils": "^2.0.0" -- }, -- "dependencies": { -- "loader-utils": { -- "version": "2.0.0", -- "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz", -- "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==", -- "dev": true, -- "optional": true, -- "requires": { -- "big.js": "^5.2.2", -- "emojis-list": "^3.0.0", -- "json5": "^2.1.2" -- } -- } -- } -- }, - "vue-router": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.5.1.tgz", --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue/login-company-logo.svg b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue/login-company-logo.svg new file mode 100644 index 000000000..0976f72e8 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue/login-company-logo.svg @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 23.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ viewBox="0 0 395.4 155.9" style="enable-background:new 0 0 395.4 155.9;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#0068B5;}
+</style>
+<rect x="4.7" y="5.2" class="st0" width="28.1" height="28.1"/>
+<g>
+ <path d="M32.1,151.6V50.4H5.5v101.2H32.1z M208.9,152.6v-24.8c-3.9,0-7.2-0.2-9.6-0.6c-2.8-0.4-4.9-1.4-6.3-2.8
+ c-1.4-1.4-2.3-3.4-2.8-6c-0.4-2.5-0.6-5.8-0.6-9.8V73.2h19.3V50.4h-19.3V10.9h-26.7v97.9c0,8.3,0.7,15.3,2.1,20.9
+ c1.4,5.5,3.8,10,7.1,13.4s7.7,5.8,13,7.3c5.4,1.5,12.2,2.2,20.3,2.2L208.9,152.6L208.9,152.6z M361.7,151.6V3.1H335v148.5H361.7z
+ M137.2,60.3c-7.4-8-17.8-12-31-12c-6.4,0-12.2,1.3-17.5,3.9C83.5,54.8,79,58.4,75.5,63L74,64.9v-1.7V50.4H47.7v101.2h26.5V97.7
+ v3.7c0-0.6,0-1.2,0-1.8c0.3-9.5,2.6-16.5,7-21c4.7-4.8,10.4-7.2,16.9-7.2c7.7,0,13.6,2.4,17.5,7c3.8,4.6,5.8,11.1,5.8,19.4l0,0V98
+ l0,0l0,0v53.5h26.9V94.1C148.4,79.7,144.6,68.3,137.2,60.3z M321.2,100.8c0-7.3-1.3-14.1-3.8-20.5c-2.6-6.3-6.2-11.9-10.7-16.7
+ c-4.6-4.8-10.1-8.5-16.5-11.2s-13.5-4-21.2-4c-7.3,0-14.2,1.4-20.6,4.1c-6.4,2.8-12,6.5-16.7,11.2s-8.5,10.3-11.2,16.7
+ c-2.8,6.4-4.1,13.3-4.1,20.6c0,7.3,1.3,14.2,3.9,20.6c2.6,6.4,6.3,12,10.9,16.7c4.6,4.7,10.3,8.5,16.9,11.2
+ c6.6,2.8,13.9,4.2,21.7,4.2c22.6,0,36.6-10.3,45-19.9l-19.2-14.6c-4,4.8-13.6,11.3-25.6,11.3c-7.5,0-13.7-1.7-18.4-5.2
+ c-4.7-3.4-7.9-8.2-9.6-14.1l-0.3-0.9h79.5L321.2,100.8L321.2,100.8z M241.9,91.5c0-7.4,8.5-20.3,26.8-20.4
+ c18.3,0,26.9,12.9,26.9,20.3L241.9,91.5z"/>
+ <path d="M392.1,138.4c-0.5-1.2-1.2-2.2-2.1-3.1c-0.9-0.9-1.9-1.6-3.1-2.1s-2.5-0.8-3.8-0.8c-1.4,0-2.6,0.3-3.8,0.8
+ c-1.2,0.5-2.2,1.2-3.1,2.1c-0.9,0.9-1.6,1.9-2.1,3.1c-0.5,1.2-0.8,2.5-0.8,3.8c0,1.4,0.3,2.6,0.8,3.8s1.2,2.2,2.1,3.1
+ c0.9,0.9,1.9,1.6,3.1,2.1s2.5,0.8,3.8,0.8c1.4,0,2.6-0.3,3.8-0.8c1.2-0.5,2.2-1.2,3.1-2.1c0.9-0.9,1.6-1.9,2.1-3.1
+ c0.5-1.2,0.8-2.5,0.8-3.8S392.6,139.6,392.1,138.4z M390.5,145.4c-0.4,1-1,1.9-1.7,2.6c-0.7,0.7-1.6,1.3-2.6,1.7s-2,0.6-3.2,0.6
+ c-1.1,0-2.2-0.2-3.2-0.6c-1-0.4-1.9-1-2.6-1.7s-1.3-1.6-1.7-2.6c-0.4-1-0.6-2-0.6-3.2c0-1.1,0.2-2.2,0.6-3.2s1-1.9,1.7-2.6
+ c0.7-0.7,1.6-1.3,2.6-1.7s2-0.6,3.2-0.6c1.1,0,2.2,0.2,3.2,0.6c1,0.4,1.9,1,2.6,1.7s1.3,1.6,1.7,2.6c0.4,1,0.6,2,0.6,3.2
+ C391.2,143.4,390.9,144.4,390.5,145.4z M384.9,143c0.8-0.1,1.4-0.4,1.9-0.9s0.8-1.2,0.8-2.2c0-1.1-0.3-1.9-1-2.5
+ c-0.6-0.6-1.7-0.9-3-0.9h-4.4v11.3h2.1v-4.6h1.5l2.8,4.6h2.2L384.9,143z M383.8,141.4c-0.3,0-0.6,0-1,0h-1.5v-3.2h1.5
+ c0.3,0,0.6,0,1,0c0.3,0,0.6,0.1,0.9,0.2c0.3,0.1,0.5,0.3,0.6,0.5s0.2,0.5,0.2,0.9s-0.1,0.7-0.2,0.9c-0.2,0.2-0.4,0.4-0.6,0.5
+ C384.4,141.3,384.1,141.4,383.8,141.4z"/>
+</g>
+</svg>
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue/logo-header.svg b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue/logo-header.svg new file mode 100644 index 000000000..dc449a1b6 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue/logo-header.svg @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 24.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="81px" height="32px"
+ viewBox="0 0 395.4 155.9" style="enable-background:new 0 0 395.4 155.9;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#00C7FD;}
+ .st1{fill:#FFFFFF;}
+</style>
+<rect x="4.7" y="5.2" class="st0" width="28.1" height="28.1"/>
+<path class="st1" d="M32.1,151.6V50.3H5.4v101.2H32.1z M208.9,152.6v-24.8c-3.9,0-7.2-0.2-9.6-0.6c-2.8-0.4-4.9-1.4-6.3-2.8
+ c-1.4-1.4-2.3-3.4-2.8-6.1c-0.4-2.5-0.6-5.8-0.6-9.8V73.2h19.3V50.3h-19.3V10.9h-26.7v97.9c0,8.3,0.7,15.3,2.1,20.9
+ c1.4,5.5,3.8,10,7.1,13.4c3.3,3.4,7.7,5.8,13,7.3c5.4,1.5,12.2,2.2,20.3,2.2H208.9z M361.7,151.6V3.1h-26.7v148.5H361.7z
+ M137.2,60.3c-7.4-8-17.8-12-31-12c-6.4,0-12.3,1.3-17.5,3.9C83.4,54.8,79,58.4,75.4,63L74,64.9l0-1.7V50.3H47.7v101.2h26.5V97.6
+ l0,3.7c0-0.6,0-1.2,0-1.8c0.3-9.5,2.6-16.5,7-21c4.7-4.8,10.4-7.2,16.9-7.2c7.7,0,13.6,2.4,17.5,7c3.8,4.6,5.8,11.1,5.8,19.4l0,0V98
+ c0,0,0,0,0,0l0,0l0,53.5h26.9V94.1C148.4,79.7,144.6,68.3,137.2,60.3z M321.2,100.8c0-7.3-1.3-14.1-3.8-20.5
+ c-2.6-6.3-6.2-11.9-10.7-16.7c-4.6-4.8-10.1-8.5-16.5-11.2c-6.4-2.7-13.5-4-21.2-4c-7.3,0-14.2,1.4-20.6,4.1
+ c-6.4,2.8-12,6.5-16.7,11.2c-4.7,4.7-8.5,10.3-11.2,16.7c-2.8,6.4-4.1,13.3-4.1,20.6c0,7.3,1.3,14.2,3.9,20.6
+ c2.6,6.4,6.3,12,10.9,16.7c4.6,4.7,10.3,8.5,16.9,11.2c6.6,2.8,13.9,4.2,21.7,4.2c22.6,0,36.6-10.3,45-19.9l-19.2-14.6
+ c-4,4.8-13.6,11.3-25.6,11.3c-7.5,0-13.7-1.7-18.4-5.2c-4.7-3.4-7.9-8.2-9.6-14.1l-0.3-0.9h79.5V100.8z M241.9,91.5
+ c0-7.4,8.5-20.3,26.8-20.4c18.3,0,26.9,12.9,26.9,20.3L241.9,91.5z M392.1,138.8c-0.5-1.2-1.2-2.2-2.1-3.1c-0.9-0.9-1.9-1.6-3.1-2.1
+ c-1.2-0.5-2.5-0.8-3.8-0.8c-1.4,0-2.6,0.3-3.8,0.8c-1.2,0.5-2.2,1.2-3.1,2.1c-0.9,0.9-1.6,1.9-2.1,3.1c-0.5,1.2-0.8,2.5-0.8,3.8
+ c0,1.4,0.3,2.6,0.8,3.8s1.2,2.2,2.1,3.1c0.9,0.9,1.9,1.6,3.1,2.1c1.2,0.5,2.5,0.8,3.8,0.8c1.4,0,2.6-0.3,3.8-0.8
+ c1.2-0.5,2.2-1.2,3.1-2.1c0.9-0.9,1.6-1.9,2.1-3.1c0.5-1.2,0.8-2.5,0.8-3.8C392.9,141.3,392.6,140,392.1,138.8z M390.5,145.8
+ c-0.4,1-1,1.9-1.7,2.6c-0.7,0.7-1.6,1.3-2.6,1.7c-1,0.4-2,0.6-3.2,0.6c-1.1,0-2.2-0.2-3.2-0.6c-1-0.4-1.9-1-2.6-1.7
+ c-0.7-0.7-1.3-1.6-1.7-2.6c-0.4-1-0.6-2-0.6-3.2c0-1.1,0.2-2.2,0.6-3.2c0.4-1,1-1.9,1.7-2.6c0.7-0.7,1.6-1.3,2.6-1.7
+ c1-0.4,2-0.6,3.2-0.6c1.1,0,2.2,0.2,3.2,0.6c1,0.4,1.9,1,2.6,1.7c0.7,0.7,1.3,1.6,1.7,2.6c0.4,1,0.6,2,0.6,3.2
+ C391.1,143.8,390.9,144.8,390.5,145.8z M384.9,143.5c0.8-0.1,1.4-0.4,1.9-0.9c0.5-0.5,0.8-1.2,0.8-2.2c0-1.1-0.3-1.9-1-2.5
+ c-0.6-0.6-1.7-0.9-3-0.9h-4.4v11.3h2.1v-4.6h1.5l2.8,4.6h2.2L384.9,143.5z M383.8,141.8c-0.3,0-0.6,0-1,0h-1.5v-3.2h1.5
+ c0.3,0,0.6,0,1,0c0.3,0,0.6,0.1,0.9,0.2c0.3,0.1,0.5,0.3,0.6,0.5c0.2,0.2,0.2,0.5,0.2,0.9c0,0.4-0.1,0.7-0.2,0.9
+ c-0.2,0.2-0.4,0.4-0.6,0.5C384.4,141.7,384.1,141.8,383.8,141.8z"/>
+</svg>
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue_%.bbappend index ed29c89df..1273ebb29 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue_%.bbappend @@ -1,12 +1,15 @@ # Enable downstream autobump SRC_URI = "git://github.com/openbmc/webui-vue.git" -SRCREV = "6a192d526c9efebf7a614a9aa473eee62e555fc5" +SRCREV = "2a2e1021f48e2a939859ba7f4ae86c5de6df5655" FILESEXTRAPATHS:append := "${THISDIR}/${PN}:" SRC_URI += " \ - file://0001-Undo-the-unrelated-package-changes-from-the-axios-up.patch \ + file://login-company-logo.svg \ + file://logo-header.svg \ " do_compile:prepend() { cp -vf ${S}/.env.intel ${S}/.env + cp -vf ${WORKDIR}/login-company-logo.svg ${S}/src/assets/images + cp -vf ${WORKDIR}/logo-header.svg ${S}/src/assets/images } |