diff options
author | P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> | 2022-03-31 00:20:48 +0300 |
---|---|---|
committer | P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> | 2022-05-06 02:21:19 +0300 |
commit | 18f97faa411078b95d042d207f5fff32bc8ece1d (patch) | |
tree | c557da2136640a8ce48439f19fe5f7071faffeca | |
parent | 2af35ee50ce9918ee3626c59f2cff62cd3ab9568 (diff) | |
download | openbmc-18f97faa411078b95d042d207f5fff32bc8ece1d.tar.xz |
Update to internal 1-0.91
Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com>
119 files changed, 2820 insertions, 3129 deletions
diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0001-Only-allow-drive-sensors-on-bus-2-for-ast2500.patch b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0001-Only-allow-drive-sensors-on-bus-2-for-ast2500.patch index ea7ca092c..c28ae6126 100644 --- a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0001-Only-allow-drive-sensors-on-bus-2-for-ast2500.patch +++ b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/sensors/dbus-sensors/0001-Only-allow-drive-sensors-on-bus-2-for-ast2500.patch @@ -1,7 +1,7 @@ -From d06d0a8fabd699fc1cab4fbd6e4572ce0b22a905 Mon Sep 17 00:00:00 2001 +From 8f6c6f3a23c002f5247c407205f3a62dcd0e0c8c Mon Sep 17 00:00:00 2001 From: James Feist <james.feist@linux.intel.com> Date: Thu, 23 Apr 2020 14:01:38 -0700 -Subject: [PATCH 1/1] Only allow drive sensors on bus 2 for ast2500 +Subject: [PATCH] Only allow drive sensors on bus 2 for ast2500 CPLD doesn't allow multi-master, so readings wont work. Put in a work-around to only allow bus 2 transactions. @@ -15,22 +15,22 @@ Signed-off-by: James Feist <james.feist@linux.intel.com> 1 file changed, 6 insertions(+) diff --git a/src/NVMeSensorMain.cpp b/src/NVMeSensorMain.cpp -index 1858ea9..844f061 100644 +index 8eaeb57..25edf01 100644 --- a/src/NVMeSensorMain.cpp +++ b/src/NVMeSensorMain.cpp -@@ -111,6 +111,12 @@ void createSensors(boost::asio::io_service& io, - rootBus = std::stoi(rootName.substr(0, dash)); - } +@@ -154,6 +154,12 @@ static void handleSensorConfigurations( + << "\n"; + } -+ // HACK: cpld on current products doesn't allow multi-master -+ if (rootBus != 2) -+ { -+ continue; -+ } ++ // HACK: cpld on current products doesn't allow multi-master ++ if (rootBus != 2) ++ { ++ continue; ++ } + - std::shared_ptr<NVMeContext> context; - auto findRoot = nvmeDeviceMap.find(rootBus); - if (findRoot != nvmeDeviceMap.end()) + std::shared_ptr<NVMeSensor> sensorPtr = + std::make_shared<NVMeSensor>( + objectServer, io, dbusConnection, *sensorName, -- 2.17.1 diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0038-Disabling-serial-console-if-FFUJ-is-enabled.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0038-Disabling-serial-console-if-FFUJ-is-enabled.patch new file mode 100644 index 000000000..372d69e26 --- /dev/null +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0038-Disabling-serial-console-if-FFUJ-is-enabled.patch @@ -0,0 +1,51 @@ +From a9f5d0357701c817106cd158d377ef645309ccc2 Mon Sep 17 00:00:00 2001 +From: gokulsanker <gokul.sanker.v.g@intel.com> +Date: Wed, 8 Dec 2021 01:44:19 +0530 +Subject: [PATCH] If FFUJ is enabled serial console must be disabled + +FFUJ mode user is not allowed to enter uboot command +line interface. Serial console is disabled by creating +an indefinite sleep if FFUJ is enabled, same +functionality is used in whitely platforms + +Tested: +Serial console is disabled in FFUJ mode + +Signed-off-by: gokulsanker <gokul.sanker.v.g@intel.com> +--- + common/autoboot.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/common/autoboot.c b/common/autoboot.c +index 8a99780423..21e59feea7 100644 +--- a/common/autoboot.c ++++ b/common/autoboot.c +@@ -19,6 +19,7 @@ DECLARE_GLOBAL_DATA_PTR; + + #define MAX_DELAY_STOP_STR 32 + ++#define WAIT_STATE_TIMEOUT 10000 + #ifndef DEBUG_BOOTKEYS + #define DEBUG_BOOTKEYS 0 + #endif +@@ -271,9 +272,14 @@ static int abortboot(int bootdelay) + { + int abort = 0; + +- abort = gpio_abort(); +- if (abort) +- goto exit; ++ if (gpio_abort()) ++ { ++ printf("#### BMC is in disabled state(FFU Jumper is asserted), " ++ "So BMC serial console disabled. ####\n"); ++ while (1) { ++ mdelay(WAIT_STATE_TIMEOUT); ++ } ++ } + + if (bootdelay >= 0) + abort = __abortboot(bootdelay); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend index 1e20585bc..fdc83fce1 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/u-boot-aspeed-sdk_%.bbappend @@ -41,6 +41,7 @@ SRC_URI:append:intel-ast2600 = " \ file://0034-Implement-the-IPMI-commands-in-FFUJ-mode-in-u-boot.patch \ file://0036-Disable-BMC-MMIO-Decode-on-VGA-SCU-register-bit.patch \ file://0037-Enable-I2C-clock-stretching-and-multi-master-support.patch \ + file://0038-Disabling-serial-console-if-FFUJ-is-enabled.patch \ " # CVE-2020-10648 vulnerability fix diff --git a/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0005-Add-sample-i3c-slave-driver.patch b/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0005-Add-sample-i3c-slave-driver.patch new file mode 100644 index 000000000..8f548c2e5 --- /dev/null +++ b/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0005-Add-sample-i3c-slave-driver.patch @@ -0,0 +1,150 @@ +From 4987202965423fafd5c704d4e68a51a4167a4414 Mon Sep 17 00:00:00 2001 +From: Oleksandr Shulzhenko <oleksandr.shulzhenko.viktorovych@intel.com> +Date: Thu, 30 Sep 2021 16:28:26 +0200 +Subject: [PATCH] Add sample i3c slave driver + +The aim of the driver is to debug various i3c solutions implemented +for DesignWare master I3C driver. +The driver is bound to the I3C device that corresponds to I3C slave +emulated by Prodigy with manufacturer ID 0xAC and part ID 0x55AA. +It is enough to fill the I3C_DEVICE macro with the corresponding data +to adjust the driver with another I3C slave device + +Signed-off-by: Oleksandr Shulzhenko <oleksandr.shulzhenko.viktorovych@intel.com> +--- + drivers/i3c/Kconfig | 2 + + drivers/i3c/Makefile | 1 + + drivers/i3c/sample/Kconfig | 7 +++ + drivers/i3c/sample/Makefile | 2 + + drivers/i3c/sample/dw-i3c-sample.c | 75 ++++++++++++++++++++++++++++++ + 5 files changed, 87 insertions(+) + create mode 100644 drivers/i3c/sample/Kconfig + create mode 100644 drivers/i3c/sample/Makefile + create mode 100644 drivers/i3c/sample/dw-i3c-sample.c + +diff --git a/drivers/i3c/Kconfig b/drivers/i3c/Kconfig +index 01642768ab5f..202b0d091631 100644 +--- a/drivers/i3c/Kconfig ++++ b/drivers/i3c/Kconfig +@@ -36,4 +36,6 @@ config I3CDEV + and hence SUBJECT TO CHANGE WITHOUT NOTICE while it stabilizes. + + source "drivers/i3c/master/Kconfig" ++ ++source "drivers/i3c/sample/Kconfig" + endif # I3C +diff --git a/drivers/i3c/Makefile b/drivers/i3c/Makefile +index 606d422841b2..8048a9a793c6 100644 +--- a/drivers/i3c/Makefile ++++ b/drivers/i3c/Makefile +@@ -3,3 +3,4 @@ i3c-y := device.o master.o + obj-$(CONFIG_I3C) += i3c.o + obj-$(CONFIG_I3CDEV) += i3cdev.o + obj-$(CONFIG_I3C) += master/ ++obj-$(CONFIG_I3C) += sample/ +diff --git a/drivers/i3c/sample/Kconfig b/drivers/i3c/sample/Kconfig +new file mode 100644 +index 000000000000..6376c9891795 +--- /dev/null ++++ b/drivers/i3c/sample/Kconfig +@@ -0,0 +1,7 @@ ++# SPDX-License-Identifier: GPL-2.0-only ++config DW_I3C_SAMPLE ++ tristate "Synopsys DesignWare I3C sample driver" ++ depends on I3C ++help ++ Say yes here to enable the driver for DesignWare ++ I3C Sample driver. +diff --git a/drivers/i3c/sample/Makefile b/drivers/i3c/sample/Makefile +new file mode 100644 +index 000000000000..c73bb34fce0e +--- /dev/null ++++ b/drivers/i3c/sample/Makefile +@@ -0,0 +1,2 @@ ++# SPDX-License-Identifier: GPL-2.0-only ++obj-$(CONFIG_DW_I3C_SAMPLE) += dw-i3c-sample.o +\ No newline at end of file +diff --git a/drivers/i3c/sample/dw-i3c-sample.c b/drivers/i3c/sample/dw-i3c-sample.c +new file mode 100644 +index 000000000000..1993b9fdb32b +--- /dev/null ++++ b/drivers/i3c/sample/dw-i3c-sample.c +@@ -0,0 +1,75 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* Copyright (C) 2021 Intel Corporation.*/ ++ ++#include <linux/i3c/device.h> ++#include <linux/module.h> ++ ++#define IBI_QUEUE_STATUS_IBI_ID(x) (((x) & GENMASK(15, 8)) >> 8) ++#define IBI_QUEUE_IBI_ADDR(x) (IBI_QUEUE_STATUS_IBI_ID(x) >> 1) ++#define IBI_QUEUE_STATUS_DATA_LEN(x) ((x) & GENMASK(7, 0)) ++ ++static void ibi_handler(struct i3c_device *dev, ++ const struct i3c_ibi_payload *payload) ++{ ++ unsigned int i = 0; ++ u32 ibi_status; ++ u8 addr; ++ const u8 *buf; ++ ++ dev_info(i3cdev_to_dev(dev), "%s:%d\n", __func__, __LINE__); ++ if (payload) { ++ ibi_status = *((u32 *)payload->data); ++ addr = IBI_QUEUE_IBI_ADDR(ibi_status); ++ dev_info(i3cdev_to_dev(dev), "%s, dynamic address = 0x%02x\n", ++ __func__, addr); ++ /* We need to read only IBI Paylod data - so shift for IBI_QUEUE_STATUS ++ * length which is 32 bits ++ */ ++ buf = payload->data + sizeof(u32); ++ for (i = 0; i < IBI_QUEUE_STATUS_DATA_LEN(ibi_status); i++) ++ dev_info(i3cdev_to_dev(dev), "%s payload[%d] = 0x%02x\n", ++ __func__, i, *(buf + sizeof(u8) * i)); ++ } ++} ++ ++static int dw_i3c_sample_probe(struct i3c_device *i3cdev) ++{ ++ int ret; ++ struct i3c_ibi_setup ibireq = { ++ .handler = ibi_handler, ++ .max_payload_len = 2, ++ .num_slots = 10, ++ }; ++ ++ ret = i3c_device_request_ibi(i3cdev, &ibireq); ++ if (ret) ++ return ret; ++ ret = i3c_device_enable_ibi(i3cdev); ++ if (ret) ++ i3c_device_free_ibi(i3cdev); ++ ++ return ret; ++} ++ ++static void dw_i3c_sample_remove(struct i3c_device *i3cdev) ++{ ++ i3c_device_disable_ibi(i3cdev); ++ i3c_device_free_ibi(i3cdev); ++} ++ ++static const struct i3c_device_id dw_i3c_sample_ids[] = { ++ I3C_DEVICE(0x2AC /*manufid*/, 0x55AA /*partid*/, NULL /*driver-data*/), ++ { /* sentinel */ }, ++}; ++ ++static struct i3c_driver dw_i3c_sample = { ++ .driver.name = "dw-i3c-sample", ++ .id_table = dw_i3c_sample_ids, ++ .probe = dw_i3c_sample_probe, ++ .remove = dw_i3c_sample_remove, ++}; ++ ++module_i3c_driver(dw_i3c_sample); ++MODULE_AUTHOR("Oleksandr Shulzhenko <oleksandr.shulzhenko.viktorovych@intel.com>"); ++MODULE_DESCRIPTION("DesignWare I3C sample driver"); ++MODULE_LICENSE("GPL"); +-- +2.25.1 + diff --git a/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed_%.bbappend b/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed_%.bbappend index df3901d77..94d22381f 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed_%.bbappend +++ b/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed_%.bbappend @@ -7,4 +7,5 @@ SRC_URI += " \ file://0002-serial-8250-Fix-RX-DMA-time-out-property.patch \ file://0003-serial-8250_aspeed-Make-port-type-fixed.patch \ file://0004-Add-a-workaround-to-cover-UART-interrupt-bug-in-AST2.patch \ + file://0005-Add-sample-i3c-slave-driver.patch \ " diff --git a/meta-openbmc-mods/meta-ast2600/recipes-phosphor/sensors/dbus-sensors/0001-ADCSensor-Fix-for-P3V3-sensor.patch b/meta-openbmc-mods/meta-ast2600/recipes-phosphor/sensors/dbus-sensors/0001-ADCSensor-Fix-for-P3V3-sensor.patch new file mode 100644 index 000000000..458f234b6 --- /dev/null +++ b/meta-openbmc-mods/meta-ast2600/recipes-phosphor/sensors/dbus-sensors/0001-ADCSensor-Fix-for-P3V3-sensor.patch @@ -0,0 +1,59 @@ +From 9923811a2880ad4a8289af666b63adfd1807b5bd Mon Sep 17 00:00:00 2001 +From: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> +Date: Mon, 22 Nov 2021 22:12:00 +0000 +Subject: [PATCH] ADCSensor: Fix for P3V3 sensor + +Issue: As part of adapting to upstream ADC driver change for all the +platforms of AST2600, ADC scale factor settings in board configurations +is adjusted. +Patch: https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/47086 +Due to this change set sensor threshold is not updating for critical +threshold value of P3V3 sensor. + +Fix: Updating pre sensor scaling of "maxVoltageReading" to 2.5 can fix +this issue. + +Tested: +Verified using IPMI set sensor threshold command for P3V3 sensor and for +other sensors as well. +Before fix: +//Get sensor threshold for P3V3 sensor +Command : ipmitool raw 0x04 0x27 0x83 +Response: 1b d6 d0 00 f8 ff 00 +//Set sensor threshold for P3V3 sensor +Command : ipmitool raw 0x04 0x26 0x83 0x10 0x00 0x00 0x00 0x00 0xfd 0x00 +Response: //Success +Command : ipmitool raw 0x04 0x27 0x83 +Response: 1b d8 d1 00 f9 ff 00 + +After fix: +//Get sensor threshold for P3V3 sensor +Command : ipmitool raw 0x04 0x27 0x81 +Response: 1b b2 ad 00 ce d4 00 +//Set sensor threshold for P3V3 sensor +Command : ipmitool raw 0x04 0x26 0x81 0x10 0x00 0x00 0x00 0x00 0xfd 0x00 +Response: //Success +Command : ipmitool raw 0x04 0x27 0x81 +Response: 1b b2 ad 00 ce fd 00 + +Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> +--- + src/ADCSensor.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/ADCSensor.cpp b/src/ADCSensor.cpp +index 9758168..2f3c66f 100644 +--- a/src/ADCSensor.cpp ++++ b/src/ADCSensor.cpp +@@ -37,7 +37,7 @@ + static constexpr unsigned int sensorScaleFactor = 1000; + + static constexpr double roundFactor = 10000; // 3 decimal places +-static constexpr double maxVoltageReading = 1.8; // pre sensor scaling ++static constexpr double maxVoltageReading = 2.5; // pre sensor scaling + static constexpr double minVoltageReading = 0; + + ADCSensor::ADCSensor(const std::string& path, +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-ast2600/recipes-phosphor/sensors/dbus-sensors_%.bbappend b/meta-openbmc-mods/meta-ast2600/recipes-phosphor/sensors/dbus-sensors_%.bbappend new file mode 100644 index 000000000..7f412bfa4 --- /dev/null +++ b/meta-openbmc-mods/meta-ast2600/recipes-phosphor/sensors/dbus-sensors_%.bbappend @@ -0,0 +1,3 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + +SRC_URI += "file://0001-ADCSensor-Fix-for-P3V3-sensor.patch" diff --git a/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/at-scale-debug_git.bb b/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/at-scale-debug_git.bb index 74db92917..e2fa7b57e 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/at-scale-debug_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/at-scale-debug_git.bb @@ -12,8 +12,10 @@ DEPENDS = "sdbusplus openssl libpam libgpiod safec" do_configure[depends] += "virtual/kernel:do_shared_workdir" -SRC_URI = "git://github.com/Intel-BMC/asd;protocol=git" -SRCREV = "1.4.6" +SRC_URI = "git://github.com/Intel-BMC/asd;protocol=https" +SRCREV = "1.4.7" + +SRC_URI += "file://0001-ASD-Fix-sprintf_s-compilation-issue-for-safec-3.5.1.patch" inherit useradd diff --git a/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/files/0001-ASD-Fix-sprintf_s-compilation-issue-for-safec-3.5.1.patch b/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/files/0001-ASD-Fix-sprintf_s-compilation-issue-for-safec-3.5.1.patch new file mode 100644 index 000000000..943ffb4a8 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/at-scale-debug/files/0001-ASD-Fix-sprintf_s-compilation-issue-for-safec-3.5.1.patch @@ -0,0 +1,35 @@ +From efd1373e7c4a7a89609184aa0b5e1c3edcb8be6a Mon Sep 17 00:00:00 2001 +From: Ernesto Corona <ernesto.corona@intel.com> +Date: Fri, 19 Nov 2021 09:11:03 -0800 +Subject: [PATCH] ASD Fix sprintf_s compilation issue for safec 3.5.1 + +A missing macro was defined to ensure sprintf_s macro defintion is +set when safe_str_lib.h is included. + +Test: +Remove openbmc-meta-intel/meta-common/recipes-core/safec/safec_3.4.bb +Compile at-scale-debug using devtool +ASD Sanity finished successfully(SPR). + +Signed-off-by: Ernesto Corona <ernesto.corona@intel.com> +Change-Id: Idd94b4ba9ff8b4194317a045b140ce90db2ee860 +--- + CMakeLists.txt | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 59ff03c..d6239a4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -4,6 +4,8 @@ project(at-scale-debug C) + find_package (PkgConfig REQUIRED) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/sysroot/include) + pkg_check_modules (SAFEC REQUIRED libsafec) ++# Define HAVE_C99 to include sprintf_s macro in safec library ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_C99") + include_directories (${SAFEC_INCLUDE_DIRS}) + link_directories (${SAFEC_LIBRARY_DIRS}) + +-- +2.25.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb index eba56f829..79027b766 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb @@ -2,7 +2,7 @@ SUMMARY = "libmctp" DESCRIPTION = "Implementation of MCTP (DTMF DSP0236)" SRC_URI = "git://github.com/openbmc/libmctp.git" -SRCREV = "663ec39ea107c2a736f9bcb20cbfdfa623092ab1" +SRCREV = "983cc3fa49dcac2e640e814500221c6acc177eff" PV = "0.1+git${SRCPV}" diff --git a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend index ac61d983c..a9e6c81ad 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend @@ -2,7 +2,7 @@ EXTRA_OECMAKE += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', '-DINTEL_PF EXTRA_OECMAKE += "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'validation-unsecure', '-DBMC_VALIDATION_UNSECURE_FEATURE=ON', '', d)}" EXTRA_OECMAKE += "-DUSING_ENTITY_MANAGER_DECORATORS=OFF" SRC_URI = "git://github.com/openbmc/intel-ipmi-oem.git" -SRCREV = "9e58cfe1ba5ca5bcd5263b50730c5a231eabdd4f" +SRCREV = "d2d60ab5b325c4630c8e794e861b88cf3c9337bf" FILESEXTRAPATHS:append := ":${THISDIR}/${PN}" diff --git a/meta-openbmc-mods/meta-common/recipes-core/ncurses/ncurses/0001-Fix-heap-buffer-overflow-in-captoinfo.patch b/meta-openbmc-mods/meta-common/recipes-core/ncurses/ncurses/0001-Fix-heap-buffer-overflow-in-captoinfo.patch new file mode 100644 index 000000000..420a19b41 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/ncurses/ncurses/0001-Fix-heap-buffer-overflow-in-captoinfo.patch @@ -0,0 +1,47 @@ +From ad135388ac66b7c8276b0899d9b43433e2faffa6 Mon Sep 17 00:00:00 2001 +From: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +Date: Tue, 7 Dec 2021 23:58:53 +0000 +Subject: [PATCH] Fix heap-buffer-overflow in captoinfo + +This has been picked up from http://cvsweb.netbsd.org/ +bsdweb.cgi/pkgsrc/devel/ncurses/patches/Attic/ +patch-ncurses_tinfo_captoinfo.c +?rev=1.1&content-type=text/x-cvsweb-markup + +Thomas Dickey is the owner of this patch. +This fix is a part of +https://github.com/ThomasDickey/ncurses-snapshots/ +commit/63ca9e061f4644795d6f3f559557f3e1ed8c738b#diff- +7e95c7bc5f213e9be438e69a9d5d0f261a14952bcbd692f7b9014217b8047340 + +Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +--- + ncurses/tinfo/captoinfo.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/ncurses/tinfo/captoinfo.c b/ncurses/tinfo/captoinfo.c +index 8b3b83d1..c9741405 100644 +--- a/ncurses/tinfo/captoinfo.c ++++ b/ncurses/tinfo/captoinfo.c +@@ -216,12 +216,15 @@ cvtchar(register const char *sp) + } + break; + case '^': ++ len = 2; + c = UChar(*++sp); +- if (c == '?') ++ if (c == '?') { + c = 127; +- else ++ } else if (c == '\0') { ++ len = 1; ++ } else { + c &= 0x1f; +- len = 2; ++ } + break; + default: + c = UChar(*sp); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-core/ncurses/ncurses_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/ncurses/ncurses_%.bbappend new file mode 100644 index 000000000..e60bd9a6b --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/ncurses/ncurses_%.bbappend @@ -0,0 +1,2 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" +SRC_URI += "file://0001-Fix-heap-buffer-overflow-in-captoinfo.patch" diff --git a/meta-openbmc-mods/meta-common/recipes-core/safec/safec_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/safec/safec_%.bbappend deleted file mode 100644 index b8256e2b1..000000000 --- a/meta-openbmc-mods/meta-common/recipes-core/safec/safec_%.bbappend +++ /dev/null @@ -1,11 +0,0 @@ -RDEPENDS:${PN} = "" -do_install:append() { - F=$(find ${D} -name check_for_unsafe_apis) - if [ -n "${F}" ]; then - # remove the unused perl script - rm -f "${F}" - # remove the script's destination directory, only if it is empty - rmdir "$(dirname ${F})" 2>/dev/null || : - fi -} - diff --git a/meta-openbmc-mods/meta-common/recipes-core/safec/safec_3.4.bb b/meta-openbmc-mods/meta-common/recipes-core/safec/safec_3.4.bb deleted file mode 100644 index cf83203ec..000000000 --- a/meta-openbmc-mods/meta-common/recipes-core/safec/safec_3.4.bb +++ /dev/null @@ -1,15 +0,0 @@ -SUMMARY = "Safe C Library" - -LICENSE = "safec" -LIC_FILES_CHKSUM = "file://COPYING;md5=6d0eb7dfc57806a006fcbc4e389cf164" -SECTION = "lib" - -inherit autotools pkgconfig - -S = "${WORKDIR}/git" -SRCREV = "e8bf1fff157ba931692130a0ec6f2833fa7d5f87" -SRC_URI = "git://github.com/rurban/safeclib.git" - -COMPATIBLE_HOST = '(x86_64|i.86|powerpc|powerpc64|arm|aarch64).*-linux' - -RDEPENDS:${PN} = "perl" diff --git a/meta-openbmc-mods/meta-common/recipes-devtools/boost-url/boost-url_%.bbappend b/meta-openbmc-mods/meta-common/recipes-devtools/boost-url/boost-url_%.bbappend deleted file mode 100644 index 323788fe8..000000000 --- a/meta-openbmc-mods/meta-common/recipes-devtools/boost-url/boost-url_%.bbappend +++ /dev/null @@ -1,4 +0,0 @@ -FILESEXTRAPATHS:append := ":${THISDIR}/${PN}" - -# Temporary pin to resolve build breaks -SRCREV = "2c867fbe284ae532f1329b87a86ad3f8cd382867" diff --git a/meta-openbmc-mods/meta-common/recipes-devtools/mtd-util/mtd-util.bb b/meta-openbmc-mods/meta-common/recipes-devtools/mtd-util/mtd-util.bb index 5b59dd909..c925c522d 100644 --- a/meta-openbmc-mods/meta-common/recipes-devtools/mtd-util/mtd-util.bb +++ b/meta-openbmc-mods/meta-common/recipes-devtools/mtd-util/mtd-util.bb @@ -3,7 +3,7 @@ DESCRIPTION = "OpenBMC mtd-util" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://COPYING;md5=b77c43ae4eaf67bd73fb6452b2f113a3" -SRC_URI = "git://github.com/Intel-BMC/mtd-util;protocol=ssh" +SRC_URI = "git://git@github.com/Intel-BMC/mtd-util.git;protocol=ssh" PV = "1.0+git${SRCPV}" SRCREV = "708072b62a3cecb520eeaacac88b4f2c2e101fe4" diff --git a/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus/0001-Revert-server-Check-return-code-for-sd_bus_add_objec.patch b/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus/0001-Revert-server-Check-return-code-for-sd_bus_add_objec.patch index 9aaf2f952..884e818a9 100644 --- a/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus/0001-Revert-server-Check-return-code-for-sd_bus_add_objec.patch +++ b/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus/0001-Revert-server-Check-return-code-for-sd_bus_add_objec.patch @@ -1,4 +1,4 @@ -From baff58f6e8f7aef4fd56be959fdd2e5e3c429eef Mon Sep 17 00:00:00 2001 +From 9d70ffc5532e17752903407d0267a281cc4be6d5 Mon Sep 17 00:00:00 2001 From: Johnathan Mantey <johnathanx.mantey@intel.com> Date: Mon, 13 Jul 2020 11:51:54 -0700 Subject: [PATCH] Revert "server: Check return code for @@ -6,29 +6,28 @@ Subject: [PATCH] Revert "server: Check return code for This reverts commit 017a19da5f67a74daedf4d63111569902d4764e6. --- - src/server/interface.cpp | 9 ++------- - 1 file changed, 2 insertions(+), 7 deletions(-) + src/server/interface.cpp | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/server/interface.cpp b/src/server/interface.cpp -index a72c656..0155b6d 100644 +index e47f6ef..1ea9a06 100644 --- a/src/server/interface.cpp +++ b/src/server/interface.cpp -@@ -17,13 +17,8 @@ interface::interface(sdbusplus::bus::bus& bus, const char* path, +@@ -17,12 +17,8 @@ interface::interface(sdbusplus::bus_t& bus, const char* path, _interface_added(false) { sd_bus_slot* slot = nullptr; -- int r = _intf->sd_bus_add_object_vtable(_bus.get(), &slot, _path.c_str(), -- _interf.c_str(), vtable, context); +- int r = _intf->sd_bus_add_object_vtable( +- get_busp(_bus), &slot, _path.c_str(), _interf.c_str(), vtable, context); - if (r < 0) - { - throw exception::SdBusError(-r, "sd_bus_add_object_vtable"); - } -- -+ _intf->sd_bus_add_object_vtable(_bus.get(), &slot, _path.c_str(), ++ _intf->sd_bus_add_object_vtable(get_busp(_bus), &slot, _path.c_str(), + _interf.c_str(), vtable, context); - _slot = decltype(_slot){slot}; - } + _slot = std::move(slot); + } -- 2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus_%.bbappend b/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus_%.bbappend index a33c265f6..36539fbda 100644 --- a/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus_%.bbappend @@ -6,4 +6,4 @@ SRC_URI += " \ " # Temporary pin to resolve build breaks -SRCREV="dfb5642201699dc42a7dda12d72718a8b9568151" +SRCREV="6adfe948ee55ffde8457047042d0d55aa3d8b4a7" diff --git a/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend b/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend index dbd591c86..e527d27f7 100644 --- a/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend @@ -2,4 +2,4 @@ FILESEXTRAPATHS:append := ":${THISDIR}/${PN}" # Use the latest to support obmc-ikvm properly SRC_URI = "git://github.com/LibVNC/libvncserver" -SRCREV = "c1f29b73e4f111fc3d4b5941936218be0c6c430f" +SRCREV = "0b8990784a81823eecc9089263ac1966d17bf399" diff --git a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm_%.bbappend b/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm_%.bbappend index faee3bf4c..695cfd437 100644 --- a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm_%.bbappend @@ -1,4 +1,4 @@ FILESEXTRAPATHS:append := ":${THISDIR}/${PN}" #SRC_URI = "git://github.com/openbmc/obmc-ikvm" -SRCREV = "f90f68d1e9bc6c53f49ebac6d0b8e11257de77a9" +SRCREV = "ee09e3033a453565034b2b9bf4f2e0cbc8323ccd" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/host-misc-comm-manager/host-misc-comm-manager_git.bb b/meta-openbmc-mods/meta-common/recipes-intel/host-misc-comm-manager/host-misc-comm-manager_git.bb index 6b54189e6..7dfce8c4e 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/host-misc-comm-manager/host-misc-comm-manager_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/host-misc-comm-manager/host-misc-comm-manager_git.bb @@ -9,7 +9,7 @@ S = "${WORKDIR}/git" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" -SRC_URI = "git://github.com/Intel-BMC/host-misc-comm-manager.git;protocol=ssh" +SRC_URI = "git://git@github.com/Intel-BMC/host-misc-comm-manager;protocol=ssh" SRCREV = "470facc6e94ecbd01ca9c3f0749ae603dffff0e9" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/hsbp/hsbp-manager_git.bb b/meta-openbmc-mods/meta-common/recipes-intel/hsbp/hsbp-manager_git.bb index a2ce25369..180693f08 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/hsbp/hsbp-manager_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/hsbp/hsbp-manager_git.bb @@ -2,7 +2,7 @@ SUMMARY = "HSBP Manager" DESCRIPTION = "HSBP Manager monitors HSBPs through SMBUS" SRC_URI = "git://github.com/openbmc/s2600wf-misc.git" -SRCREV = "0c5059f685f6df0704a4b773f2e617cf10d03210" +SRCREV = "26067f6af051ccf8feff251a081aa46e45dfa4dc" PV = "0.1+git${SRCPV}" LICENSE = "Apache-2.0" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-pfr-signing-utility-native.bb b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-pfr-signing-utility-native.bb index 72e7857ef..112b6b4c2 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-pfr-signing-utility-native.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/intel-pfr-signing-utility-native.bb @@ -8,9 +8,9 @@ LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fe DEPENDS = "openssl-native libxml2-native " -SRC_URI = "git://github.com/Intel-BMC/intel-pfr-signing-utility;protocol=ssh" +SRC_URI = "git://git@github.com/Intel-BMC/intel-pfr-signing-utility.git;protocol=ssh" -SRCREV = "33b8e02e9b25d5150b744fcbda4cf1e508813194" +SRCREV = "7ad7cb3f3d7f408fd9ac454c242e77c8fbc6d61b" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/pfr-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/pfr-manager_%.bbappend index 2ae1e372b..1e6becb03 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/pfr-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/pfr-manager_%.bbappend @@ -1,5 +1,5 @@ # Enable downstream autobump SRC_URI = "git://github.com/openbmc/pfr-manager" -SRCREV = "8491692089f9295cf2efab456d4747f3cf1fb098" +SRCREV = "57f42c3d37d9546ede4f2c015bf9f392130c93b5" DEPENDS += " libgpiod \ " diff --git a/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/psu-manager.bb b/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/psu-manager.bb index 9cd2eec6f..6ce844f60 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/psu-manager.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/psu-manager.bb @@ -1,7 +1,7 @@ SUMMARY = "Power supply manager for Intel based platform" DESCRIPTION = "Power supply manager which include PSU Cold Redundancy service" -SRC_URI = "git://github.com/Intel-BMC/psu-manager.git;protocol=ssh" +SRC_URI = "git://git@github.com/Intel-BMC/psu-manager.git;protocol=ssh" SRCREV = "30788892792c302b1317bac4e7f837ca1374d789" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv1.bb b/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv1.bb deleted file mode 100644 index 9eca05bae..000000000 --- a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv1.bb +++ /dev/null @@ -1,31 +0,0 @@ -SUMMARY = "SMBIOS MDR version 1 service for Intel based platform" -DESCRIPTION = "SMBIOS MDR version 1 service for Intel based platfrom" - -SRC_URI = "git://github.com/Intel-BMC/provingground.git;protocol=ssh;nobranch=1" -SRCREV = "6aab8bcc8fd0550753c87265036b1b7c4c8a9f71" - -S = "${WORKDIR}/git/services/smbios" - -PV = "1.0+git${SRCPV}" - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" - -inherit cmake pkgconfig -inherit obmc-phosphor-systemd - -SYSTEMD_SERVICE:${PN} += "smbios-mdrv1.service" - -DEPENDS += " \ - autoconf-archive-native \ - systemd \ - sdbusplus \ - phosphor-dbus-interfaces \ - phosphor-logging \ - " -RDEPENDS:${PN} += " \ - libsystemd \ - sdbusplus \ - phosphor-dbus-interfaces \ - phosphor-logging \ - " diff --git a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv1/smbios-mdrv1.service b/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv1/smbios-mdrv1.service deleted file mode 100644 index edfd3bf70..000000000 --- a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv1/smbios-mdrv1.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Intel BMC SMBIOS MDR V1 - -[Service] -Restart=always -RestartSec=5 -StartLimitBurst=10 -ExecStartPre=/bin/mkdir -p /etc/smbios -ExecStart=/usr/bin/env smbiosapp -SyslogIdentifier=smbiosapp - -[Install] -WantedBy={SYSTEMD_DEFAULT_TARGET} diff --git a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb b/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb index 683497208..fefaddbce 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb @@ -2,7 +2,7 @@ SUMMARY = "SMBIOS MDR version 2 service for Intel based platform" DESCRIPTION = "SMBIOS MDR version 2 service for Intel based platfrom" SRC_URI = "git://github.com/openbmc/smbios-mdr.git" -SRCREV = "631388e621abad855abbe4abbfb20111da9056f1" +SRCREV = "bc924d0f9f590d7d420b9f7bc98bdb9b8688618e" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend index fb05aa1a0..2a9a03d1b 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend @@ -3,10 +3,10 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" LINUX_VERSION = "5.15" KBRANCH = "dev-5.15-intel" -KSRC = "git://github.com/Intel-BMC/linux;protocol=ssh;branch=${KBRANCH}" +KSRC = "git://git@github.com/Intel-BMC/linux.git;protocol=ssh;branch=${KBRANCH}" # Include this as a comment only for downstream auto-bump -# SRC_URI = "git://github.com/Intel-BMC/linux;protocol=ssh;branch=dev-5.15-intel" -SRCREV="c7981259e359523e74044f926b69a804c61c86b1" +# SRC_URI = "git://git@github.com/Intel-BMC/linux.git;protocol=ssh;branch=dev-5.15-intel" +SRCREV="aaccb149bfa6ff74dc8e9ff043191730060002db" do_compile:prepend(){ # device tree compiler flags diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor.bb b/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor.bb index cdb8e2097..4219a8e42 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor.bb +++ b/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor.bb @@ -14,6 +14,8 @@ SRC_URI = "\ file://${BPN}.service \ " +RDEPENDS:${PN} += "bash" + inherit obmc-phosphor-systemd SYSTEMD_SERVICE:${PN} += "${BPN}.service" diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor/check-for-host-in-reset b/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor/check-for-host-in-reset index aa17aebf2..be01092a2 100755 --- a/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor/check-for-host-in-reset +++ b/meta-openbmc-mods/meta-common/recipes-network/network/ncsi-monitor/check-for-host-in-reset @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # PFR Boot Time Detection # @@ -51,14 +51,20 @@ RSMRST="RSMRST_N" # Read the assertion state from the RSMRST_N input function get_rsmrst_state { local __resultVal=$1 - local gpio_state=$($GPIOGET $($GPIOFIND "$RSMRST")) + local gpioFound=$($GPIOFIND $RSMRST) + # Test to see if the RSMRST_N input exists. This test does not cover the + # case where an input is already owned by another service/process. + if [ -z "$gpioFound" ] + then + return 1 + fi + local gpio_state=$($GPIOGET $gpioFound) eval $__resultVal="'$gpio_state'" return 0 } get_rsmrst_state rsmrst_val - -if [ "$rsmrst_val" -eq 0 ] +if [[ $? == 0 && $rsmrst_val -eq 0 ]] then echo "RSMRST_N is asserted, take eth1 down" ip link set down dev eth1 diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0003-Adding-channel-specific-privilege-to-network.patch b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0003-Adding-channel-specific-privilege-to-network.patch index f21283a75..153480728 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0003-Adding-channel-specific-privilege-to-network.patch +++ b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0003-Adding-channel-specific-privilege-to-network.patch @@ -1,4 +1,4 @@ -From 145778897e36f407773844b3b96847ff10306ee8 Mon Sep 17 00:00:00 2001 +From eacd73a119e55599d1f8837d04b4fa40452e5653 Mon Sep 17 00:00:00 2001 From: AppaRao Puli <apparao.puli@linux.intel.com> Date: Thu, 2 Apr 2020 17:06:07 +0530 Subject: [PATCH] Adding channel specific privilege to network @@ -23,11 +23,11 @@ Signed-off-by: Ramya Narayana <ramyax.narayana@intel.com> src/ethernet_interface.cpp | 124 +++++++++++++++++++++++++++++++++++++ src/ethernet_interface.hpp | 37 ++++++++++- src/network_manager.cpp | 102 ++++++++++++++++++++++++++++++ - src/network_manager.hpp | 9 +++ - 4 files changed, 271 insertions(+), 1 deletion(-) + src/network_manager.hpp | 7 +++ + 4 files changed, 269 insertions(+), 1 deletion(-) diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp -index 2e15803..1145773 100644 +index 44f46f6..61eb8de 100644 --- a/src/ethernet_interface.cpp +++ b/src/ethernet_interface.cpp @@ -48,6 +48,10 @@ constexpr auto PROPERTY_INTERFACE = "org.freedesktop.DBus.Properties"; @@ -49,7 +49,7 @@ index 2e15803..1145773 100644 // Emit deferred signal. if (emitSignal) -@@ -1322,5 +1327,124 @@ std::string EthernetInterface::defaultGateway6(std::string gateway) +@@ -1319,5 +1324,124 @@ std::string EthernetInterface::defaultGateway6(std::string gateway) return gw; } @@ -175,7 +175,7 @@ index 2e15803..1145773 100644 } // namespace network } // namespace phosphor diff --git a/src/ethernet_interface.hpp b/src/ethernet_interface.hpp -index 0fe3778..fa5c889 100644 +index 8928455..0f54814 100644 --- a/src/ethernet_interface.hpp +++ b/src/ethernet_interface.hpp @@ -2,11 +2,14 @@ @@ -233,7 +233,7 @@ index 0fe3778..fa5c889 100644 using EthernetInterfaceIntf::interfaceName; using EthernetInterfaceIntf::linkUp; using EthernetInterfaceIntf::mtu; -@@ -372,6 +387,26 @@ class EthernetInterface : public Ifaces +@@ -363,6 +378,26 @@ class EthernetInterface : public Ifaces * @returns true/false value if the NIC is enabled */ bool queryNicEnabled() const; @@ -261,10 +261,10 @@ index 0fe3778..fa5c889 100644 } // namespace network diff --git a/src/network_manager.cpp b/src/network_manager.cpp -index fe59f0b..01a99a3 100644 +index 19e4673..1c8bf3b 100644 --- a/src/network_manager.cpp +++ b/src/network_manager.cpp -@@ -39,6 +39,13 @@ extern std::unique_ptr<Timer> refreshObjectTimer; +@@ -39,6 +39,13 @@ extern std::unique_ptr<Timer> reloadTimer; using namespace phosphor::logging; using namespace sdbusplus::xyz::openbmc_project::Common::Error; @@ -381,27 +381,25 @@ index fe59f0b..01a99a3 100644 bool Manager::createDefaultNetworkFiles(bool force) diff --git a/src/network_manager.hpp b/src/network_manager.hpp -index fb3cc32..0c3d49b 100644 +index f574891..49f1cfa 100644 --- a/src/network_manager.hpp +++ b/src/network_manager.hpp -@@ -156,6 +156,12 @@ class Manager : public details::VLANCreateIface - return routeTable; +@@ -170,6 +170,11 @@ class Manager : public details::VLANCreateIface + { + reloadPreHooks.push_back(std::move(hook)); } - + /** supported privilege list **/ + std::vector<std::string> supportedPrivList; + + /** @brief initializes the supportedPrivilege List */ + void initSupportedPrivilges(); -+ + protected: /** @brief Persistent sdbusplus DBus bus connection. */ - sdbusplus::bus::bus& bus; -@@ -181,6 +187,9 @@ class Manager : public details::VLANCreateIface +@@ -199,6 +204,8 @@ class Manager : public details::VLANCreateIface - /** @brief The routing table */ - route::Table routeTable; -+ + /** @brief List of hooks to execute during the next reload */ + std::vector<fu2::unique_function<void()>> reloadPreHooks; + /** Get the user management service name dynamically **/ + std::string getUserServiceName(); }; diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Fix-for-updating-MAC-address-from-RedFish.patch b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Fix-for-updating-MAC-address-from-RedFish.patch deleted file mode 100644 index 90bbc1d5b..000000000 --- a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Fix-for-updating-MAC-address-from-RedFish.patch +++ /dev/null @@ -1,109 +0,0 @@ -From cbd034daf844529eb7f098c990dc8f44c12f6b97 Mon Sep 17 00:00:00 2001 -From: sunitakx <sunitax.kumari@linux.intel.com> -Date: Tue, 13 Jul 2021 12:54:01 +0000 -Subject: [PATCH] Fix for updating MAC address from RedFish - -Issue: When IP address source for an interface is DHCP and its MAC -address is patched using RedFish, response code is not reaching the -RedFish request initiator (client). - -RootCause: After bmcweb patches the MAC address, immediately IP address -of that interface also changes to new value (because of DHCP). -Due to this, success response from bmcweb is not reaching the client as -expected. - -Fix: Do MAC-ADDR patching after validating the request and responding -"200 OK" to RedFish client. i.e Start a timer which will modify the -MAC-ADDR at the end of its expiry. - -Tested: -Update the MAC address from RedFish. -PATCH: https://<bmc_ip>/redfish/v1/Managers/bmc/EthernetInterfaces/eth0 -Body: - {"MACAddress": "xx:xx:xx:xx:xx:xx"} - -Response code: {"200 OK"} received. - -Signed-off-by: sunitakx <sunitax.kumari@linux.intel.com> -Signed-off-by: Ramya Narayana <ramyax.narayana@intel.com> ---- - src/ethernet_interface.cpp | 17 ++++++++++++----- - src/ethernet_interface.hpp | 5 +++++ - 2 files changed, 17 insertions(+), 5 deletions(-) - -diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp -index 1145773..129905e 100644 ---- a/src/ethernet_interface.cpp -+++ b/src/ethernet_interface.cpp -@@ -143,6 +143,8 @@ EthernetInterface::EthernetInterface(sdbusplus::bus::bus& bus, - { - this->emit_object_added(); - } -+ macUpdateTimer = std::make_unique<phosphor::Timer>( -+ [this](void) { macAddressTimeoutHandler(); }); - } - - static IP::Protocol convertFamily(int family) -@@ -1209,8 +1211,17 @@ void EthernetInterface::writeDHCPSection(std::fstream& stream) - } - } - -+void EthernetInterface::macAddressTimeoutHandler() -+{ -+ macUpdateTimer->stop(); -+ // The MAC and LLADDRs will only update if the NIC is already down -+ EthernetIntfSocket eifSocket(PF_INET, SOCK_DGRAM, IPPROTO_IP); -+ setNICAdminState(eifSocket.sock, interfaceName().c_str(), false); -+ manager.reloadConfigs(); -+} - std::string EthernetInterface::macAddress(std::string value) - { -+ std::chrono::seconds usec(defaultTimeout); - ether_addr newMAC; - try - { -@@ -1244,12 +1255,8 @@ std::string EthernetInterface::macAddress(std::string value) - intf->MacAddressIntf::macAddress(validMAC); - } - MacAddressIntf::macAddress(validMAC); -- -+ macUpdateTimer->start(usec); - writeConfigurationFile(); -- // The MAC and LLADDRs will only update if the NIC is already down -- EthernetIntfSocket eifSocket(PF_INET, SOCK_DGRAM, IPPROTO_IP); -- setNICAdminState(eifSocket.sock, interface.c_str(), false); -- manager.reloadConfigs(); - } - - #ifdef HAVE_UBOOT_ENV -diff --git a/src/ethernet_interface.hpp b/src/ethernet_interface.hpp -index fa5c889..70f4756 100644 ---- a/src/ethernet_interface.hpp -+++ b/src/ethernet_interface.hpp -@@ -11,11 +11,14 @@ - #include <sdbusplus/bus.hpp> - #include <sdbusplus/bus/match.hpp> - #include <sdbusplus/server/object.hpp> -+#include <sdbusplus/timer.hpp> - #include <string> - #include <xyz/openbmc_project/Collection/DeleteAll/server.hpp> - #include <xyz/openbmc_project/Network/EthernetInterface/server.hpp> - #include <xyz/openbmc_project/Network/MACAddress/server.hpp> - -+static constexpr const uint32_t defaultTimeout = 1; -+ - namespace phosphor - { - namespace network -@@ -84,6 +87,8 @@ class EthernetInterface : public Ifaces - EthernetInterface& operator=(EthernetInterface&&) = delete; - virtual ~EthernetInterface() = default; - -+ std::unique_ptr<phosphor::Timer> macUpdateTimer; -+ void macAddressTimeoutHandler(); - /** @brief Constructor to put object onto bus at a dbus path. - * @param[in] bus - Bus to attach to. - * @param[in] objPath - Path to attach at. --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend index 4828c9ea0..a6cc6f510 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend @@ -3,10 +3,9 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" DEPENDS += "nlohmann-json boost" SRC_URI = "git://github.com/openbmc/phosphor-networkd" -SRCREV = "ee2cba8a7d22ef4a251181087e9ef9bfc5c4b165" +SRCREV = "cc5a670f1650e76b66750365bd4beecf821969fa" SRC_URI += " file://0003-Adding-channel-specific-privilege-to-network.patch \ - file://0004-Fix-for-updating-MAC-address-from-RedFish.patch \ " EXTRA_OECONF:append = " --enable-nic-ethtool=yes" diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr.bb b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr.bb index ee55c5407..c32e14b6f 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr.bb +++ b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr.bb @@ -4,6 +4,8 @@ DESCRIPTION = "Set a priority on MAC addresses to run with: \ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" +RDEPENDS:${PN} += "bash" + PV = "1.0" LICENSE = "Apache-2.0" @@ -11,7 +13,7 @@ LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fe SRC_URI = "\ file://mac-check \ - file://${PN}.service \ + file://${BPN}.service \ " inherit obmc-phosphor-systemd diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check index 39d7dd8a7..429f9264b 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check +++ b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Copyright 2018 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -158,4 +158,29 @@ done <<-END_CONF eth0 eth1addr eth1 ethaddr END_CONF + +### HOSTNAME FEATURE ### +if [[ $* == *--no-unique-hostname* ]]; then + echo "mac-check: Skipping hostname check" +else + # Read MAC and strip colon chars + hw_mac=$(cat /sys/class/net/eth0/address | tr -d ":") + # Read Hostname + hostname=$(hostname) + #Match bmc-mac<any MAC address> (a MAC address has 12 hex digits) + bmc_mac_format="^bmc-mac[a-f0-9]{12}$" + #Match bmc-mac<current MAC address> + inteldefault="bmc-mac$hw_mac" + #if the current hostname already has the current MAC address, we won't rewrite the name unnecessarily. + #Otherwise, match intel-obmc or bmc-mac<any MAC address>, and change the hostname to use the current MAC address + if [[ "$hostname" == "intel-obmc" || \ + ("$hostname" != "$inteldefault" && \ + "$hostname" =~ $bmc_mac_format) ]]; then + hostnamectl set-hostname "$inteldefault" + echo "mac-check: HOSTNAME CHANGED (hostname deemed to be default or wrong MAC Address)" + else + echo "mac-check: HOSTNAME NOT CHANGED (hostname is already correct or is custom)" + fi +fi + exit $first_error_seen 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 711e4eced..8f14552ad 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 = "29656f07b7e81c0bb13ca119b4c6ef62f5e79a18" +SRCREV = "616f9228daa5b94447c3c9d519b63f1686e751f5" SYSTEMD_SERVICE:${PN} += " \ xyz.openbmc_project.biosconfig_manager.service \ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0002-Entity-manager-Add-support-to-update-assetTag.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0002-Entity-manager-Add-support-to-update-assetTag.patch index 0fea3e8a0..12a0ce5ca 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0002-Entity-manager-Add-support-to-update-assetTag.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0002-Entity-manager-Add-support-to-update-assetTag.patch @@ -1,6 +1,6 @@ -From 0941036f4206d74bfc3d3e505a5d269fb39c48ff Mon Sep 17 00:00:00 2001 +From 31f3f766c9c6cc6c0b7c722030dbbf6de65b7e2f Mon Sep 17 00:00:00 2001 From: mansijos <mansi.joshi@intel.com> -Date: Tue, 6 Apr 2021 02:12:56 +0530 +Date: Mon, 3 Jan 2022 19:44:09 +0000 Subject: [PATCH] Entity-manager: Add support to update assetTag Asset tag is an updateable property from User level interface like @@ -12,26 +12,20 @@ Successfully updated in assetTag interface as well as in fru interface while using set-property and using redfish as well. The new value is preserved after BMC resets. -Change-Id: If7fbfd8325488280f500ab0e2c8b38475813cc3f Signed-off-by: mansijos <mansi.joshi@intel.com> --- - src/EntityManager.cpp | 95 +++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 91 insertions(+), 4 deletions(-) + src/EntityManager.cpp | 83 ++++++++++++++++++++++++++++++++++++++++--- + src/PerformScan.cpp | 11 ++++++ + 2 files changed, 90 insertions(+), 4 deletions(-) diff --git a/src/EntityManager.cpp b/src/EntityManager.cpp -index 490c0f5..139ba9a 100644 +index d327f2b..5fade71 100644 --- a/src/EntityManager.cpp +++ b/src/EntityManager.cpp -@@ -48,9 +48,19 @@ constexpr const char* lastConfiguration = "/tmp/configuration/last.json"; - constexpr const char* currentConfiguration = "/var/configuration/system.json"; +@@ -51,6 +51,13 @@ constexpr const char* currentConfiguration = "/var/configuration/system.json"; constexpr const char* globalSchema = "global.json"; - constexpr const int32_t maxMapperDepth = 0; -+constexpr const char* foundObject = "FoundProbe"; - constexpr const bool debug = false; -+ -+ +using foundProbeData = std::map<std::string, std::string>; +static foundProbeData foundData; +static std::map<std::string, foundProbeData> mapFoundData; @@ -39,10 +33,10 @@ index 490c0f5..139ba9a 100644 +constexpr const char* fruConn = "xyz.openbmc_project.FruDevice"; +constexpr const char* fruIntf = "xyz.openbmc_project.FruDevice"; + - struct CmpStr - { - bool operator()(const char* a, const char* b) const -@@ -577,6 +587,43 @@ void addArrayToDbus(const std::string& name, const nlohmann::json& array, + const boost::container::flat_map<const char*, probe_type_codes, CmpStr> + probeTypes{{{"FALSE", probe_type_codes::FALSE_T}, + {"TRUE", probe_type_codes::TRUE_T}, +@@ -205,6 +212,43 @@ void addArrayToDbus(const std::string& name, const nlohmann::json& array, } } @@ -86,7 +80,7 @@ index 490c0f5..139ba9a 100644 template <typename PropertyType> void addProperty(const std::string& propertyName, const PropertyType& value, sdbusplus::asio::dbus_interface* iface, -@@ -591,9 +638,18 @@ void addProperty(const std::string& propertyName, const PropertyType& value, +@@ -219,9 +263,18 @@ void addProperty(const std::string& propertyName, const PropertyType& value, } iface->register_property( propertyName, value, @@ -106,7 +100,7 @@ index 490c0f5..139ba9a 100644 val = newVal; if (!setJsonFromPointer(jsonPointerString, val, systemConfiguration)) -@@ -993,6 +1049,9 @@ void postToDbus(const nlohmann::json& newConfiguration, +@@ -621,6 +674,9 @@ void postToDbus(const nlohmann::json& newConfiguration, populateInterfaceFromJson(systemConfiguration, jsonPointerPath, boardIface, boardValues, objServer); jsonPointerPath += "/"; @@ -116,7 +110,7 @@ index 490c0f5..139ba9a 100644 // iterate through board properties for (auto& boardField : boardValues.items()) { -@@ -1002,9 +1061,28 @@ void postToDbus(const nlohmann::json& newConfiguration, +@@ -630,9 +686,28 @@ void postToDbus(const nlohmann::json& newConfiguration, createInterface(objServer, boardName, boardField.key(), boardKeyOrig); @@ -148,7 +142,20 @@ index 490c0f5..139ba9a 100644 } } -@@ -1362,6 +1440,11 @@ void PerformScan::run() +diff --git a/src/PerformScan.cpp b/src/PerformScan.cpp +index 5978710..5261ef7 100644 +--- a/src/PerformScan.cpp ++++ b/src/PerformScan.cpp +@@ -38,6 +38,8 @@ constexpr const int32_t maxMapperDepth = 0; + + constexpr const bool debug = false; + ++constexpr const char* foundObject = "FoundProbe"; ++ + void getInterfaces( + const std::tuple<std::string, std::string, std::string>& call, + const std::vector<std::shared_ptr<PerformProbe>>& probeVector, +@@ -359,6 +361,11 @@ void PerformScan::run() { continue; // non-numeric replacement } @@ -160,7 +167,7 @@ index 490c0f5..139ba9a 100644 usedNames.insert(nameIt.value()); auto usedIt = std::find(indexes.begin(), indexes.end(), index); -@@ -1439,6 +1522,10 @@ void PerformScan::run() +@@ -436,6 +443,10 @@ void PerformScan::run() } } 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 ba51f9454..32f0a7857 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 = "2c412eef8eb76bf2a998c9d193f2dc92aaec39f8" +SRCREV = "3b802f1c8c030965b76737966b9b022433e6ef5b" FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" 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 b8e0e7741..d8f77004b 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 = "e0764cf41d16b823a519e9d4f508b588e3e84aba" +SRCREV = "ed708de3a629531dc2fdb8e70946fb24e112d617" 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 328176aca..3da638514 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 = "cca9c659889d149c06e95bab4b8808db4f1e3eab" +SRCREV = "457993f836338aa0c13a32af803fcbc5227c81f3" SRC_URI += "\ file://0001-allow-dbus-sensors-without-thresholds.patch \ 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 0c97b0b86..21ff75f73 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 = "996facb65d554f7c0f14c10e3c9252d67a01e21a" +SRCREV = "6a5e0a1cba979c3c793e794c41481221da9a4e33" 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 6621d2512..4fb12ed04 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,6 +1,6 @@ -From 7c005c318a12c53ed887b3081bd4b34ea0213053 Mon Sep 17 00:00:00 2001 +From 74309a2b2f9a41b741816cb427d9008f67c6f160 Mon Sep 17 00:00:00 2001 From: Vikram Bodireddy <vikram.bodireddy@intel.com> -Date: Mon, 28 Jun 2021 21:56:18 +0530 +Date: Fri, 3 Dec 2021 05:25:02 +0530 Subject: [PATCH] Firmware update configuration changes This commit will provide user to PATCH the below firmware update @@ -39,20 +39,18 @@ 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 | 462 ++++++++++++++---- + redfish-core/lib/update_service.hpp | 337 ++++++++++++++++-- static/redfish/v1/$metadata/index.xml | 3 + - .../JsonSchemas/OemUpdateService/index.json | 69 +++ - .../redfish/v1/schema/OemUpdateService_v1.xml | 40 ++ - 4 files changed, 484 insertions(+), 90 deletions(-) + .../JsonSchemas/OemUpdateService/index.json | 69 ++++ + .../redfish/v1/schema/OemUpdateService_v1.xml | 40 +++ + 4 files changed, 421 insertions(+), 28 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 e420130..b3270f0 100644 +index fde878e..be0abc9 100644 --- a/redfish-core/lib/update_service.hpp +++ b/redfish-core/lib/update_service.hpp @@ -26,7 +26,9 @@ @@ -84,7 +82,7 @@ index e420130..b3270f0 100644 inline static void cleanUp() { -@@ -42,28 +55,120 @@ inline static void cleanUp() +@@ -42,27 +55,120 @@ inline static void cleanUp() fwUpdateErrorMatcher = nullptr; } inline static void activateImage(const std::string& objPath, @@ -97,13 +95,13 @@ index e420130..b3270f0 100644 + if (imgUriTargets.size() == 0) + { + crow::connections::systemBus->async_method_call( -+ [](const boost::system::error_code error_code) { -+ if (error_code) ++ [](const boost::system::error_code errorCode) { ++ if (errorCode) + { + BMCWEB_LOG_DEBUG + << "RequestedActivation failed: error_code = " -+ << error_code; -+ BMCWEB_LOG_DEBUG << "error msg = " << error_code.message(); ++ << errorCode; ++ BMCWEB_LOG_DEBUG << "error msg = " << errorCode.message(); + } + }, + service, objPath, "org.freedesktop.DBus.Properties", "Set", @@ -123,14 +121,14 @@ index e420130..b3270f0 100644 + const boost::system::error_code ec, + const crow::openbmc_mapper::GetSubTreeType& subtree) { + if (ec || !subtree.size()) -+ { + { +- BMCWEB_LOG_DEBUG << "error_code = " << errorCode; +- BMCWEB_LOG_DEBUG << "error msg = " << errorCode.message(); + return; + } + + for (const auto& [invObjPath, invDict] : subtree) - { -- BMCWEB_LOG_DEBUG << "error_code = " << errorCode; -- BMCWEB_LOG_DEBUG << "error msg = " << errorCode.message(); ++ { + std::size_t idPos = invObjPath.rfind("/"); + if ((idPos == std::string::npos) || + ((idPos + 1) >= invObjPath.size())) @@ -198,9 +196,8 @@ index e420130..b3270f0 100644 }, - service, objPath, "org.freedesktop.DBus.Properties", "Set", - "xyz.openbmc_project.Software.Activation", "RequestedActivation", -- std::variant<std::string>( -- "xyz.openbmc_project.Software.Activation.RequestedActivations." -- "Active")); +- dbus::utility::DbusVariantType( +- "xyz.openbmc_project.Software.Activation.RequestedActivations.Active")); + "xyz.openbmc_project.ObjectMapper", + "/xyz/openbmc_project/object_mapper", + "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/", @@ -215,7 +212,7 @@ index e420130..b3270f0 100644 sdbusplus::message::message& m, task::Payload&& payload) { -@@ -76,23 +181,25 @@ static void +@@ -75,23 +181,26 @@ static void m.read(objPath, interfacesProperties); @@ -234,11 +231,9 @@ index e420130..b3270f0 100644 + [objPath, asyncResp, imgTargets{imgUriTargets}, + 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) { + const std::vector< + std::pair<std::string, std::vector<std::string>>>& + objInfo) mutable { if (errorCode) { - BMCWEB_LOG_DEBUG << "error_code = " << errorCode; @@ -248,7 +243,7 @@ index e420130..b3270f0 100644 BMCWEB_LOG_DEBUG << "error msg = " << errorCode.message(); if (asyncResp) -@@ -119,7 +226,7 @@ static void +@@ -118,7 +227,7 @@ static void // is added fwAvailableTimer = nullptr; @@ -257,7 +252,7 @@ index e420130..b3270f0 100644 if (asyncResp) { std::shared_ptr<task::TaskData> task = -@@ -251,8 +358,7 @@ static void +@@ -249,8 +358,7 @@ static void "xyz.openbmc_project.ObjectMapper", "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetObject", objPath.str, @@ -267,7 +262,7 @@ index e420130..b3270f0 100644 } } } -@@ -262,7 +368,7 @@ static void +@@ -260,7 +368,7 @@ static void static void monitorForSoftwareAvailable( const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const crow::Request& req, const std::string& url, @@ -276,11 +271,9 @@ index e420130..b3270f0 100644 { // Only allow one FW update at a time if (fwUpdateInProgress != false) -@@ -301,11 +407,12 @@ static void monitorForSoftwareAvailable( - redfish::messages::internalError(asyncResp->res); +@@ -300,10 +408,10 @@ static void monitorForSoftwareAvailable( } }); -+ task::Payload payload(req); - auto callback = [asyncResp, + auto callback = [asyncResp, imgTargets{imgUriTargets}, @@ -291,7 +284,7 @@ index e420130..b3270f0 100644 }; fwUpdateInProgress = true; -@@ -470,12 +577,15 @@ inline void requestRoutesUpdateServiceActionsSimpleUpdate(App& app) +@@ -470,12 +578,15 @@ inline void requestRoutesUpdateServiceActionsSimpleUpdate(App& app) std::string fwFile = imageURI.substr(separator + 1); BMCWEB_LOG_DEBUG << "Server: " << tftpServer + " File: " << fwFile; @@ -308,7 +301,7 @@ index e420130..b3270f0 100644 // TFTP can take up to 10 minutes depending on image size and // connection speed. Return to caller as soon as the TFTP operation -@@ -524,6 +634,9 @@ inline void requestRoutesUpdateService(App& app) +@@ -524,6 +635,9 @@ inline void requestRoutesUpdateService(App& app) asyncResp->res.jsonValue["Name"] = "Update Service"; asyncResp->res.jsonValue["HttpPushUri"] = "/redfish/v1/UpdateService"; @@ -318,20 +311,10 @@ index e420130..b3270f0 100644 // UpdateService cannot be disabled asyncResp->res.jsonValue["ServiceEnabled"] = true; asyncResp->res.jsonValue["FirmwareInventory"] = { -@@ -538,7 +651,8 @@ inline void requestRoutesUpdateService(App& app) - asyncResp->res - .jsonValue["Actions"]["#UpdateService.SimpleUpdate"]; - updateSvcSimpleUpdate["target"] = -- "/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate"; -+ "/redfish/v1/UpdateService/Actions/" -+ "UpdateService.SimpleUpdate"; - updateSvcSimpleUpdate["TransferProtocol@Redfish.AllowableValues"] = - {"TFTP"}; - #endif -@@ -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"); +@@ -575,6 +689,34 @@ inline void requestRoutesUpdateService(App& app) + "OnReset"; + } + }); + + // Get the ApplyOptions value + crow::connections::systemBus->async_method_call( @@ -361,33 +344,26 @@ index e420130..b3270f0 100644 + "org.freedesktop.DBus.Properties", "Get", + "xyz.openbmc_project.Software.ApplyOptions", "ClearConfig"); }); -+ BMCWEB_ROUTE(app, "/redfish/v1/UpdateService/") .privileges(redfish::privileges::patchUpdateService) -- .methods(boost::beast::http::verb::patch)( -- [](const crow::Request& req, -- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { -- BMCWEB_LOG_DEBUG << "doPatch..."; -+ .methods( -+ boost::beast::http::verb:: -+ patch)([](const crow::Request& req, -+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { -+ BMCWEB_LOG_DEBUG << "doPatch..."; -+ -+ std::optional<nlohmann::json> pushUriOptions; +@@ -585,12 +727,60 @@ inline void requestRoutesUpdateService(App& app) + BMCWEB_LOG_DEBUG << "doPatch..."; + + std::optional<nlohmann::json> pushUriOptions; + std::optional<std::vector<std::string>> imgTargets; + std::optional<bool> imgTargetBusy; + std::optional<nlohmann::json> oemProps; -+ if (!json_util::readJson(req, asyncResp->res, "HttpPushUriOptions", + if (!json_util::readJson(req, asyncResp->res, "HttpPushUriOptions", +- pushUriOptions)) + pushUriOptions, "HttpPushUriTargets", + imgTargets, "HttpPushUriTargetsBusy", + imgTargetBusy, "Oem", oemProps)) -+ { + { + BMCWEB_LOG_DEBUG + << "UpdateService doPatch: Invalid request body"; -+ return; -+ } -+ + return; + } + + if (oemProps) + { + std::optional<nlohmann::json> applyOptions; @@ -406,10 +382,7 @@ index e420130..b3270f0 100644 + { + return; + } - -- std::optional<nlohmann::json> pushUriOptions; -- if (!json_util::readJson(req, asyncResp->res, -- "HttpPushUriOptions", pushUriOptions)) ++ + if (clearConfig) + { + // Set the requested image apply time value @@ -432,82 +405,13 @@ index e420130..b3270f0 100644 + } + } + } -+ if (pushUriOptions) -+ { -+ std::optional<nlohmann::json> pushUriApplyTime; -+ if (!json_util::readJson(*pushUriOptions, asyncResp->res, -+ "HttpPushUriApplyTime", -+ pushUriApplyTime)) - { - return; - } - -- if (pushUriOptions) -+ if (pushUriApplyTime) - { -- std::optional<nlohmann::json> pushUriApplyTime; -- if (!json_util::readJson(*pushUriOptions, asyncResp->res, -- "HttpPushUriApplyTime", -- pushUriApplyTime)) -+ std::optional<std::string> applyTime; -+ if (!json_util::readJson(*pushUriApplyTime, asyncResp->res, -+ "ApplyTime", applyTime)) - { - return; + if (pushUriOptions) + { + std::optional<nlohmann::json> pushUriApplyTime; +@@ -653,6 +843,98 @@ inline void requestRoutesUpdateService(App& app) } - -- if (pushUriApplyTime) -+ if (applyTime) - { -- std::optional<std::string> applyTime; -- if (!json_util::readJson(*pushUriApplyTime, -- asyncResp->res, "ApplyTime", -- 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"; -+ } -+ else -+ { -+ BMCWEB_LOG_INFO -+ << "ApplyTime value is not in the list of " -+ "acceptable values"; -+ messages::propertyValueNotInList( -+ asyncResp->res, *applyTime, "ApplyTime"); - return; - } - -- if (applyTime) -+ // Set the requested image apply time value -+ crow::connections::systemBus->async_method_call( -+ [asyncResp](const boost::system::error_code ec) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR -+ << "D-Bus responses error: " << ec; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ messages::success(asyncResp->res); -+ }, -+ "xyz.openbmc_project.Settings", -+ "/xyz/openbmc_project/software/apply_time", -+ "org.freedesktop.DBus.Properties", "Set", -+ "xyz.openbmc_project.Software.ApplyTime", -+ "RequestedApplyTime", -+ std::variant<std::string>{applyTimeNewVal}); -+ } -+ } -+ } + } + } + if (imgTargetBusy) + { + if ((httpPushUriTargetBusy) && (*imgTargetBusy)) @@ -539,29 +443,7 @@ index e420130..b3270f0 100644 + // single image in future. For now, consider first + // target alone. + if ((*imgTargets).size() != 1) - { -- 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"; -- } -- else -- { -- BMCWEB_LOG_INFO -- << "ApplyTime value is not in the list of " -- "acceptable values"; -- messages::propertyValueNotInList( -- asyncResp->res, *applyTime, "ApplyTime"); -- return; -- } ++ { + messages::invalidObject(asyncResp->res, + "HttpPushUriTargets"); + return; @@ -575,35 +457,19 @@ index e420130..b3270f0 100644 + { + return; + } - -- // Set the requested image apply time value -- crow::connections::systemBus->async_method_call( -- [asyncResp]( -- const boost::system::error_code ec) { -- if (ec) ++ + bool swInvObjFound = false; + for (const std::string& path : swInvPaths) + { + std::size_t idPos = path.rfind("/"); + if ((idPos == std::string::npos) || + ((idPos + 1) >= path.size())) - { -- BMCWEB_LOG_ERROR -- << "D-Bus responses error: " << ec; - messages::internalError(asyncResp->res); ++ { ++ messages::internalError(asyncResp->res); + BMCWEB_LOG_DEBUG + << "Can't parse firmware ID!!"; - return; - } -- messages::success(asyncResp->res); -- }, -- "xyz.openbmc_project.Settings", -- "/xyz/openbmc_project/software/apply_time", -- "org.freedesktop.DBus.Properties", "Set", -- "xyz.openbmc_project.Software.ApplyTime", -- "RequestedApplyTime", -- std::variant<std::string>{applyTimeNewVal}); -- } ++ return; ++ } + std::string swId = path.substr(idPos + 1); + + if (swId == uriTargets[0]) @@ -631,20 +497,17 @@ index e420130..b3270f0 100644 + { + httpPushUriTargetBusy = *imgTargetBusy; + httpPushUriTargets = *imgTargets; - } - } -- }); ++ } ++ } + else + { + httpPushUriTargetBusy = *imgTargetBusy; + } + } -+ }); -+ + }); BMCWEB_ROUTE(app, "/redfish/v1/UpdateService/") .privileges(redfish::privileges::postUpdateService) - .methods(boost::beast::http::verb::post)( -@@ -672,7 +955,8 @@ inline void requestRoutesUpdateService(App& app) +@@ -663,7 +945,8 @@ inline void requestRoutesUpdateService(App& app) // Setup callback for when new software detected monitorForSoftwareAvailable(asyncResp, req, @@ -654,26 +517,17 @@ index e420130..b3270f0 100644 std::string filepath("/tmp/images/" + boost::uuids::to_string( -@@ -685,7 +969,7 @@ inline void requestRoutesUpdateService(App& app) - out.close(); - BMCWEB_LOG_DEBUG << "file upload complete!!"; - }); --} -+} // namespace redfish - - 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), -- std::array<const char*, 1>{ -- "xyz.openbmc_project.Software.Version"}); -+ std::array<const char*, 1>{versionIntf}); - }); +@@ -739,8 +1022,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), +- std::array<const char*, 1>{ +- "xyz.openbmc_project.Software.Version"}); ++ std::array<const char*, 1>{versionIntf}); + }); } /* Fill related item links (i.e. bmc, bios) in for inventory */ -@@ -913,7 +1196,7 @@ inline void requestRoutesSoftwareInventory(App& app) +@@ -908,7 +1190,7 @@ inline void requestRoutesSoftwareInventory(App& app) }, obj.second[0].first, obj.first, "org.freedesktop.DBus.Properties", "GetAll", @@ -682,7 +536,7 @@ index e420130..b3270f0 100644 } if (!found) { -@@ -937,8 +1220,7 @@ inline void requestRoutesSoftwareInventory(App& app) +@@ -932,8 +1214,7 @@ inline void requestRoutesSoftwareInventory(App& app) "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/", static_cast<int32_t>(0), @@ -693,10 +547,10 @@ index e420130..b3270f0 100644 } diff --git a/static/redfish/v1/$metadata/index.xml b/static/redfish/v1/$metadata/index.xml -index 66b6faf..f0919c9 100644 +index 445af04..de7dc77 100644 --- a/static/redfish/v1/$metadata/index.xml +++ b/static/redfish/v1/$metadata/index.xml -@@ -2444,6 +2444,9 @@ +@@ -2502,6 +2502,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/0025-Add-Model-CoreCount-to-ProcessorSummary.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0025-Add-Model-CoreCount-to-ProcessorSummary.patch deleted file mode 100644 index edf4d219e..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0025-Add-Model-CoreCount-to-ProcessorSummary.patch +++ /dev/null @@ -1,288 +0,0 @@ -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/0025-Add-Model-to-ProcessorSummary.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0025-Add-Model-to-ProcessorSummary.patch new file mode 100644 index 000000000..92654bee1 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0025-Add-Model-to-ProcessorSummary.patch @@ -0,0 +1,108 @@ +From 1b34b289eacc2ebb9c343680a3696dda4abe4a37 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 to ProcessorSummary + +In Redfish ComputerSystem schema, the ProcessorSummary parameter +lists summary information of the Processors on the system. This commit +adds the 'Model' property 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 | 47 +++++++++++++++++++++++++++++++----- + 1 file changed, 41 insertions(+), 6 deletions(-) + +diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp +index 2f88a777..8406bd4d 100644 +--- a/redfish-core/lib/systems.hpp ++++ b/redfish-core/lib/systems.hpp +@@ -185,21 +185,56 @@ inline void getProcessorProperties( + + 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*>(); + +- // TODO: Get Model ++ // If CPU Models are different, use the first entry in ++ // alphabetical order + +- // Get CoreCount +- if (property.first == "CoreCount") ++ // 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) + { +- messages::internalError(aResp->res); +- return; ++ BMCWEB_LOG_DEBUG << "Failed to get CPU Core count"; ++ // Skip it and continue with other properties ++ continue; + } + + nlohmann::json& coreCount = +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0026-Revert-Delete-the-copy-constructor-on-the-Request.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0026-Revert-Delete-the-copy-constructor-on-the-Request.patch new file mode 100644 index 000000000..9f21b8475 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0026-Revert-Delete-the-copy-constructor-on-the-Request.patch @@ -0,0 +1,30 @@ +From d9488db9785b599d2c1e3a9d9fe1d2b5fa953865 Mon Sep 17 00:00:00 2001 +From: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +Date: Tue, 4 Jan 2022 06:49:58 +0530 +Subject: [PATCH] Revert "Delete the copy constructor on the Request object" + +This commit is reverted to resolve build issues due arising due +to removal of the copy constructor. + +This reverts commit 597d2b142362bafa90f24fc8c30750afab91f78f. +--- + http/http_request.hpp | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/http/http_request.hpp b/http/http_request.hpp +index 4567314..be84f18 100644 +--- a/http/http_request.hpp ++++ b/http/http_request.hpp +@@ -45,9 +45,6 @@ struct Request + } + } + +- Request(const Request&) = delete; +- Request& operator=(const Request&) = delete; +- + boost::beast::http::verb method() const + { + return req.method(); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0027-Convert-VariantType-to-DbusVariantType.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0027-Convert-VariantType-to-DbusVariantType.patch new file mode 100644 index 000000000..f9bb69826 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0027-Convert-VariantType-to-DbusVariantType.patch @@ -0,0 +1,50 @@ +From 8e78ffc54b2a5444e96cdcc1440928b04e21c2a5 Mon Sep 17 00:00:00 2001 +From: AppaRao Puli <apparao.puli@intel.com> +Date: Thu, 6 Jan 2022 01:37:08 +0000 +Subject: [PATCH] Convert VariantType to DbusVariantType + +All bmcweb code is now converted to use +DbusVariantType to reduce the image size. + +Its missed in one place where the code is under compiler +flag BMCWEB_ENABLE_REDFISH_PROVISIONING_FEATURE. This commit +convert missed types to DbusVariantType. + +Tested: +After conversion, image builds fine with compiler +flag enabled. Also tested the PFR provisioned +dbus calls and it works fine. + +Signed-off-by: AppaRao Puli <apparao.puli@intel.com> +--- + redfish-core/lib/systems.hpp | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp +index 5fbd568..e9ae7ca 100644 +--- a/redfish-core/lib/systems.hpp ++++ b/redfish-core/lib/systems.hpp +@@ -1840,7 +1840,8 @@ inline void getProvisioningStatus(std::shared_ptr<bmcweb::AsyncResp> aResp) + BMCWEB_LOG_DEBUG << "Get OEM information."; + crow::connections::systemBus->async_method_call( + [aResp](const boost::system::error_code ec, +- const std::vector<std::pair<std::string, VariantType>>& ++ const std::vector< ++ std::pair<std::string, dbus::utility::DbusVariantType>>& + propertiesList) { + nlohmann::json& oemPFR = + aResp->res.jsonValue["Oem"]["OpenBmc"]["FirmwareProvisioning"]; +@@ -1858,8 +1859,8 @@ inline void getProvisioningStatus(std::shared_ptr<bmcweb::AsyncResp> aResp) + + const bool* provState = nullptr; + const bool* lockState = nullptr; +- for (const std::pair<std::string, VariantType>& property : +- propertiesList) ++ for (const std::pair<std::string, dbus::utility::DbusVariantType>& ++ property : propertiesList) + { + if (property.first == "UfmProvisioned") + { +-- +2.17.1 + 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 2e72a639d..85b5b3494 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 f75beb0472a42d5af512661470aadf12ac460470 Mon Sep 17 00:00:00 2001 +From 8225b2dc07279c65cdfe2ddc13964d84fd2ed8bb Mon Sep 17 00:00:00 2001 From: Arun Lal K M <arun.lal@intel.com> -Date: Fri, 8 Oct 2021 21:30:33 +0000 +Date: Tue, 4 Jan 2022 01:56:57 +0000 Subject: [PATCH] Add fix for broken feature 'Pending Attributes'. Fix is added for the following: @@ -10,6 +10,7 @@ Fix is added for the following: 4) Fix for incremental duplicate values in BiosAttributeRegistry. 5) POST to '/redfish/v1/Systems/system/Bios/Actions /Bios.ChangePassword/'. +6) Add support for Enumeration. Tested: By giving PATCH to 'redfish/v1/Systems/system/Bios/Settings' @@ -133,11 +134,11 @@ Validation has succeeded. 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 | 586 ++++++++++++++++++++++++-------------- - 1 file changed, 376 insertions(+), 210 deletions(-) + redfish-core/lib/bios.hpp | 592 ++++++++++++++++++++++++-------------- + 1 file changed, 383 insertions(+), 209 deletions(-) diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index 0bb0b9e..de79be2 100644 +index 0bb0b9e..69340eb 100644 --- a/redfish-core/lib/bios.hpp +++ b/redfish-core/lib/bios.hpp @@ -12,13 +12,15 @@ map{attributeName,struct{attributeType,readonlyStatus,displayname, @@ -191,7 +192,7 @@ index 0bb0b9e..de79be2 100644 enum PendingAttributesIndex { pendingAttrType = 0, -@@ -64,31 +63,16 @@ enum PendingAttributesIndex +@@ -64,30 +63,20 @@ enum PendingAttributesIndex static std::string mapAttrTypeToRedfish(const std::string_view typeDbus) { std::string ret; @@ -217,15 +218,16 @@ index 0bb0b9e..de79be2 100644 { ret = "Integer"; } -- else if (typeDbus == "xyz.openbmc_project.BIOSConfig." + else if (typeDbus == "xyz.openbmc_project.BIOSConfig." - "Manager.AttributeType.Boolean") -- { ++ "Manager.AttributeType.Enumeration") + { - ret = "Boolean"; -- } ++ ret = "Enumeration"; + } else { - ret = "UNKNOWN"; -@@ -96,29 +80,7 @@ static std::string mapAttrTypeToRedfish(const std::string_view typeDbus) +@@ -96,29 +85,7 @@ static std::string mapAttrTypeToRedfish(const std::string_view typeDbus) return ret; } @@ -255,7 +257,7 @@ index 0bb0b9e..de79be2 100644 static std::string mapBoundTypeToRedfish(const std::string_view typeDbus) { std::string ret; -@@ -201,6 +163,15 @@ inline void +@@ -201,6 +168,15 @@ inline void return; } @@ -271,7 +273,7 @@ index 0bb0b9e..de79be2 100644 const std::string& service = getObjectType.begin()->first; crow::connections::systemBus->async_method_call( -@@ -220,7 +191,7 @@ inline void +@@ -220,7 +196,7 @@ inline void asyncResp->res.jsonValue["Attributes"]; if (baseBiosTable == nullptr) { @@ -280,7 +282,16 @@ index 0bb0b9e..de79be2 100644 messages::internalError(asyncResp->res); return; } -@@ -248,7 +219,6 @@ inline void +@@ -230,7 +206,7 @@ inline void + const std::string& itemType = + std::get<biosBaseAttrType>(item.second); + std::string attrType = mapAttrTypeToRedfish(itemType); +- if (attrType == "String") ++ if (attrType == "String" || attrType == "Enumeration") + { + const std::string* currValue = + std::get_if<std::string>( +@@ -248,7 +224,6 @@ inline void else { BMCWEB_LOG_ERROR << "Unsupported attribute type."; @@ -288,7 +299,7 @@ index 0bb0b9e..de79be2 100644 } } }, -@@ -275,8 +245,9 @@ inline void requestRoutesBiosService(App& app) +@@ -275,8 +250,9 @@ inline void requestRoutesBiosService(App& app) */ inline void requestRoutesBiosChangePassword(App& app) { @@ -300,7 +311,7 @@ index 0bb0b9e..de79be2 100644 .methods(boost::beast::http::verb::post)( [](const crow::Request& req, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { -@@ -342,180 +313,298 @@ inline void requestRoutesBiosSettings(App& app) +@@ -342,180 +318,300 @@ inline void requestRoutesBiosSettings(App& app) { BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Bios/Settings") .privileges(redfish::privileges::getBios) @@ -429,7 +440,8 @@ index 0bb0b9e..de79be2 100644 + std::string itemType = + mapAttrTypeToRedfish(biosAttrType); + -+ if (itemType == "String") ++ if (itemType == "String" || ++ itemType == "Enumeration") { - const std::string& key = item.first; - const std::string& itemType = @@ -625,9 +637,9 @@ index 0bb0b9e..de79be2 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); @@ -635,9 +647,9 @@ index 0bb0b9e..de79be2 100644 + if (baseBiosTable == nullptr) + { + BMCWEB_LOG_ERROR << "baseBiosTable is empty."; - messages::internalError(asyncResp->res); - return; - } ++ messages::internalError(asyncResp->res); ++ return; ++ } + + PendingAttributesType pendingAttributes{}; + @@ -665,7 +677,8 @@ index 0bb0b9e..de79be2 100644 + std::string attrType = + mapAttrTypeToRedfish(itemType); + -+ if (attrType == "String") ++ if (attrType == "String" || ++ attrType == "Enumeration") + { + std::string val = attributes.value(); + @@ -741,7 +754,7 @@ index 0bb0b9e..de79be2 100644 } /** * BiosAttributeRegistry class supports handle get method for BIOS attribute -@@ -555,6 +644,15 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -555,6 +651,15 @@ inline void requestRoutesBiosAttributeRegistry(App& app) return; } @@ -757,7 +770,7 @@ index 0bb0b9e..de79be2 100644 std::string service = getObjectType.begin()->first; crow::connections::systemBus->async_method_call( -@@ -575,8 +673,6 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -575,8 +680,6 @@ inline void requestRoutesBiosAttributeRegistry(App& app) nlohmann::json& attributeArray = asyncResp->res .jsonValue["RegistryEntries"]["Attributes"]; @@ -766,7 +779,7 @@ index 0bb0b9e..de79be2 100644 if (baseBiosTable == nullptr) { BMCWEB_LOG_ERROR << "baseBiosTable == nullptr "; -@@ -592,10 +688,11 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -592,10 +695,11 @@ inline void requestRoutesBiosAttributeRegistry(App& app) mapAttrTypeToRedfish(itemType); if (attrType == "UNKNOWN") { @@ -781,7 +794,15 @@ index 0bb0b9e..de79be2 100644 nlohmann::json attributeItem; attributeItem["AttributeName"] = item.first; attributeItem["Type"] = attrType; -@@ -615,10 +712,30 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -609,16 +713,37 @@ inline void requestRoutesBiosAttributeRegistry(App& app) + attributeItem["MenuPath"] = + std::get<biosBaseMenuPath>(item.second); + +- if (attrType == "String") ++ if (attrType == "String" || ++ attrType == "Enumeration") + { + const std::string* currValue = std::get_if<std::string>( &std::get<biosBaseCurrValue>( item.second)); @@ -812,7 +833,7 @@ index 0bb0b9e..de79be2 100644 attributeItem["CurrentValue"] = currValue != nullptr ? *currValue : ""; attributeItem["DefaultValue"] = -@@ -630,10 +747,30 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -630,10 +755,30 @@ inline void requestRoutesBiosAttributeRegistry(App& app) std::get_if<int64_t>( &std::get<biosBaseCurrValue>( item.second)); @@ -843,7 +864,7 @@ index 0bb0b9e..de79be2 100644 attributeItem["CurrentValue"] = currValue != nullptr ? *currValue : 0; attributeItem["DefaultValue"] = -@@ -641,12 +778,13 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -641,12 +786,13 @@ inline void requestRoutesBiosAttributeRegistry(App& app) } else { @@ -861,7 +882,7 @@ index 0bb0b9e..de79be2 100644 const std::vector<OptionsItemType>& optionsVector = std::get<biosBaseOptions>(item.second); -@@ -661,9 +799,9 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -661,9 +807,9 @@ inline void requestRoutesBiosAttributeRegistry(App& app) if (optItemTypeRedfish == "UNKNOWN") { BMCWEB_LOG_ERROR @@ -874,7 +895,7 @@ index 0bb0b9e..de79be2 100644 } if (optItemTypeRedfish == "OneOf") { -@@ -671,6 +809,17 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -671,6 +817,17 @@ inline void requestRoutesBiosAttributeRegistry(App& app) std::get_if<std::string>( &std::get<optItemValue>( optItem)); @@ -892,7 +913,7 @@ index 0bb0b9e..de79be2 100644 optItemJson[optItemTypeRedfish] = currValue != nullptr ? *currValue : ""; -@@ -681,6 +830,17 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -681,6 +838,17 @@ inline void requestRoutesBiosAttributeRegistry(App& app) std::get_if<int64_t>( &std::get<optItemValue>( optItem)); @@ -910,7 +931,7 @@ index 0bb0b9e..de79be2 100644 optItemJson[optItemTypeRedfish] = currValue != nullptr ? *currValue : 0; -@@ -689,6 +849,12 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -689,6 +857,12 @@ inline void requestRoutesBiosAttributeRegistry(App& app) optionsArray.push_back(optItemJson); } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0007-Add-BiosAttributeRegistry-node-under-Registries.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0007-Add-BiosAttributeRegistry-node-under-Registries.patch new file mode 100644 index 000000000..5e05e8f3a --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0007-Add-BiosAttributeRegistry-node-under-Registries.patch @@ -0,0 +1,76 @@ +From cf2e892bdd85b8fe1ccaf1296e02d8589aef05c1 Mon Sep 17 00:00:00 2001 +From: Snehalatha Venkatesh <snehalathax.v@intel.com> +Date: Tue, 28 Dec 2021 11:05:50 +0000 +Subject: [PATCH] Add BiosAttributeRegistry node under Registries. + +/redfish/v1/Registries/ is missing node BiosAttributeRegistry +under it. Added code to fix the same. + +Tested: +1.Ran Redfish Validator and passed. +2.GET - /redfish/v1/Registries/ + +Response: +{ +"@odata.id": "/redfish/v1/Registries", +"@odata.type": "#MessageRegistryFileCollection.MessageRegistryFileCollection", +"Description": "Collection of MessageRegistryFiles", +"Members": [ +{ +"@odata.id": "/redfish/v1/Registries/Base" +}, +{ +"@odata.id": "/redfish/v1/Registries/TaskEvent" +}, +{ +"@odata.id": "/redfish/v1/Registries/ResourceEvent" +}, +{ +"@odata.id": "/redfish/v1/Registries/BiosAttributeRegistry" +}, +{ +"@odata.id": "/redfish/v1/Registries/OpenBMC" +} +], +"Members@odata.count": 5, +"Name": "MessageRegistryFile Collection" +} + +Signed-off-by: Snehalatha Venkatesh <snehalathax.v@intel.com> +--- + redfish-core/lib/message_registries.hpp | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp +index 510b19a..0467f1e 100644 +--- a/redfish-core/lib/message_registries.hpp ++++ b/redfish-core/lib/message_registries.hpp +@@ -40,11 +40,12 @@ inline void handleMessageRegistryFileCollectionGet( + {"@odata.id", "/redfish/v1/Registries"}, + {"Name", "MessageRegistryFile Collection"}, + {"Description", "Collection of MessageRegistryFiles"}, +- {"Members@odata.count", 4}, ++ {"Members@odata.count", 5}, + {"Members", + {{{"@odata.id", "/redfish/v1/Registries/Base"}}, + {{"@odata.id", "/redfish/v1/Registries/TaskEvent"}}, + {{"@odata.id", "/redfish/v1/Registries/ResourceEvent"}}, ++ {{"@odata.id", "/redfish/v1/Registries/BiosAttributeRegistry"}}, + {{"@odata.id", "/redfish/v1/Registries/OpenBMC"}}}}}; + } + +@@ -87,6 +88,11 @@ inline void handleMessageRoutesMessageRegistryFileGet( + 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( +-- +2.17.1 + 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 index 52135e255..7229f9aa7 100644 --- 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 @@ -1,6 +1,6 @@ -From 6ff897d2b5513f15445f18aae16d8439ed94f377 Mon Sep 17 00:00:00 2001 +From 43b629c180e1b4350a9e9bd917d81a49acb57731 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 +Date: Mon, 6 Dec 2021 19:49:01 +0000 Subject: [PATCH] Add unmerged changes for http retry support The http retry support added upstream as a single patch was slpit into @@ -9,45 +9,19 @@ 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 +Change-Id: I43e68eeffb8d69c289dd306c1c7cafc87ad766a0 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(-) + http/http_client.hpp | 32 ++++++++++++++++--- + .../include/event_service_manager.hpp | 26 +++++++++------ + redfish-core/lib/event_service.hpp | 1 + + 3 files changed, 45 insertions(+), 14 deletions(-) diff --git a/http/http_client.hpp b/http/http_client.hpp -index ab20eb0..aad1cce 100644 +index 0c9e387..0701d9e 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> +@@ -189,6 +189,17 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> BMCWEB_LOG_DEBUG << "recvMessage() data: " << self->parser->get(); @@ -65,57 +39,125 @@ index ab20eb0..aad1cce 100644 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> +@@ -381,15 +392,17 @@ 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, - const std::string& destUri) : +- const std::string& destUri, +- const boost::beast::http::fields& httpHeader) : ++ 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) +- timer(ioc), +- req(boost::beast::http::verb::post, destUri, 11, "", httpHeader), +- subId(id), host(destIP), port(destPort) ++ timer(ioc), req(boost::beast::http::verb::post, destUri, 11), subId(id), ++ host(destIP), port(destPort) { -- state = ConnState::initialized; + // Set the request header -+ req.set(boost::beast::http::field::host, host); + req.set(boost::beast::http::field::host, host); + req.set(boost::beast::http::field::content_type, "application/json"); -+ req.keep_alive(true); + 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> +@@ -412,6 +425,15 @@ 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; ++ void setHeaders(const boost::beast::http::fields& httpHeaders) ++ { + // Set custom headers -+ for (const auto& [key, value] : httpHeaders) ++ for (const auto& header : httpHeaders) + { -+ req.set(key, value); ++ req.set(header.name(), header.value()); + } - } - ++ } ++ void setRetryConfig(const uint32_t retryAttempts, + const uint32_t retryTimeoutInterval) + { diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index 8042803..0a63b8c 100644 +index e0f290c..7a2f096 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++; +@@ -384,7 +384,10 @@ class Subscription : public persistent_data::UserSubscription + eventSeqNum(1), + host(inHost), port(inPort), path(inPath), uriProto(inUriProto) + { +- // Subscription constructor ++ // create the HttpClient connection ++ conn = std::make_shared<crow::HttpClient>( ++ crow::connections::systemBus->get_io_context(), id, host, port, ++ path); + } + + Subscription(const std::shared_ptr<boost::beast::tcp_stream>& adaptor) : +@@ -397,17 +400,12 @@ class Subscription : public persistent_data::UserSubscription + + void sendEvent(const std::string& msg) + { +- if (conn == nullptr) ++ if (conn != nullptr) + { +- // create the HttpClient connection +- conn = std::make_shared<crow::HttpClient>( +- crow::connections::systemBus->get_io_context(), id, host, port, +- path, httpHeaders); ++ conn->sendData(msg); ++ eventSeqNum++; } + +- conn->sendData(msg); +- eventSeqNum++; +- + if (sseConn != nullptr) + { + sseConn->sendData(eventSeqNum, msg); +@@ -551,6 +549,14 @@ class Subscription : public persistent_data::UserSubscription + } + } + ++ void updatehttpHeaders() ++ { ++ if (conn != nullptr) ++ { ++ conn->setHeaders(httpHeaders); ++ } ++ } ++ + uint64_t getEventSeqNum() + { + return eventSeqNum; +@@ -664,6 +670,7 @@ class EventServiceManager + // Update retry configuration. + subValue->updateRetryConfig(retryAttempts, retryTimeoutInterval); + subValue->updateRetryPolicy(); ++ subValue->updatehttpHeaders(); + } + return; + } +@@ -919,6 +926,7 @@ class EventServiceManager + // Update retry configuration. + subValue->updateRetryConfig(retryAttempts, retryTimeoutInterval); + subValue->updateRetryPolicy(); ++ subValue->updatehttpHeaders(); + + return id; + } +diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp +index d273aea..7739ad0 100644 +--- a/redfish-core/lib/event_service.hpp ++++ b/redfish-core/lib/event_service.hpp +@@ -611,6 +611,7 @@ inline void requestRoutesEventDestination(App& app) + } + } + subValue->httpHeaders = fields; ++ subValue->updatehttpHeaders(); + } + + if (retryPolicy) -- 2.17.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 aeeafc421..2125fcc52 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,6 +1,6 @@ -From 3f2ad28e6e124249cde3df50c9e18c283fbcbf3e Mon Sep 17 00:00:00 2001 +From b5e0024f33afc95751afe14e66c38bf9802645f6 Mon Sep 17 00:00:00 2001 From: AppaRao Puli <apparao.puli@linux.intel.com> -Date: Mon, 22 Feb 2021 17:07:47 +0000 +Date: Mon, 6 Dec 2021 21:39:05 +0000 Subject: [PATCH] EventService: https client support Add https client support for push style eventing. Using this BMC can @@ -13,15 +13,16 @@ Tested: listener. - Validator passed. -Change-Id: I44c3918b39baa2eb5fddda9d635f99aa280a422a +Change-Id: I480085344ba7bed6ec0d94876eda1d252e51cb45 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_client.hpp | 307 ++++++++++++------ .../include/event_service_manager.hpp | 2 +- - 2 files changed, 202 insertions(+), 107 deletions(-) + 2 files changed, 204 insertions(+), 105 deletions(-) diff --git a/http/http_client.hpp b/http/http_client.hpp -index aad1cce..5e7ff47 100644 +index d3d3491..58b5402 100644 --- a/http/http_client.hpp +++ b/http/http_client.hpp @@ -20,6 +20,7 @@ @@ -30,9 +31,9 @@ index aad1cce..5e7ff47 100644 #include <boost/beast/http/message.hpp> +#include <boost/beast/ssl/ssl_stream.hpp> #include <boost/beast/version.hpp> + #include <boost/circular_buffer.hpp> #include <include/async_resolve.hpp> - -@@ -43,6 +44,8 @@ enum class ConnState +@@ -44,6 +45,8 @@ enum class ConnState resolveFailed, connectInProgress, connectFailed, @@ -41,7 +42,7 @@ index aad1cce..5e7ff47 100644 connected, sendInProgress, sendFailed, -@@ -61,7 +64,9 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -62,7 +65,9 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> { private: crow::async_resolve::Resolver resolver; @@ -51,7 +52,7 @@ index aad1cce..5e7ff47 100644 boost::asio::steady_timer timer; boost::beast::flat_static_buffer<httpReadBodyLimit> buffer; boost::beast::http::request<boost::beast::http::string_body> req; -@@ -108,23 +113,52 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -110,23 +115,52 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> const std::vector<boost::asio::ip::tcp::endpoint>& endpointList) { state = ConnState::connectInProgress; @@ -112,15 +113,7 @@ index aad1cce..5e7ff47 100644 self->state = ConnState::connected; self->handleConnState(); }); -@@ -132,132 +166,187 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> - - void sendMessage(const std::string& data) - { -- state = ConnState::sendInProgress; -- - BMCWEB_LOG_DEBUG << __FUNCTION__ << "(): " << host << ":" << port; -+ state = ConnState::sendInProgress; - +@@ -139,124 +173,182 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> req.body() = data; req.prepare_payload(); @@ -173,23 +166,52 @@ index aad1cce..5e7ff47 100644 + boost::beast::http::async_write(conn, req, std::move(respHandler)); + } } -- + void recvMessage() { state = ConnState::recvInProgress; +- parser.emplace(std::piecewise_construct, std::make_tuple()); +- parser->body_limit(httpReadBodyLimit); + auto respHandler = [self(shared_from_this())]( + const boost::beast::error_code ec, + const std::size_t& bytesTransferred) { + if (ec && ec != boost::asio::ssl::error::stream_truncated) + { + BMCWEB_LOG_ERROR << "recvMessage() failed: " << ec.message(); -+ + +- // Receive the HTTP response +- boost::beast::http::async_read( +- conn, buffer, *parser, +- [self(shared_from_this())](const boost::beast::error_code& ec, +- const std::size_t& bytesTransferred) { +- if (ec) +- { +- BMCWEB_LOG_ERROR << "recvMessage() failed: " +- << ec.message(); +- self->state = ConnState::recvFailed; +- self->handleConnState(); +- return; +- } +- BMCWEB_LOG_DEBUG << "recvMessage() bytes transferred: " +- << bytesTransferred; +- BMCWEB_LOG_DEBUG << "recvMessage() data: " +- << self->parser->get(); + self->state = ConnState::recvFailed; + self->handleConnState(); + return; + } -+ + +- // 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; +- } + BMCWEB_LOG_DEBUG << "recvMessage() bytes transferred: " + << bytesTransferred; + boost::ignore_unused(bytesTransferred); @@ -204,11 +226,26 @@ index aad1cce..5e7ff47 100644 + self->handleConnState(); + return; + } -+ + +- unsigned int respCode = self->parser->get().result_int(); +- BMCWEB_LOG_DEBUG << "recvMessage() Header Response Code: " +- << respCode; + 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. Header Response Code: " +- << respCode; +- self->state = ConnState::recvFailed; +- self->handleConnState(); +- return; +- } + // 2XX response is considered to be successful + if ((respCode < 200) || (respCode >= 300)) + { @@ -219,7 +256,14 @@ index aad1cce..5e7ff47 100644 + 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; + // Send is successful, Lets remove data from queue + // check for next request data in queue. + if (!self->requestDataQueue.empty()) @@ -236,17 +280,30 @@ index aad1cce..5e7ff47 100644 + // Abort the connection since server is not keep-alive enabled + self->state = ConnState::abortConnection; + } -+ + +- // 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(); +- }); +- } + self->handleConnState(); + }; - parser.emplace(std::piecewise_construct, std::make_tuple()); - parser->body_limit(httpReadBodyLimit); ++ parser.emplace(std::piecewise_construct, std::make_tuple()); ++ parser->body_limit(httpReadBodyLimit); - // Check only for the response header - parser->skip(true); ++ // Check only for the response header ++ parser->skip(true); + conn.expires_after(std::chrono::seconds(30)); + if (sslConn) + { @@ -259,28 +316,25 @@ index aad1cce..5e7ff47 100644 + std::move(respHandler)); + } + } -+ void doClose() -+ { -+ state = ConnState::closeInProgress; + void doClose() + { + state = ConnState::closeInProgress; +- boost::beast::error_code ec; +- conn.socket().shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec); +- conn.close(); -- // Receive the HTTP response -- boost::beast::http::async_read( -- conn, buffer, *parser, -- [self(shared_from_this())](const boost::beast::error_code& ec, -- const std::size_t& bytesTransferred) { +- // not_connected happens sometimes so don't bother reporting it. +- if (ec && ec != boost::beast::errc::not_connected) + // Set the timeout on the tcp stream socket for the async operation + conn.expires_after(std::chrono::seconds(30)); + if (sslConn) -+ { + { +- BMCWEB_LOG_ERROR << "shutdown failed: " << ec.message(); +- return; + sslConn->async_shutdown([self = shared_from_this()]( + const boost::system::error_code ec) { - if (ec) - { -- BMCWEB_LOG_ERROR << "recvMessage() failed: " -- << ec.message(); -- self->state = ConnState::recvFailed; -- self->handleConnState(); -- return; ++ if (ec) ++ { + // Many https server closes connection abruptly + // i.e witnout close_notify. More details are at + // https://github.com/boostorg/beast/issues/824 @@ -294,79 +348,20 @@ index aad1cce..5e7ff47 100644 + BMCWEB_LOG_ERROR << "doClose() failed: " + << ec.message(); + } - } -- BMCWEB_LOG_DEBUG << "recvMessage() bytes transferred: " -- << bytesTransferred; -- BMCWEB_LOG_DEBUG << "recvMessage() data: " -- << self->parser->get(); -- -- // Check if the response and header are received -- if (!self->parser->is_done()) ++ } + else - { -- // 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->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()) -- { -- // Abort the connection since server is not keep-alive -- // enabled -- self->state = ConnState::abortConnection; -- } -- -- 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(); -- -- // not_connected happens sometimes so don't bother reporting it. -- if (ec && ec != boost::beast::errc::not_connected) -- { -- BMCWEB_LOG_ERROR << "shutdown failed: " << ec.message(); -- return; ++ self->handleConnState(); ++ } ++ }); } - BMCWEB_LOG_DEBUG << "Connection closed gracefully"; - if ((state != ConnState::suspended) && (state != ConnState::terminated)) @@ -396,7 +391,7 @@ index aad1cce..5e7ff47 100644 } } -@@ -330,6 +419,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -329,6 +421,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> { case ConnState::resolveInProgress: case ConnState::connectInProgress: @@ -404,7 +399,7 @@ index aad1cce..5e7ff47 100644 case ConnState::sendInProgress: case ConnState::recvInProgress: case ConnState::closeInProgress: -@@ -356,6 +446,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -355,6 +448,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> } case ConnState::resolveFailed: case ConnState::connectFailed: @@ -412,7 +407,7 @@ index aad1cce..5e7ff47 100644 case ConnState::sendFailed: case ConnState::recvFailed: case ConnState::retry: -@@ -394,7 +485,8 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -391,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, @@ -420,9 +415,9 @@ index aad1cce..5e7ff47 100644 + const std::string& destUri, + const std::string& uriProto) : conn(ioc), - timer(ioc), req(boost::beast::http::verb::post, destUri, 11), - state(ConnState::initialized), subId(id), host(destIP), port(destPort), -@@ -407,8 +499,11 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> + timer(ioc), req(boost::beast::http::verb::post, destUri, 11), subId(id), + host(destIP), port(destPort) +@@ -402,6 +497,10 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> req.keep_alive(true); requestDataQueue.set_capacity(maxRequestQueueSize); @@ -431,16 +426,14 @@ index aad1cce..5e7ff47 100644 + sslConn.emplace(conn, ctx); + } } -- + void sendData(const std::string& data) - { - 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 08d0b98..f1ce0c0 100644 +index 317f900..f581b96 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp -@@ -385,7 +385,7 @@ class Subscription : public persistent_data::UserSubscription - { +@@ -383,7 +383,7 @@ class Subscription : public persistent_data::UserSubscription + // create the HttpClient connection conn = std::make_shared<crow::HttpClient>( crow::connections::systemBus->get_io_context(), id, host, port, - path); 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 ea521a7e4..dfa67935c 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 d7a2660f200c38e74bfcbfe55b8da1b8bed08833 Mon Sep 17 00:00:00 2001 +From ea7d0091545450721d8b9b901e2593401b50d24c 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 @@ -31,10 +31,10 @@ Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> create mode 100644 http/server_sent_event.hpp diff --git a/http/http_connection.hpp b/http/http_connection.hpp -index 8e53afa..a1bbfce 100644 +index 0f20761..9cf603d 100644 --- a/http/http_connection.hpp +++ b/http/http_connection.hpp -@@ -378,11 +378,13 @@ class Connection : +@@ -362,11 +362,13 @@ class Connection : [self] { self->completeRequest(); }); }); @@ -83,10 +83,10 @@ 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 5d9c8e3..bfff107 100644 +index fe9c7e9..c748580 100644 --- a/http/routing.hpp +++ b/http/routing.hpp -@@ -6,6 +6,7 @@ +@@ -7,6 +7,7 @@ #include "http_response.hpp" #include "logging.hpp" #include "privileges.hpp" @@ -94,7 +94,7 @@ index 5d9c8e3..bfff107 100644 #include "sessions.hpp" #include "utility.hpp" #include "websocket.hpp" -@@ -398,6 +399,68 @@ class WebSocketRule : public BaseRule +@@ -397,6 +398,68 @@ class WebSocketRule : public BaseRule std::function<void(crow::websocket::Connection&)> errorHandler; }; @@ -163,7 +163,7 @@ index 5d9c8e3..bfff107 100644 template <typename T> struct RuleParameterTraits { -@@ -410,6 +473,14 @@ struct RuleParameterTraits +@@ -409,6 +472,14 @@ struct RuleParameterTraits return *p; } 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 ee69081ef..525070d93 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 799e47842e179f7c752712004f0e96d3219eee11 Mon Sep 17 00:00:00 2001 +From 278ea5570d8a162774c3d84b0706e27539e714cc 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 @@ -25,18 +25,18 @@ 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 | 109 +++++-- - redfish-core/include/server_sent_events.hpp | 290 ------------------ + redfish-core/include/server_sent_events.hpp | 289 ------------------ redfish-core/lib/event_service.hpp | 8 +- src/webserver_main.cpp | 2 + - 6 files changed, 164 insertions(+), 322 deletions(-) + 6 files changed, 164 insertions(+), 321 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 a1bbfce..2d08501 100644 +index 9cf603d..cf629ea 100644 --- a/http/http_connection.hpp +++ b/http/http_connection.hpp -@@ -382,7 +382,7 @@ class Connection : +@@ -366,7 +366,7 @@ class Connection : boost::iequals( thisReq.getHeaderValue(boost::beast::http::field::upgrade), "websocket")) || @@ -127,17 +127,18 @@ 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 3f398d7..dd833ce 100644 +index f581b96..57a2ab8 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp -@@ -22,15 +22,17 @@ +@@ -23,6 +23,7 @@ #include <sys/inotify.h> #include <boost/asio/io_context.hpp> +#include <boost/beast/core/span.hpp> #include <boost/container/flat_map.hpp> + #include <dbus_utility.hpp> #include <error_messages.hpp> - #include <event_service_store.hpp> +@@ -30,9 +31,10 @@ #include <http_client.hpp> #include <persistent_data.hpp> #include <random.hpp> @@ -149,7 +150,7 @@ index 3f398d7..dd833ce 100644 #include <cstdlib> #include <ctime> #include <fstream> -@@ -46,9 +48,27 @@ using ReadingsObjType = +@@ -48,9 +50,27 @@ using ReadingsObjType = static constexpr const char* eventFormatType = "Event"; static constexpr const char* metricReportFormatType = "MetricReport"; @@ -176,10 +177,10 @@ index 3f398d7..dd833ce 100644 + namespace message_registries { - inline boost::beast::span<const MessageEntry> -@@ -68,24 +88,6 @@ inline boost::beast::span<const MessageEntry> + inline std::span<const MessageEntry> +@@ -70,24 +90,6 @@ inline std::span<const MessageEntry> } - return boost::beast::span<const MessageEntry>(openbmc::registry); + return {openbmc::registry}; } -} // namespace message_registries - @@ -201,8 +202,8 @@ index 3f398d7..dd833ce 100644 -{ static const Message* getMsgFromRegistry(const std::string& messageKey, - const boost::beast::span<const MessageEntry>& registry) -@@ -388,11 +390,9 @@ class Subscription : public persistent_data::UserSubscription + const std::span<const MessageEntry>& registry) +@@ -386,11 +388,9 @@ class Subscription : public persistent_data::UserSubscription path, uriProto); } @@ -217,7 +218,7 @@ index 3f398d7..dd833ce 100644 ~Subscription() = default; -@@ -417,7 +417,7 @@ class Subscription : public persistent_data::UserSubscription +@@ -404,7 +404,7 @@ class Subscription : public persistent_data::UserSubscription if (sseConn != nullptr) { @@ -226,7 +227,7 @@ index 3f398d7..dd833ce 100644 } } -@@ -508,6 +508,7 @@ class Subscription : public persistent_data::UserSubscription +@@ -495,6 +495,7 @@ class Subscription : public persistent_data::UserSubscription this->sendEvent( msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace)); @@ -234,7 +235,7 @@ index 3f398d7..dd833ce 100644 } #endif -@@ -578,14 +579,39 @@ class Subscription : public persistent_data::UserSubscription +@@ -557,14 +558,39 @@ class Subscription : public persistent_data::UserSubscription return eventSeqNum; } @@ -275,16 +276,16 @@ index 3f398d7..dd833ce 100644 }; class EventServiceManager -@@ -942,6 +968,8 @@ class EventServiceManager - subValue->updateRetryConfig(retryAttempts, retryTimeoutInterval); +@@ -922,6 +948,8 @@ class EventServiceManager subValue->updateRetryPolicy(); + subValue->updatehttpHeaders(); + // Set Subscription ID for back trace + subValue->setSubscriptionId(id); return id; } -@@ -970,11 +998,40 @@ class EventServiceManager +@@ -950,11 +978,40 @@ class EventServiceManager } } @@ -327,10 +328,10 @@ index 3f398d7..dd833ce 100644 std::vector<std::string> idList; diff --git a/redfish-core/include/server_sent_events.hpp b/redfish-core/include/server_sent_events.hpp deleted file mode 100644 -index 7613d7b..0000000 +index dd3cd36..0000000 --- a/redfish-core/include/server_sent_events.hpp +++ /dev/null -@@ -1,290 +0,0 @@ +@@ -1,289 +0,0 @@ - -/* -// Copyright (c) 2020 Intel Corporation @@ -350,7 +351,6 @@ index 7613d7b..0000000 -#pragma once - -#include <boost/asio/strand.hpp> --#include <boost/beast/core/span.hpp> -#include <boost/beast/http/buffer_body.hpp> -#include <boost/beast/http/message.hpp> -#include <boost/beast/version.hpp> @@ -622,10 +622,10 @@ index 7613d7b..0000000 - -} // namespace crow diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp -index 8609862..249e594 100644 +index 91a041e..9ad2bbd 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 = { +@@ -40,8 +40,6 @@ static constexpr const std::array<const char*, 1> supportedResourceTypes = { "Task"}; #endif @@ -634,16 +634,16 @@ index 8609862..249e594 100644 inline void requestRoutesEventService(App& app) { BMCWEB_ROUTE(app, "/redfish/v1/EventService/") -@@ -50,6 +48,8 @@ inline void requestRoutesEventService(App& app) - {"@odata.type", "#EventService.v1_5_0.EventService"}, - {"Id", "EventService"}, - {"Name", "Event Service"}, -+ {"ServerSentEventUri", -+ "/redfish/v1/EventService/Subscriptions/SSE"}, - {"Subscriptions", - {{"@odata.id", "/redfish/v1/EventService/Subscriptions"}}}, - {"Actions", -@@ -90,9 +90,7 @@ inline void requestRoutesEventService(App& app) +@@ -54,6 +52,8 @@ inline void requestRoutesEventService(App& app) + {"@odata.type", "#EventService.v1_5_0.EventService"}, + {"Id", "EventService"}, + {"Name", "Event Service"}, ++ {"ServerSentEventUri", ++ "/redfish/v1/EventService/Subscriptions/SSE"}, + {"Subscriptions", + {{"@odata.id", "/redfish/v1/EventService/Subscriptions"}}}, + {"Actions", +@@ -92,9 +92,7 @@ inline void requestRoutesEventService(App& app) .privileges(redfish::privileges::patchEventService) .methods(boost::beast::http::verb::patch)( [](const crow::Request& req, 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 3914cc81a..05018a47d 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 769f0e20d0a7e786d7091ffb7ee57d35204dfa28 Mon Sep 17 00:00:00 2001 +From 64a9d1826b7b4a66750f7ecaaff7bcf7e0d23932 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 @@ -59,7 +59,7 @@ index 14daf00..fed7fec 100644 + std::string queryFilters; + if (req.urlParams.size()) + { -+ boost::urls::url_view::params_type::iterator it = ++ boost::urls::query_params_view::iterator it = + req.urlParams.find("$filter"); + if (it == req.urlParams.end()) + { @@ -155,14 +155,14 @@ index 14daf00..fed7fec 100644 + // Check for Message ID in each of the selected Registry + for (const std::string& it : registryPrefix) + { -+ const boost::beast::span< ++ const std::span< + const redfish::message_registries::MessageEntry> + registry = + redfish::message_registries::getRegistryFromPrefix( + it); + + if (std::any_of( -+ registry.cbegin(), registry.cend(), ++ registry.begin(), registry.end(), + [&id]( + const redfish::message_registries::MessageEntry& + messageEntry) { @@ -203,10 +203,10 @@ index 14daf00..fed7fec 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 3d11cc4..90084e3 100644 +index 7f53fa4..9c688b4 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, +@@ -985,6 +985,15 @@ nlohmann::json mutualExclusiveProperties(const std::string& arg1, void mutualExclusiveProperties(crow::Response& res, const std::string& arg1, const std::string& arg2); @@ -223,10 +223,10 @@ index 3d11cc4..90084e3 100644 } // namespace redfish diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index dd833ce..861f4cb 100644 +index 57a2ab8..aae9f02 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp -@@ -55,6 +55,11 @@ static constexpr const char* eventServiceFile = +@@ -57,6 +57,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 dd833ce..861f4cb 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 249e594..6f01707 100644 +index 9ad2bbd..99c3bfd 100644 --- a/redfish-core/lib/event_service.hpp +++ b/redfish-core/lib/event_service.hpp -@@ -21,11 +21,6 @@ +@@ -24,11 +24,6 @@ namespace redfish { @@ -255,10 +255,10 @@ index 249e594..6f01707 100644 "TerminateAfterRetries", "SuspendRetries", "RetryForever"}; diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp -index 9c28e8f..2394398 100644 +index 2087a67..ecb3721 100644 --- a/redfish-core/src/error_messages.cpp +++ b/redfish-core/src/error_messages.cpp -@@ -2173,6 +2173,32 @@ void mutualExclusiveProperties(crow::Response& res, const std::string& arg1, +@@ -2203,6 +2203,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/0007-EventService-Log-events-for-subscription-actions.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0007-EventService-Log-events-for-subscription-actions.patch index 3be65ee2a..7cad022f3 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0007-EventService-Log-events-for-subscription-actions.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0007-EventService-Log-events-for-subscription-actions.patch @@ -1,4 +1,4 @@ -From b8eb53886106e44e3668857b13f8642d2ad3cfbf Mon Sep 17 00:00:00 2001 +From b5020756ae3fbff6283c293c74b779d656429f3a Mon Sep 17 00:00:00 2001 From: AppaRao Puli <apparao.puli@linux.intel.com> Date: Fri, 27 Aug 2021 16:02:01 +0000 Subject: [PATCH] EventService: Log events for subscription actions @@ -21,13 +21,14 @@ Tested: Change-Id: I3745fa6357bd215379781a9818d9acc02a853d79 Signed-off-by: AppaRao Puli <apparao.puli@intel.com> Signed-off-by: Ayushi Smriti <smriti.ayushi@intel.com> +Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> --- .../include/event_service_manager.hpp | 35 ++++++++++++++++--- redfish-core/lib/event_service.hpp | 2 +- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index c3e7f61..e9bdbfa 100644 +index aae9f02..69db652 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -21,6 +21,7 @@ @@ -38,7 +39,7 @@ index c3e7f61..e9bdbfa 100644 #include <boost/asio/io_context.hpp> #include <boost/beast/core/span.hpp> -@@ -788,7 +789,7 @@ class EventServiceManager +@@ -780,7 +781,7 @@ class EventServiceManager } } @@ -47,7 +48,7 @@ index c3e7f61..e9bdbfa 100644 { persistent_data::EventServiceStore::getInstance() .eventServiceConfig.enabled = serviceEnabled; -@@ -835,7 +836,7 @@ class EventServiceManager +@@ -827,7 +828,7 @@ class EventServiceManager if (updateConfig) { @@ -56,7 +57,7 @@ index c3e7f61..e9bdbfa 100644 } if (updateRetryCfg) -@@ -947,7 +948,7 @@ class EventServiceManager +@@ -939,7 +940,7 @@ class EventServiceManager if (updateFile) { @@ -65,7 +66,7 @@ index c3e7f61..e9bdbfa 100644 } #ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES -@@ -962,6 +963,13 @@ class EventServiceManager +@@ -955,6 +956,13 @@ class EventServiceManager // Set Subscription ID for back trace subValue->setSubscriptionId(id); @@ -79,7 +80,7 @@ index c3e7f61..e9bdbfa 100644 return id; } -@@ -986,7 +994,14 @@ class EventServiceManager +@@ -979,7 +987,14 @@ class EventServiceManager persistent_data::EventServiceStore::getInstance() .subscriptionsConfigMap.erase(obj2); updateNoOfSubscribersCount(); @@ -95,7 +96,7 @@ index c3e7f61..e9bdbfa 100644 } } -@@ -1008,6 +1023,18 @@ class EventServiceManager +@@ -1001,6 +1016,18 @@ class EventServiceManager } } @@ -115,10 +116,10 @@ index c3e7f61..e9bdbfa 100644 { return subscriptionsMap.size(); diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp -index 9def549..6a8421f 100644 +index 99c3bfd..15e45dc 100644 --- a/redfish-core/lib/event_service.hpp +++ b/redfish-core/lib/event_service.hpp -@@ -617,7 +617,7 @@ inline void requestRoutesEventDestination(App& app) +@@ -624,7 +624,7 @@ inline void requestRoutesEventDestination(App& app) subValue->updateRetryPolicy(); } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0008-Add-checks-on-Event-Subscription-input-parameters.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0008-Add-checks-on-Event-Subscription-input-parameters.patch index 84ceb4ba8..a46708ee5 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0008-Add-checks-on-Event-Subscription-input-parameters.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0008-Add-checks-on-Event-Subscription-input-parameters.patch @@ -1,4 +1,4 @@ -From 05fdea2bb8e486b058d137a067ce1f5c885d2a96 Mon Sep 17 00:00:00 2001 +From ee758f1f97890f51707e72b3c6b08c8c46c41595 Mon Sep 17 00:00:00 2001 From: Nitin Wankhade <nitinx.arunrao.wankhade@intel.com> Date: Mon, 28 Jun 2021 19:59:57 +0000 Subject: [PATCH] Add checks on Event Subscription input parameters @@ -16,17 +16,18 @@ Tested Change-Id: Iec2cd766c0e137b72706fc2da468d4fefd8fbaae Signed-off-by: Nitin Wankhade <nitinx.arunrao.wankhade@intel.com> +Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> --- - redfish-core/lib/event_service.hpp | 30 ++++++++++++++++++++++++++++++ - 1 file changed, 30 insertions(+) + redfish-core/lib/event_service.hpp | 26 ++++++++++++++++++++++++++ + 1 file changed, 26 insertions(+) diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp -index 52b01e5..f8a1671 100644 +index 15e45dc..27dec86 100644 --- a/redfish-core/lib/event_service.hpp +++ b/redfish-core/lib/event_service.hpp -@@ -19,6 +19,10 @@ - #include <app.hpp> - #include <registries/privilege_registry.hpp> +@@ -22,6 +22,10 @@ + + #include <span> +#define MAX_CONTEXT_SIZE 256 +#define MAX_DESTINATION_SIZE 1024 @@ -35,7 +36,7 @@ index 52b01e5..f8a1671 100644 namespace redfish { static constexpr const std::array<const char*, 3> supportedRetryPolicies = { -@@ -220,6 +224,12 @@ inline void requestRoutesEventDestinationCollection(App& app) +@@ -223,6 +227,12 @@ inline void requestRoutesEventDestinationCollection(App& app) return; } @@ -48,7 +49,7 @@ index 52b01e5..f8a1671 100644 if (regPrefixes && msgIds) { if (regPrefixes->size() && msgIds->size()) -@@ -330,11 +340,31 @@ inline void requestRoutesEventDestinationCollection(App& app) +@@ -333,13 +343,29 @@ inline void requestRoutesEventDestinationCollection(App& app) if (context) { @@ -64,22 +65,20 @@ index 52b01e5..f8a1671 100644 { + size_t cumulativeLen = 0; + -+ for (nlohmann::json& itr : *headers) -+ { -+ std::string hdr{itr.dump( + for (const nlohmann::json& headerChunk : *headers) + { ++ std::string hdr{headerChunk.dump( + -1, ' ', true, nlohmann::json::error_handler_t::replace)}; + cumulativeLen += hdr.length(); -+ + if (cumulativeLen > MAX_HEADER_SIZE) + { + messages::propertySizeExceeded(asyncResp->res, + "HttpHeaders"); + return; + } -+ } - subValue->httpHeaders = *headers; - } - + for (const auto& item : headerChunk.items()) + { + const std::string* value = -- 2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0009-Restructure-Redifsh-EventLog-Transmit-code-flow.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0009-Restructure-Redifsh-EventLog-Transmit-code-flow.patch index d1fe475f5..918560f4d 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0009-Restructure-Redifsh-EventLog-Transmit-code-flow.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0009-Restructure-Redifsh-EventLog-Transmit-code-flow.patch @@ -1,5 +1,5 @@ -From 542505dff60e3921b00b51acae882e207d46f1a6 Mon Sep 17 00:00:00 2001 -From: Krzysztof Grobelny <krzysztof.grobelny@intel.com> +From d047619b7003882846b108f519b00cdd41265361 Mon Sep 17 00:00:00 2001 +From: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> Date: Wed, 14 Jul 2021 14:13:11 +0000 Subject: [PATCH] Restructure Redfish EventLog Transmit code flow @@ -35,7 +35,7 @@ Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> 1 file changed, 76 insertions(+), 32 deletions(-) diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index e9bdbfa..5c4de70 100644 +index 3208fb3..86c90fb 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -134,15 +134,10 @@ static const Message* formatMessage(const std::string_view& messageID) @@ -55,7 +55,7 @@ index e9bdbfa..5c4de70 100644 // Get the entry timestamp std::time_t curTs = 0; -@@ -621,6 +616,7 @@ class EventServiceManager +@@ -628,6 +623,7 @@ class EventServiceManager } std::string lastEventTStr; @@ -63,7 +63,7 @@ index e9bdbfa..5c4de70 100644 size_t noOfEventLogSubscribers{0}; size_t noOfMetricReportSubscribers{0}; std::shared_ptr<sdbusplus::bus::match::match> matchTelemetryMonitor; -@@ -1163,7 +1159,22 @@ class EventServiceManager +@@ -1172,7 +1168,22 @@ class EventServiceManager #ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES void cacheLastEventTimestamp() { @@ -87,7 +87,7 @@ index e9bdbfa..5c4de70 100644 std::ifstream logStream(redfishEventLogFile); if (!logStream.good()) { -@@ -1171,27 +1182,44 @@ class EventServiceManager +@@ -1180,27 +1191,44 @@ class EventServiceManager return; } std::string logEntry; @@ -143,7 +143,7 @@ index e9bdbfa..5c4de70 100644 std::ifstream logStream(redfishEventLogFile); if (!logStream.good()) { -@@ -1201,27 +1229,21 @@ class EventServiceManager +@@ -1210,27 +1238,21 @@ class EventServiceManager std::vector<EventLogObjectsType> eventRecords; @@ -178,7 +178,7 @@ index e9bdbfa..5c4de70 100644 std::string timestamp; std::string messageID; -@@ -1233,6 +1255,16 @@ class EventServiceManager +@@ -1242,6 +1264,16 @@ class EventServiceManager continue; } @@ -195,7 +195,7 @@ index e9bdbfa..5c4de70 100644 std::string registryName; std::string messageKey; event_log::getRegistryAndMessageKey(messageID, registryName, -@@ -1242,11 +1274,23 @@ class EventServiceManager +@@ -1251,11 +1283,23 @@ class EventServiceManager continue; } 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 9af5a066b..f37bc241b 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,5 +1,5 @@ -From f665ba085bb2310f008b7534f827fb401ad973c2 Mon Sep 17 00:00:00 2001 -From: Krzysztof Grobelny <krzysztof.grobelny@intel.com> +From 5d13aa636aba6c68ab5a74e589cac35f4e925129 Mon Sep 17 00:00:00 2001 +From: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> Date: Tue, 12 Oct 2021 08:19:51 +0000 Subject: [PATCH] Delete/Remove Terminated Event Subscription(s) @@ -22,15 +22,15 @@ Tested: 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 | 36 ++++++++++++++++ - 2 files changed, 70 insertions(+), 9 deletions(-) + http/http_client.hpp | 48 +++++++++++++++---- + .../include/event_service_manager.hpp | 36 ++++++++++++++ + 2 files changed, 75 insertions(+), 9 deletions(-) diff --git a/http/http_client.hpp b/http/http_client.hpp -index 5e7ff47..54ae2c3 100644 +index 58b5402..745eeb6 100644 --- a/http/http_client.hpp +++ b/http/http_client.hpp -@@ -55,6 +55,8 @@ enum class ConnState +@@ -56,6 +56,8 @@ enum class ConnState closeInProgress, closed, suspended, @@ -39,7 +39,7 @@ index 5e7ff47..54ae2c3 100644 terminated, abortConnection, retry -@@ -288,7 +290,14 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -290,7 +292,14 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> } void doClose() { @@ -55,7 +55,7 @@ index 5e7ff47..54ae2c3 100644 // Set the timeout on the tcp stream socket for the async operation conn.expires_after(std::chrono::seconds(30)); -@@ -318,8 +327,11 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -320,8 +329,11 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> } self->conn.close(); @@ -69,7 +69,7 @@ index 5e7ff47..54ae2c3 100644 { self->state = ConnState::closed; self->handleConnState(); -@@ -341,8 +353,11 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -343,8 +355,11 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> } conn.close(); @@ -83,7 +83,7 @@ index 5e7ff47..54ae2c3 100644 { state = ConnState::closed; handleConnState(); -@@ -365,8 +380,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -367,8 +382,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> BMCWEB_LOG_DEBUG << "Retry policy: " << retryPolicyAction; if (retryPolicyAction == "TerminateAfterRetries") { @@ -93,7 +93,7 @@ index 5e7ff47..54ae2c3 100644 } if (retryPolicyAction == "SuspendRetries") { -@@ -423,6 +437,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -425,6 +439,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> case ConnState::sendInProgress: case ConnState::recvInProgress: case ConnState::closeInProgress: @@ -101,7 +101,7 @@ index 5e7ff47..54ae2c3 100644 { BMCWEB_LOG_DEBUG << "Async operation is already in progress"; break; -@@ -439,7 +454,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -441,11 +456,16 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> break; } case ConnState::suspended: @@ -110,8 +110,17 @@ index 5e7ff47..54ae2c3 100644 { doClose(); break; -@@ -506,7 +521,8 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> - } + } ++ case ConnState::terminated: ++ { ++ BMCWEB_LOG_DEBUG << "Connection Terminated"; ++ break; ++ } + case ConnState::resolveFailed: + case ConnState::connectFailed: + case ConnState::handshakeFailed: +@@ -505,7 +525,8 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> + void sendData(const std::string& data) { - if ((state == ConnState::suspended) || (state == ConnState::terminated)) @@ -120,7 +129,7 @@ index 5e7ff47..54ae2c3 100644 { return; } -@@ -524,6 +540,15 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -523,6 +544,15 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> return; } @@ -133,14 +142,14 @@ index 5e7ff47..54ae2c3 100644 + return false; + } + - void addHeaders( - const std::vector<std::pair<std::string, std::string>>& httpHeaders) + void setHeaders(const boost::beast::http::fields& httpHeaders) { + // Set custom headers diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index 6f60a31..363adb0 100644 +index 69db652..5d71c63 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 +@@ -588,6 +588,14 @@ class Subscription : public persistent_data::UserSubscription return std::nullopt; } @@ -155,7 +164,7 @@ index 6f60a31..363adb0 100644 private: std::shared_ptr<crow::SseConnection> sseConn = nullptr; uint64_t eventSeqNum; -@@ -847,6 +855,22 @@ class EventServiceManager +@@ -843,6 +851,22 @@ class EventServiceManager } } @@ -178,7 +187,7 @@ index 6f60a31..363adb0 100644 void updateNoOfSubscribersCount() { size_t eventLogSubCount = 0; -@@ -881,6 +905,7 @@ class EventServiceManager +@@ -877,6 +901,7 @@ class EventServiceManager std::shared_ptr<Subscription> getSubscription(const std::string& id) { @@ -186,7 +195,7 @@ index 6f60a31..363adb0 100644 auto obj = subscriptionsMap.find(id); if (obj == subscriptionsMap.end()) { -@@ -971,6 +996,7 @@ class EventServiceManager +@@ -968,6 +993,7 @@ class EventServiceManager bool isSubscriptionExist(const std::string& id) { @@ -194,7 +203,7 @@ index 6f60a31..363adb0 100644 auto obj = subscriptionsMap.find(id); if (obj == subscriptionsMap.end()) { -@@ -1033,6 +1059,7 @@ class EventServiceManager +@@ -1030,6 +1056,7 @@ class EventServiceManager size_t getNumberOfSubscriptions() { @@ -202,7 +211,7 @@ index 6f60a31..363adb0 100644 return subscriptionsMap.size(); } -@@ -1049,6 +1076,7 @@ class EventServiceManager +@@ -1046,6 +1073,7 @@ class EventServiceManager std::vector<std::string> getAllIDs() { @@ -210,7 +219,7 @@ index 6f60a31..363adb0 100644 std::vector<std::string> idList; for (const auto& it : subscriptionsMap) { -@@ -1059,6 +1087,7 @@ class EventServiceManager +@@ -1056,6 +1084,7 @@ class EventServiceManager bool isDestinationExist(const std::string& destUrl) { @@ -218,7 +227,7 @@ index 6f60a31..363adb0 100644 for (const auto& it : subscriptionsMap) { std::shared_ptr<Subscription> entry = it.second; -@@ -1073,6 +1102,7 @@ class EventServiceManager +@@ -1070,6 +1099,7 @@ class EventServiceManager void sendTestEventLog() { @@ -226,7 +235,7 @@ index 6f60a31..363adb0 100644 for (const auto& it : this->subscriptionsMap) { std::shared_ptr<Subscription> entry = it.second; -@@ -1100,6 +1130,8 @@ class EventServiceManager +@@ -1097,6 +1127,8 @@ class EventServiceManager } eventRecord.push_back(eventMessage); @@ -235,7 +244,7 @@ index 6f60a31..363adb0 100644 for (const auto& it : this->subscriptionsMap) { std::shared_ptr<Subscription> entry = it.second; -@@ -1143,6 +1175,8 @@ class EventServiceManager +@@ -1140,6 +1172,8 @@ class EventServiceManager } void sendBroadcastMsg(const std::string& broadcastMsg) { @@ -244,7 +253,7 @@ index 6f60a31..363adb0 100644 for (const auto& it : this->subscriptionsMap) { std::shared_ptr<Subscription> entry = it.second; -@@ -1291,6 +1325,8 @@ class EventServiceManager +@@ -1254,6 +1288,8 @@ class EventServiceManager return; } @@ -254,5 +263,5 @@ index 6f60a31..363adb0 100644 { std::shared_ptr<Subscription> entry = it.second; -- -2.25.1 +2.17.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 index 585f7bf09..87f0a4fd9 100644 --- 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 @@ -1,4 +1,4 @@ -From 5b87bb61b58e92a8c5af37a7959347747409a65c Mon Sep 17 00:00:00 2001 +From ff562320d23e1c1e075689a636505f22eb4890d4 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 @@ -33,10 +33,10 @@ Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> 2 files changed, 58 insertions(+), 12 deletions(-) diff --git a/http/http_client.hpp b/http/http_client.hpp -index 54ae2c3..162cb09 100644 +index 745eeb6..5575765 100644 --- a/http/http_client.hpp +++ b/http/http_client.hpp -@@ -367,6 +367,12 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -369,6 +369,12 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> void waitAndRetry() { @@ -49,7 +49,7 @@ index 54ae2c3..162cb09 100644 if (retryCount >= maxRetryAttempts) { BMCWEB_LOG_ERROR << "Maximum number of retries reached."; -@@ -393,11 +399,6 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -395,11 +401,6 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> return; } @@ -62,10 +62,10 @@ index 54ae2c3..162cb09 100644 retryCount++; diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index 363adb0..7af7a4d 100644 +index 5d71c63..f97909c 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp -@@ -857,18 +857,63 @@ class EventServiceManager +@@ -853,18 +853,63 @@ class EventServiceManager void deleteTerminatedSubcriptions() { diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0009-Add-support-for-deleting-terminated-subscriptions.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0012-Add-support-for-deleting-terminated-subscriptions.patch index 548e3d9c6..dd4827f27 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0009-Add-support-for-deleting-terminated-subscriptions.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0012-Add-support-for-deleting-terminated-subscriptions.patch @@ -1,6 +1,6 @@ -From ef83a4fb14648edc6c8370363ff88fb6f060a43b Mon Sep 17 00:00:00 2001 -From: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> -Date: Mon, 20 Sep 2021 21:55:57 +0530 +From e44cced4e8a50a6edf0ace0e00b5be4b61533190 Mon Sep 17 00:00:00 2001 +From: Krzysztof Grobelny <krzysztof.grobelny@intel.com> +Date: Tue, 7 Dec 2021 09:48:07 +0100 Subject: [PATCH] Add support for deleting terminated subscriptions Added functionality to delete/remove event subscription(s) which are @@ -24,23 +24,22 @@ Tested: Change-Id: I3cb0af5bc24411cddcdb3d1d9de25e8e9144106c Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> --- - redfish-core/include/event_service_manager.hpp | 3 +++ - 1 file changed, 3 insertions(+) + redfish-core/include/event_service_manager.hpp | 2 ++ + 1 file changed, 2 insertions(+) diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index c9e2812..c2fefb3 100644 +index f97909c..881d2db 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp -@@ -1535,6 +1535,9 @@ class EventServiceManager +@@ -1514,6 +1514,8 @@ class EventServiceManager + return; + } - std::variant<telemetry::TimestampReadings>& readings = - found->second; ++ this->deleteTerminatedSubcriptions(); + -+ this->deleteTerminatedSubcriptions(); -+ - for (const auto& it : - EventServiceManager::getInstance().subscriptionsMap) - { + for (const auto& it : + EventServiceManager::getInstance().subscriptionsMap) + { -- 2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0007-event-service-fix-added-Context-field-to-response.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0013-event-service-fix-added-Context-field-to-response.patch index ffab743f6..019ccbe64 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0007-event-service-fix-added-Context-field-to-response.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0013-event-service-fix-added-Context-field-to-response.patch @@ -1,6 +1,6 @@ -From 0ca8c383db8c9afbce63380955a20ada0acc20b7 Mon Sep 17 00:00:00 2001 +From ce9b52791e76d73050f053f8fc607c6e1eb5d8c4 Mon Sep 17 00:00:00 2001 From: Krzysztof Grobelny <krzysztof.grobelny@intel.com> -Date: Wed, 2 Jun 2021 12:44:43 +0000 +Date: Thu, 16 Dec 2021 10:46:55 +0100 Subject: [PATCH] event service fix, added Context field to response Tested: @@ -9,21 +9,25 @@ Tested: Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> --- - redfish-core/include/event_service_manager.hpp | 1 + - 1 file changed, 1 insertion(+) + redfish-core/include/event_service_manager.hpp | 5 +++++ + 1 file changed, 5 insertions(+) diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index 2b957ea..289886b 100644 +index 881d2db..1ba9f21 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp -@@ -556,6 +556,7 @@ class Subscription - << id; +@@ -530,6 +530,11 @@ class Subscription : public persistent_data::UserSubscription return; } -+ msg["Context"] = customText; ++ if (!customText.empty()) ++ { ++ msg["Context"] = customText; ++ } ++ this->sendEvent( msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace)); + } -- -2.25.1 +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 c09967456..22dae410d 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 @@ -22,7 +22,7 @@ Upstream revision information: file://eventservice/0007-EventService-Log-events-for-subscription-actions.patch - Add checks on Event-Subscription input parameters (Downstream patch) - file://eventservice//0008-Add-checks-on-Event-Subscription-input-parameters.patch + file://eventservice/0008-Add-checks-on-Event-Subscription-input-parameters.patch - Restructure Redifsh EventLog Transmit code flow https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/44449/3 @@ -31,4 +31,10 @@ Upstream revision information: 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 + file://eventservice/0011-Fix-bmcweb-crash-while-deleting-terminated-subscriptions.patch + + - Add support for deleting terminated subscriptions + file://eventservice/0012-Add-support-for-deleting-terminated-subscriptions.patch + + - event service fix added Context field to response + file://eventservice/0013-event-service-fix-added-Context-field-to-response.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 index b3aa11774..c25a79521 100644 --- 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 @@ -176,7 +176,7 @@ index 25e4ce8..858f146 100644 + crow::Response resp; + rules[ruleIndex]->handleUpgrade(req, resp, std::move(adaptor)); } - catch (std::exception& e) + catch (const std::exception& e) { BMCWEB_LOG_ERROR << "An uncaught exception occurred: " << e.what(); - res.result(boost::beast::http::status::internal_server_error); 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 index 1ba584616..180ee46d0 100644 --- 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 @@ -60,7 +60,7 @@ index acc99dc..e2a8fbb 100644 - crow::Response resp; - rules[ruleIndex]->handleUpgrade(req, resp, std::move(adaptor)); - } -- catch (std::exception& e) +- catch (const std::exception& e) - { - BMCWEB_LOG_ERROR << "An uncaught exception occurred: " << e.what(); - asyncResp->res.result( 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 index 64e235ce3..19c671754 100644 --- 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 @@ -117,9 +117,9 @@ 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 <boost/process/async_pipe.hpp> + #include <boost/process/child.hpp> + #include <boost/process/io.hpp> +#include <registries/privilege_registry.hpp> #include <websocket.hpp> 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 deleted file mode 100644 index f5226fe6e..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Add-support-for-MetricDefinition-scheme.patch +++ /dev/null @@ -1,619 +0,0 @@ -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 - -Added MetricDefinition node to Redfish code. Now user is able to list -all available metrics in OpenBMC that are supported by Telemetry -service. Metrics are grouped by reading type. - -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 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 - with and without Telemetry service - - Validated a presence of MetricDefinition members and its attributes - - Successfully passed RedfishServiceValidator.py using witherspoon - image on QEMU - - Tested using following GET,POST requests - -GET /redfish/v1/TelemetryService/MetricDefinitions -{ - "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions", - "@odata.type": "#MetricDefinitionCollection.MetricDefinitionCollection", - "Members": [ - { - "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Fan_Pwm" - }, - { - "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Fan_Tach" - }, - { - "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/HostCpuUtilization" - }, - { - "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/HostMemoryBandwidthUtilization" - }, - { - "@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": 7, - "Name": "Metric Definition Collection" -} - -GET /redfish/v1/TelemetryService/MetricDefinitions/Fan_Tach -{ - "@odata.id": "/redfish/v1/TelemetryService/MetricDefinitions/Fan_Tach", - "@odata.type": "#MetricDefinition.v1_0_3.MetricDefinition", - "Id": "Fan_Tach", - "IsLinear": true, - "MaxReadingRange": 25000.0, - "MetricDataType": "Decimal", - "MetricProperties": [ - "/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": "Gauge", - "MinReadingRange": 0.0, - "Name": "Fan_Tach", - "Units": "RPM" -} - -POST redfish/v1/TelemetryService/MetricReportDefinitions, body: -{ - "Id": "TestReport", - "Metrics": [ - { - "MetricId": "TestMetric", - "MetricProperties": [ - "/redfish/v1/Chassis/Chassis0/Thermal#/Fans/3/Reading", - ] - } - ], - "MetricReportDefinitionType": "OnRequest", - "ReportActions": [ - "RedfishEvent", - "LogToMetricReportsCollection" - ] -} -{ - "@Message.ExtendedInfo": [ - { - "@odata.type": "#Message.v1_1_1.Message", - "Message": "The resource has been created successfully", - "MessageArgs": [], - "MessageId": "Base.1.8.1.Created", - "MessageSeverity": "OK", - "Resolution": "None" - } - ] -} - -Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com> -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/telemetry_utils.hpp | 2 + - 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 0a97150..67c5af2 100644 ---- a/redfish-core/include/redfish.hpp -+++ b/redfish-core/include/redfish.hpp -@@ -26,6 +26,7 @@ - #include "../lib/managers.hpp" - #include "../lib/memory.hpp" - #include "../lib/message_registries.hpp" -+#include "../lib/metric_definition.hpp" - #include "../lib/metric_report.hpp" - #include "../lib/metric_report_definition.hpp" - #include "../lib/network_protocol.hpp" -@@ -200,6 +201,8 @@ class RedfishService - requestRoutesMetricReportDefinition(app); - requestRoutesMetricReportCollection(app); - requestRoutesMetricReport(app); -+ requestRoutesMetricDefinitionCollection(app); -+ requestRoutesMetricDefinition(app); - } - }; - -diff --git a/redfish-core/include/utils/get_chassis_names.hpp b/redfish-core/include/utils/get_chassis_names.hpp -new file mode 100644 -index 0000000..0276b6f ---- /dev/null -+++ b/redfish-core/include/utils/get_chassis_names.hpp -@@ -0,0 +1,58 @@ -+#pragma once -+ -+#include <include/dbus_singleton.hpp> -+ -+#include <array> -+#include <string> -+#include <vector> -+ -+namespace redfish -+{ -+ -+namespace utils -+{ -+ -+template <typename F> -+inline void getChassisNames(F&& cb) -+{ -+ const std::array<const char*, 2> interfaces = { -+ "xyz.openbmc_project.Inventory.Item.Board", -+ "xyz.openbmc_project.Inventory.Item.Chassis"}; -+ -+ crow::connections::systemBus->async_method_call( -+ [callback = std::move(cb)](const boost::system::error_code ec, -+ const std::vector<std::string>& chassis) { -+ std::vector<std::string> chassisNames; -+ -+ if (ec) -+ { -+ callback(ec, chassisNames); -+ return; -+ } -+ -+ chassisNames.reserve(chassis.size()); -+ for (const std::string& path : chassis) -+ { -+ sdbusplus::message::object_path dbusPath = path; -+ std::string name = dbusPath.filename(); -+ if (name.empty()) -+ { -+ callback(boost::system::errc::make_error_code( -+ boost::system::errc::invalid_argument), -+ chassisNames); -+ return; -+ } -+ chassisNames.emplace_back(std::move(name)); -+ } -+ -+ callback(ec, chassisNames); -+ }, -+ "xyz.openbmc_project.ObjectMapper", -+ "/xyz/openbmc_project/object_mapper", -+ "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", -+ "/xyz/openbmc_project/inventory", 0, interfaces); -+} -+ -+} // namespace utils -+ -+} // namespace redfish -diff --git a/redfish-core/include/utils/telemetry_utils.hpp b/redfish-core/include/utils/telemetry_utils.hpp -index 5872350..1b4f75d 100644 ---- a/redfish-core/include/utils/telemetry_utils.hpp -+++ b/redfish-core/include/utils/telemetry_utils.hpp -@@ -10,6 +10,8 @@ namespace telemetry - - constexpr const char* service = "xyz.openbmc_project.Telemetry"; - constexpr const char* reportInterface = "xyz.openbmc_project.Telemetry.Report"; -+constexpr const char* metricDefinitionUri = -+ "/redfish/v1/TelemetryService/MetricDefinitions/"; - constexpr const char* metricReportDefinitionUri = - "/redfish/v1/TelemetryService/MetricReportDefinitions/"; - 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..347c297 ---- /dev/null -+++ b/redfish-core/lib/metric_definition.hpp -@@ -0,0 +1,368 @@ -+#pragma once -+ -+#include "async_resp.hpp" -+#include "sensors.hpp" -+#include "utils/get_chassis_names.hpp" -+#include "utils/telemetry_utils.hpp" -+ -+#include <registries/privilege_registry.hpp> -+ -+namespace redfish -+{ -+ -+namespace telemetry -+{ -+ -+struct ValueVisitor -+{ -+ 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) -+ { -+ callback(ec, double{}); -+ return; -+ } -+ -+ 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) -+ { -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ -+ if (std::isfinite(readingRange)) -+ { -+ asyncResp->res.jsonValue["MetricType"] = "Gauge"; -+ -+ asyncResp->res.jsonValue["MinReadingRange"] = readingRange; -+ } -+ }); -+ -+ 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; -+ } -+ }); -+} -+ -+inline void getSensorService( -+ const std::string& sensorPath, -+ std::function<void(boost::system::error_code, const std::string&)> callback) -+{ -+ using ResultType = std::pair< -+ std::string, -+ std::vector<std::pair<std::string, std::vector<std::string>>>>; -+ -+ 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; -+ } -+ } -+ } -+ -+ 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"}); -+} -+ -+constexpr auto metricDefinitionMapping = std::array{ -+ std::pair{"fan_pwm", "Fan_Pwm"}, std::pair{"fan_tach", "Fan_Tach"}}; -+ -+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/"; -+ -+ if (it != metricDefinitionMapping.end()) -+ { -+ return std::string{metricDefinitionPath} + it->second; -+ } -+ -+ return metricDefinitionPath + sensorObjectPath.filename(); -+} -+ -+template <class Callback> -+inline void mapRedfishUriToDbusPath(Callback&& callback) -+{ -+ utils::getChassisNames([callback = std::move(callback)]( -+ boost::system::error_code ec, -+ const std::vector<std::string>& chassisNames) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "getChassisNames error: " << ec.value(); -+ callback(ec, {}); -+ return; -+ } -+ -+ auto counter = std::make_shared<std::pair< -+ boost::container::flat_map<std::string, std::string>, size_t>>(); -+ -+ auto handleRetrieveUriToDbusMap = -+ [counter, callback = std::move(callback)]( -+ const boost::beast::http::status status, -+ const boost::container::flat_map<std::string, std::string>& -+ uriToDbus) { -+ if (status != boost::beast::http::status::ok) -+ { -+ 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; -+ } -+ -+ 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); -+ } -+ } -+ }); -+} -+ -+} // namespace telemetry -+ -+inline void requestRoutesMetricDefinitionCollection(App& app) -+{ -+ BMCWEB_ROUTE(app, "/redfish/v1/TelemetryService/MetricDefinitions/") -+ .privileges(privileges::getTelemetryService) -+ .methods(boost::beast::http::verb::get)( -+ [](const crow::Request&, -+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { -+ telemetry::mapRedfishUriToDbusPath( -+ [asyncResp](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::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"] = -+ "#MetricDefinitionCollection." -+ "MetricDefinitionCollection"; -+ asyncResp->res.jsonValue["@odata.id"] = -+ "/redfish/v1/TelemetryService/MetricDefinitions"; -+ asyncResp->res.jsonValue["Name"] = -+ "Metric Definition Collection"; -+ asyncResp->res.jsonValue["Members"] = nlohmann::json::array(); -+ asyncResp->res.jsonValue["Members@odata.count"] = 0; -+ }); -+} -+ -+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& 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) -+ { -+ matchingUris.emplace(uri, dbusPath); -+ } -+ } -+ -+ 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 8ecc591..027b51b 100644 ---- a/redfish-core/lib/telemetry_service.hpp -+++ b/redfish-core/lib/telemetry_service.hpp -@@ -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](const boost::system::error_code ec, --- -2.25.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Add-support-for-POST-on-TriggersCollection.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Add-support-for-POST-on-TriggersCollection.patch new file mode 100644 index 000000000..b0cf44cb2 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Add-support-for-POST-on-TriggersCollection.patch @@ -0,0 +1,889 @@ +From 008cc1b35ccb1508d3c71ff5c6cfc6c772f1744c Mon Sep 17 00:00:00 2001 +From: Szymon Dompke <szymon.dompke@intel.com> +Date: Wed, 17 Nov 2021 18:18:16 +0100 +Subject: [PATCH] Add support for POST on TriggersCollection +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Added POST method on /redfish/v1/TelemetryService/Triggers uri, which +creates new trigger in telemetry service, by using dbus call AddTrigger. + +By DMTF, most of the properties are not required, and as such are +treated as optional. Some values can be deduced from others (like +'MetricType', depending on 'DiscreteTriggers' or 'NumericThresholds'). +All properties provided in POST body by user will be verified against +each other, and errors will be raised. Few examples of such situations: +- 'MetricType' is set to 'Discrete' but 'NumericThresholds' was passed. +- 'MetricType' is set to 'Numeric' but "DiscreteTriggers' or + 'DiscreteTriggerCondition' were passed +- 'DiscreteTriggerCondition' is set to 'Specified' but + 'DiscreteTriggers' is an empty array or was not passed. +- 'DiscreteTriggerCondition' is set to 'Changed' but 'DiscreteTriggers' + is passed and is not an empty array. + +Example 1 – Trigger with discrete values: +{ + "Id": "TestTrigger", + "MetricType": "Discrete", + "TriggerActions": [ + "RedfishEvent" + ], + "DiscreteTriggerCondition": "Specified", + "DiscreteTriggers": [ + { + "Value": "55.88", + "DwellTime": "PT0.001S", + "Severity": "Warning" + }, + { + "Name": "My discrete trigger", + "Value": "55.88", + "DwellTime": "PT0.001S", + "Severity": "OK" + }, + { + "Value": "55.88", + "DwellTime": "PT0.001S", + "Severity": "Critical" + } + ], + "MetricProperties": [ + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/0/Reading" + ], + "Links": { + "MetricReportDefinitions": [] + } +} + +Example 2 – trigger with numeric threshold: +{ + "Id": "TestTrigger2", + "Name": "My Numeric Trigger", + "MetricType": "Numeric", + "TriggerActions": [ + "RedfishEvent", + "RedfishMetricReport" + ], + "NumericThresholds": { + "UpperCritical": { + "Reading": 50, + "Activation": "Increasing", + "DwellTime": "PT0.001S" + }, + "UpperWarning": { + "Reading": 48.1, + "Activation": "Increasing", + "DwellTime": "PT0.004S" + } + }, + "MetricProperties": [ + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/0/Reading", + "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/17/Reading" + ], + "Links": { + "MetricReportDefinitions": [ + "/redfish/v1/TelemetryService/MetricReportDefinitions/PowerMetrics", + "/redfish/v1/TelemetryService/MetricReportDefinitions/PowerMetricStats", + "/redfish/v1/TelemetryService/MetricReportDefinitions/PlatformPowerUsage" + ] + } +} + +Tested: +- Triggers were successfully created with above example message bodies. + This can be checked by calling: + 'busctl tree xyz.openbmc_project.Telemetry'. +- Expected errors were returned for messages with incorrect or mutually + exclusive properties and incorrect values. +- Redfish service validator is passing. + +Signed-off-by: Szymon Dompke <szymon.dompke@intel.com> +Change-Id: Ief8c76de8aa660ae0d2dbe4610c26a28186a290a +--- + redfish-core/include/utils/finalizer.hpp | 35 ++ + .../include/utils/telemetry_utils.hpp | 82 +++ + redfish-core/lib/metric_report_definition.hpp | 31 +- + redfish-core/lib/trigger.hpp | 526 +++++++++++++++++- + 4 files changed, 642 insertions(+), 32 deletions(-) + create mode 100644 redfish-core/include/utils/finalizer.hpp + +diff --git a/redfish-core/include/utils/finalizer.hpp b/redfish-core/include/utils/finalizer.hpp +new file mode 100644 +index 0000000..cb98507 +--- /dev/null ++++ b/redfish-core/include/utils/finalizer.hpp +@@ -0,0 +1,35 @@ ++#pragma once ++ ++#include <functional> ++ ++namespace redfish ++{ ++ ++namespace utils ++{ ++ ++class Finalizer ++{ ++ public: ++ Finalizer() = delete; ++ Finalizer(std::function<void()> finalizer) : finalizer(std::move(finalizer)) ++ {} ++ ++ Finalizer(const Finalizer&) = delete; ++ Finalizer(Finalizer&&) = delete; ++ ++ ~Finalizer() ++ { ++ if (finalizer) ++ { ++ finalizer(); ++ } ++ } ++ ++ private: ++ std::function<void()> finalizer; ++}; ++ ++} // namespace utils ++ ++} // namespace redfish +\ No newline at end of file +diff --git a/redfish-core/include/utils/telemetry_utils.hpp b/redfish-core/include/utils/telemetry_utils.hpp +index 8aeff0d..c68e40c 100644 +--- a/redfish-core/include/utils/telemetry_utils.hpp ++++ b/redfish-core/include/utils/telemetry_utils.hpp +@@ -13,6 +13,9 @@ constexpr const char* metricReportDefinitionUri = + "/redfish/v1/TelemetryService/MetricReportDefinitions"; + constexpr const char* metricReportUri = + "/redfish/v1/TelemetryService/MetricReports"; ++constexpr const char* triggerInterface = ++ "xyz.openbmc_project.Telemetry.Trigger"; ++constexpr const char* triggerUri = "/redfish/v1/TelemetryService/Triggers"; + + inline std::string getDbusReportPath(const std::string& id) + { +@@ -28,5 +31,84 @@ inline std::string getDbusTriggerPath(const std::string& id) + return {triggersPath / id}; + } + ++inline std::optional<std::string> ++ getReportNameFromReportDefinitionUri(const std::string& uri) ++{ ++ constexpr const char* uriPattern = ++ "/redfish/v1/TelemetryService/MetricReportDefinitions/"; ++ constexpr size_t idx = std::string_view(uriPattern).length(); ++ if (boost::starts_with(uri, uriPattern)) ++ { ++ return uri.substr(idx); ++ } ++ return std::nullopt; ++} ++ ++inline std::optional<std::string> ++ getTriggerIdFromDbusPath(const std::string& dbusPath) ++{ ++ constexpr const char* triggerTree = ++ "/xyz/openbmc_project/Telemetry/Triggers/TelemetryService/"; ++ constexpr size_t idx = std::string_view(triggerTree).length(); ++ if (boost::starts_with(dbusPath, triggerTree)) ++ { ++ return dbusPath.substr(idx); ++ } ++ return std::nullopt; ++} ++ ++inline bool getChassisSensorNode( ++ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, ++ const std::vector<std::string>& uris, ++ boost::container::flat_set<std::pair<std::string, std::string>>& matched) ++{ ++ size_t uriIdx = 0; ++ for (const std::string& uri : uris) ++ { ++ std::string chassis; ++ std::string node; ++ ++ if (!boost::starts_with(uri, "/redfish/v1/Chassis/") || ++ !dbus::utility::getNthStringFromPath(uri, 3, chassis) || ++ !dbus::utility::getNthStringFromPath(uri, 4, node)) ++ { ++ BMCWEB_LOG_ERROR << "Failed to get chassis and sensor Node " ++ "from " ++ << uri; ++ messages::propertyValueIncorrect(asyncResp->res, uri, ++ "MetricProperties/" + ++ std::to_string(uriIdx)); ++ return false; ++ } ++ ++ if (boost::ends_with(node, "#")) ++ { ++ node.pop_back(); ++ } ++ ++ matched.emplace(std::move(chassis), std::move(node)); ++ uriIdx++; ++ } ++ return true; ++} ++ ++inline std::optional<std::string> ++ redfishActionToDbusAction(const std::string& redfishAction) ++{ ++ if (redfishAction == "RedfishMetricReport") ++ { ++ return "UpdateReport"; ++ } ++ if (redfishAction == "RedfishEvent") ++ { ++ return "RedfishEvent"; ++ } ++ if (redfishAction == "LogToLogService") ++ { ++ return "LogToLogService"; ++ } ++ return std::nullopt; ++} ++ + } // namespace telemetry + } // namespace redfish +diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp +index cb38633..4007544 100644 +--- a/redfish-core/lib/metric_report_definition.hpp ++++ b/redfish-core/lib/metric_report_definition.hpp +@@ -217,7 +217,7 @@ inline bool getUserParameters(crow::Response& res, const crow::Request& req, + return true; + } + +-inline bool getChassisSensorNode( ++inline bool getChassisSensorNodeFromMetrics( + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::vector<std::pair<std::string, std::vector<std::string>>>& + metrics, +@@ -225,30 +225,9 @@ inline bool getChassisSensorNode( + { + for (const auto& [id, uris] : metrics) + { +- for (size_t i = 0; i < uris.size(); i++) ++ if (!getChassisSensorNode(asyncResp, uris, matched)) + { +- const std::string& uri = uris[i]; +- std::string chassis; +- std::string node; +- +- if (!boost::starts_with(uri, "/redfish/v1/Chassis/") || +- !dbus::utility::getNthStringFromPath(uri, 3, chassis) || +- !dbus::utility::getNthStringFromPath(uri, 4, node)) +- { +- BMCWEB_LOG_ERROR +- << "Failed to get chassis and sensor Node from " << uri; +- messages::propertyValueIncorrect(asyncResp->res, uri, +- "MetricProperties/" + +- std::to_string(i)); +- return false; +- } +- +- if (boost::ends_with(node, "#")) +- { +- node.pop_back(); +- } +- +- matched.emplace(std::move(chassis), std::move(node)); ++ return false; + } + } + return true; +@@ -382,8 +361,8 @@ inline void requestRoutesMetricReportDefinitionCollection(App& app) + + boost::container::flat_set<std::pair<std::string, std::string>> + chassisSensors; +- if (!telemetry::getChassisSensorNode(asyncResp, args.metrics, +- chassisSensors)) ++ if (!telemetry::getChassisSensorNodeFromMetrics( ++ asyncResp, args.metrics, chassisSensors)) + { + return; + } +diff --git a/redfish-core/lib/trigger.hpp b/redfish-core/lib/trigger.hpp +index 210468c..01c150e 100644 +--- a/redfish-core/lib/trigger.hpp ++++ b/redfish-core/lib/trigger.hpp +@@ -1,7 +1,9 @@ + #pragma once + +-#include "utils/collection.hpp" ++#include "sensors.hpp" ++#include "utils/finalizer.hpp" + #include "utils/telemetry_utils.hpp" ++#include "utils/time_utils.hpp" + + #include <app.hpp> + #include <registries/privilege_registry.hpp> +@@ -14,9 +16,10 @@ namespace redfish + { + namespace telemetry + { +-constexpr const char* triggerInterface = +- "xyz.openbmc_project.Telemetry.Trigger"; +-constexpr const char* triggerUri = "/redfish/v1/TelemetryService/Triggers"; ++ ++static constexpr std::array<std::string_view, 4> ++ supportedNumericThresholdNames = {"UpperCritical", "LowerCritical", ++ "UpperWarning", "LowerWarning"}; + + using NumericThresholdParams = + std::tuple<std::string, uint64_t, std::string, double>; +@@ -24,6 +27,10 @@ using NumericThresholdParams = + using DiscreteThresholdParams = + std::tuple<std::string, std::string, uint64_t, std::string>; + ++using TriggerThresholdParams = ++ std::variant<std::vector<NumericThresholdParams>, ++ std::vector<DiscreteThresholdParams>>; ++ + using TriggerThresholdParamsExt = + std::variant<std::monostate, std::vector<NumericThresholdParams>, + std::vector<DiscreteThresholdParams>>; +@@ -35,6 +42,455 @@ using TriggerGetParamsVariant = + std::variant<std::monostate, bool, std::string, TriggerThresholdParamsExt, + TriggerSensorsParams, std::vector<std::string>>; + ++namespace add_trigger ++{ ++ ++enum class MetricType ++{ ++ Discrete, ++ Numeric ++}; ++ ++enum class DiscreteCondition ++{ ++ Specified, ++ Changed ++}; ++ ++struct Context ++{ ++ struct ++ { ++ std::string id; ++ std::string name; ++ std::vector<std::string> actions; ++ std::vector<std::pair<sdbusplus::message::object_path, std::string>> ++ sensors; ++ std::vector<std::string> reportNames; ++ TriggerThresholdParams thresholds; ++ } dbusArgs; ++ ++ struct ++ { ++ std::optional<DiscreteCondition> discreteCondition; ++ std::optional<MetricType> metricType; ++ std::optional<std::vector<std::string>> metricProperties; ++ } parsedInfo; ++ ++ boost::container::flat_map<std::string, std::string> uriToDbusMerged{}; ++}; ++ ++inline std::optional<MetricType> getMetricType(const std::string& metricType) ++{ ++ if (metricType == "Discrete") ++ { ++ return MetricType::Discrete; ++ } ++ if (metricType == "Numeric") ++ { ++ return MetricType::Numeric; ++ } ++ return std::nullopt; ++} ++ ++inline std::optional<DiscreteCondition> ++ getDiscreteCondition(const std::string& discreteTriggerCondition) ++{ ++ if (discreteTriggerCondition == "Specified") ++ { ++ return DiscreteCondition::Specified; ++ } ++ if (discreteTriggerCondition == "Changed") ++ { ++ return DiscreteCondition::Changed; ++ } ++ return std::nullopt; ++} ++ ++inline bool parseNumericThresholds(crow::Response& res, ++ nlohmann::json& numericThresholds, ++ Context& ctx) ++{ ++ if (!numericThresholds.is_object()) ++ { ++ messages::propertyValueTypeError(res, numericThresholds.dump(), ++ "NumericThresholds"); ++ return false; ++ } ++ ++ std::vector<NumericThresholdParams> parsedParams; ++ parsedParams.reserve(numericThresholds.size()); ++ ++ for (auto& [thresholdName, thresholdData] : numericThresholds.items()) ++ { ++ if (std::find(supportedNumericThresholdNames.begin(), ++ supportedNumericThresholdNames.end(), ++ thresholdName) == supportedNumericThresholdNames.end()) ++ { ++ messages::propertyUnknown(res, thresholdName); ++ return false; ++ } ++ ++ double reading = .0; ++ std::string activation; ++ std::string dwellTimeStr; ++ ++ if (!json_util::readJson(thresholdData, res, "Reading", reading, ++ "Activation", activation, "DwellTime", ++ dwellTimeStr)) ++ { ++ return false; ++ } ++ ++ std::optional<std::chrono::milliseconds> dwellTime = ++ time_utils::fromDurationString(dwellTimeStr); ++ if (!dwellTime) ++ { ++ messages::propertyValueIncorrect(res, "DwellTime", dwellTimeStr); ++ return false; ++ } ++ ++ parsedParams.emplace_back(thresholdName, ++ static_cast<uint64_t>(dwellTime->count()), ++ activation, reading); ++ } ++ ++ ctx.dbusArgs.thresholds = std::move(parsedParams); ++ return true; ++} ++ ++inline bool parseDiscreteTriggers( ++ crow::Response& res, ++ std::optional<std::vector<nlohmann::json>>& discreteTriggers, Context& ctx) ++{ ++ std::vector<DiscreteThresholdParams> parsedParams; ++ if (!discreteTriggers) ++ { ++ ctx.dbusArgs.thresholds = std::move(parsedParams); ++ return true; ++ } ++ ++ parsedParams.reserve(discreteTriggers->size()); ++ for (nlohmann::json& thresholdInfo : *discreteTriggers) ++ { ++ std::optional<std::string> name; ++ std::string value; ++ std::string dwellTimeStr; ++ std::string severity; ++ ++ if (!json_util::readJson(thresholdInfo, res, "Name", name, "Value", ++ value, "DwellTime", dwellTimeStr, "Severity", ++ severity)) ++ { ++ return false; ++ } ++ ++ std::optional<std::chrono::milliseconds> dwellTime = ++ time_utils::fromDurationString(dwellTimeStr); ++ if (!dwellTime) ++ { ++ messages::propertyValueIncorrect(res, "DwellTime", dwellTimeStr); ++ return false; ++ } ++ ++ if (!name) ++ { ++ name = ""; ++ } ++ ++ parsedParams.emplace_back( ++ *name, severity, static_cast<uint64_t>(dwellTime->count()), value); ++ } ++ ++ ctx.dbusArgs.thresholds = std::move(parsedParams); ++ return true; ++} ++ ++inline bool parseTriggerThresholds( ++ crow::Response& res, ++ std::optional<std::vector<nlohmann::json>>& discreteTriggers, ++ std::optional<nlohmann::json>& numericThresholds, Context& ctx) ++{ ++ if (discreteTriggers && numericThresholds) ++ { ++ messages::mutualExclusiveProperties(res, "DiscreteTriggers", ++ "NumericThresholds"); ++ return false; ++ } ++ ++ if (ctx.parsedInfo.discreteCondition) ++ { ++ if (numericThresholds) ++ { ++ messages::mutualExclusiveProperties(res, "DiscreteTriggerCondition", ++ "NumericThresholds"); ++ return false; ++ } ++ } ++ ++ if (ctx.parsedInfo.metricType) ++ { ++ if (*ctx.parsedInfo.metricType == MetricType::Discrete && ++ numericThresholds) ++ { ++ messages::propertyValueConflict(res, "NumericThresholds", ++ "MetricType"); ++ return false; ++ } ++ if (*ctx.parsedInfo.metricType == MetricType::Numeric && ++ discreteTriggers) ++ { ++ messages::propertyValueConflict(res, "DiscreteTriggers", ++ "MetricType"); ++ return false; ++ } ++ if (*ctx.parsedInfo.metricType == MetricType::Numeric && ++ ctx.parsedInfo.discreteCondition) ++ { ++ messages::propertyValueConflict(res, "DiscreteTriggers", ++ "DiscreteTriggerCondition"); ++ return false; ++ } ++ } ++ ++ if (discreteTriggers || ctx.parsedInfo.discreteCondition || ++ (ctx.parsedInfo.metricType && ++ *ctx.parsedInfo.metricType == MetricType::Discrete)) ++ { ++ if (ctx.parsedInfo.discreteCondition) ++ { ++ if (*ctx.parsedInfo.discreteCondition == ++ DiscreteCondition::Specified && ++ !discreteTriggers) ++ { ++ messages::createFailedMissingReqProperties(res, ++ "DiscreteTriggers"); ++ return false; ++ } ++ if (discreteTriggers && ((*ctx.parsedInfo.discreteCondition == ++ DiscreteCondition::Specified && ++ discreteTriggers->empty()) || ++ (*ctx.parsedInfo.discreteCondition == ++ DiscreteCondition::Changed && ++ !discreteTriggers->empty()))) ++ { ++ messages::propertyValueConflict(res, "DiscreteTriggers", ++ "DiscreteTriggerCondition"); ++ return false; ++ } ++ } ++ if (!parseDiscreteTriggers(res, discreteTriggers, ctx)) ++ { ++ return false; ++ } ++ } ++ else if (numericThresholds) ++ { ++ if (!parseNumericThresholds(res, *numericThresholds, ctx)) ++ { ++ return false; ++ } ++ } ++ else ++ { ++ messages::createFailedMissingReqProperties( ++ res, "'DiscreteTriggers', 'NumericThresholds', " ++ "'DiscreteTriggerCondition' or 'MetricType'"); ++ return false; ++ } ++ return true; ++} ++ ++inline bool parseLinks(crow::Response& res, nlohmann::json& links, Context& ctx) ++{ ++ if (links.empty()) ++ { ++ return true; ++ } ++ ++ std::optional<std::vector<std::string>> metricReportDefinitions; ++ if (!json_util::readJson(links, res, "MetricReportDefinitions", ++ metricReportDefinitions)) ++ { ++ return false; ++ } ++ ++ if (metricReportDefinitions) ++ { ++ ctx.dbusArgs.reportNames.reserve(metricReportDefinitions->size()); ++ for (std::string& reportDefinionUri : *metricReportDefinitions) ++ { ++ std::optional<std::string> reportName = ++ getReportNameFromReportDefinitionUri(reportDefinionUri); ++ if (!reportName) ++ { ++ messages::propertyValueIncorrect(res, "MetricReportDefinitions", ++ reportDefinionUri); ++ return false; ++ } ++ ctx.dbusArgs.reportNames.push_back(*reportName); ++ } ++ } ++ return true; ++} ++ ++inline bool parseMetricProperties(crow::Response& res, Context& ctx) ++{ ++ if (!ctx.parsedInfo.metricProperties) ++ { ++ return true; ++ } ++ ++ ctx.dbusArgs.sensors.reserve(ctx.parsedInfo.metricProperties->size()); ++ ++ size_t uriIdx = 0; ++ for (const std::string& uri : *ctx.parsedInfo.metricProperties) ++ { ++ auto el = ctx.uriToDbusMerged.find(uri); ++ if (el == ctx.uriToDbusMerged.end()) ++ { ++ BMCWEB_LOG_ERROR << "Failed to find DBus sensor " ++ "corsresponding to URI " ++ << uri; ++ messages::propertyValueNotInList( ++ res, uri, "MetricProperties/" + std::to_string(uriIdx)); ++ return false; ++ } ++ ++ const std::string& dbusPath = el->second; ++ ctx.dbusArgs.sensors.emplace_back(dbusPath, uri); ++ uriIdx++; ++ } ++ return true; ++} ++ ++inline bool parsePostTriggerParams(crow::Response& res, ++ const crow::Request& req, Context& ctx) ++{ ++ std::optional<std::string> id; ++ std::optional<std::string> name; ++ std::optional<std::string> metricType; ++ std::optional<std::vector<std::string>> triggerActions; ++ std::optional<std::string> discreteTriggerCondition; ++ std::optional<std::vector<nlohmann::json>> discreteTriggers; ++ std::optional<nlohmann::json> numericThresholds; ++ std::optional<nlohmann::json> links; ++ if (!json_util::readJson( ++ req, res, "Id", id, "Name", name, "MetricType", metricType, ++ "TriggerActions", triggerActions, "DiscreteTriggerCondition", ++ discreteTriggerCondition, "DiscreteTriggers", discreteTriggers, ++ "NumericThresholds", numericThresholds, "MetricProperties", ++ ctx.parsedInfo.metricProperties, "Links", links)) ++ { ++ return false; ++ } ++ ++ ctx.dbusArgs.id = id.value_or(""); ++ ctx.dbusArgs.name = name.value_or(""); ++ ++ if (metricType) ++ { ++ if (!(ctx.parsedInfo.metricType = getMetricType(*metricType))) ++ { ++ messages::propertyValueIncorrect(res, "MetricType", *metricType); ++ return false; ++ } ++ } ++ ++ if (discreteTriggerCondition) ++ { ++ if (!(ctx.parsedInfo.discreteCondition = ++ getDiscreteCondition(*discreteTriggerCondition))) ++ { ++ messages::propertyValueIncorrect(res, "DiscreteTriggerCondition", ++ *discreteTriggerCondition); ++ return false; ++ } ++ } ++ ++ if (triggerActions) ++ { ++ ctx.dbusArgs.actions.reserve(triggerActions->size()); ++ for (const std::string& action : *triggerActions) ++ { ++ if (const std::optional<std::string>& dbusAction = ++ redfishActionToDbusAction(action)) ++ { ++ ctx.dbusArgs.actions.emplace_back(*dbusAction); ++ } ++ else ++ { ++ messages::propertyValueNotInList(res, action, "TriggerActions"); ++ return false; ++ } ++ } ++ } ++ ++ if (!parseTriggerThresholds(res, discreteTriggers, numericThresholds, ctx)) ++ { ++ return false; ++ } ++ ++ if (links) ++ { ++ if (!parseLinks(res, *links, ctx)) ++ { ++ return false; ++ } ++ } ++ return true; ++} ++ ++inline void createTrigger(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, ++ Context& ctx) ++{ ++ crow::connections::systemBus->async_method_call( ++ [aResp = asyncResp, id = ctx.dbusArgs.id]( ++ const boost::system::error_code ec, const std::string& dbusPath) { ++ if (ec == boost::system::errc::file_exists) ++ { ++ messages::resourceAlreadyExists(aResp->res, "Trigger", "Id", ++ id); ++ return; ++ } ++ if (ec == boost::system::errc::too_many_files_open) ++ { ++ messages::createLimitReachedForResource(aResp->res); ++ return; ++ } ++ if (ec) ++ { ++ messages::internalError(aResp->res); ++ BMCWEB_LOG_ERROR << "respHandler DBus error " << ec; ++ return; ++ } ++ ++ const std::optional<std::string>& triggerId = ++ getTriggerIdFromDbusPath(dbusPath); ++ if (!triggerId) ++ { ++ messages::internalError(aResp->res); ++ BMCWEB_LOG_ERROR << "Unknown data returned by " ++ "AddTrigger DBus method"; ++ return; ++ } ++ ++ messages::created(aResp->res); ++ aResp->res.addHeader("Location", ++ triggerUri + std::string("/") + *triggerId); ++ }, ++ service, "/xyz/openbmc_project/Telemetry/Triggers", ++ "xyz.openbmc_project.Telemetry.TriggerManager", "AddTrigger", ++ "TelemetryService/" + ctx.dbusArgs.id, ctx.dbusArgs.name, ++ ctx.dbusArgs.actions, ctx.dbusArgs.sensors, ctx.dbusArgs.reportNames, ++ ctx.dbusArgs.thresholds); ++} ++ ++} // namespace add_trigger ++ ++namespace get_trigger ++{ ++ + inline std::optional<std::string> + getRedfishFromDbusAction(const std::string& dbusAction) + { +@@ -270,6 +726,8 @@ inline bool fillTrigger( + return true; + } + ++} // namespace get_trigger ++ + } // namespace telemetry + + inline void requestRoutesTriggerCollection(App& app) +@@ -290,6 +748,62 @@ inline void requestRoutesTriggerCollection(App& app) + asyncResp, telemetry::triggerUri, interfaces, + "/xyz/openbmc_project/Telemetry/Triggers/TelemetryService"); + }); ++ ++ BMCWEB_ROUTE(app, "/redfish/v1/TelemetryService/Triggers/") ++ .privileges(redfish::privileges::postTriggersCollection) ++ .methods(boost::beast::http::verb::post)( ++ [](const crow::Request& req, ++ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { ++ const auto ctx = ++ std::make_shared<telemetry::add_trigger::Context>(); ++ if (!telemetry::add_trigger::parsePostTriggerParams( ++ asyncResp->res, req, *ctx)) ++ { ++ return; ++ } ++ ++ if (!ctx->parsedInfo.metricProperties || ++ ctx->parsedInfo.metricProperties->empty()) ++ { ++ telemetry::add_trigger::createTrigger(asyncResp, *ctx); ++ return; ++ } ++ ++ boost::container::flat_set<std::pair<std::string, std::string>> ++ chassisSensors; ++ if (!telemetry::getChassisSensorNode( ++ asyncResp, *ctx->parsedInfo.metricProperties, ++ chassisSensors)) ++ { ++ return; ++ } ++ ++ const auto finalizer = ++ std::make_shared<utils::Finalizer>([asyncResp, ctx] { ++ if (!telemetry::add_trigger::parseMetricProperties( ++ asyncResp->res, *ctx)) ++ { ++ return; ++ } ++ telemetry::add_trigger::createTrigger(asyncResp, *ctx); ++ }); ++ ++ for (const auto& [chassis, sensorType] : chassisSensors) ++ { ++ retrieveUriToDbusMap( ++ chassis, sensorType, ++ [asyncResp, ctx, ++ finalizer](const boost::beast::http::status status, ++ const boost::container::flat_map< ++ std::string, std::string>& uriToDbus) { ++ if (status == boost::beast::http::status::ok) ++ { ++ ctx->uriToDbusMerged.insert(uriToDbus.begin(), ++ uriToDbus.end()); ++ } ++ }); ++ } ++ }); + } + + inline void requestRoutesTrigger(App& app) +@@ -320,8 +834,8 @@ inline void requestRoutesTrigger(App& app) + return; + } + +- if (!telemetry::fillTrigger(asyncResp->res.jsonValue, +- id, ret)) ++ if (!telemetry::get_trigger::fillTrigger( ++ asyncResp->res.jsonValue, id, ret)) + { + messages::internalError(asyncResp->res); + } +-- +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/0001-Sync-Telmetry-service-with-EventService.patch index 3088a7f9d..f86f48528 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/0001-Sync-Telmetry-service-with-EventService.patch @@ -1,4 +1,4 @@ -From 541353a4e4b06de42b6a9a400629f5a5fba04e86 Mon Sep 17 00:00:00 2001 +From 383848b9088056371743a28eb1f9a3ed415dc46b 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 @@ -18,12 +18,12 @@ 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(-) + .../include/event_service_manager.hpp | 135 ++++++------------ + redfish-core/lib/metric_report.hpp | 29 ++-- + 2 files changed, 59 insertions(+), 105 deletions(-) diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index 3f398d7..cf9f658 100644 +index 010c991..38ab879 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -14,6 +14,7 @@ @@ -34,7 +34,7 @@ index 3f398d7..cf9f658 100644 #include "registries.hpp" #include "registries/base_message_registry.hpp" #include "registries/openbmc_message_registry.hpp" -@@ -511,47 +512,32 @@ class Subscription : public persistent_data::UserSubscription +@@ -503,47 +504,32 @@ class Subscription : public persistent_data::UserSubscription } #endif @@ -93,28 +93,45 @@ index 3f398d7..cf9f658 100644 this->sendEvent( msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace)); } -@@ -1317,75 +1303,6 @@ class EventServiceManager +@@ -1309,73 +1295,43 @@ class EventServiceManager } #endif - - void getMetricReading(const std::string& service, - const std::string& objPath, const std::string& intf) -- { ++ void getReadingsForReport(sdbusplus::message::message& msg) + { - std::size_t found = objPath.find_last_of('/'); - if (found == std::string::npos) -- { ++ sdbusplus::message::object_path path(msg.get_path()); ++ std::string id = path.filename(); ++ if (id.empty()) + { - BMCWEB_LOG_DEBUG << "Invalid objPath received"; -- return; -- } -- ++ BMCWEB_LOG_ERROR << "Failed to get Id from path"; + return; + } + - std::string idStr = objPath.substr(found + 1); - if (idStr.empty()) -- { ++ std::string interface; ++ std::vector< ++ std::pair<std::string, std::variant<telemetry::TimestampReadings>>> ++ props; ++ std::vector<std::string> invalidProps; ++ msg.read(interface, props, invalidProps); ++ ++ auto found = ++ std::find_if(props.begin(), props.end(), ++ [](const auto& x) { return x.first == "Readings"; }); ++ if (found == props.end()) + { - BMCWEB_LOG_DEBUG << "Invalid ID in objPath"; -- return; -- } -- ++ BMCWEB_LOG_INFO << "Failed to get Readings from Report properties"; + return; + } + - crow::connections::systemBus->async_method_call( - [idStr{std::move(idStr)}]( - const boost::system::error_code ec, @@ -164,12 +181,21 @@ index 3f398d7..cf9f658 100644 - }, - service, objPath, "org.freedesktop.DBus.Properties", "GetAll", - intf); -- } -- ++ const std::variant<telemetry::TimestampReadings>& readings = ++ found->second; ++ for (const auto& it : ++ EventServiceManager::getInstance().subscriptionsMap) ++ { ++ Subscription& entry = *it.second.get(); ++ if (entry.eventFormatType == metricReportFormatType) ++ { ++ entry.filterAndSendReports(id, readings); ++ } ++ } + } + void unregisterMetricReportSignal() - { - if (matchTelemetryMonitor) -@@ -1405,9 +1322,11 @@ class EventServiceManager +@@ -1397,9 +1353,9 @@ class EventServiceManager } BMCWEB_LOG_DEBUG << "Metrics report signal - Register"; @@ -178,13 +204,11 @@ index 3f398d7..cf9f658 100644 - "interface='xyz.openbmc_project.MonitoringService.Report'"); + std::string matchStr = "type='signal',member='PropertiesChanged'," + "interface='org.freedesktop.DBus.Properties'," -+ "path_namespace=/xyz/openbmc_project/Telemetry/" -+ "Reports/TelemetryService," + "arg0=xyz.openbmc_project.Telemetry.Report"; matchTelemetryMonitor = std::make_shared<sdbusplus::bus::match::match>( *crow::connections::systemBus, matchStr, -@@ -1418,10 +1337,43 @@ class EventServiceManager +@@ -1410,10 +1366,7 @@ class EventServiceManager return; } @@ -192,51 +216,15 @@ index 3f398d7..cf9f658 100644 - std::string objPath = msg.get_path(); - std::string intf = msg.get_interface(); - getMetricReading(service, objPath, intf); -+ sdbusplus::message::object_path path(msg.get_path()); -+ std::string id = path.filename(); -+ if (id.empty()) -+ { -+ BMCWEB_LOG_ERROR << "Failed to get Id from path"; -+ return; -+ } -+ -+ std::string intf; -+ std::vector<std::pair< -+ std::string, std::variant<telemetry::TimestampReadings>>> -+ props; -+ std::vector<std::string> invalidProps; -+ msg.read(intf, props, invalidProps); -+ -+ auto found = -+ std::find_if(props.begin(), props.end(), [](const auto& x) { -+ return x.first == "Readings"; -+ }); -+ if (found == props.end()) -+ { -+ BMCWEB_LOG_INFO -+ << "Failed to get Readings from Report properties"; -+ return; -+ } -+ -+ const std::variant<telemetry::TimestampReadings>& readings = -+ found->second; -+ for (const auto& it : -+ EventServiceManager::getInstance().subscriptionsMap) -+ { -+ Subscription& entry = *it.second.get(); -+ if (entry.eventFormatType == metricReportFormatType) -+ { -+ entry.filterAndSendReports(id, readings); -+ } -+ } ++ getReadingsForReport(msg); }); } diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp -index 63c8c19..7fe281d 100644 +index 159968a..c959495 100644 --- a/redfish-core/lib/metric_report.hpp +++ b/redfish-core/lib/metric_report.hpp -@@ -33,16 +33,14 @@ inline nlohmann::json toMetricValues(const Readings& readings) +@@ -34,17 +34,14 @@ inline nlohmann::json toMetricValues(const Readings& readings) return metricValues; } @@ -247,19 +235,20 @@ index 63c8c19..7fe281d 100644 { - asyncResp->res.jsonValue["@odata.type"] = - "#MetricReport.v1_3_0.MetricReport"; -- asyncResp->res.jsonValue["@odata.id"] = telemetry::metricReportUri + id; +- asyncResp->res.jsonValue["@odata.id"] = +- telemetry::metricReportUri + std::string("/") + id; - asyncResp->res.jsonValue["Id"] = id; - asyncResp->res.jsonValue["Name"] = id; - asyncResp->res.jsonValue["MetricReportDefinition"]["@odata.id"] = + json["@odata.type"] = "#MetricReport.v1_3_0.MetricReport"; -+ json["@odata.id"] = telemetry::metricReportUri + id; ++ json["@odata.id"] = telemetry::metricReportUri + std::string("/") + id; + json["Id"] = id; + json["Name"] = id; + json["MetricReportDefinition"]["@odata.id"] = - telemetry::metricReportDefinitionUri + id; + telemetry::metricReportDefinitionUri + std::string("/") + id; const TimestampReadings* timestampReadings = -@@ -50,14 +48,14 @@ inline void fillReport(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, +@@ -52,14 +49,14 @@ inline void fillReport(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, if (!timestampReadings) { BMCWEB_LOG_ERROR << "Property type mismatch or property is missing"; @@ -278,7 +267,7 @@ index 63c8c19..7fe281d 100644 } } // namespace telemetry -@@ -118,7 +116,11 @@ inline void requestRoutesMetricReport(App& app) +@@ -122,7 +119,11 @@ inline void requestRoutesMetricReport(App& app) return; } 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/0002-Revert-Remove-LogService-from-TelemetryService.patch index a80ac61c7..6b57dc912 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/0002-Revert-Remove-LogService-from-TelemetryService.patch @@ -1,21 +1,21 @@ -From da575aaf0bdcb15be261d58314cf7bbbcd92dd74 Mon Sep 17 00:00:00 2001 +From 71b55e9773c387d6510650e7cf64f050a853ac77 Mon Sep 17 00:00:00 2001 From: Krzysztof Grobelny <krzysztof.grobelny@intel.com> -Date: Tue, 12 Oct 2021 08:08:06 +0000 +Date: Tue, 30 Nov 2021 16:29:12 +0100 Subject: [PATCH] Revert "Remove LogService from TelemetryService" This reverts commit 2b3da45876aac57a36d3093379a992d699e7e396. --- - redfish-core/lib/telemetry_service.hpp | 2 ++ - 1 file changed, 2 insertions(+) + redfish-core/lib/telemetry_service.hpp | 2 + + 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp -index 027b51b..49471fe 100644 +index b79a5cd..e3e4a25 100644 --- a/redfish-core/lib/telemetry_service.hpp +++ b/redfish-core/lib/telemetry_service.hpp -@@ -24,6 +24,8 @@ inline void handleTelemetryServiceGet( +@@ -25,6 +25,8 @@ inline void handleTelemetryServiceGet( "/redfish/v1/TelemetryService/MetricReports"; - asyncResp->res.jsonValue["MetricDefinitions"]["@odata.id"] = - "/redfish/v1/TelemetryService/MetricDefinitions"; + asyncResp->res.jsonValue["Triggers"]["@odata.id"] = + "/redfish/v1/TelemetryService/Triggers"; + asyncResp->res.jsonValue["LogService"]["@odata.id"] = + "/redfish/v1/Managers/bmc/LogServices/Journal"; 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 5dd2f51bc..a71511a96 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,6 +1,6 @@ -From 8ba1bcc3503cafb33b1a06356d4f8f92ae23e39a Mon Sep 17 00:00:00 2001 +From 41ee20f46f2c6d2e9e5418128993cd176d03a927 Mon Sep 17 00:00:00 2001 From: Krzysztof Grobelny <krzysztof.grobelny@intel.com> -Date: Thu, 17 Jun 2021 13:37:57 +0000 +Date: Wed, 5 Jan 2022 14:54:18 +0100 Subject: [PATCH] Switched bmcweb to use new telemetry service API Added support for multiple MetricProperties. Added support for new @@ -15,51 +15,66 @@ Tested: Change-Id: I2cd17069e3ea015c8f5571c29278f1d50536272a Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> +Signed-off-by: Lukasz Kazmierczak <lukasz.kazmierczak@intel.com> --- - redfish-core/lib/metric_report_definition.hpp | 212 ++++++++++-------- - 1 file changed, 114 insertions(+), 98 deletions(-) + include/dbus_utility.hpp | 5 +- + redfish-core/lib/metric_report_definition.hpp | 310 +++++++++++------- + 2 files changed, 189 insertions(+), 126 deletions(-) +diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp +index a971325..35109c4 100644 +--- a/include/dbus_utility.hpp ++++ b/include/dbus_utility.hpp +@@ -51,8 +51,9 @@ using DbusVariantType = sdbusplus::utility::dedup_variant_t< + std::vector<std::tuple<std::string, std::string>>, + std::vector<std::tuple<uint32_t, std::vector<uint32_t>>>, + std::vector<std::tuple<uint32_t, size_t>>, +- std::vector<std::tuple<sdbusplus::message::object_path, std::string, +- std::string, std::string>> ++ std::vector<std::tuple< ++ std::vector<std::tuple<sdbusplus::message::object_path, std::string>>, ++ std::string, std::string, std::string, uint64_t>> + >; + + // clang-format on diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp -index a0c4f1d..7c26787 100644 +index 2584afc..9512381 100644 --- a/redfish-core/lib/metric_report_definition.hpp +++ b/redfish-core/lib/metric_report_definition.hpp -@@ -7,6 +7,8 @@ - #include <app.hpp> +@@ -8,6 +8,8 @@ #include <boost/container/flat_map.hpp> + #include <dbus_utility.hpp> #include <registries/privilege_registry.hpp> +#include <sdbusplus/asio/property.hpp> +#include <sdbusplus/unpack_properties.hpp> #include <tuple> #include <variant> -@@ -17,87 +19,90 @@ namespace redfish +@@ -18,119 +20,156 @@ namespace redfish namespace telemetry { -using ReadingParameters = - std::vector<std::tuple<sdbusplus::message::object_path, std::string, - std::string, std::string>>; -+using ReadingParameters = std::vector< -+ std::tuple<std::vector<sdbusplus::message::object_path>, std::string, -+ std::string, std::string, std::string, uint64_t>>; ++using ReadingParameters = std::vector<std::tuple< ++ std::vector<std::tuple<sdbusplus::message::object_path, std::string>>, ++ std::string, std::string, std::string, uint64_t>>; - inline void fillReportDefinition( - const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& id, - const std::vector< -- std::pair<std::string, std::variant<std::string, bool, uint64_t, -- ReadingParameters>>>& ret) -+ std::pair<std::string, std::variant<std::monostate, std::string, bool, -+ uint64_t, ReadingParameters>>>& -+ properties) +-inline void fillReportDefinition( +- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& id, +- const std::vector<std::pair<std::string, dbus::utility::DbusVariantType>>& +- ret) ++std::string toReadfishReportAction(std::string_view action) { - asyncResp->res.jsonValue["@odata.type"] = - "#MetricReportDefinition.v1_3_0.MetricReportDefinition"; - asyncResp->res.jsonValue["@odata.id"] = -- telemetry::metricReportDefinitionUri + id; +- telemetry::metricReportDefinitionUri + std::string("/") + id; - asyncResp->res.jsonValue["Id"] = id; - asyncResp->res.jsonValue["Name"] = id; - asyncResp->res.jsonValue["MetricReport"]["@odata.id"] = -- telemetry::metricReportUri + id; +- telemetry::metricReportUri + std::string("/") + id; - asyncResp->res.jsonValue["Status"]["State"] = "Enabled"; - asyncResp->res.jsonValue["ReportUpdates"] = "Overwrite"; - @@ -69,34 +84,16 @@ index a0c4f1d..7c26787 100644 - const std::string* reportingType = nullptr; - const uint64_t* interval = nullptr; - for (const auto& [key, var] : ret) -+ try ++ if (action == "EmitsReadingsUpdate") { - if (key == "EmitsReadingsUpdate") -+ bool emitsReadingsUpdate = false; -+ bool logToMetricReportsCollection = false; -+ ReadingParameters readingParams; -+ std::string reportingType; -+ uint64_t interval = 0u; -+ -+ sdbusplus::unpackProperties( -+ properties, "EmitsReadingsUpdate", emitsReadingsUpdate, -+ "LogToMetricReportsCollection", logToMetricReportsCollection, -+ "ReadingParametersFutureVersion", readingParams, "ReportingType", -+ reportingType, "Interval", interval); -+ -+ std::vector<std::string> redfishReportActions; -+ redfishReportActions.reserve(2); -+ if (emitsReadingsUpdate) - { +- { - emitsReadingsUpdate = std::get_if<bool>(&var); -+ redfishReportActions.emplace_back("RedfishEvent"); - } +- } - else if (key == "LogToMetricReportsCollection") -+ if (logToMetricReportsCollection) - { +- { - logToMetricReportsCollection = std::get_if<bool>(&var); -+ redfishReportActions.emplace_back("LogToMetricReportsCollection"); - } +- } - else if (key == "ReadingParameters") - { - readingParams = std::get_if<ReadingParameters>(&var); @@ -106,76 +103,126 @@ index a0c4f1d..7c26787 100644 - reportingType = std::get_if<std::string>(&var); - } - else if (key == "Interval") -+ -+ nlohmann::json metrics = nlohmann::json::array(); -+ for (auto& [sensorPath, operationType, id, metadata, -+ collectionTimeScope, collectionDuration] : readingParams) - { +- { - interval = std::get_if<uint64_t>(&var); -+ std::vector<std::string> metricProperties; -+ -+ nlohmann::json parsedMetadata = nlohmann::json::parse(metadata); -+ if (!json_util::readJson(parsedMetadata, asyncResp->res, -+ "MetricProperties", metricProperties)) -+ { -+ BMCWEB_LOG_ERROR << "Failed to read metadata"; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ -+ metrics.push_back({ -+ {"MetricId", id}, -+ {"MetricProperties", std::move(metricProperties)}, -+ }); - } -- } +- } ++ return "RedfishEvent"; + } - if (!emitsReadingsUpdate || !logToMetricReportsCollection || - !readingParams || !reportingType || !interval) -- { ++ if (action == "LogToMetricReportsCollection") + { - BMCWEB_LOG_ERROR << "Property type mismatch or property is missing"; - messages::internalError(asyncResp->res); - return; -- } ++ return "LogToMetricReportsCollection"; + } ++ return ""; ++} - std::vector<std::string> redfishReportActions; - redfishReportActions.reserve(2); - if (*emitsReadingsUpdate) -- { ++std::string toDbusReportAction(std::string_view action) ++{ ++ if (action == "RedfishEvent") + { - redfishReportActions.emplace_back("RedfishEvent"); ++ return "EmitsReadingsUpdate"; + } +- if (*logToMetricReportsCollection) ++ if (action == "LogToMetricReportsCollection") + { +- redfishReportActions.emplace_back("LogToMetricReportsCollection"); ++ return "LogToMetricReportsCollection"; + } ++ return ""; ++} + +- nlohmann::json metrics = nlohmann::json::array(); +- for (auto& [sensorPath, operationType, id, metadata] : *readingParams) ++inline void fillReportDefinition( ++ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& id, ++ const std::vector<std::pair<std::string, dbus::utility::DbusVariantType>>& ++ properties) ++{ ++ try + { +- metrics.push_back({ +- {"MetricId", id}, +- {"MetricProperties", {metadata}}, +- }); ++ std::vector<std::string> reportActions; ++ ReadingParameters readingParams; ++ std::string reportingType; ++ std::string reportUpdates; ++ std::string name; ++ uint64_t appendLimit = 0u; ++ uint64_t interval = 0u; ++ ++ sdbusplus::unpackProperties( ++ properties, "ReportActions", reportActions, "ReportUpdates", ++ reportUpdates, "AppendLimit", appendLimit, ++ "ReadingParametersFutureVersion", readingParams, "ReportingType", ++ reportingType, "Interval", interval, "Name", name); ++ ++ for (std::string& action : reportActions) ++ { ++ action = toReadfishReportAction(action); ++ ++ if (action.empty()) ++ { ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ } ++ ++ nlohmann::json metrics = nlohmann::json::array(); ++ for (auto& [sensorData, collectionFunction, id, collectionTimeScope, ++ collectionDuration] : readingParams) ++ { ++ std::vector<std::string> metricProperties; ++ ++ for (auto& [sensorPath, sensorMetadata] : sensorData) ++ { ++ metricProperties.emplace_back(std::move(sensorMetadata)); ++ } ++ ++ metrics.push_back( ++ {{"MetricId", std::move(id)}, ++ {"MetricProperties", std::move(metricProperties)}, ++ {"CollectionFunction", std::move(collectionFunction)}, ++ {"CollectionDuration", ++ time_utils::toDurationString( ++ std::chrono::milliseconds(collectionDuration))}, ++ {"CollectionTimeScope", std::move(collectionTimeScope)}}); ++ } ++ + asyncResp->res.jsonValue["@odata.type"] = + "#MetricReportDefinition.v1_3_0.MetricReportDefinition"; + asyncResp->res.jsonValue["@odata.id"] = -+ telemetry::metricReportDefinitionUri + id; ++ telemetry::metricReportDefinitionUri + std::string("/") + id; + asyncResp->res.jsonValue["Id"] = id; -+ asyncResp->res.jsonValue["Name"] = id; ++ asyncResp->res.jsonValue["Name"] = name; + asyncResp->res.jsonValue["MetricReport"]["@odata.id"] = -+ telemetry::metricReportUri + id; ++ telemetry::metricReportUri + std::string("/") + id; + asyncResp->res.jsonValue["Status"]["State"] = "Enabled"; -+ asyncResp->res.jsonValue["ReportUpdates"] = "Overwrite"; ++ asyncResp->res.jsonValue["ReportUpdates"] = reportUpdates; ++ asyncResp->res.jsonValue["AppendLimit"] = appendLimit; + asyncResp->res.jsonValue["Metrics"] = metrics; + asyncResp->res.jsonValue["MetricReportDefinitionType"] = reportingType; -+ asyncResp->res.jsonValue["ReportActions"] = redfishReportActions; ++ asyncResp->res.jsonValue["ReportActions"] = reportActions; + asyncResp->res.jsonValue["Schedule"]["RecurrenceInterval"] = + time_utils::toDurationString(std::chrono::milliseconds(interval)); - } -- if (*logToMetricReportsCollection) ++ } + catch (const sdbusplus::exception::UnpackPropertyError& error) - { -- redfishReportActions.emplace_back("LogToMetricReportsCollection"); ++ { + BMCWEB_LOG_ERROR << error.what() << ", property: " + << error.propertyName + ", reason: " << error.reason; -+ messages::internalError(asyncResp->res); - } -- -- nlohmann::json metrics = nlohmann::json::array(); -- for (auto& [sensorPath, operationType, id, metadata] : *readingParams) -+ catch (const nlohmann::json::parse_error& e) - { -- metrics.push_back({ -- {"MetricId", id}, -- {"MetricProperties", {metadata}}, -- }); -+ BMCWEB_LOG_ERROR << "Failed to parse metadata: " << e.what(); ++ messages::queryParameterValueFormatError( ++ asyncResp->res, ++ std::string(error.propertyName) + " " + std::string(error.reason), ++ error.what()); + messages::internalError(asyncResp->res); } - asyncResp->res.jsonValue["Metrics"] = metrics; @@ -186,33 +233,196 @@ index a0c4f1d..7c26787 100644 } struct AddReportArgs -@@ -275,6 +280,11 @@ class AddReport + { +- std::string name; ++ struct MetricArgs ++ { ++ std::string id; ++ std::vector<std::string> uris; ++ std::optional<std::string> collectionFunction; ++ std::optional<std::string> collectionTimeScope; ++ std::optional<uint64_t> collectionDuration; ++ }; ++ ++ std::optional<std::string> id; ++ std::optional<std::string> name; + std::string reportingType; +- bool emitsReadingsUpdate = false; +- bool logToMetricReportsCollection = false; ++ std::optional<std::string> reportUpdates; ++ std::optional<uint64_t> appendLimit; ++ std::vector<std::string> reportActions; + uint64_t interval = 0; +- std::vector<std::pair<std::string, std::vector<std::string>>> metrics; ++ std::vector<MetricArgs> metrics; + }; - for (const auto& [id, uris] : args.metrics) + inline bool toDbusReportActions(crow::Response& res, +- std::vector<std::string>& actions, ++ const std::vector<std::string>& actions, + AddReportArgs& args) + { + size_t index = 0; +- for (auto& action : actions) ++ for (const auto& action : actions) + { +- if (action == "RedfishEvent") +- { +- args.emitsReadingsUpdate = true; +- } +- else if (action == "LogToMetricReportsCollection") +- { +- args.logToMetricReportsCollection = true; +- } +- else ++ std::string dbusReportAction = toDbusReportAction(action); ++ ++ if (dbusReportAction.empty()) { -+ std::vector<sdbusplus::message::object_path> dbusPaths; -+ dbusPaths.reserve(uris.size()); -+ nlohmann::json metadata; -+ metadata["MetricProperties"] = nlohmann::json::array(); + messages::propertyValueNotInList( + res, action, "ReportActions/" + std::to_string(index)); + return false; + } + - for (size_t i = 0; i < uris.size(); i++) ++ args.reportActions.emplace_back(std::move(dbusReportAction)); + index++; + } + return true; +@@ -142,23 +181,12 @@ inline bool getUserParameters(crow::Response& res, const crow::Request& req, + std::vector<nlohmann::json> metrics; + std::vector<std::string> reportActions; + std::optional<nlohmann::json> schedule; +- if (!json_util::readJson(req, res, "Id", args.name, "Metrics", metrics, +- "MetricReportDefinitionType", args.reportingType, +- "ReportActions", reportActions, "Schedule", +- schedule)) +- { +- return false; +- } +- +- constexpr const char* allowedCharactersInName = +- "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"; +- if (args.name.empty() || args.name.find_first_not_of( +- allowedCharactersInName) != std::string::npos) ++ if (!json_util::readJson( ++ req, res, "Id", args.id, "Name", args.name, "Metrics", metrics, ++ "MetricReportDefinitionType", args.reportingType, "ReportUpdates", ++ args.reportUpdates, "AppendLimit", args.appendLimit, ++ "ReportActions", reportActions, "Schedule", schedule)) + { +- BMCWEB_LOG_ERROR << "Failed to match " << args.name +- << " with allowed character " +- << allowedCharactersInName; +- messages::propertyValueIncorrect(res, "Id", args.name); + return false; + } + +@@ -203,15 +231,35 @@ inline bool getUserParameters(crow::Response& res, const crow::Request& req, + args.metrics.reserve(metrics.size()); + for (auto& m : metrics) + { +- std::string id; +- std::vector<std::string> uris; +- if (!json_util::readJson(m, res, "MetricId", id, "MetricProperties", +- uris)) ++ std::optional<std::string> collectionDurationStr; ++ AddReportArgs::MetricArgs metricArgs; ++ if (!json_util::readJson( ++ m, res, "MetricId", metricArgs.id, "MetricProperties", ++ metricArgs.uris, "CollectionFunction", ++ metricArgs.collectionFunction, "CollectionTimeScope", ++ metricArgs.collectionTimeScope, "CollectionDuration", ++ collectionDurationStr)) + { + return false; + } + +- args.metrics.emplace_back(std::move(id), std::move(uris)); ++ if (collectionDurationStr) ++ { ++ std::optional<std::chrono::milliseconds> duration = ++ time_utils::fromDurationString(*collectionDurationStr); ++ ++ if (!duration || duration->count() < 0) ++ { ++ messages::propertyValueIncorrect(res, "CollectionDuration", ++ *collectionDurationStr); ++ return false; ++ } ++ ++ metricArgs.collectionDuration = ++ static_cast<uint64_t>(duration->count()); ++ } ++ ++ args.metrics.emplace_back(std::move(metricArgs)); + } + + return true; +@@ -219,13 +267,12 @@ inline bool getUserParameters(crow::Response& res, const crow::Request& req, + + inline bool getChassisSensorNodeFromMetrics( + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, +- const std::vector<std::pair<std::string, std::vector<std::string>>>& +- metrics, ++ const std::vector<AddReportArgs::MetricArgs>& metrics, + boost::container::flat_set<std::pair<std::string, std::string>>& matched) + { +- for (const auto& [id, uris] : metrics) ++ for (const auto& metric : metrics) + { +- if (!getChassisSensorNode(asyncResp, uris, matched)) ++ if (!getChassisSensorNode(asyncResp, metric.uris, matched)) + { + return false; + } +@@ -251,11 +298,16 @@ class AddReport + telemetry::ReadingParameters readingParams; + readingParams.reserve(args.metrics.size()); + +- for (const auto& [id, uris] : args.metrics) ++ for (auto& metric : args.metrics) + { +- for (size_t i = 0; i < uris.size(); i++) ++ std::vector< ++ std::tuple<sdbusplus::message::object_path, std::string>> ++ sensorParams; ++ sensorParams.reserve(metric.uris.size()); ++ ++ for (size_t i = 0; i < metric.uris.size(); i++) { - const std::string& uri = uris[i]; -@@ -291,8 +301,12 @@ class AddReport +- const std::string& uri = uris[i]; ++ const std::string& uri = metric.uris[i]; + auto el = uriToDbus.find(uri); + if (el == uriToDbus.end()) + { +@@ -269,17 +321,23 @@ class AddReport } const std::string& dbusPath = el->second; - readingParams.emplace_back(dbusPath, "SINGLE", id, uri); -+ dbusPaths.emplace_back(dbusPath); -+ metadata["MetricProperties"].emplace_back(uri); ++ sensorParams.emplace_back(dbusPath, uri); } + -+ readingParams.emplace_back(dbusPaths, "SINGLE", id, metadata.dump(), -+ "Point", 0u); ++ readingParams.emplace_back( ++ std::move(sensorParams), metric.collectionFunction.value_or(""), ++ std::move(metric.id), metric.collectionTimeScope.value_or(""), ++ metric.collectionDuration.value_or(0u)); } const std::shared_ptr<bmcweb::AsyncResp> aResp = asyncResp; crow::connections::systemBus->async_method_call( -@@ -330,10 +344,10 @@ class AddReport +- [aResp, name = args.name, uriToDbus = std::move(uriToDbus)]( ++ [aResp, id = args.id.value_or(""), ++ uriToDbus = std::move(uriToDbus)]( + const boost::system::error_code ec, const std::string&) { + if (ec == boost::system::errc::file_exists) + { + messages::resourceAlreadyExists( +- aResp->res, "MetricReportDefinition", "Id", name); ++ aResp->res, "MetricReportDefinition", "Id", id); + return; + } + if (ec == boost::system::errc::too_many_files_open) +@@ -308,10 +366,12 @@ class AddReport messages::created(aResp->res); }, telemetry::service, "/xyz/openbmc_project/Telemetry/Reports", @@ -221,81 +431,50 @@ index a0c4f1d..7c26787 100644 - args.emitsReadingsUpdate, args.logToMetricReportsCollection, - args.interval, readingParams); + "xyz.openbmc_project.Telemetry.ReportManager", -+ "AddReportFutureVersion", "TelemetryService/" + args.name, -+ args.reportingType, args.emitsReadingsUpdate, -+ args.logToMetricReportsCollection, args.interval, readingParams); ++ "AddReportFutureVersion", ++ "TelemetryService/" + args.id.value_or(""), args.name.value_or(""), ++ args.reportingType, args.reportUpdates.value_or("Overwrite"), ++ args.appendLimit.value_or(0), args.reportActions, args.interval, ++ readingParams); } void insert(const boost::container::flat_map<std::string, std::string>& el) -@@ -415,37 +429,39 @@ inline void requestRoutesMetricReportDefinition(App& app) - BMCWEB_ROUTE(app, - "/redfish/v1/TelemetryService/MetricReportDefinitions/<str>/") - .privileges(redfish::privileges::getMetricReportDefinition) -- .methods(boost::beast::http::verb::get)( -- [](const crow::Request&, -- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, -- const std::string& id) { +@@ -399,12 +459,15 @@ inline void requestRoutesMetricReportDefinition(App& app) + [](const crow::Request&, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& id) { - crow::connections::systemBus->async_method_call( -- [asyncResp, id]( -- const boost::system::error_code ec, -- const std::vector<std::pair< -- std::string, -- std::variant<std::string, bool, uint64_t, -- telemetry::ReadingParameters>>>& ret) { -- if (ec.value() == EBADR || -- ec == boost::system::errc::host_unreachable) -- { -- messages::resourceNotFound( -- asyncResp->res, "MetricReportDefinition", id); -- return; -- } -- if (ec) -- { -- BMCWEB_LOG_ERROR << "respHandler DBus error " << ec; -- messages::internalError(asyncResp->res); -- return; -- } -+ .methods( -+ boost::beast::http::verb::get)([](const crow::Request&, -+ const std::shared_ptr< -+ bmcweb::AsyncResp>& asyncResp, -+ const std::string& id) { -+ sdbusplus::asio::getAllProperties( -+ *crow::connections::systemBus, telemetry::service, -+ telemetry::getDbusReportPath(id), telemetry::reportInterface, -+ [asyncResp, -+ id](boost::system::error_code ec, -+ const std::vector<std::pair< -+ std::string, -+ std::variant<std::monostate, std::string, bool, -+ uint64_t, telemetry::ReadingParameters>>>& -+ properties) { -+ if (ec.value() == EBADR || -+ ec == boost::system::errc::host_unreachable) -+ { -+ messages::resourceNotFound( -+ asyncResp->res, "MetricReportDefinition", id); -+ return; -+ } -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "respHandler DBus error " << ec; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ -+ telemetry::fillReportDefinition(asyncResp, id, properties); -+ }); -+ }); ++ sdbusplus::asio::getAllProperties( ++ *crow::connections::systemBus, telemetry::service, ++ telemetry::getDbusReportPath(id), ++ telemetry::reportInterface, + [asyncResp, +- id](const boost::system::error_code ec, ++ id](boost::system::error_code ec, + const std::vector<std::pair< + std::string, dbus::utility::DbusVariantType>>& +- ret) { ++ properties) { + if (ec.value() == EBADR || + ec == boost::system::errc::host_unreachable) + { +@@ -419,12 +482,11 @@ inline void requestRoutesMetricReportDefinition(App& app) + return; + } - telemetry::fillReportDefinition(asyncResp, id, ret); - }, - telemetry::service, telemetry::getDbusReportPath(id), - "org.freedesktop.DBus.Properties", "GetAll", - telemetry::reportInterface); -- }); ++ telemetry::fillReportDefinition(asyncResp, id, ++ properties); ++ }); + }); ++ BMCWEB_ROUTE(app, "/redfish/v1/TelemetryService/MetricReportDefinitions/<str>/") .privileges(redfish::privileges::deleteMetricReportDefinitionCollection) -- 2.25.1 + 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 deleted file mode 100644 index bf5a09d9d..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Add-support-for-MetricDefinition-property-in-MetricReport.patch +++ /dev/null @@ -1,268 +0,0 @@ -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 -MetricReport. It contains single @odata.id with URI to proper -MetricDefinition resource - depending on MetricProperty. - -Testing done: -- GET request on redfish/v1/TelemetryService/MetricReports - got response with MetricDefinition and proper id inside - MetricValues array. - -Testing steps: -1. POST on redfish/v1/TelemetryService/MetricReportDefinitions - with body: -{ - "Id": "PeriodicReport_1", - "MetricReportDefinitionType": "Periodic", - "ReportActions": [ - "LogToMetricReportsCollection", - "RedfishEvent" - ], - "Metrics": [ - { - "MetricId": "sensor_1", - "MetricProperties": [ - "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/1/Reading" - ] - } - ], - "Schedule": { - "RecurrenceInterval": "PT10S" - } -} - -2. GET on redfish/v1/TelemetryService/MetricReports/PeriodicReport_1 - should return: -{ - "@odata.id": - "/redfish/v1/TelemetryService/MetricReports/PeriodicReport_1", - "@odata.type": "#MetricReport.v1_3_0.MetricReport", - "Id": "PeriodicReport_1", - "MetricReportDefinition": { - "@odata.id": - "/redfish/v1/TelemetryService/MetricReportDefinitions/PeriodicReport_1" - }, - "MetricValues": [ - { - "MetricDefinition": { - "@odata.id": - "/redfish/v1/TelemetryService/MetricDefinitions/Rotational" - }, - "MetricId": "sensor_1", - "MetricProperty": - "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/1/Reading", - "MetricValue": "nan", - "Timestamp": "1970-01-01T00:03:21+00:00" - } - ], - "Name": "PeriodicReport_1", - "Timestamp": "1970-01-01T00:03:21+00:00" -} - -Change-Id: I7181c612f9b443015d551259bae25303aa436822 -Signed-off-by: Szymon Dompke <szymon.dompke@intel.com> ---- - meson.build | 4 +- - .../include/utils/telemetry_utils.hpp | 40 ++++++++++++ - redfish-core/lib/metric_report.hpp | 64 +++++++++++++++---- - redfish-core/lib/sensors.hpp | 2 + - 4 files changed, 95 insertions(+), 15 deletions(-) - -diff --git a/meson.build b/meson.build -index 6b6a8ab..218ea49 100644 ---- a/meson.build -+++ b/meson.build -@@ -377,6 +377,8 @@ srcfiles_unittest = [ - 'http/ut/utility_test.cpp' - ] - -+srcfiles_unittest_dependencies = ['redfish-core/src/error_messages.cpp', 'src/boost_url.cpp'] -+ - # Gather the Configuration data - - conf_data = configuration_data() -@@ -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] -- test(testname,executable(testname,src_test, -+ test(testname,executable(testname,[src_test] + srcfiles_unittest_dependencies, - include_directories : incdir, - install_dir: bindir, - dependencies: [ -diff --git a/redfish-core/include/utils/telemetry_utils.hpp b/redfish-core/include/utils/telemetry_utils.hpp -index 1b4f75d..c0c5ba3 100644 ---- a/redfish-core/include/utils/telemetry_utils.hpp -+++ b/redfish-core/include/utils/telemetry_utils.hpp -@@ -17,6 +17,46 @@ constexpr const char* metricReportDefinitionUri = - constexpr const char* metricReportUri = - "/redfish/v1/TelemetryService/MetricReports/"; - -+inline std::optional<nlohmann::json> -+ getMetadataJson(const std::string& metadataStr) -+{ -+ std::optional<nlohmann::json> res = -+ nlohmann::json::parse(metadataStr, nullptr, false); -+ if (res->is_discarded()) -+ { -+ BMCWEB_LOG_ERROR << "Malformed reading metatadata JSON provided by " -+ "telemetry service."; -+ return std::nullopt; -+ } -+ return res; -+} -+ -+inline std::optional<std::string> -+ readStringFromMetadata(const nlohmann::json& metadataJson, const char* key) -+{ -+ std::optional<std::string> res; -+ if (auto it = metadataJson.find(key); it != metadataJson.end()) -+ { -+ if (const std::string* value = it->get_ptr<const std::string*>()) -+ { -+ res = *value; -+ } -+ else -+ { -+ BMCWEB_LOG_ERROR << "Incorrect reading metatadata JSON provided by " -+ "telemetry service. Missing key '" -+ << key << "'."; -+ } -+ } -+ else -+ { -+ BMCWEB_LOG_ERROR << "Incorrect reading metatadata JSON provided by " -+ "telemetry service. Key '" -+ << key << "' has a wrong type."; -+ } -+ return res; -+} -+ - inline void - getReportCollection(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, - const std::string& uri) -diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp -index 7fe281d..13bf792 100644 ---- a/redfish-core/lib/metric_report.hpp -+++ b/redfish-core/lib/metric_report.hpp -@@ -1,5 +1,6 @@ - #pragma once - -+#include "sensors.hpp" - #include "utils/telemetry_utils.hpp" - - #include <app.hpp> -@@ -15,34 +16,56 @@ using Readings = - std::vector<std::tuple<std::string, std::string, double, uint64_t>>; - using TimestampReadings = std::tuple<uint64_t, Readings>; - --inline nlohmann::json toMetricValues(const Readings& readings) -+inline bool fillMetricValues(nlohmann::json& metricValues, -+ const Readings& readings) - { -- nlohmann::json metricValues = nlohmann::json::array_t(); -- -- for (auto& [id, metadata, sensorValue, timestamp] : readings) -+ for (auto& [id, metadataStr, sensorValue, timestamp] : readings) - { -+ std::optional<nlohmann::json> readingMetadataJson = -+ getMetadataJson(metadataStr); -+ if (!readingMetadataJson) -+ { -+ return false; -+ } -+ -+ std::optional<std::string> sensorDbusPath = -+ readStringFromMetadata(*readingMetadataJson, "SensorDbusPath"); -+ if (!sensorDbusPath) -+ { -+ return false; -+ } -+ -+ std::optional<std::string> sensorRedfishUri = -+ readStringFromMetadata(*readingMetadataJson, "SensorRedfishUri"); -+ if (!sensorRedfishUri) -+ { -+ return false; -+ } -+ -+ std::string metricDefinition = -+ std::string(metricDefinitionUri) + -+ sensors::toReadingType( -+ sdbusplus::message::object_path(*sensorDbusPath) -+ .parent_path() -+ .filename()); -+ - metricValues.push_back({ -+ {"MetricDefinition", -+ nlohmann::json{{"@odata.id", metricDefinition}}}, - {"MetricId", id}, -- {"MetricProperty", metadata}, -+ {"MetricProperty", *sensorRedfishUri}, - {"MetricValue", std::to_string(sensorValue)}, - {"Timestamp", - crow::utility::getDateTime(static_cast<time_t>(timestamp))}, - }); - } - -- return metricValues; -+ return true; - } - - inline bool fillReport(nlohmann::json& json, const std::string& id, - const std::variant<TimestampReadings>& var) - { -- json["@odata.type"] = "#MetricReport.v1_3_0.MetricReport"; -- json["@odata.id"] = telemetry::metricReportUri + id; -- json["Id"] = id; -- json["Name"] = id; -- json["MetricReportDefinition"]["@odata.id"] = -- telemetry::metricReportDefinitionUri + id; -- - const TimestampReadings* timestampReadings = - std::get_if<TimestampReadings>(&var); - if (!timestampReadings) -@@ -52,9 +75,22 @@ inline bool fillReport(nlohmann::json& json, const std::string& id, - } - - const auto& [timestamp, readings] = *timestampReadings; -+ nlohmann::json metricValues = nlohmann::json::array(); -+ if (!fillMetricValues(metricValues, readings)) -+ { -+ return false; -+ } -+ -+ json["@odata.type"] = "#MetricReport.v1_3_0.MetricReport"; -+ json["@odata.id"] = telemetry::metricReportUri + id; -+ json["Id"] = id; -+ json["Name"] = id; -+ json["MetricReportDefinition"]["@odata.id"] = -+ telemetry::metricReportDefinitionUri + id; - json["Timestamp"] = - crow::utility::getDateTime(static_cast<time_t>(timestamp)); -- json["MetricValues"] = toMetricValues(readings); -+ json["MetricValues"] = metricValues; -+ - return true; - } - } // namespace telemetry -diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp -index 7405e5a..9850b24 100644 ---- a/redfish-core/lib/sensors.hpp -+++ b/redfish-core/lib/sensors.hpp -@@ -21,6 +21,8 @@ - #include <boost/container/flat_map.hpp> - #include <boost/range/algorithm/replace_copy_if.hpp> - #include <dbus_singleton.hpp> -+#include <dbus_utility.hpp> -+#include <error_messages.hpp> - #include <registries/privilege_registry.hpp> - #include <utils/json_utils.hpp> - --- -2.25.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0005-Add-GET-method-for-TriggerCollection.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0005-Add-GET-method-for-TriggerCollection.patch deleted file mode 100644 index 0646aba5c..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0005-Add-GET-method-for-TriggerCollection.patch +++ /dev/null @@ -1,313 +0,0 @@ -From a1e89d356ba5ed594a1494efe8257946e1062396 Mon Sep 17 00:00:00 2001 -From: Lukasz Kazmierczak <lukasz.kazmierczak@intel.com> -Date: Tue, 31 Aug 2021 14:35:31 +0200 -Subject: [PATCH] Add GET method for TriggerCollection - -Added GET method for retrieving list of Triggers from Telemetry service - -Tested: -- Added single Trigger and requested result from bmcweb via - /redfish/v1/TelemetryService/Triggers -- Added multiple Triggers numeric and discrete, and requested results - from bmcweb via /redfish/v1/TelemetryService/Triggers -- Verified uri /redfish/v1/TelemetryService/Triggers by using - Redfish-Service-Validator (all passed) - -Signed-off-by: Lukasz Kazmierczak <lukasz.kazmierczak@intel.com> -Change-Id: Ide00eb44901ea1b97b80fc5c5ddfd97e393d4a04 ---- - redfish-core/include/redfish.hpp | 2 + - .../include/utils/telemetry_utils.hpp | 40 ++++++++--- - redfish-core/lib/metric_report.hpp | 6 +- - redfish-core/lib/metric_report_definition.hpp | 6 +- - redfish-core/lib/trigger.hpp | 31 ++++++++ - scripts/update_schemas.py | 1 + - static/redfish/v1/$metadata/index.xml | 3 + - .../v1/schema/TriggersCollection_v1.xml | 70 +++++++++++++++++++ - 8 files changed, 144 insertions(+), 15 deletions(-) - create mode 100644 redfish-core/lib/trigger.hpp - create mode 100644 static/redfish/v1/schema/TriggersCollection_v1.xml - -diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp -index 9fb0ffe..99b3fe6 100644 ---- a/redfish-core/include/redfish.hpp -+++ b/redfish-core/include/redfish.hpp -@@ -42,6 +42,7 @@ - #include "../lib/task.hpp" - #include "../lib/telemetry_service.hpp" - #include "../lib/thermal.hpp" -+#include "../lib/trigger.hpp" - #include "../lib/update_service.hpp" - #include "../lib/virtual_media.hpp" - -@@ -197,6 +198,7 @@ class RedfishService - - hypervisor::requestRoutesHypervisorSystems(app); - -+ requestRoutesTriggerCollection(app); - requestRoutesTelemetryService(app); - requestRoutesMetricReportDefinitionCollection(app); - requestRoutesMetricReportDefinition(app); -diff --git a/redfish-core/include/utils/telemetry_utils.hpp b/redfish-core/include/utils/telemetry_utils.hpp -index c0c5ba3..df1aa68 100644 ---- a/redfish-core/include/utils/telemetry_utils.hpp -+++ b/redfish-core/include/utils/telemetry_utils.hpp -@@ -9,6 +9,8 @@ namespace telemetry - { - - constexpr const char* service = "xyz.openbmc_project.Telemetry"; -+constexpr const char* reportSubtree = -+ "/xyz/openbmc_project/Telemetry/Reports/TelemetryService"; - constexpr const char* reportInterface = "xyz.openbmc_project.Telemetry.Report"; - constexpr const char* metricDefinitionUri = - "/redfish/v1/TelemetryService/MetricDefinitions/"; -@@ -16,6 +18,11 @@ constexpr const char* metricReportDefinitionUri = - "/redfish/v1/TelemetryService/MetricReportDefinitions/"; - constexpr const char* metricReportUri = - "/redfish/v1/TelemetryService/MetricReports/"; -+constexpr const char* triggerSubtree = -+ "/xyz/openbmc_project/Telemetry/Triggers/TelemetryService"; -+constexpr const char* triggerInterface = -+ "xyz.openbmc_project.Telemetry.Trigger"; -+constexpr const char* triggerUri = "/redfish/v1/TelemetryService/Triggers/"; - - inline std::optional<nlohmann::json> - getMetadataJson(const std::string& metadataStr) -@@ -57,15 +64,27 @@ inline std::optional<std::string> - return res; - } - --inline void -- getReportCollection(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, -- const std::string& uri) -+struct CollectionParams - { -- const std::array<const char*, 1> interfaces = {reportInterface}; -+ const char* subtree; -+ int depth; -+ std::array<const char*, 1> interfaces; - -+ CollectionParams() = delete; -+ CollectionParams(const char* st, int dp, -+ const std::array<const char*, 1>& ifaces) : -+ subtree{st}, -+ depth{dp}, interfaces{ifaces} -+ {} -+}; -+ -+inline void getCollection(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, -+ const std::string& uri, -+ const CollectionParams& params) -+{ - crow::connections::systemBus->async_method_call( - [asyncResp, uri](const boost::system::error_code ec, -- const std::vector<std::string>& reports) { -+ const std::vector<std::string>& items) { - if (ec == boost::system::errc::io_error) - { - asyncResp->res.jsonValue["Members"] = nlohmann::json::array(); -@@ -82,13 +101,13 @@ inline void - nlohmann::json& members = asyncResp->res.jsonValue["Members"]; - members = nlohmann::json::array(); - -- for (const std::string& report : reports) -+ for (const std::string& item : items) - { -- sdbusplus::message::object_path path(report); -+ sdbusplus::message::object_path path(item); - std::string name = path.filename(); - if (name.empty()) - { -- BMCWEB_LOG_ERROR << "Received invalid path: " << report; -+ BMCWEB_LOG_ERROR << "Received invalid path: " << item; - messages::internalError(asyncResp->res); - return; - } -@@ -99,9 +118,8 @@ inline void - }, - "xyz.openbmc_project.ObjectMapper", - "/xyz/openbmc_project/object_mapper", -- "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", -- "/xyz/openbmc_project/Telemetry/Reports/TelemetryService", 1, -- interfaces); -+ "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", params.subtree, -+ params.depth, params.interfaces); - } - - inline std::string getDbusReportPath(const std::string& id) -diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp -index 13bf792..ea4cd62 100644 ---- a/redfish-core/lib/metric_report.hpp -+++ b/redfish-core/lib/metric_report.hpp -@@ -108,8 +108,10 @@ inline void requestRoutesMetricReportCollection(App& app) - "/redfish/v1/TelemetryService/MetricReports"; - asyncResp->res.jsonValue["Name"] = "Metric Report Collection"; - -- telemetry::getReportCollection(asyncResp, -- telemetry::metricReportUri); -+ telemetry::getCollection( -+ asyncResp, telemetry::metricReportUri, -+ telemetry::CollectionParams(telemetry::reportSubtree, 1, -+ {telemetry::reportInterface})); - }); - } - -diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp -index 7c26787..c97a1df 100644 ---- a/redfish-core/lib/metric_report_definition.hpp -+++ b/redfish-core/lib/metric_report_definition.hpp -@@ -377,8 +377,10 @@ inline void requestRoutesMetricReportDefinitionCollection(App& app) - asyncResp->res.jsonValue["Name"] = - "Metric Definition Collection"; - -- telemetry::getReportCollection( -- asyncResp, telemetry::metricReportDefinitionUri); -+ telemetry::getCollection( -+ asyncResp, telemetry::metricReportDefinitionUri, -+ telemetry::CollectionParams(telemetry::reportSubtree, 1, -+ {telemetry::reportInterface})); - }); - - BMCWEB_ROUTE(app, "/redfish/v1/TelemetryService/MetricReportDefinitions/") -diff --git a/redfish-core/lib/trigger.hpp b/redfish-core/lib/trigger.hpp -new file mode 100644 -index 0000000..681b3b4 ---- /dev/null -+++ b/redfish-core/lib/trigger.hpp -@@ -0,0 +1,31 @@ -+#pragma once -+ -+#include "utils/telemetry_utils.hpp" -+ -+#include <app.hpp> -+#include <registries/privilege_registry.hpp> -+ -+namespace redfish -+{ -+ -+inline void requestRoutesTriggerCollection(App& app) -+{ -+ BMCWEB_ROUTE(app, "/redfish/v1/TelemetryService/Triggers/") -+ .privileges(redfish::privileges::getTriggersCollection) -+ .methods(boost::beast::http::verb::get)( -+ [](const crow::Request&, -+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { -+ asyncResp->res.jsonValue["@odata.type"] = -+ "#TriggersCollection.TriggersCollection"; -+ asyncResp->res.jsonValue["@odata.id"] = -+ "/redfish/v1/TelemetryService/Triggers"; -+ asyncResp->res.jsonValue["Name"] = "Triggers Collection"; -+ -+ telemetry::getCollection( -+ asyncResp, telemetry::triggerUri, -+ telemetry::CollectionParams(telemetry::triggerSubtree, 1, -+ {telemetry::triggerInterface})); -+ }); -+} -+ -+} // namespace redfish -diff --git a/scripts/update_schemas.py b/scripts/update_schemas.py -index dd39278..d66a59a 100755 ---- a/scripts/update_schemas.py -+++ b/scripts/update_schemas.py -@@ -93,6 +93,7 @@ include_list = [ - 'TaskService', - 'TelemetryService', - 'Thermal', -+ 'TriggersCollection', - 'UpdateService', - 'VLanNetworkInterfaceCollection', - 'VLanNetworkInterface', -diff --git a/static/redfish/v1/$metadata/index.xml b/static/redfish/v1/$metadata/index.xml -index 876ebfb..75e3dd4 100644 ---- a/static/redfish/v1/$metadata/index.xml -+++ b/static/redfish/v1/$metadata/index.xml -@@ -2215,6 +2215,9 @@ - <edmx:Include Namespace="Thermal.v1_7_0"/> - <edmx:Include Namespace="Thermal.v1_7_1"/> - </edmx:Reference> -+ <edmx:Reference Uri="/redfish/v1/schema/TriggersCollection_v1.xml"> -+ <edmx:Include Namespace="TriggersCollection"/> -+ </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/UpdateService_v1.xml"> - <edmx:Include Namespace="UpdateService"/> - <edmx:Include Namespace="UpdateService.v1_0_0"/> -diff --git a/static/redfish/v1/schema/TriggersCollection_v1.xml b/static/redfish/v1/schema/TriggersCollection_v1.xml -new file mode 100644 -index 0000000..399bebd ---- /dev/null -+++ b/static/redfish/v1/schema/TriggersCollection_v1.xml -@@ -0,0 +1,70 @@ -+<?xml version="1.0" encoding="UTF-8"?> -+<!----> -+<!--################################################################################ --> -+<!--# Redfish Schema: TriggerSetCollection --> -+<!--# --> -+<!--# For a detailed change log, see the README file contained in the DSP8010 bundle, --> -+<!--# available at http://www.dmtf.org/standards/redfish --> -+<!--# Copyright 2014-2021 DMTF. --> -+<!--# For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright --> -+<!--################################################################################ --> -+<!----> -+<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0"> -+ -+ <edmx:Reference Uri="http://docs.oasis-open.org/odata/odata/v4.0/errata03/csd01/complete/vocabularies/Org.OData.Core.V1.xml"> -+ <edmx:Include Namespace="Org.OData.Core.V1" Alias="OData"/> -+ </edmx:Reference> -+ <edmx:Reference Uri="http://docs.oasis-open.org/odata/odata/v4.0/errata03/csd01/complete/vocabularies/Org.OData.Capabilities.V1.xml"> -+ <edmx:Include Namespace="Org.OData.Capabilities.V1" Alias="Capabilities"/> -+ </edmx:Reference> -+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/Resource_v1.xml"> -+ <edmx:Include Namespace="Resource.v1_0_0"/> -+ </edmx:Reference> -+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/RedfishExtensions_v1.xml"> -+ <edmx:Include Namespace="RedfishExtensions.v1_0_0" Alias="Redfish"/> -+ </edmx:Reference> -+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/Triggers_v1.xml"> -+ <edmx:Include Namespace="Triggers"/> -+ </edmx:Reference> -+ -+ <edmx:DataServices> -+ -+ <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="TriggersCollection"> -+ <Annotation Term="Redfish.OwningEntity" String="DMTF"/> -+ -+ <EntityType Name="TriggersCollection" BaseType="Resource.v1_0_0.ResourceCollection"> -+ <Annotation Term="OData.Description" String="The collection of Triggers resource instances."/> -+ <Annotation Term="OData.LongDescription" String="This resource shall represent a resource collection of Triggers instances for a Redfish implementation."/> -+ <Annotation Term="Capabilities.InsertRestrictions"> -+ <Record> -+ <PropertyValue Property="Insertable" Bool="true"/> -+ <Annotation Term="OData.Description" String="Create triggers through a POST to the trigger collection."/> -+ </Record> -+ </Annotation> -+ <Annotation Term="Capabilities.UpdateRestrictions"> -+ <Record> -+ <PropertyValue Property="Updatable" Bool="false"/> -+ </Record> -+ </Annotation> -+ <Annotation Term="Capabilities.DeleteRestrictions"> -+ <Record> -+ <PropertyValue Property="Deletable" Bool="false"/> -+ </Record> -+ </Annotation> -+ <Annotation Term="Redfish.Uris"> -+ <Collection> -+ <String>/redfish/v1/TelemetryService/Triggers</String> -+ </Collection> -+ </Annotation> -+ <NavigationProperty Name="Members" Type="Collection(Triggers.Triggers)"> -+ <Annotation Term="OData.Permissions" EnumMember="OData.Permission/Read"/> -+ <Annotation Term="OData.Description" String="The members of this collection."/> -+ <Annotation Term="OData.LongDescription" String="This property shall contain an array of links to the members of this collection."/> -+ <Annotation Term="OData.AutoExpandReferences"/> -+ <Annotation Term="Redfish.Required"/> -+ </NavigationProperty> -+ </EntityType> -+ -+ </Schema> -+ </edmx:DataServices> -+</edmx:Edmx> --- -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 90916ecec..541fa6aba 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 @@ -2,29 +2,11 @@ These patches are mirror of upstream TelemetryService implementation. Until change is integrated they will be manually merged here to enable feature in Intel builds. Current revisions: -- Add support for MetricDefinition scheme - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/33363/102 - -- Sync Telmetry service with EventService - 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/19 - -- Add support for MetricDefinition property in MetricReport - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/44512/24 - -- Add GET method for TriggerCollection - file://telemetry/0005-Add-GET-method-for-TriggerCollection.patch +- Add support for POST on TriggersCollection + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/44935/19 - LogService field, actual implementation will be upstreamed with triggers feature - file://telemetry/0006-Revert-Remove-LogService-from-TelemetryService.patch - -- Event service fix for Context field - file://telemetry/0007-event-service-fix-added-Context-field-to-response.patch + file://telemetry/0002-Revert-Remove-LogService-from-TelemetryService.patch -- Generalize ReadingType in MetricDefinition - file://telemetry/0008-Generalize-ReadingType-in-MetricDefinition.patch - -- Add support for deleting terminated subscriptions - file://telemetry/0009-Add-support-for-deleting-terminated-subscriptions.patch +- Switched bmcweb to use new telemetry service API + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/44270/28 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 de316c4fa..9225d20f1 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,6 +1,6 @@ -From b6863f9a0c1c36705eba0c3181541f67cd1a202a Mon Sep 17 00:00:00 2001 +From e614dec3e007d3ceaa697fd7bb264dbc1ef496e5 Mon Sep 17 00:00:00 2001 From: Krzysztof Grobelny <krzysztof.grobelny@intel.com> -Date: Wed, 14 Jul 2021 09:04:42 +0000 +Date: Wed, 1 Dec 2021 12:25:07 +0100 Subject: [PATCH] Revert "Disable nbd proxy from the build" NBD Proxy has been disabled upstream. Reenable as we use it for Virtual @@ -15,24 +15,24 @@ Change-Id: I19a88b30c1074dd376f2df8f5668245b638b881f 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/meson.build b/meson.build -index 650a5ec..5738b10 100644 +index c9066d4..51c7f9d 100644 --- a/meson.build +++ b/meson.build -@@ -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', +@@ -86,7 +86,8 @@ feature_map = { + 'static-hosting' : '-DBMCWEB_ENABLE_STATIC_HOSTING', + 'vm-websocket' : '-DBMCWEB_ENABLE_VM_WEBSOCKET', + 'xtoken-auth' : '-DBMCWEB_ENABLE_XTOKEN_AUTHENTICATION', +- #'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY', ++ 'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY', ++ 'validate-unsecure-feature' : '-DBMCWEB_ENABLE_VALIDATION_UNSECURE_FEATURE', } + # Get the options status and build a project summary to show which flags are diff --git a/meson_options.txt b/meson_options.txt -index ff5b887..645f224 100644 +index 4661658..435f382 100644 --- a/meson_options.txt +++ b/meson_options.txt -@@ -3,14 +3,7 @@ option('yocto-deps', type: 'feature', value: 'disabled', description : 'Use YOCT +@@ -2,14 +2,7 @@ option('yocto-deps', type: 'feature', value: 'disabled', description : 'Use YOCT option('kvm', type : 'feature',value : 'enabled', description : 'Enable the KVM host video WebSocket. Path is \'/kvm/0\'. Video is from the BMC\'s \'/dev/video\' device.') option ('tests', type : 'feature', value : 'enabled', description : 'Enable Unit tests for bmcweb') option('vm-websocket', type : 'feature', value : 'enabled', description : '''Enable the Virtual Media WebSocket. Path is \'/vm/0/0\'to open the websocket. See https://github.com/openbmc/jsnbd/blob/master/README.''') @@ -45,10 +45,10 @@ index ff5b887..645f224 100644 -# opportunity to upstream their backend implementation -#option('vm-nbdproxy', type: 'feature', value : 'disabled', description : 'Enable the Virtual Media WebSocket.') +option('vm-nbdproxy', type: 'feature', value : 'disabled', description : 'Enable the Virtual Media WebSocket.') - 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('rest', type : 'feature', value : 'disabled', 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.') -@@ -39,6 +32,7 @@ option ('https_port', type : 'integer', min : 1, max : 65535, value : 443, descr +@@ -38,6 +31,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 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0004-Invalid-status-code-from-InsertMedia-REST-methods.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0004-Invalid-status-code-from-InsertMedia-REST-methods.patch index 439b05b3c..6443124c2 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0004-Invalid-status-code-from-InsertMedia-REST-methods.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0004-Invalid-status-code-from-InsertMedia-REST-methods.patch @@ -1,7 +1,7 @@ -From 437a2a854303ed4e05344684b1990806464268cd Mon Sep 17 00:00:00 2001 +From 47d907688368b98320d785aa8d285c9cf031d067 Mon Sep 17 00:00:00 2001 From: Krzysztof Grobelny <krzysztof.grobelny@intel.com> -Date: Thu, 1 Jul 2021 10:08:27 +0000 -Subject: [PATCH] Invalid status code from InsertMedia REST methods GET, PUT, +Date: Wed, 1 Dec 2021 12:27:22 +0100 +Subject: [PATCH] Invalid status code from InsertMedia REST methods GET, PUT, DELETE, PATCH in proxy mode Add handlers for GET, PUT, DELETE, PATCH method and function that @@ -16,7 +16,7 @@ Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> 1 file changed, 137 insertions(+) diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index 3b9f7ef..7d77b9f 100644 +index 601b973..7d9dade 100644 --- a/redfish-core/lib/virtual_media.hpp +++ b/redfish-core/lib/virtual_media.hpp @@ -30,6 +30,117 @@ @@ -29,7 +29,7 @@ index 3b9f7ef..7d77b9f 100644 + * and sets suitable response code for unsupported REST method. + * + */ -+void CheckProxyMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp, ++void checkProxyMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const crow::Request& req, const std::string& name, + const std::string& resName) +{ @@ -137,7 +137,7 @@ index 3b9f7ef..7d77b9f 100644 /** * @brief Function extracts transfer protocol name from URI. */ -@@ -844,6 +955,32 @@ inline void doVmAction(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, +@@ -850,6 +961,32 @@ inline void doVmAction(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, inline void requestNBDVirtualMediaRoutes(App& app) { @@ -148,7 +148,7 @@ index 3b9f7ef..7d77b9f 100644 + [](const crow::Request& req, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& name, const std::string& resName) { -+ CheckProxyMode(asyncResp, req, name, resName); ++ checkProxyMode(asyncResp, req, name, resName); + }); + + for (auto method : @@ -163,13 +163,13 @@ index 3b9f7ef..7d77b9f 100644 + [](const crow::Request& req, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& name, const std::string& resName) { -+ CheckProxyMode(asyncResp, req, name, resName); ++ checkProxyMode(asyncResp, req, name, resName); + }); + } + - BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/VirtualMedia/<str>/Actions/" - "VirtualMedia.InsertMedia") - .privileges(redfish::privileges::postVirtualMedia) + BMCWEB_ROUTE( + app, + "/redfish/v1/Managers/<str>/VirtualMedia/<str>/Actions/VirtualMedia.InsertMedia") -- -2.17.1 +2.25.1 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 a716e612d..7183dfffa 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend @@ -1,16 +1,10 @@ SRC_URI = "git://github.com/openbmc/bmcweb.git" -SRCREV = "b7ff344535c42af074c60bfb272ef66a2ba157b4" +SRCREV = "85ffe86a60f50ce9ad5728caf384a0dd0c8cc6a5" DEPENDS += "boost-url" FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" -# add a user called bmcweb for the server to assume -# bmcweb is part of group shadow for non-root pam authentication -USERADD_PARAM:${PN} = "-r -s /usr/sbin/nologin -d /home/bmcweb -m -G shadow bmcweb" - -GROUPADD_PARAM:${PN} = "web; redfish " - SRC_URI += "file://0001-Firmware-update-configuration-changes.patch \ file://0002-Use-chip-id-based-UUID-for-Service-Root.patch \ file://0010-managers-add-attributes-for-Manager.CommandShell.patch \ @@ -26,7 +20,9 @@ SRC_URI += "file://0001-Firmware-update-configuration-changes.patch \ file://0020-Redfish-Deny-set-AccountLockDuration-to-zero.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 \ + file://0025-Add-Model-to-ProcessorSummary.patch \ + file://0026-Revert-Delete-the-copy-constructor-on-the-Request.patch \ + file://0027-Convert-VariantType-to-DbusVariantType.patch \ " # OOB Bios Config: @@ -36,10 +32,12 @@ SRC_URI += "file://biosconfig/0001-Define-Redfish-interface-Registries-Bios.patc file://biosconfig/0004-Add-support-to-ChangePassword-action.patch \ file://biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch \ file://biosconfig/0006-Add-fix-for-broken-feature-Pending-Attributes.patch \ + file://biosconfig/0007-Add-BiosAttributeRegistry-node-under-Registries.patch \ " # Virtual Media: Backend code is not upstreamed so downstream only patches. -SRC_URI += "file://vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch \ +SRC_URI += " \ + file://vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch \ file://vm/0002-bmcweb-handle-device-or-resource-busy-exception.patch \ file://vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch \ file://vm/0004-Invalid-status-code-from-InsertMedia-REST-methods.patch \ @@ -56,35 +54,26 @@ SRC_URI += "file://eventservice/0001-Add-unmerged-changes-for-http-retry-support file://eventservice/0006-Add-EventService-SSE-filter-support.patch \ file://eventservice/0007-EventService-Log-events-for-subscription-actions.patch \ 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 \ + file://eventservice/0012-Add-support-for-deleting-terminated-subscriptions.patch \ + file://eventservice/0013-event-service-fix-added-Context-field-to-response.patch \ " + # Temporary downstream mirror of upstream patches, see telemetry\README for details -SRC_URI += " file://telemetry/0001-Add-support-for-MetricDefinition-scheme.patch \ - file://telemetry/0002-Sync-Telmetry-service-with-EventService.patch \ +SRC_URI += " file://telemetry/0001-Add-support-for-POST-on-TriggersCollection.patch \ + file://telemetry/0002-Revert-Remove-LogService-from-TelemetryService.patch \ file://telemetry/0003-Switched-bmcweb-to-use-new-telemetry-service-API.patch \ - file://telemetry/0004-Add-support-for-MetricDefinition-property-in-MetricReport.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/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 -} +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 \ + " # 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/0062-Update-IPMI-Chassis-Control-command.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0062-Update-IPMI-Chassis-Control-command.patch deleted file mode 100644 index 112c1ffab..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0062-Update-IPMI-Chassis-Control-command.patch +++ /dev/null @@ -1,292 +0,0 @@ -From 99f63d2af9f45badaa8aff4ef958443bea62ede8 Mon Sep 17 00:00:00 2001 -From: "Jason M. Bills" <jason.m.bills@linux.intel.com> -Date: Mon, 3 Jun 2019 17:01:47 -0700 -Subject: [PATCH] Update IPMI Chassis Control command - -This change updates the IPMI Chassis Control command to use the new -host state transitions. This allows each chassis control action -to more closely follow the behavior defined in the IPMI spec. - -ref: https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/22358 - -Tested: -Ran each IPMI chassis control command to confirm the expected -behavior: -ipmitool power on: system is powered-on -ipmitool power off: system is forced off -ipmitool power cycle: system is forced off then powered-on -ipmitool power reset: system is hard reset -ipmitool power soft: soft power-off requested from system software - -Change-Id: Ic9fba3ca4abd9a758eb88f1e6ee09f7ca64ff80a -Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com> ---- - chassishandler.cpp | 204 +++++++++++---------------------------------- - 1 file changed, 48 insertions(+), 156 deletions(-) - -diff --git a/chassishandler.cpp b/chassishandler.cpp -index dfbe004be490..cd0ba3402f84 100644 ---- a/chassishandler.cpp -+++ b/chassishandler.cpp -@@ -32,6 +32,7 @@ - #include <xyz/openbmc_project/Control/Boot/Source/server.hpp> - #include <xyz/openbmc_project/Control/Boot/Type/server.hpp> - #include <xyz/openbmc_project/Control/Power/RestorePolicy/server.hpp> -+#include <xyz/openbmc_project/State/Chassis/server.hpp> - #include <xyz/openbmc_project/State/Host/server.hpp> - #include <xyz/openbmc_project/State/PowerOnHours/server.hpp> - -@@ -815,59 +816,63 @@ ipmi::RspType<> ipmiSetChassisCap(bool intrusion, bool fpLockout, - //------------------------------------------ - // Calls into Host State Manager Dbus object - //------------------------------------------ --int initiate_state_transition(State::Host::Transition transition) -+int initiateHostStateTransition(State::Host::Transition transition) - { - // OpenBMC Host State Manager dbus framework -- constexpr auto HOST_STATE_MANAGER_ROOT = "/xyz/openbmc_project/state/host0"; -- constexpr auto HOST_STATE_MANAGER_IFACE = "xyz.openbmc_project.State.Host"; -- constexpr auto DBUS_PROPERTY_IFACE = "org.freedesktop.DBus.Properties"; -- constexpr auto PROPERTY = "RequestedHostTransition"; -+ constexpr auto hostStatePath = "/xyz/openbmc_project/state/host0"; -+ constexpr auto hostStateIntf = "xyz.openbmc_project.State.Host"; - -- // sd_bus error -- int rc = 0; -- char* busname = NULL; -+ auto service = ipmi::getService(*getSdBus(), hostStateIntf, hostStatePath); - -- // SD Bus error report mechanism. -- sd_bus_error bus_error = SD_BUS_ERROR_NULL; -+ // Convert to string equivalent of the passed in transition enum. -+ auto request = State::convertForMessage(transition); - -- // Gets a hook onto either a SYSTEM or SESSION bus -- sd_bus* bus_type = ipmid_get_sd_bus_connection(); -- rc = mapper_get_service(bus_type, HOST_STATE_MANAGER_ROOT, &busname); -- if (rc < 0) -+ try -+ { -+ ipmi::setDbusProperty(*getSdBus(), service, hostStatePath, -+ hostStateIntf, "RequestedHostTransition", -+ request); -+ } -+ catch (std::exception& e) - { - log<level::ERR>( -- "Failed to get bus name", -- entry("ERRNO=0x%X, OBJPATH=%s", -rc, HOST_STATE_MANAGER_ROOT)); -- return rc; -+ "Failed to initiate transition", -+ entry("EXCEPTION=%s, REQUEST=%s", e.what(), request.c_str())); -+ return -1; - } -+ return 0; -+} -+ -+//------------------------------------------ -+// Calls into Chassis State Manager Dbus object -+//------------------------------------------ -+int initiateChassisStateTransition(State::Chassis::Transition transition) -+{ -+ // OpenBMC Chassis State Manager dbus framework -+ constexpr auto chassisStatePath = "/xyz/openbmc_project/state/chassis0"; -+ constexpr auto chassisStateIntf = "xyz.openbmc_project.State.Chassis"; -+ -+ auto service = -+ ipmi::getService(*getSdBus(), chassisStateIntf, chassisStatePath); - - // Convert to string equivalent of the passed in transition enum. - auto request = State::convertForMessage(transition); - -- rc = sd_bus_call_method(bus_type, // On the system bus -- busname, // Service to contact -- HOST_STATE_MANAGER_ROOT, // Object path -- DBUS_PROPERTY_IFACE, // Interface name -- "Set", // Method to be called -- &bus_error, // object to return error -- nullptr, // Response buffer if any -- "ssv", // Takes 3 arguments -- HOST_STATE_MANAGER_IFACE, PROPERTY, "s", -- request.c_str()); -- if (rc < 0) -- { -- log<level::ERR>("Failed to initiate transition", -- entry("ERRNO=0x%X, REQUEST=%s", -rc, request.c_str())); -+ try -+ { -+ ipmi::setDbusProperty(*getSdBus(), service, chassisStatePath, -+ chassisStateIntf, "RequestedPowerTransition", -+ request); - } -- else -+ catch (std::exception& e) - { -- log<level::INFO>("Transition request initiated successfully"); -+ log<level::ERR>( -+ "Failed to initiate transition", -+ entry("EXCEPTION=%s, REQUEST=%s", e.what(), request.c_str())); -+ return -1; - } - -- sd_bus_error_free(&bus_error); -- free(busname); -- -- return rc; -+ return 0; - } - - //------------------------------------------ -@@ -1302,76 +1307,6 @@ ipmi::RspType<uint4_t, // Restart Cause - return ipmi::responseSuccess(cause.value(), reserved, channel); - } - --//------------------------------------------------------------- --// Send a command to SoftPowerOff application to stop any timer --//------------------------------------------------------------- --int stop_soft_off_timer() --{ -- constexpr auto iface = "org.freedesktop.DBus.Properties"; -- constexpr auto soft_off_iface = "xyz.openbmc_project.Ipmi.Internal." -- "SoftPowerOff"; -- -- constexpr auto property = "ResponseReceived"; -- constexpr auto value = "xyz.openbmc_project.Ipmi.Internal." -- "SoftPowerOff.HostResponse.HostShutdown"; -- -- // Get the system bus where most system services are provided. -- auto bus = ipmid_get_sd_bus_connection(); -- -- // Get the service name -- // TODO openbmc/openbmc#1661 - Mapper refactor -- // -- // See openbmc/openbmc#1743 for some details but high level summary is that -- // for now the code will directly call the soft off interface due to a -- // race condition with mapper usage -- // -- // char *busname = nullptr; -- // auto r = mapper_get_service(bus, SOFTOFF_OBJPATH, &busname); -- // if (r < 0) -- //{ -- // fprintf(stderr, "Failed to get %s bus name: %s\n", -- // SOFTOFF_OBJPATH, -r); -- // return r; -- //} -- -- // No error object or reply expected. -- int rc = sd_bus_call_method(bus, SOFTOFF_BUSNAME, SOFTOFF_OBJPATH, iface, -- "Set", nullptr, nullptr, "ssv", soft_off_iface, -- property, "s", value); -- if (rc < 0) -- { -- log<level::ERR>("Failed to set property in SoftPowerOff object", -- entry("ERRNO=0x%X", -rc)); -- } -- -- // TODO openbmc/openbmc#1661 - Mapper refactor -- // free(busname); -- return rc; --} -- --//---------------------------------------------------------------------- --// Create file to indicate there is no need for softoff notification to host --//---------------------------------------------------------------------- --void indicate_no_softoff_needed() --{ -- fs::path path{HOST_INBAND_REQUEST_DIR}; -- if (!fs::is_directory(path)) -- { -- fs::create_directory(path); -- } -- -- // Add the host instance (default 0 for now) to the file name -- std::string file{HOST_INBAND_REQUEST_FILE}; -- auto size = std::snprintf(nullptr, 0, file.c_str(), 0); -- size++; // null -- std::unique_ptr<char[]> buf(new char[size]); -- std::snprintf(buf.get(), size, file.c_str(), 0); -- -- // Append file name to directory and create it -- path /= buf.get(); -- std::ofstream(path.c_str()); --} -- - /** @brief Implementation of chassis control command - * - * @param - chassisControl command byte -@@ -1384,66 +1319,22 @@ ipmi::RspType<> ipmiChassisControl(uint8_t chassisControl) - switch (chassisControl) - { - case CMD_POWER_ON: -- rc = initiate_state_transition(State::Host::Transition::On); -+ rc = initiateHostStateTransition(State::Host::Transition::On); - break; - case CMD_POWER_OFF: -- // This path would be hit in 2 conditions. -- // 1: When user asks for power off using ipmi chassis command 0x04 -- // 2: Host asking for power off post shutting down. -- -- // If it's a host requested power off, then need to nudge Softoff -- // application that it needs to stop the watchdog timer if running. -- // If it is a user requested power off, then this is not really -- // needed. But then we need to differentiate between user and host -- // calling this same command -- -- // For now, we are going ahead with trying to nudge the soft off and -- // interpret the failure to do so as a non softoff case -- rc = stop_soft_off_timer(); -- -- // Only request the Off transition if the soft power off -- // application is not running -- if (rc < 0) -- { -- // First create a file to indicate to the soft off application -- // that it should not run. Not doing this will result in State -- // manager doing a default soft power off when asked for power -- // off. -- indicate_no_softoff_needed(); -- -- // Now request the shutdown -- rc = initiate_state_transition(State::Host::Transition::Off); -- } -- else -- { -- log<level::INFO>("Soft off is running, so let shutdown target " -- "stop the host"); -- } -+ rc = -+ initiateChassisStateTransition(State::Chassis::Transition::Off); - break; -- - case CMD_HARD_RESET: -- rc = initiate_state_transition( -+ rc = initiateHostStateTransition( - State::Host::Transition::ForceWarmReboot); - break; - case CMD_POWER_CYCLE: -- // SPEC has a section that says certain implementations can trigger -- // PowerOn if power is Off when a command to power cycle is -- // requested -- -- // First create a file to indicate to the soft off application -- // that it should not run since this is a direct user initiated -- // power reboot request (i.e. a reboot request that is not -- // originating via a soft power off SMS request) -- indicate_no_softoff_needed(); -- -- rc = initiate_state_transition(State::Host::Transition::Reboot); -+ rc = initiateHostStateTransition(State::Host::Transition::Reboot); - break; -- - case CMD_SOFT_OFF_VIA_OVER_TEMP: -- // Request Host State Manager to do a soft power off -- rc = initiate_state_transition(State::Host::Transition::Off); -+ rc = initiateHostStateTransition(State::Host::Transition::Off); - break; -- - case CMD_PULSE_DIAGNOSTIC_INTR: - rc = setNmiProperty(true); - break; --- -2.17.1 - 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 87aab6f79..5c0908515 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 @@ -2,14 +2,13 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" PROJECT_SRC_DIR := "${THISDIR}/${PN}" #SRC_URI += "git://github.com/openbmc/phosphor-host-ipmid" -SRCREV = "78fe1b14f60d55ae335369fb2c6e81ed9ac6d865" +SRCREV = "f93da667b58b67cf61d06dcc5862d9864c96d8e7" 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 \ file://0059-Move-Set-SOL-config-parameter-to-host-ipmid.patch \ file://0060-Move-Get-SOL-config-parameter-to-host-ipmid.patch \ - file://0062-Update-IPMI-Chassis-Control-command.patch \ file://0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch \ " 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 a0b507cb8..853d68d87 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 = "5819666c23ee1d01a54fc5fb2c068bb1da1f29c7" +SRCREV = "af23add2a2cf73226cdc72af4793fde6357e8932" 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 14093cf3e..5935b3289 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 @@ -2,7 +2,7 @@ SUMMARY = "Node Manager Proxy" DESCRIPTION = "The Node Manager Proxy provides a simple interface for communicating \ with Management Engine via IPMB" -SRC_URI = "git://github.com/Intel-BMC/node-manager;protocol=ssh" +SRC_URI = "git://git@github.com/Intel-BMC/node-manager.git;protocol=ssh" SRCREV = "9aca80fa2a405938de99aae777e6cfcf08525563" PV = "0.1+git${SRCPV}" 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 index 6d9294635..1c8d7c91f 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/network/phosphor-snmp_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/network/phosphor-snmp_%.bbappend @@ -1,4 +1,4 @@ FILESEXTRAPATHS:append := ":${THISDIR}/${PN}" # SRC_URI = "git://github.com/openbmc/phosphor-snmp" -SRCREV = "d560529eb7e22c0b78fb0def20f57c6f35be9dfe" +SRCREV = "7350c77aa635cff08c5f1ee32e10679de7c5afda" 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 e7c5d1af3..34b6e89e7 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 = "de624395a587be555463a14a3db90500b4e0521c" +SRCREV = "bb5efe7b3ecfd56584cef10739b3395ef3017dd4" 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 592d6ae0c..a342f25c7 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 @@ -1,7 +1,7 @@ SUMMARY = "libmctp:intel" DESCRIPTION = "Implementation of MCTP(DMTF DSP0236)" -SRC_URI = "git://github.com/Intel-BMC/libmctp.git;protocol=ssh" +SRC_URI = "git://git@github.com/Intel-BMC/libmctp.git;protocol=ssh" 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 162b4ed74..f86d8b7bc 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 @@ -1,10 +1,10 @@ SUMMARY = "libpldm_intel" DESCRIPTION = "Provides encode/decode APIs for PLDM specifications" -SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "94437a678a1d23b22dc179b5cb7b165e52a429c0" +SRC_URI = "git://git@github.com/Intel-BMC/libpldm.git;protocol=ssh;branch=main" +SRCREV = "cf792b06a27f308a888c4bbf5cb5f8b90fa18d22" -S = "${WORKDIR}/git/libpldm_intel" +S = "${WORKDIR}/git" PV = "1.0+git${SRCPV}" 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 fda4d6b79..e6a953468 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 @@ -4,10 +4,10 @@ DESCRIPTION = "Implementation of MCTP (DTMF DSP0236)" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=bcd9ada3a943f58551867d72893cc9ab" -SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "94437a678a1d23b22dc179b5cb7b165e52a429c0" +SRC_URI = "git://git@github.com/Intel-BMC/mctp-emulator.git;protocol=ssh;branch=main" +SRCREV = "3a95b7be9114d8a7f559ba68799e3c55d91aab13" -S = "${WORKDIR}/git/mctp_emulator" +S = "${WORKDIR}/git" PV = "1.0+git${SRCPV}" 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 05e64ed46..5ddd791a1 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 @@ -4,10 +4,10 @@ DESCRIPTION = "Implementation of MCTP Wrapper Library" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=bcd9ada3a943f58551867d72893cc9ab" -SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "94437a678a1d23b22dc179b5cb7b165e52a429c0" +SRC_URI = "git://git@github.com/Intel-BMC/mctp-wrapper.git;protocol=ssh;branch=main" +SRCREV = "643337bb5d2eb9697335a38d6e57cbcea20123f2" -S = "${WORKDIR}/git/mctp_wrapper" +S = "${WORKDIR}/git" PV = "1.0+git${SRCPV}" 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 8b088be23..1710c1acd 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb @@ -2,16 +2,16 @@ SUMMARY = "MCTP Daemon" DESCRIPTION = "Implementation of MCTP (DTMF DSP0236)" LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${PN}/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" +LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" -SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "94437a678a1d23b22dc179b5cb7b165e52a429c0" +SRC_URI = "git://git@github.com/Intel-BMC/mctpd.git;protocol=ssh;branch=main" +SRCREV = "60c0862eb286b2de8cee93a2f6736a3d317d9739" S = "${WORKDIR}/git" PV = "1.0+git${SRCPV}" -OECMAKE_SOURCEPATH = "${S}/${PN}" +OECMAKE_SOURCEPATH = "${S}" inherit cmake systemd 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 b1c40ab61..2c84eb697 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb @@ -4,10 +4,10 @@ DESCRIPTION = "Implementation of MCTP Wrapper Library Plus" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=615045c30a05cde5c0e924854d43c327" -SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "94437a678a1d23b22dc179b5cb7b165e52a429c0" +SRC_URI = "git://git@github.com/Intel-BMC/mctpwplus.git;protocol=ssh;branch=main" +SRCREV = "7a7425ce324497d1199af2cc9ce0e948cc226307" -S = "${WORKDIR}/git/mctpwplus" +S = "${WORKDIR}/git" PV = "1.0+git${SRCPV}" 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 84c2c8066..97168e8a9 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 @@ -4,8 +4,8 @@ DESCRIPTION = "Implementation of NVMe MI daemon" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" -SRC_URI = "git://github.com/Intel-BMC/nvme-mi.git;protocol=ssh" -SRCREV = "c3d5021fb60cd46d5c948c69f3d57ac9648b5be5" +SRC_URI = "git://git@github.com/Intel-BMC/nvme-mi.git;protocol=ssh;branch=master" +SRCREV = "f33407cec7dd1f5702402d9dea05d6a141f34d4d" 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 16253b5d0..661db1ea0 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb @@ -4,10 +4,10 @@ DESCRIPTION = "Implementation of PLDM specifications" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" -SRC_URI += "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "94437a678a1d23b22dc179b5cb7b165e52a429c0" +SRC_URI += "git://git@github.com/Intel-BMC/pldmd.git;protocol=ssh;branch=main;branch=main" +SRCREV = "5a698ca08b8159d935f8ccbc09a84960cf201896" -S = "${WORKDIR}/git/pldmd" +S = "${WORKDIR}/git" PV = "1.0+git${SRCPV}" 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 c640c5664..4da8e97a2 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 @@ -4,10 +4,10 @@ DESCRIPTION = "Support to launch pmci services on-demand" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" -SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "94437a678a1d23b22dc179b5cb7b165e52a429c0" +SRC_URI = "git://git@github.com/Intel-BMC/pmci-launcher.git;protocol=ssh;branch=main" +SRCREV = "5b29e915cf8c34f84a6d4c03bd7fccf1a0642398" -S = "${WORKDIR}/git/pmci_launcher" +S = "${WORKDIR}/git" PV = "1.0+git${SRCPV}" 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 79971942a..3483293f7 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 @@ -8,7 +8,7 @@ S = "${WORKDIR}/git" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" -SRC_URI = "git://github.com/Intel-BMC/provisioning-mode-manager.git;protocol=ssh" +SRC_URI = "git://git@github.com/Intel-BMC/provisioning-mode-manager.git;protocol=ssh" SRCREV = "0aca01b4ce9b303e12ba0f757f56390da139c8bb" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/security-manager/security-manager_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/security-manager/security-manager_git.bb index 783dea029..c30c62ca2 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/security-manager/security-manager_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/security-manager/security-manager_git.bb @@ -3,14 +3,14 @@ DESCRIPTION = "Daemon check for Remote debug enable and user account violation" PV = "1.0+git${SRCPV}" -S = "${WORKDIR}/git/security-manager" +S = "${WORKDIR}/git" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658" inherit cmake systemd -SRC_URI = "git://github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "bee56d62b209088454d166d1efae4825a2b175df" +SRC_URI = "git://git@github.com/Intel-BMC/security-manager.git;protocol=ssh;branch=main" +SRCREV = "1cf60de11c5f13bd791402aef7f9a8d33de54c64" SYSTEMD_SERVICE:${PN} += "xyz.openbmc_project.SecurityManager.service" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0001-Add-check-for-min-max-received-from-hwmon-files.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0001-Add-check-for-min-max-received-from-hwmon-files.patch index 33d35ec5e..d864d3290 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0001-Add-check-for-min-max-received-from-hwmon-files.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0001-Add-check-for-min-max-received-from-hwmon-files.patch @@ -1,4 +1,4 @@ -From 2516d67f8bb5ecd241b8dcdec3f8c58d0e3c4744 Mon Sep 17 00:00:00 2001 +From 021b17af775b58a61661f75af595b71625509241 Mon Sep 17 00:00:00 2001 From: Wojciech Dembinski <wojciech.dembinski@intel.com> Date: Mon, 7 Dec 2020 19:23:10 +0100 Subject: [PATCH] Add check for min/max received from hwmon files @@ -21,7 +21,7 @@ Change-Id: Ia061f849b0f434812f822ed1902c8964d4c64b45 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp -index 2356821..01f5eb6 100644 +index cd1038f..16c3686 100644 --- a/src/CPUSensor.cpp +++ b/src/CPUSensor.cpp @@ -1,5 +1,5 @@ @@ -31,7 +31,7 @@ index 2356821..01f5eb6 100644 // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. -@@ -146,19 +146,22 @@ void CPUSensor::setupRead(void) +@@ -166,19 +166,22 @@ void CPUSensor::setupRead(void) void CPUSensor::updateMinMaxValues(void) { @@ -62,7 +62,7 @@ index 2356821..01f5eb6 100644 if (auto fileParts = splitFileName(path)) { -@@ -168,26 +171,25 @@ void CPUSensor::updateMinMaxValues(void) +@@ -188,26 +191,25 @@ void CPUSensor::updateMinMaxValues(void) { for (const auto& vectorItem : mapIt->second) { diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0002-Fix-PECI-client-creation-flow.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0002-Fix-PECI-client-creation-flow.patch index cfdc99d66..fdb245545 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0002-Fix-PECI-client-creation-flow.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0002-Fix-PECI-client-creation-flow.patch @@ -1,4 +1,4 @@ -From 0a1b2a13f6dbc64b5851ac2b1ca99d57afa78d60 Mon Sep 17 00:00:00 2001 +From 34d1e910cd1c9daa271ebb8c50edc5fc9b763b1a Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Date: Wed, 27 Jan 2021 15:52:16 -0800 Subject: [PATCH] Fix PECI client creation flow @@ -7,15 +7,16 @@ This commit fixes the PECI client creation flow to make it retry the creation when the client is not exposed correctly. Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> +Signed-off-by: AppaRao Puli <apparao.puli@intel.com> --- - src/CPUSensorMain.cpp | 66 +++++++++++++++++++++++++++++++++++-------- - 1 file changed, 54 insertions(+), 12 deletions(-) + src/CPUSensorMain.cpp | 69 +++++++++++++++++++++++++++++++++++-------- + 1 file changed, 56 insertions(+), 13 deletions(-) diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp -index f304e3f..92c1716 100644 +index 9e991e7..abae170 100644 --- a/src/CPUSensorMain.cpp +++ b/src/CPUSensorMain.cpp -@@ -82,6 +82,7 @@ struct CPUConfig +@@ -83,6 +83,7 @@ struct CPUConfig }; static constexpr const char* peciDev = "/dev/peci-"; @@ -23,16 +24,19 @@ index f304e3f..92c1716 100644 static constexpr const unsigned int rankNumMax = 8; namespace fs = std::filesystem; -@@ -167,7 +168,7 @@ bool createSensors(boost::asio::io_service& io, +@@ -168,8 +169,9 @@ bool createSensors(boost::asio::io_service& io, } std::vector<fs::path> hwmonNamePaths; -- if (!findFiles(fs::path(R"(/sys/bus/peci/devices)"), +- if (!findFiles(fs::path(R"(/sys/bus/peci/devices/peci-0)"), +- R"(\d+-.+/peci-.+/hwmon/hwmon\d+/name$)", hwmonNamePaths, 5)) + if (!findFiles(fs::path(peciDevPath), - R"(peci-\d+/\d+-.+/peci-.+/hwmon/hwmon\d+/name$)", - hwmonNamePaths, 6)) ++ R"(peci-\d+/\d+-.+/peci-.+/hwmon/hwmon\d+/name$)", ++ hwmonNamePaths, 6)) { -@@ -403,7 +404,7 @@ bool createSensors(boost::asio::io_service& io, + std::cerr << "No CPU sensors in system\n"; + return true; +@@ -403,7 +405,7 @@ bool createSensors(boost::asio::io_service& io, return true; } @@ -41,7 +45,7 @@ index f304e3f..92c1716 100644 { std::ostringstream hex; hex << std::hex << config.addr; -@@ -411,9 +412,12 @@ void exportDevice(const CPUConfig& config) +@@ -411,9 +413,12 @@ void exportDevice(const CPUConfig& config) std::string busStr = std::to_string(config.bus); std::string parameters = "peci-client 0x" + addrHexStr; @@ -56,7 +60,7 @@ index f304e3f..92c1716 100644 const std::string& dir = devicePath.parent_path().string(); for (const auto& path : std::filesystem::directory_iterator(dir)) { -@@ -431,20 +435,38 @@ void exportDevice(const CPUConfig& config) +@@ -431,20 +436,38 @@ void exportDevice(const CPUConfig& config) std::cout << parameters << " on bus " << busStr << " is already exported\n"; } @@ -99,7 +103,7 @@ index f304e3f..92c1716 100644 } void detectCpu(boost::asio::deadline_timer& pingTimer, -@@ -460,6 +482,11 @@ void detectCpu(boost::asio::deadline_timer& pingTimer, +@@ -460,6 +483,11 @@ void detectCpu(boost::asio::deadline_timer& pingTimer, for (CPUConfig& config : cpuConfigs) { @@ -111,7 +115,7 @@ index f304e3f..92c1716 100644 std::string peciDevPath = peciDev + std::to_string(config.bus); auto file = open(peciDevPath.c_str(), O_RDWR | O_CLOEXEC); if (file < 0) -@@ -510,16 +537,29 @@ void detectCpu(boost::asio::deadline_timer& pingTimer, +@@ -510,16 +538,29 @@ void detectCpu(boost::asio::deadline_timer& pingTimer, newState = State::OFF; } @@ -145,7 +149,7 @@ index f304e3f..92c1716 100644 } if (newState == State::ON) -@@ -542,6 +582,8 @@ void detectCpu(boost::asio::deadline_timer& pingTimer, +@@ -542,6 +583,8 @@ void detectCpu(boost::asio::deadline_timer& pingTimer, keepPinging = true; } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0003-Fix-missing-threshold-de-assert-event-when-threshold.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0003-Fix-missing-threshold-de-assert-event-when-threshold.patch index 1cba1095d..fe9ce264d 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0003-Fix-missing-threshold-de-assert-event-when-threshold.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0003-Fix-missing-threshold-de-assert-event-when-threshold.patch @@ -1,4 +1,4 @@ -From db4353de222b51726c8e3c765cc8f1df4ad67687 Mon Sep 17 00:00:00 2001 +From d477be5da32c62fc30096a99d1e601ed7c42a10c Mon Sep 17 00:00:00 2001 From: Zhikui Ren <zhikui.ren@intel.com> Date: Tue, 22 Jun 2021 11:35:12 -0700 Subject: [PATCH] Fix missing de-assert event when threshold changes @@ -46,10 +46,10 @@ Signed-off-by: Zhikui Ren <zhikui.ren@intel.com> 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/include/Thresholds.hpp b/include/Thresholds.hpp -index af63f72..fd507d0 100644 +index 209d68e..640fdb4 100644 --- a/include/Thresholds.hpp +++ b/include/Thresholds.hpp -@@ -44,7 +44,7 @@ struct Threshold +@@ -47,7 +47,7 @@ struct Threshold void assertThresholds(Sensor* sensor, double assertValue, thresholds::Level level, thresholds::Direction direction, @@ -59,18 +59,18 @@ index af63f72..fd507d0 100644 struct TimerUsed { diff --git a/include/sensor.hpp b/include/sensor.hpp -index b98241b..6235674 100644 +index d38bcde..b8cfd66 100644 --- a/include/sensor.hpp +++ b/include/sensor.hpp -@@ -71,6 +71,7 @@ struct Sensor - std::shared_ptr<sdbusplus::asio::dbus_interface> operationalInterface; +@@ -81,6 +81,7 @@ struct Sensor + std::shared_ptr<sdbusplus::asio::dbus_interface> valueMutabilityInterface; double value = std::numeric_limits<double>::quiet_NaN(); double rawValue = std::numeric_limits<double>::quiet_NaN(); + bool hadValidValue = false; bool overriddenState = false; bool internalSet = false; double hysteresisTrigger; -@@ -432,6 +433,7 @@ struct Sensor +@@ -462,6 +463,7 @@ struct Sensor { markFunctional(true); markAvailable(true); @@ -79,10 +79,10 @@ index b98241b..6235674 100644 } diff --git a/src/Thresholds.cpp b/src/Thresholds.cpp -index 821083a..da0d650 100644 +index 0581f21..84df7cf 100644 --- a/src/Thresholds.cpp +++ b/src/Thresholds.cpp -@@ -418,10 +418,19 @@ bool checkThresholds(Sensor* sensor) +@@ -426,10 +426,19 @@ bool checkThresholds(Sensor* sensor) { bool status = true; std::vector<ChangeParam> changes = checkThresholds(sensor, sensor->value); @@ -103,7 +103,7 @@ index 821083a..da0d650 100644 if (change.threshold.level == thresholds::Level::CRITICAL && change.asserted) { -@@ -443,6 +452,7 @@ void checkThresholdsPowerDelay(const std::weak_ptr<Sensor>& weakSensor, +@@ -451,6 +460,7 @@ void checkThresholdsPowerDelay(const std::weak_ptr<Sensor>& weakSensor, Sensor* sensor = sensorPtr.get(); std::vector<ChangeParam> changes = checkThresholds(sensor, sensor->value); @@ -111,7 +111,7 @@ index 821083a..da0d650 100644 for (const auto& change : changes) { // When CPU is powered off, some volatges are expected to -@@ -467,13 +477,13 @@ void checkThresholdsPowerDelay(const std::weak_ptr<Sensor>& weakSensor, +@@ -475,13 +485,13 @@ void checkThresholdsPowerDelay(const std::weak_ptr<Sensor>& weakSensor, } } assertThresholds(sensor, change.assertValue, change.threshold.level, @@ -127,7 +127,7 @@ index 821083a..da0d650 100644 { std::string property; std::shared_ptr<sdbusplus::asio::dbus_interface> interface; -@@ -513,7 +523,9 @@ void assertThresholds(Sensor* sensor, double assertValue, +@@ -521,7 +531,9 @@ void assertThresholds(Sensor* sensor, double assertValue, return; } 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 214fbe888..c04d16feb 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 221aaf1431a01fefb5e7df2461a1c691738a50a7 Mon Sep 17 00:00:00 2001 +From 6c482ff2206cedea73615d3c0370f6edfd245a08 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 @@ -21,17 +21,23 @@ Tested: No cr event for the missing fans. Signed-off-by: Zhikui Ren <zhikui.ren@intel.com> +Signed-off-by: Saravanan Palanisamy <saravanan.palanisamy@intel.com> +Change-Id: I6ef1d61573dcb8c15c0b76a6a6805f368be13fc0 --- - src/TachSensor.cpp | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) + src/TachSensor.cpp | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/TachSensor.cpp b/src/TachSensor.cpp -index c375dbf..e85a2a2 100644 +index 2c48cc9..e85a2a2 100644 --- a/src/TachSensor.cpp +++ b/src/TachSensor.cpp -@@ -186,10 +186,16 @@ void TachSensor::checkThresholds(void) - // WA - treat value <= 0 as not present - bool status = false; +@@ -183,12 +183,19 @@ void TachSensor::handleResponse(const boost::system::error_code& err) + + void TachSensor::checkThresholds(void) + { +- bool status = thresholds::checkThresholds(this); ++ // WA - treat value <= 0 as not present ++ bool status = false; - if (redundancy && *redundancy) + if (value > 0) diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0005-Fix-PECI-ioctl-number.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0005-Fix-PECI-ioctl-number.patch index 8119f7542..6fb1a27e6 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0005-Fix-PECI-ioctl-number.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0005-Fix-PECI-ioctl-number.patch @@ -1,4 +1,4 @@ -From f85dd776301371892ff5197c1995bf2224dd87ab Mon Sep 17 00:00:00 2001 +From 07f431e2d58e6e41482141c32a4cc2e9b62755d8 Mon Sep 17 00:00:00 2001 From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> Date: Mon, 22 Feb 2021 15:57:20 -0800 Subject: [PATCH] Fix PECI ioctl number @@ -12,7 +12,7 @@ Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/peci-ioctl.h b/include/linux/peci-ioctl.h -index e5b4b8bd3275..1f44edf4fc04 100644 +index e5b4b8b..1f44edf 100644 --- a/include/linux/peci-ioctl.h +++ b/include/linux/peci-ioctl.h @@ -601,7 +601,7 @@ struct peci_crashdump_get_frame_msg { 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 2083adfef..4c340a37a 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 6ace96be5a7b6763545c1dfc572f8e2790d99d4b Mon Sep 17 00:00:00 2001 +From fefdd414b158d7b4424cb213dc74e89bab0507ab 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 @@ -28,10 +28,10 @@ Signed-off-by: Zhikui Ren <zhikui.ren@intel.com> 3 files changed, 123 insertions(+), 8 deletions(-) diff --git a/include/CPUSensor.hpp b/include/CPUSensor.hpp -index 8b51b76..93b7fcc 100644 +index 84a1e32..a083b9d 100644 --- a/include/CPUSensor.hpp +++ b/include/CPUSensor.hpp -@@ -26,6 +26,15 @@ class CPUSensor : public Sensor +@@ -26,6 +26,15 @@ class CPUSensor : public Sensor, public std::enable_shared_from_this<CPUSensor> std::vector<thresholds::Threshold>&& thresholds, const std::string& configuration, int cpuId, bool show, double dtsOffset); @@ -48,11 +48,11 @@ index 8b51b76..93b7fcc 100644 static constexpr unsigned int sensorScaleFactor = 1000; static constexpr unsigned int sensorPollMs = 1000; diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp -index c330088..3861ade 100644 +index 16c3686..5aab17f 100644 --- a/src/CPUSensor.cpp +++ b/src/CPUSensor.cpp @@ -98,6 +98,74 @@ CPUSensor::CPUSensor(const std::string& path, const std::string& objectType, - setupRead(); + setupPowerMatch(conn); } +// Create a dummy "not available" CPUSensor @@ -127,7 +127,7 @@ index c330088..3861ade 100644 { // close the input dev to cancel async operations diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp -index 0d94e4b..1d12fa6 100644 +index abae170..2b02d60 100644 --- a/src/CPUSensorMain.cpp +++ b/src/CPUSensorMain.cpp @@ -332,10 +332,9 @@ bool createSensors(boost::asio::io_service& io, @@ -143,7 +143,7 @@ index 0d94e4b..1d12fa6 100644 } // check hidden properties -@@ -636,9 +635,9 @@ void detectCpuAsync( +@@ -637,9 +636,9 @@ void detectCpuAsync( }); } @@ -155,7 +155,7 @@ index 0d94e4b..1d12fa6 100644 sdbusplus::asio::object_server& objectServer) { bool useCache = false; -@@ -700,6 +699,45 @@ bool getCpuConfig(const std::shared_ptr<sdbusplus::asio::connection>& systemBus, +@@ -701,6 +700,45 @@ bool getCpuConfig(const std::shared_ptr<sdbusplus::asio::connection>& systemBus, iface->register_property("Present", *present); iface->initialize(); inventoryIfaces[name] = std::move(iface); @@ -201,7 +201,7 @@ index 0d94e4b..1d12fa6 100644 } auto findBus = config.second.find("Bus"); -@@ -728,7 +766,6 @@ bool getCpuConfig(const std::shared_ptr<sdbusplus::asio::connection>& systemBus, +@@ -729,7 +767,6 @@ bool getCpuConfig(const std::shared_ptr<sdbusplus::asio::connection>& systemBus, std::cout << "name: " << name << "\n"; std::cout << "type: " << type << "\n"; } @@ -209,7 +209,7 @@ index 0d94e4b..1d12fa6 100644 cpuConfigs.emplace(bus, addr, name, State::OFF); } } -@@ -764,7 +801,8 @@ int main() +@@ -765,7 +802,8 @@ int main() return; // we're being canceled } @@ -219,7 +219,7 @@ index 0d94e4b..1d12fa6 100644 { detectCpuAsync(pingTimer, creationTimer, io, objectServer, systemBus, cpuConfigs, sensorConfigs); -@@ -792,7 +830,7 @@ int main() +@@ -793,7 +831,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 daaca7fae..ac7dfdfcf 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 9f5ef2e8d9c34d9d9ddce34d450aaedd5c122b22 Mon Sep 17 00:00:00 2001 +From e280ca18317ec7095e876a97ab6164ab5100c1e0 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 @@ -37,7 +37,7 @@ Signed-off-by: Szymon Dompke <szymon.dompke@intel.com> 3 files changed, 60 insertions(+), 51 deletions(-) diff --git a/include/CPUSensor.hpp b/include/CPUSensor.hpp -index 93b7fcc..76e43dc 100644 +index a083b9d..a6fbdad 100644 --- a/include/CPUSensor.hpp +++ b/include/CPUSensor.hpp @@ -16,6 +16,15 @@ @@ -53,10 +53,10 @@ index 93b7fcc..76e43dc 100644 + unsigned int scaleFactor; +}; + - class CPUSensor : public Sensor + class CPUSensor : public Sensor, public std::enable_shared_from_this<CPUSensor> { public: -@@ -25,7 +34,7 @@ class CPUSensor : public Sensor +@@ -25,7 +34,7 @@ class CPUSensor : public Sensor, public std::enable_shared_from_this<CPUSensor> boost::asio::io_service& io, const std::string& sensorName, std::vector<thresholds::Threshold>&& thresholds, const std::string& configuration, int cpuId, bool show, @@ -65,7 +65,7 @@ index 93b7fcc..76e43dc 100644 // Create a CPUSensor without a path to sensor value CPUSensor(const std::string& objectType, -@@ -36,7 +45,6 @@ class CPUSensor : public Sensor +@@ -36,7 +45,6 @@ class CPUSensor : public Sensor, public std::enable_shared_from_this<CPUSensor> const std::string& sensorConfiguration); ~CPUSensor() override; @@ -73,19 +73,19 @@ index 93b7fcc..76e43dc 100644 static constexpr unsigned int sensorPollMs = 1000; static constexpr size_t warnAfterErrorCount = 10; static constexpr const char* labelTcontrol = "Tcontrol"; -@@ -54,6 +62,7 @@ class CPUSensor : public Sensor +@@ -55,6 +63,7 @@ class CPUSensor : public Sensor, public std::enable_shared_from_this<CPUSensor> size_t pollTime; bool loggedInterfaceDown = false; uint8_t minMaxReadCounter; + unsigned int scaleFactor; - void setupRead(void); void handleResponse(const boost::system::error_code& err); void checkThresholds(void) override; + void updateMinMaxValues(void); diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp -index 3861ade..6737151 100644 +index 5aab17f..fefd89a 100644 --- a/src/CPUSensor.cpp +++ b/src/CPUSensor.cpp -@@ -39,58 +39,37 @@ CPUSensor::CPUSensor(const std::string& path, const std::string& objectType, +@@ -39,59 +39,38 @@ 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, @@ -96,7 +96,8 @@ index 3861ade..6737151 100644 - 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), + std::enable_shared_from_this<CPUSensor>(), objServer(objectServer), + inputDev(io), waitTimer(io), path(path), privTcontrol(std::numeric_limits<double>::quiet_NaN()), dtsOffset(dtsOffset), show(show), pollTime(CPUSensor::sensorPollMs), - minMaxReadCounter(0) @@ -164,7 +165,7 @@ index 3861ade..6737151 100644 } // call setup always as not all sensors call setInitialProperties -@@ -248,7 +227,7 @@ void CPUSensor::updateMinMaxValues(void) +@@ -262,7 +241,7 @@ void CPUSensor::updateMinMaxValues(void) auto& [suffix, oldValue, dbusName, newValue] = vectorItem; auto attrPath = boost::replace_all_copy(path, fileItem, suffix); @@ -173,7 +174,7 @@ index 3861ade..6737151 100644 { newValue.get() = *tmp; } -@@ -302,7 +281,7 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) +@@ -316,7 +295,7 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) std::getline(responseStream, response); rawValue = std::stod(response); responseStream.clear(); @@ -182,7 +183,7 @@ index 3861ade..6737151 100644 if (show) { -@@ -328,8 +307,7 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) +@@ -342,8 +321,7 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) { std::vector<thresholds::Threshold> newThresholds; if (parseThresholdsFromAttr(newThresholds, path, @@ -193,7 +194,7 @@ index 3861ade..6737151 100644 if (!std::equal(thresholds.begin(), thresholds.end(), newThresholds.begin(), diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp -index 1d12fa6..e348aa7 100644 +index 2b02d60..a64d39c 100644 --- a/src/CPUSensorMain.cpp +++ b/src/CPUSensorMain.cpp @@ -94,6 +94,18 @@ static constexpr auto sensorTypes{std::to_array<const char*>({"XeonCPU"})}; @@ -253,14 +254,14 @@ index 1d12fa6..e348aa7 100644 std::cerr << "error populating thresholds for " << sensorName << "\n"; @@ -384,7 +406,7 @@ bool createSensors(boost::asio::io_service& io, - sensorPtr = std::make_unique<CPUSensor>( + sensorPtr = std::make_shared<CPUSensor>( inputPathStr, sensorType, objectServer, dbusConnection, io, sensorName, std::move(sensorThresholds), *interfacePath, cpuId, - show, dtsOffset); + show, dtsOffset, prop); + sensorPtr->setupRead(); createdSensors.insert(sensorName); if (debug) - { -- 2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0008-CPUSensor-additional-debug-message.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0008-CPUSensor-additional-debug-message.patch index 40c8d46bd..be2f7fa9a 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0008-CPUSensor-additional-debug-message.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0008-CPUSensor-additional-debug-message.patch @@ -1,4 +1,4 @@ -From c045d0ace218a8f0c9e9af0b04aed24ec733fc79 Mon Sep 17 00:00:00 2001 +From 805ae6679f49d0d7a3a6448af97f3cb639b9634f Mon Sep 17 00:00:00 2001 From: Zhikui Ren <zhikui.ren@intel.com> Date: Tue, 22 Jun 2021 14:49:44 -0700 Subject: [PATCH] CPUSensor: additional debug message @@ -24,10 +24,10 @@ Signed-off-by: Zhikui Ren <zhikui.ren@intel.com> 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp -index 0621e04..65acdac 100644 +index fefd89a..de33f9b 100644 --- a/src/CPUSensor.cpp +++ b/src/CPUSensor.cpp -@@ -300,6 +300,7 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) +@@ -315,6 +315,7 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) : std::numeric_limits<double>::quiet_NaN(); if (gTcontrol != privTcontrol) { @@ -35,7 +35,7 @@ index 0621e04..65acdac 100644 privTcontrol = gTcontrol; if (!thresholds.empty()) -@@ -318,6 +319,10 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) +@@ -333,6 +334,10 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) thresholds::updateThresholds(this); } } @@ -47,10 +47,10 @@ index 0621e04..65acdac 100644 else { diff --git a/src/Thresholds.cpp b/src/Thresholds.cpp -index 78ded55..283dacf 100644 +index 84df7cf..d1e04eb 100644 --- a/src/Thresholds.cpp +++ b/src/Thresholds.cpp -@@ -583,11 +583,8 @@ bool parseThresholdsFromAttr( +@@ -592,11 +592,8 @@ bool parseThresholdsFromAttr( if (auto val = readFile(attrPath, scaleFactor)) { *val += offset; diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0009-CPUSensor-Create-CPUConfig-for-each-PECI-adapter.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0009-CPUSensor-Create-CPUConfig-for-each-PECI-adapter.patch index 737ba9128..e1896ca7c 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0009-CPUSensor-Create-CPUConfig-for-each-PECI-adapter.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0009-CPUSensor-Create-CPUConfig-for-each-PECI-adapter.patch @@ -1,4 +1,4 @@ -From 262682632ee493d0b6593540cfc902d11286b7c3 Mon Sep 17 00:00:00 2001 +From c420a04ec18e9d62e11a69a0d5e88762b2a141a3 Mon Sep 17 00:00:00 2001 From: Iwona Winiarska <iwona.winiarska@intel.com> Date: Tue, 13 Jul 2021 15:16:16 +0200 Subject: [PATCH] CPUSensor: Create CPUConfig for each PECI adapter @@ -27,7 +27,7 @@ Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com> 1 file changed, 90 insertions(+) diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp -index 744ca50..6850df7 100644 +index a64d39c..32cb6b3 100644 --- a/src/CPUSensorMain.cpp +++ b/src/CPUSensorMain.cpp @@ -33,6 +33,7 @@ @@ -143,5 +143,5 @@ index 744ca50..6850df7 100644 } } -- -2.31.1 +2.17.1 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 765ad3739..23a44d69a 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,8 +1,8 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" PROJECT_SRC_DIR := "${THISDIR}/${PN}" -SRCREV = "77518b28db824e01af18351094680a99b1ba3cae" #SRC_URI = "git://github.com/openbmc/dbus-sensors.git" +SRCREV = "0b207a624f925460797a51974b77b275d4c05e30" SRC_URI += "\ file://intrusionsensor-depend-on-networkd.conf \ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/settings/settings_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/settings/settings_git.bb index 703cbb803..3a7ba69cd 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/settings/settings_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/settings/settings_git.bb @@ -1,6 +1,6 @@ SUMMARY = "Settings" -SRC_URI = "git://github.com/Intel-BMC/settings.git;protocol=ssh" +SRC_URI = "git://git@github.com/Intel-BMC/settings.git;protocol=ssh" SRCREV = "85a8be9a3fb8ef4726899b28f10fb9afa6fa9e89" PV = "0.1+git${SRCPV}" 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 d17aebf00..9b21f3753 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 @@ -8,8 +8,8 @@ S = "${WORKDIR}/git" 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 = "42a0ba3c61ae38cc84b06705159065860492fc2e" +SRC_URI = "git://git@github.com/Intel-BMC/special-mode-manager.git;protocol=ssh" +SRCREV = "7dc05af0adc32e0f16cd2e4f47956a6b2a470790" 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 a4e894cbc..f17d24806 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 = "9ce5a645f50c0ab94e582abbf95474f636aba678" +SRCREV = "987f91a6536e0330799cc5f4e54740c4023b5ef0" 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 b123ddb35..d6196b75e 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 = "0c5059f685f6df0704a4b773f2e617cf10d03210" +SRCREV = "26067f6af051ccf8feff251a081aa46e45dfa4dc" 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 ebd808168..0f2db3f1a 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 = "e28aa53dc1492f09a64dc9f1dbfd5b6dba06e31f" +SRCREV = "51f0fd501f4b772533271d15cb27d396186a7192" 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/0005-Added-suport-for-multiple-user-manager-services.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager/0005-Added-suport-for-multiple-user-manager-services.patch index a7f431049..0a8962698 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager/0005-Added-suport-for-multiple-user-manager-services.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager/0005-Added-suport-for-multiple-user-manager-services.patch @@ -1,4 +1,4 @@ -From 75971b8faf7ef7af7285ba7d5207be71c66e5d11 Mon Sep 17 00:00:00 2001 +From d03ec9b688a5d93f8f44e775eb74358d30d9d314 Mon Sep 17 00:00:00 2001 From: Radivoje Jovanovic <radivoje.jovanovic@intel.com> Date: Mon, 2 Jul 2018 19:23:25 -0700 Subject: [PATCH] Added suport for multiple user manager services @@ -12,11 +12,11 @@ Signed-off-by: Arun P. Mohanan <arun.p.m@linux.intel.com> --- Makefile.am | 5 +- mainapp.cpp | 90 +++++- - user_mgr.cpp | 297 ++---------------- + user_mgr.cpp | 305 ++---------------- user_mgr.hpp | 9 +- user_service.cpp | 789 +++++++++++++++++++++++++++++++++++++++++++++++ user_service.hpp | 233 ++++++++++++++ - 6 files changed, 1149 insertions(+), 274 deletions(-) + 6 files changed, 1150 insertions(+), 281 deletions(-) create mode 100644 user_service.cpp create mode 100644 user_service.hpp @@ -152,7 +152,7 @@ index e08da61..f4b7f8c 100644 // Claim the bus now bus.request_name(USER_MANAGER_BUSNAME); diff --git a/user_mgr.cpp b/user_mgr.cpp -index 1b14e8e..f6f2fdb 100644 +index 8fc899f..acc16b0 100644 --- a/user_mgr.cpp +++ b/user_mgr.cpp @@ -18,43 +18,34 @@ @@ -226,8 +226,8 @@ index 1b14e8e..f6f2fdb 100644 - int retCode = execProg.exit_code(); - if (retCode) - { -- log<level::ERR>("Command execution failed", entry("PATH=%d", path), -- entry("RETURN_CODE:%d", retCode)); +- log<level::ERR>("Command execution failed", entry("PATH=%s", path), +- entry("RETURN_CODE=%d", retCode)); - elog<InternalFailure>(); - } - @@ -281,7 +281,7 @@ index 1b14e8e..f6f2fdb 100644 bool UserMgr::isUserExist(const std::string& userName) { if (userName.empty()) -@@ -299,39 +217,14 @@ void UserMgr::createUser(std::string userName, +@@ -299,44 +217,15 @@ void UserMgr::createUser(std::string userName, { throwForInvalidPrivilege(priv); throwForInvalidGroups(groupNames); @@ -306,10 +306,12 @@ index 1b14e8e..f6f2fdb 100644 - } - try - { +- // set EXPIRE_DATE to 0 to disable user, PAM takes 0 as expire on +- // 1970-01-01, that's an implementation-defined behavior - executeCmd("/usr/sbin/useradd", userName.c_str(), "-G", groups.c_str(), - "-m", "-N", "-s", - (sshRequested ? "/bin/sh" : "/bin/nologin"), "-e", -- (enabled ? "" : "1970-01-02")); +- (enabled ? "" : "1970-01-01")); - } - catch (const InternalFailure& e) - { @@ -320,11 +322,15 @@ index 1b14e8e..f6f2fdb 100644 + userSrvc->createUser(userName, groupNames, priv, enabled); - // Add the users object before sending out the signal +- sdbusplus::message::object_path tempObjPath(usersObjPath); +- tempObjPath /= userName; +- std::string userObj(tempObjPath); + // Add the users to the local list before sending out the signal - std::string userObj = std::string(usersObjPath) + "/" + userName; ++ std::string userObj = std::string(usersObjPath) + "/" + userName; std::sort(groupNames.begin(), groupNames.end()); usersList.emplace( -@@ -345,19 +238,11 @@ void UserMgr::createUser(std::string userName, + userName, std::move(std::make_unique<phosphor::user::Users>( +@@ -349,19 +238,11 @@ void UserMgr::createUser(std::string userName, void UserMgr::deleteUser(std::string userName) { @@ -348,7 +354,7 @@ index 1b14e8e..f6f2fdb 100644 usersList.erase(userName); -@@ -368,24 +253,13 @@ void UserMgr::deleteUser(std::string userName) +@@ -372,24 +253,13 @@ void UserMgr::deleteUser(std::string userName) void UserMgr::renameUser(std::string userName, std::string newUserName) { @@ -376,7 +382,7 @@ index 1b14e8e..f6f2fdb 100644 const auto& user = usersList[userName]; std::string priv = user.get()->userPrivilege(); std::vector<std::string> groupNames = user.get()->userGroups(); -@@ -409,8 +283,6 @@ void UserMgr::updateGroupsAndPriv(const std::string& userName, +@@ -415,8 +285,6 @@ void UserMgr::updateGroupsAndPriv(const std::string& userName, { throwForInvalidPrivilege(priv); throwForInvalidGroups(groupNames); @@ -385,7 +391,7 @@ index 1b14e8e..f6f2fdb 100644 throwForUserDoesNotExist(userName); const std::vector<std::string>& oldGroupNames = usersList[userName].get()->userGroups(); -@@ -426,29 +298,8 @@ void UserMgr::updateGroupsAndPriv(const std::string& userName, +@@ -432,29 +300,8 @@ void UserMgr::updateGroupsAndPriv(const std::string& userName, throwForMaxGrpUserCount(groupNames); } @@ -417,7 +423,7 @@ index 1b14e8e..f6f2fdb 100644 log<level::INFO>("User groups / privilege updated successfully", entry("USER_NAME=%s", userName.c_str())); -@@ -644,19 +495,9 @@ int UserMgr::setPamModuleArgValue(const std::string& moduleName, +@@ -650,21 +497,9 @@ int UserMgr::setPamModuleArgValue(const std::string& moduleName, void UserMgr::userEnable(const std::string& userName, bool enabled) { @@ -426,8 +432,10 @@ index 1b14e8e..f6f2fdb 100644 throwForUserDoesNotExist(userName); - try - { +- // set EXPIRE_DATE to 0 to disable user, PAM takes 0 as expire on +- // 1970-01-01, that's an implementation-defined behavior - executeCmd("/usr/sbin/usermod", userName.c_str(), "-e", -- (enabled ? "" : "1970-01-02")); +- (enabled ? "" : "1970-01-01")); - } - catch (const InternalFailure& e) - { @@ -439,7 +447,7 @@ index 1b14e8e..f6f2fdb 100644 log<level::INFO>("User enabled/disabled state updated successfully", entry("USER_NAME=%s", userName.c_str()), -@@ -779,54 +620,8 @@ bool UserMgr::userPasswordExpired(const std::string& userName) +@@ -787,54 +622,8 @@ bool UserMgr::userPasswordExpired(const std::string& userName) UserSSHLists UserMgr::getUserAndSshGrpList() { @@ -496,7 +504,7 @@ index 1b14e8e..f6f2fdb 100644 } size_t UserMgr::getIpmiUsersCount() -@@ -837,49 +632,14 @@ size_t UserMgr::getIpmiUsersCount() +@@ -845,49 +634,14 @@ size_t UserMgr::getIpmiUsersCount() bool UserMgr::isUserEnabled(const std::string& userName) { @@ -550,7 +558,7 @@ index 1b14e8e..f6f2fdb 100644 } DbusUserObj UserMgr::getPrivilegeMapperObject(void) -@@ -1106,11 +866,9 @@ void UserMgr::initUserObjects(void) +@@ -1114,11 +868,9 @@ void UserMgr::initUserObjects(void) { // All user management lock has to be based on /etc/shadow // TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{}; @@ -564,7 +572,7 @@ index 1b14e8e..f6f2fdb 100644 if (!userNameList.empty()) { -@@ -1165,8 +923,10 @@ void UserMgr::initUserObjects(void) +@@ -1175,8 +927,10 @@ void UserMgr::initUserObjects(void) } } @@ -577,7 +585,7 @@ index 1b14e8e..f6f2fdb 100644 { UserMgrIface::allPrivileges(privMgr); std::sort(groupsMgr.begin(), groupsMgr.end()); -@@ -1274,6 +1034,7 @@ UserMgr::UserMgr(sdbusplus::bus::bus& bus, const char* path) : +@@ -1284,6 +1038,7 @@ UserMgr::UserMgr(sdbusplus::bus::bus& bus, const char* path) : } AccountPolicyIface::accountUnlockTimeout(value32); } 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 21c7991bd..0bf528eb4 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,13 +1,13 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" SRC_URI = "git://github.com/openbmc/phosphor-user-manager" -SRCREV = "c0760c9109a0d847fd77d54c6b7948322a375d1d" +SRCREV = "b01e2fe760eb04ae9d0d13716a127056949e2601" EXTRA_OECONF += "${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'allow-root-login' ], '', '--disable-root_user_mgmt', d)}" SRC_URI += " \ - file://0005-Added-suport-for-multiple-user-manager-services.patch \ - file://0006-Use-groupmems-instead-of-getgrnam_r-due-to-overlay.patch \ + file://0005-Added-suport-for-multiple-user-manager-services.patch \ + file://0006-Use-groupmems-instead-of-getgrnam_r-due-to-overlay.patch \ " FILES:${PN} += "${datadir}/dbus-1/system.d/phosphor-nslcd-cert-config.conf" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb index b8aedc6ee..f41ae7e3a 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb @@ -1,10 +1,10 @@ SUMMARY = "Virtual Media Service" DESCRIPTION = "Virtual Media Service" -SRC_URI = "git://github.com/Intel-BMC/provingground.git;protocol=ssh" -SRCREV = "bee56d62b209088454d166d1efae4825a2b175df" +SRC_URI = "git://git@github.com/Intel-BMC/virtual-media.git;protocol=ssh;branch=main" +SRCREV = "6165e07cd0ef6da314ed1ef4f58fe47b7d8112db" -S = "${WORKDIR}/git/virtual-media" +S = "${WORKDIR}/git" PV = "1.0+git${SRCPV}" LICENSE = "Apache-2.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 19db93805..39153c9c9 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" +SRC_URI = "git://git@github.com/Intel-BMC/phosphor-webui.git;protocol=ssh;branch=intel2" FILESEXTRAPATHS:prepend:intel := "${THISDIR}/${PN}:" SRCREV = "b5707d7648de19350b3f308b9602c888c6418d6f" 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 1273ebb29..bdd6a3bad 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,6 +1,6 @@ # Enable downstream autobump SRC_URI = "git://github.com/openbmc/webui-vue.git" -SRCREV = "2a2e1021f48e2a939859ba7f4ae86c5de6df5655" +SRCREV = "f4328edf86b284fe8836717251ce6696670dbdd5" FILESEXTRAPATHS:append := "${THISDIR}/${PN}:" SRC_URI += " \ diff --git a/meta-openbmc-mods/meta-common/recipes-support/gmp/gmp/CVE-2021-43618-Avoid-bit-size-overflows.patch b/meta-openbmc-mods/meta-common/recipes-support/gmp/gmp/CVE-2021-43618-Avoid-bit-size-overflows.patch new file mode 100644 index 000000000..f74197243 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-support/gmp/gmp/CVE-2021-43618-Avoid-bit-size-overflows.patch @@ -0,0 +1,25 @@ + +# HG changeset patch +# User Marco Bodrato <bodrato@mail.dm.unipi.it> +# Date 1634836009 -7200 +# Node ID 561a9c25298e17bb01896801ff353546c6923dbd +# Parent e1fd9db13b475209a864577237ea4b9105b3e96e +mpz/inp_raw.c: Avoid bit size overflows + +diff -r e1fd9db13b47 -r 561a9c25298e mpz/inp_raw.c +--- a/mpz/inp_raw.c Tue Dec 22 23:49:51 2020 +0100 ++++ b/mpz/inp_raw.c Thu Oct 21 19:06:49 2021 +0200 +@@ -88,8 +88,11 @@ + + abs_csize = ABS (csize); + ++ if (UNLIKELY (abs_csize > ~(mp_bitcnt_t) 0 / 8)) ++ return 0; /* Bit size overflows */ ++ + /* round up to a multiple of limbs */ +- abs_xsize = BITS_TO_LIMBS (abs_csize*8); ++ abs_xsize = BITS_TO_LIMBS ((mp_bitcnt_t) abs_csize * 8); + + if (abs_xsize != 0) + { + diff --git a/meta-openbmc-mods/meta-common/recipes-support/gmp/gmp_%.bbappend b/meta-openbmc-mods/meta-common/recipes-support/gmp/gmp_%.bbappend new file mode 100644 index 000000000..7d77ea4b6 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-support/gmp/gmp_%.bbappend @@ -0,0 +1,4 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" +SRC_URI += " \ + file://CVE-2021-43618-Avoid-bit-size-overflows.patch \ + " diff --git a/meta-openbmc-mods/meta-common/recipes-x86/chassis/x86-power-control_%.bbappend b/meta-openbmc-mods/meta-common/recipes-x86/chassis/x86-power-control_%.bbappend index daac0ecb8..d4d9b9566 100755 --- a/meta-openbmc-mods/meta-common/recipes-x86/chassis/x86-power-control_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-x86/chassis/x86-power-control_%.bbappend @@ -1,6 +1,6 @@ # Enable downstream autobump SRC_URI = "git://github.com/openbmc/x86-power-control.git;protocol=ssh" -SRCREV = "48c94c59728023cdbff3bd62f203de3434af8b8a" +SRCREV = "c46ebb493f0e0cc1ccc5525d5484465bba69551f" FILESEXTRAPATHS:append := "${THISDIR}/${PN}:" diff --git a/meta-openbmc-mods/meta-wht/conf/bblayers.conf.sample b/meta-openbmc-mods/meta-wht/conf/bblayers.conf.sample index 546cd7b31..44f5d6376 100644 --- a/meta-openbmc-mods/meta-wht/conf/bblayers.conf.sample +++ b/meta-openbmc-mods/meta-wht/conf/bblayers.conf.sample @@ -17,7 +17,6 @@ BBLAYERS ?= " \ ##OEROOT##/meta-openembedded/meta-python \ ##OEROOT##/meta-phosphor \ ##OEROOT##/meta-aspeed \ - ##OEROOT##/meta-x86 \ ##OEROOT##/meta-openbmc-mods \ ##OEROOT##/meta-intel-openbmc \ ##OEROOT##/meta-openbmc-mods/meta-common \ diff --git a/meta-openbmc-mods/meta-wolfpass/conf/bblayers.conf.sample b/meta-openbmc-mods/meta-wolfpass/conf/bblayers.conf.sample index 925cdbd97..785634751 100644 --- a/meta-openbmc-mods/meta-wolfpass/conf/bblayers.conf.sample +++ b/meta-openbmc-mods/meta-wolfpass/conf/bblayers.conf.sample @@ -14,7 +14,6 @@ BBLAYERS ?= " \ ##OEROOT##/meta-openembedded/meta-python \ ##OEROOT##/meta-phosphor \ ##OEROOT##/meta-aspeed \ - ##OEROOT##/meta-x86 \ ##OEROOT##/meta-openbmc-mods \ ##OEROOT##/meta-intel-openbmc \ ##OEROOT##/meta-openbmc-mods/meta-common \ |