From defdca82c107f46e980c84bffb1b2c1263522fa0 Mon Sep 17 00:00:00 2001 From: "Jason M. Bills" Date: Wed, 23 Jun 2021 16:18:49 -0700 Subject: Update to internal 0.57 Signed-off-by: Jason M. Bills --- ...ty-manager-Add-support-to-update-assetTag.patch | 35 +- .../configuration/entity-manager_%.bbappend | 5 +- ...001-allow-dbus-sensors-without-thresholds.patch | 39 + .../fans/phosphor-pid-control_%.bbappend | 6 +- ...rmware-activation-to-launch-fwupd.sh-thro.patch | 31 +- .../0007-PFR-images-support.patch | 70 +- ...Fix-for-RedudancyPriority-in-item_updater.patch | 36 - .../flash/phosphor-software-manager_%.bbappend | 1 - ...edVia-property-to-virtual-media-item-temp.patch | 25 - ...001-Firmware-update-configuration-changes.patch | 137 ++-- ...status-code-from-InsertMedia-REST-methods.patch | 182 ----- ...d-redfish-property-for-not-inserted-resou.patch | 40 - ...Bmcweb-handle-permission-denied-exception.patch | 44 -- ...-handle-device-or-resource-busy-exception.patch | 219 ------ .../0005-EventService-https-client-support.patch | 547 ------------- .../0005-Fix-unmounting-image-in-proxy-mode.patch | 32 - ...-Define-Redfish-interface-Registries-Bios.patch | 850 --------------------- ...OS-config-Add-support-for-PATCH-operation.patch | 153 ---- .../0008-Add-support-to-ResetBios-action.patch | 62 -- ...0009-Add-support-to-ChangePassword-action.patch | 139 ---- ...s-add-attributes-for-Manager.CommandShell.patch | 36 +- ...4-recommended-fixes-by-crypto-review-team.patch | 75 ++ ...Add-state-sensor-messages-to-the-registry.patch | 98 +++ ...b-crashes-if-socket-directory-not-present.patch | 44 ++ ...registry-for-subscription-related-actions.patch | 81 ++ ...4-recommended-fixes-by-crypto-review-team.patch | 75 -- ...Add-state-sensor-messages-to-the-registry.patch | 98 --- ...8-Revert-Disable-nbd-proxy-from-the-build.patch | 50 -- ...b-crashes-if-socket-directory-not-present.patch | 44 -- ...0039-Fix-comparison-for-proxy-legacy-mode.patch | 51 -- ...-Define-Redfish-interface-Registries-Bios.patch | 848 ++++++++++++++++++++ ...BiosTable-Add-support-for-PATCH-operation.patch | 152 ++++ .../0003-Add-support-to-ResetBios-action.patch | 61 ++ ...0004-Add-support-to-ChangePassword-action.patch | 139 ++++ ...e-bios-user-pwd-change-option-via-Redfish.patch | 44 ++ ...ervice-Fix-retry-handling-for-http-client.patch | 46 +- .../0002-EventService-https-client-support.patch | 35 +- .../0004-Add-Server-Sent-Events-support.patch | 25 +- ...tyle-subscription-support-to-eventservice.patch | 85 ++- .../0006-Add-EventService-SSE-filter-support.patch | 23 +- ...rvice-Log-events-for-subscription-actions.patch | 132 ++++ .../interfaces/bmcweb/eventservice/README | 10 +- ...3-Add-support-for-MetricDefinition-scheme.patch | 400 +++++----- ...4-Sync-Telmetry-service-with-EventService.patch | 22 +- .../interfaces/bmcweb/telemetry/README | 4 +- ...1-Revert-Disable-nbd-proxy-from-the-build.patch | 50 ++ ...-handle-device-or-resource-busy-exception.patch | 219 ++++++ ...edVia-property-to-virtual-media-item-temp.patch | 28 + ...status-code-from-InsertMedia-REST-methods.patch | 185 +++++ ...d-redfish-property-for-not-inserted-resou.patch | 43 ++ ...Bmcweb-handle-permission-denied-exception.patch | 47 ++ .../0007-Fix-unmounting-image-in-proxy-mode.patch | 35 + ...ix-VM-NBDPROXY-build-issue-with-AsyncResp.patch | 37 + .../recipes-phosphor/interfaces/bmcweb_%.bbappend | 51 +- .../ipmi/phosphor-ipmi-config/channel_config.json | 1 + .../ipmi/phosphor-ipmi-kcs_%.bbappend | 2 +- .../ipmi/phosphor-ipmi-net_%.bbappend | 2 +- .../leds/phosphor-led-manager_%.bbappend | 13 + .../recipes-phosphor/pmci/libmctp-intel_git.bb | 2 +- .../recipes-phosphor/pmci/libpldm-intel_git.bb | 2 +- .../recipes-phosphor/pmci/mctp-emulator.bb | 2 +- .../recipes-phosphor/pmci/mctp-wrapper.bb | 2 +- .../meta-common/recipes-phosphor/pmci/mctpd.bb | 2 +- .../meta-common/recipes-phosphor/pmci/mctpwplus.bb | 2 +- .../recipes-phosphor/pmci/nvmemi-daemon.bb | 2 +- .../meta-common/recipes-phosphor/pmci/pldmd.bb | 2 +- .../recipes-phosphor/pmci/pmci-launcher.bb | 2 +- ...sor-create-RequirediTempSensor-if-defined.patch | 234 ++++++ .../sensors/dbus-sensors_%.bbappend | 3 +- .../special-mode-mgr/special-mode-mgr_git.bb | 2 +- .../recipes-phosphor/system/callback-manager.bb | 2 +- .../telemetry/telemetry_%.bbappend | 6 +- .../users/phosphor-user-manager_%.bbappend | 2 +- ...ize-phosphor-watchdog-for-Intel-platforms.patch | 22 +- .../recipes-phosphor/webui/webui-vue_%.bbappend | 2 +- 75 files changed, 3190 insertions(+), 3145 deletions(-) create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control/0001-allow-dbus-sensors-without-thresholds.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0011-Fix-for-RedudancyPriority-in-item_updater.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Add-ConnectedVia-property-to-virtual-media-item-temp.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Invalid-status-code-from-InsertMedia-REST-methods.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0003-Set-Inserted-redfish-property-for-not-inserted-resou.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-Bmcweb-handle-permission-denied-exception.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-bmcweb-handle-device-or-resource-busy-exception.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-EventService-https-client-support.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-Fix-unmounting-image-in-proxy-mode.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0006-Define-Redfish-interface-Registries-Bios.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0007-BIOS-config-Add-support-for-PATCH-operation.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0008-Add-support-to-ResetBios-action.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0009-Add-support-to-ChangePassword-action.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0014-recommended-fixes-by-crypto-review-team.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0015-Add-state-sensor-messages-to-the-registry.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0016-Fix-bmcweb-crashes-if-socket-directory-not-present.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0017-Add-msg-registry-for-subscription-related-actions.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0034-recommended-fixes-by-crypto-review-team.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0037-Add-state-sensor-messages-to-the-registry.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0038-Revert-Disable-nbd-proxy-from-the-build.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-bmcweb-crashes-if-socket-directory-not-present.patch delete mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-comparison-for-proxy-legacy-mode.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0007-EventService-Log-events-for-subscription-actions.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0002-bmcweb-handle-device-or-resource-busy-exception.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0004-Invalid-status-code-from-InsertMedia-REST-methods.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0005-Set-Inserted-redfish-property-for-not-inserted-resou.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0006-Bmcweb-handle-permission-denied-exception.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0007-Fix-unmounting-image-in-proxy-mode.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0008-Fix-VM-NBDPROXY-build-issue-with-AsyncResp.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/leds/phosphor-led-manager_%.bbappend create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0006-CPUSensor-create-RequirediTempSensor-if-defined.patch (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor') 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 8682e2cad..b44220e4b 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,4 +1,4 @@ -From ff5dbca96d12b1c2aaaec0bb891125990af3f218 Mon Sep 17 00:00:00 2001 +From 7ae5ebc43755631c1756bbc1e89b41f2a1da138c Mon Sep 17 00:00:00 2001 From: mansijos Date: Tue, 6 Apr 2021 02:12:56 +0530 Subject: [PATCH] Entity-manager: Add support to update assetTag @@ -15,14 +15,14 @@ The new value is preserved after BMC resets. Change-Id: If7fbfd8325488280f500ab0e2c8b38475813cc3f Signed-off-by: mansijos --- - src/EntityManager.cpp | 92 +++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 88 insertions(+), 4 deletions(-) + src/EntityManager.cpp | 93 +++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 89 insertions(+), 4 deletions(-) diff --git a/src/EntityManager.cpp b/src/EntityManager.cpp -index 932b6f9..67b8f95 100644 +index 7cfcc6e..bf5e175 100644 --- a/src/EntityManager.cpp +++ b/src/EntityManager.cpp -@@ -47,9 +47,17 @@ constexpr const char* lastConfiguration = "/tmp/configuration/last.json"; +@@ -48,9 +48,17 @@ constexpr const char* lastConfiguration = "/tmp/configuration/last.json"; constexpr const char* currentConfiguration = "/var/configuration/system.json"; constexpr const char* globalSchema = "global.json"; constexpr const int32_t MAX_MAPPER_DEPTH = 0; @@ -40,7 +40,7 @@ index 932b6f9..67b8f95 100644 struct cmp_str { bool operator()(const char* a, const char* b) const -@@ -575,6 +583,43 @@ void addArrayToDbus(const std::string& name, const nlohmann::json& array, +@@ -576,6 +584,43 @@ void addArrayToDbus(const std::string& name, const nlohmann::json& array, } } @@ -84,7 +84,7 @@ index 932b6f9..67b8f95 100644 template void addProperty(const std::string& propertyName, const PropertyType& value, sdbusplus::asio::dbus_interface* iface, -@@ -589,9 +634,18 @@ void addProperty(const std::string& propertyName, const PropertyType& value, +@@ -590,9 +635,18 @@ void addProperty(const std::string& propertyName, const PropertyType& value, } iface->register_property( propertyName, value, @@ -104,7 +104,7 @@ index 932b6f9..67b8f95 100644 val = newVal; if (!setJsonFromPointer(jsonPointerString, val, systemConfiguration)) -@@ -989,6 +1043,9 @@ void postToDbus(const nlohmann::json& newConfiguration, +@@ -990,6 +1044,9 @@ void postToDbus(const nlohmann::json& newConfiguration, populateInterfaceFromJson(systemConfiguration, jsonPointerPath, boardIface, boardValues, objServer); jsonPointerPath += "/"; @@ -114,7 +114,7 @@ index 932b6f9..67b8f95 100644 // iterate through board properties for (auto& boardField : boardValues.items()) { -@@ -998,9 +1055,28 @@ void postToDbus(const nlohmann::json& newConfiguration, +@@ -999,9 +1056,28 @@ void postToDbus(const nlohmann::json& newConfiguration, createInterface(objServer, boardName, boardField.key(), boardKeyOrig); @@ -146,18 +146,19 @@ index 932b6f9..67b8f95 100644 } } -@@ -1349,6 +1425,10 @@ void PerformScan::run() - continue; +@@ -1357,6 +1433,11 @@ void PerformScan::run() + { + continue; // non-numeric replacement } - ++ + nlohmann::json recordVal = *recordPtr; + // Save the dbus path info of the device + recordVal[foundObject]["Path"] = std::get<1>(*itr); + - int index = std::stoi( - nameIt->get().substr(indexIdx), - nullptr, 0); -@@ -1421,6 +1501,10 @@ void PerformScan::run() + usedNames.insert(nameIt.value()); + auto usedIt = std::find(indexes.begin(), + indexes.end(), index); +@@ -1434,6 +1515,10 @@ void PerformScan::run() } } @@ -169,5 +170,5 @@ index 932b6f9..67b8f95 100644 { std::cerr << "Duplicates found, replacing " -- -2.17.1 +2.30.2 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 9d891c620..a7448a84b 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,11 +1,10 @@ # this is here just to bump faster than upstream # SRC_URI = "git://github.com/openbmc/entity-manager.git" -SRCREV = "1694ef625a1075599e40faa695a40d61ccd91095" +SRCREV = "cda147301b0fa7eac99eee3a7565604dbd6f74dd" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" -SRC_URI += " file://0001-Improve-initialization-of-I2C-sensors.patch \ - file://0002-Entity-manager-Add-support-to-update-assetTag.patch \ +SRC_URI += " file://0002-Entity-manager-Add-support-to-update-assetTag.patch \ file://0003-Add-logs-to-fwVersionIsSame.patch \ " diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control/0001-allow-dbus-sensors-without-thresholds.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control/0001-allow-dbus-sensors-without-thresholds.patch new file mode 100644 index 000000000..6af0a5702 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control/0001-allow-dbus-sensors-without-thresholds.patch @@ -0,0 +1,39 @@ +From 6b4071c12bdcc3bd20e72a7bd2eed19ff14b97af Mon Sep 17 00:00:00 2001 +From: Zhikui Ren +Date: Wed, 12 May 2021 19:11:08 -0700 +Subject: [PATCH] allow dbus sensors without thresholds + +catch dbus exceptions when query for thresholds interfaces. +log messages and continue. + +Signed-off-by: Zhikui Ren +--- + dbus/dbusconfiguration.cpp | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/dbus/dbusconfiguration.cpp b/dbus/dbusconfiguration.cpp +index 55151d3..fd7a138 100644 +--- a/dbus/dbusconfiguration.cpp ++++ b/dbus/dbusconfiguration.cpp +@@ -286,13 +286,15 @@ void populatePidInfo( + { + interface = thresholds::criticalInterface; + } +- const std::string& path = sensorConfig.at(info.inputs.front()).readPath; + +- DbusHelper helper(sdbusplus::bus::new_system()); +- std::string service = helper.getService(interface, path); + double reading = 0; + try + { ++ const std::string& path = sensorConfig.at(info.inputs.front()).readPath; ++ ++ DbusHelper helper(sdbusplus::bus::new_system()); ++ std::string service = helper.getService(interface, path); ++ + helper.getProperty(service, path, interface, *thresholdProperty, + reading); + } +-- +2.17.1 + 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 ab1cd3742..cdefe246f 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,6 +5,10 @@ SYSTEMD_SERVICE_${PN} = "phosphor-pid-control.service" EXTRA_OECONF = "--enable-configure-dbus=yes" SRC_URI = "git://github.com/openbmc/phosphor-pid-control.git" -SRCREV = "cb4c1a27574a7fe121a851ae7ba67aec254a1129" +SRCREV = "18d5bb18dcb4ebf7340b0b7a0b39daa887d530ce" + +SRC_URI += "\ + file://0001-allow-dbus-sensors-without-thresholds.patch \ + " FILES_${PN} = "${bindir}/swampd ${bindir}/setsensor" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch index cfaa077eb..0a47e3278 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch @@ -1,4 +1,4 @@ -From df1281792f6886b41c99919e8197c2c2d369d0ca Mon Sep 17 00:00:00 2001 +From 6ce336adafd723319befc4ce918ba67a0ad3492c Mon Sep 17 00:00:00 2001 From: Jennifer Lee Date: Mon, 10 Dec 2018 10:36:44 -0800 Subject: [PATCH] Modified firmware activation to launch fwupd.sh through @@ -12,19 +12,19 @@ Signed-off-by: Jennifer Lee Signed-off-by: James Feist --- activation.cpp | 45 ++++++++++++++++++++++++++++++++++++++++++++- - meson.build | 1 + + meson.build | 2 ++ meson_options.txt | 3 +++ static/flash.cpp | 42 ++++++++++++++++++++++++++++++++++++++++-- ubi/flash.cpp | 9 +++------ - 5 files changed, 91 insertions(+), 9 deletions(-) + 5 files changed, 92 insertions(+), 9 deletions(-) diff --git a/activation.cpp b/activation.cpp -index eb57587..901caf3 100644 +index c82e297..d690a39 100644 --- a/activation.cpp +++ b/activation.cpp -@@ -92,7 +92,50 @@ auto Activation::activation(Activations value) -> Activations - value == - softwareServer::Activation::Activations::ActivatingAsStandbySpare) +@@ -88,7 +88,50 @@ auto Activation::activation(Activations value) -> Activations + + if (value == softwareServer::Activation::Activations::Activating) { +#ifdef FWUPD_SCRIPT + if (!activationProgress) @@ -53,7 +53,7 @@ index eb57587..901caf3 100644 + } + else if (activationProgress->progress() == 100) + { -+ log("[Jennifer] progress == 100..."); ++ log("progress == 100..."); + if (!redundancyPriority) + { + redundancyPriority = @@ -73,7 +73,7 @@ index eb57587..901caf3 100644 #ifdef HOST_BIOS_UPGRADE auto purpose = parent.versions.find(versionId)->second->purpose(); if (purpose == VersionPurpose::Host) -@@ -115,7 +158,6 @@ auto Activation::activation(Activations value) -> Activations +@@ -111,7 +154,6 @@ auto Activation::activation(Activations value) -> Activations return softwareServer::Activation::activation(value); } #endif @@ -81,7 +81,7 @@ index eb57587..901caf3 100644 auto versionStr = parent.versions.find(versionId)->second->version(); if (!minimum_ship_level::verify(versionStr)) -@@ -179,6 +221,7 @@ auto Activation::activation(Activations value) -> Activations +@@ -175,6 +217,7 @@ auto Activation::activation(Activations value) -> Activations return softwareServer::Activation::activation( softwareServer::Activation::Activations::Active); #endif @@ -90,19 +90,20 @@ index eb57587..901caf3 100644 else { diff --git a/meson.build b/meson.build -index 0a7a6a6..5990168 100644 +index a6ebcc4..5c79009 100644 --- a/meson.build +++ b/meson.build -@@ -57,6 +57,7 @@ conf.set('WANT_SIGNATURE_VERIFY', \ - get_option('verify-signature').enabled() or \ +@@ -59,6 +59,8 @@ conf.set('WANT_SIGNATURE_VERIFY', \ get_option('verify-full-signature').enabled()) conf.set('WANT_SIGNATURE_FULL_VERIFY', get_option('verify-full-signature').enabled()) -+conf.set('FWUPD_SCRIPT', get_option('fwupd-script').enabled()) ++conf.set('FWUPD_SCRIPT', get_option('fwupd-script').enabled()) ++ # Configurable variables conf.set('ACTIVE_BMC_MAX_ALLOWED', get_option('active-bmc-max-allowed')) + conf.set_quoted('HASH_FILE_NAME', get_option('hash-file-name')) diff --git a/meson_options.txt b/meson_options.txt -index 355773c..f0c8730 100644 +index 0877798..da257b7 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -25,6 +25,9 @@ option('verify-signature', type: 'feature', diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch index 49bdc138f..e1a7f1746 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch @@ -1,4 +1,4 @@ -From 030f918b90ea45104bccf68082c2d634c6694238 Mon Sep 17 00:00:00 2001 +From 51fd06346ff492d5d4862886cb34e024d05edb45 Mon Sep 17 00:00:00 2001 From: Vikram Bodireddy Date: Tue, 13 Aug 2019 22:43:12 +0530 Subject: [PATCH] PFR images support in phosphor-software-manager @@ -12,34 +12,20 @@ tested PFR image uploads and updates Signed-off-by: Vikram Bodireddy --- - activation.cpp | 2 +- item_updater.cpp | 7 +- - meson.build | 7 +- + meson.build | 8 +- meson_options.txt | 3 + - pfr_image_manager.cpp | 217 ++++++++++++++++++++++++++++++++++++++++++ - pfr_image_manager.hpp | 75 +++++++++++++++ - 6 files changed, 306 insertions(+), 5 deletions(-) + pfr_image_manager.cpp | 218 ++++++++++++++++++++++++++++++++++++++++++ + pfr_image_manager.hpp | 76 +++++++++++++++ + 5 files changed, 308 insertions(+), 4 deletions(-) create mode 100644 pfr_image_manager.cpp create mode 100644 pfr_image_manager.hpp -diff --git a/activation.cpp b/activation.cpp -index bad17b8..3363230 100644 ---- a/activation.cpp -+++ b/activation.cpp -@@ -119,7 +119,7 @@ auto Activation::activation(Activations value) -> Activations - } - else if (activationProgress->progress() == 100) - { -- log("[Jennifer] progress == 100..."); -+ log("progress == 100..."); - if (!redundancyPriority) - { - redundancyPriority = diff --git a/item_updater.cpp b/item_updater.cpp -index df8595c..694975f 100644 +index 81fc01f..60e7d23 100644 --- a/item_updater.cpp +++ b/item_updater.cpp -@@ -64,10 +64,10 @@ void ItemUpdater::createActivation(sdbusplus::message::message& msg) +@@ -65,10 +65,10 @@ void ItemUpdater::createActivation(sdbusplus::message::message& msg) auto value = SVersion::convertVersionPurposeFromString( std::get(property.second)); if (value == VersionPurpose::BMC || @@ -52,7 +38,7 @@ index df8595c..694975f 100644 { purpose = value; } -@@ -399,6 +399,7 @@ void ItemUpdater::deleteAll() +@@ -414,6 +414,7 @@ void ItemUpdater::deleteAll() ItemUpdater::ActivationStatus ItemUpdater::validateSquashFSImage(const std::string& filePath) { @@ -60,7 +46,7 @@ index df8595c..694975f 100644 bool valid = true; // Record the images which are being updated -@@ -416,7 +417,7 @@ ItemUpdater::ActivationStatus +@@ -431,7 +432,7 @@ ItemUpdater::ActivationStatus return ItemUpdater::ActivationStatus::invalid; } } @@ -69,37 +55,27 @@ index df8595c..694975f 100644 return ItemUpdater::ActivationStatus::ready; } -@@ -690,8 +691,8 @@ void ItemUpdater::freeSpace(Activation& caller) - // Failed activations don't have priority, assign them a large value - // for sorting purposes. - auto priority = 999; -- if ((iter.second.get()->activation() == -- server::Activation::Activations::Active)&& -+ if ((iter.second.get()->activation() == -+ server::Activation::Activations::Active) && - iter.second->redundancyPriority.get()) - { - priority = iter.second->redundancyPriority.get()->priority(); diff --git a/meson.build b/meson.build -index 08d6f71..c61d59f 100644 +index 5c79009..e33998d 100644 --- a/meson.build +++ b/meson.build -@@ -55,6 +55,7 @@ conf.set('MMC_LAYOUT', get_option('bmc-layout').contains('mmc')) - conf.set('HOST_BIOS_UPGRADE', get_option('host-bios-upgrade').enabled()) - conf.set('WANT_SIGNATURE_VERIFY', get_option('verify-signature').enabled()) +@@ -60,6 +60,7 @@ conf.set('WANT_SIGNATURE_VERIFY', \ + conf.set('WANT_SIGNATURE_FULL_VERIFY', get_option('verify-full-signature').enabled()) + conf.set('FWUPD_SCRIPT', get_option('fwupd-script').enabled()) +conf.set('PFR_UPDATE', get_option('pfr-update').enabled()) - + # Configurable variables conf.set('ACTIVE_BMC_MAX_ALLOWED', get_option('active-bmc-max-allowed')) -@@ -195,12 +196,16 @@ executable( +@@ -205,12 +206,17 @@ executable( install: true ) - + +image_manager_source = files('image_manager.cpp') +if get_option('pfr-update').enabled() + image_manager_source = files('pfr_image_manager.cpp') +endif ++ executable( 'phosphor-version-software-manager', image_error_cpp, @@ -111,22 +87,22 @@ index 08d6f71..c61d59f 100644 'watch.cpp', dependencies: [deps, ssl], diff --git a/meson_options.txt b/meson_options.txt -index 4f7e62a..1593502 100644 +index da257b7..2204e04 100644 --- a/meson_options.txt +++ b/meson_options.txt -@@ -25,6 +25,9 @@ option('verify-signature', type: 'feature', +@@ -28,6 +28,9 @@ option('verify-full-signature', type: 'feature', option('fwupd-script', type: 'feature', description: 'Enable fwupd script support.') - + +option('pfr-update', type: 'feature', -+ description: 'Enable fwupd script support.') ++ description: 'Enable PFR image support.') + # Variables option( 'active-bmc-max-allowed', type: 'integer', diff --git a/pfr_image_manager.cpp b/pfr_image_manager.cpp new file mode 100644 -index 0000000..242a6ca +index 0000000..fec1e94 --- /dev/null +++ b/pfr_image_manager.cpp @@ -0,0 +1,218 @@ @@ -350,7 +326,7 @@ index 0000000..242a6ca +} // namespace phosphor diff --git a/pfr_image_manager.hpp b/pfr_image_manager.hpp new file mode 100644 -index 0000000..c6ee6a4 +index 0000000..b9a5822 --- /dev/null +++ b/pfr_image_manager.hpp @@ -0,0 +1,76 @@ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0011-Fix-for-RedudancyPriority-in-item_updater.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0011-Fix-for-RedudancyPriority-in-item_updater.patch deleted file mode 100644 index 156e6fe7c..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0011-Fix-for-RedudancyPriority-in-item_updater.patch +++ /dev/null @@ -1,36 +0,0 @@ -From f6022e25d0b47af502522913773e589fcdd1568e Mon Sep 17 00:00:00 2001 -From: Vikram Bodireddy -Date: Sun, 5 Jul 2020 00:54:57 +0530 -Subject: [PATCH] Fix for RedudancyPriority in item_updater - -This fixes accessing RedudancyPriority property for the -activated image in item_updater. The downloaded image object -is not actually associated with RedudancyPriority before and -after activation. There exists no RedundancyPriority property -for downloaded image, accessing it causing a crash in -item_updater. - -Tested: Tested for coredumps during Seamless firmware update. - -Signed-off-by: Vikram Bodireddy - ---- - item_updater.cpp | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/item_updater.cpp b/item_updater.cpp -index c3a846d..b299b4d 100644 ---- a/item_updater.cpp -+++ b/item_updater.cpp -@@ -690,8 +690,9 @@ void ItemUpdater::freeSpace(Activation& caller) - // Failed activations don't have priority, assign them a large value - // for sorting purposes. - auto priority = 999; -- if (iter.second.get()->activation() == -- server::Activation::Activations::Active) -+ if ((iter.second.get()->activation() == -+ server::Activation::Activations::Active)&& -+ iter.second->redundancyPriority.get()) - { - priority = iter.second->redundancyPriority.get()->priority(); - } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend index 63e0aff25..decea878f 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend @@ -13,7 +13,6 @@ SRC_URI += " \ file://0007-Adding-StandBySpare-for-firmware-activation.patch \ file://0008-item_updater-update-the-bmc_active-objectPath.patch \ file://0009-Add-ApplyOptions-D-bus-property-under-Software.patch \ - file://0011-Fix-for-RedudancyPriority-in-item_updater.patch \ file://0013-remove-image-file-on-pre-script-failures.patch \ " diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Add-ConnectedVia-property-to-virtual-media-item-temp.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Add-ConnectedVia-property-to-virtual-media-item-temp.patch deleted file mode 100644 index ec6d70df1..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Add-ConnectedVia-property-to-virtual-media-item-temp.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 4af788655c5b5a5fae4d85b365a70dc619810fe0 Mon Sep 17 00:00:00 2001 -From: Karol Wachowski -Date: Thu, 11 Feb 2021 08:35:41 +0000 -Subject: [PATCH] Add ConnectedVia property to virtual media item template - -Tested: Verified that ConnectedVia property is returned and set to - "NotConnected" for disconnected media. - -Signed-off-by: Karol Wachowski ---- - redfish-core/lib/virtual_media.hpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index 188248a..80e7315 100644 ---- a/redfish-core/lib/virtual_media.hpp -+++ b/redfish-core/lib/virtual_media.hpp -@@ -192,6 +192,7 @@ static nlohmann::json vmItemTemplate(const std::string& name, - item["@odata.id"] = - "/redfish/v1/Managers/" + name + "/VirtualMedia/" + resName; - item["@odata.type"] = "#VirtualMedia.v1_3_0.VirtualMedia"; -+ item["ConnectedVia"] = "NotConnected"; - item["Name"] = "Virtual Removable Media"; - item["Id"] = resName; - item["WriteProtected"] = true; 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 193461baf..a76990262 100755 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch @@ -1,4 +1,4 @@ -From 10cb7cb14974725a29b3ead4c543ca5e58234c07 Mon Sep 17 00:00:00 2001 +From d5f2e8b00bc5f8a727a1ef678941c4993c3ea7a6 Mon Sep 17 00:00:00 2001 From: Vikram Bodireddy Date: Wed, 18 Nov 2020 17:14:41 +0530 Subject: [PATCH] Firmware update configuration changes @@ -39,23 +39,21 @@ Tested: - Successfully ran redfish validater with no new errors. -Signed-off-by: Vikram Bodireddy - -%% original patch: 0001-Firmware-update-configuration-changes.patch - Change-Id: I44e1743fd76aa37c7b8affa49a3e05f808187037 +Signed-off-by: Vikram Bodireddy Signed-off-by: Helen Huang +Signed-off-by: AppaRao Puli --- - redfish-core/lib/update_service.hpp | 339 ++++++++++++++++-- + redfish-core/lib/update_service.hpp | 338 ++++++++++++++++-- static/redfish/v1/$metadata/index.xml | 3 + .../JsonSchemas/OemUpdateService/index.json | 69 ++++ .../redfish/v1/schema/OemUpdateService_v1.xml | 40 +++ - 4 files changed, 421 insertions(+), 30 deletions(-) + 4 files changed, 421 insertions(+), 29 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 6d44171..8eda265 100644 +index ca1234f..0a9f81a 100644 --- a/redfish-core/lib/update_service.hpp +++ b/redfish-core/lib/update_service.hpp @@ -32,6 +32,17 @@ static std::unique_ptr fwUpdateErrorMatcher; @@ -76,7 +74,7 @@ index 6d44171..8eda265 100644 static void cleanUp() { -@@ -40,27 +51,119 @@ static void cleanUp() +@@ -40,28 +51,120 @@ static void cleanUp() fwUpdateErrorMatcher = nullptr; } static void activateImage(const std::string& objPath, @@ -201,12 +199,13 @@ index 6d44171..8eda265 100644 // Note that asyncResp can be either a valid pointer or nullptr. If nullptr // then no asyncResp updates will occur - static void softwareInterfaceAdded(const std::shared_ptr& asyncResp, -+ const std::vector imgUriTargets, - sdbusplus::message::message& m, - const crow::Request& req) + static void + softwareInterfaceAdded(const std::shared_ptr& asyncResp, ++ const std::vector imgUriTargets, + sdbusplus::message::message& m, + const crow::Request& req) { -@@ -73,22 +176,24 @@ static void softwareInterfaceAdded(const std::shared_ptr& asyncResp, +@@ -74,22 +177,24 @@ static void m.read(objPath, interfacesProperties); @@ -235,7 +234,7 @@ index 6d44171..8eda265 100644 BMCWEB_LOG_DEBUG << "error msg = " << errorCode.message(); if (asyncResp) -@@ -115,7 +220,7 @@ static void softwareInterfaceAdded(const std::shared_ptr& asyncResp, +@@ -116,7 +221,7 @@ static void // is added fwAvailableTimer = nullptr; @@ -244,7 +243,7 @@ index 6d44171..8eda265 100644 if (asyncResp) { std::shared_ptr task = -@@ -247,8 +352,7 @@ static void softwareInterfaceAdded(const std::shared_ptr& asyncResp, +@@ -248,8 +353,7 @@ static void "xyz.openbmc_project.ObjectMapper", "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetObject", objPath.str, @@ -254,17 +253,16 @@ index 6d44171..8eda265 100644 } } } -@@ -257,7 +361,8 @@ static void softwareInterfaceAdded(const std::shared_ptr& asyncResp, - // then no asyncResp updates will occur +@@ -259,7 +363,7 @@ static void static void monitorForSoftwareAvailable( - const std::shared_ptr& asyncResp, const crow::Request& req, -- const std::string& url, int timeoutTimeSeconds = 10) -+ const std::string& url, const std::vector& imgUriTargets, -+ int timeoutTimeSeconds = 10) + const std::shared_ptr& asyncResp, + const crow::Request& req, const std::string& url, +- int timeoutTimeSeconds = 10) ++ const std::vector& imgUriTargets, int timeoutTimeSeconds = 10) { // Only allow one FW update at a time if (fwUpdateInProgress != false) -@@ -297,9 +402,10 @@ static void monitorForSoftwareAvailable( +@@ -299,9 +403,10 @@ static void monitorForSoftwareAvailable( } }); @@ -277,7 +275,7 @@ index 6d44171..8eda265 100644 }; fwUpdateInProgress = true; -@@ -475,12 +581,15 @@ class UpdateServiceActionsSimpleUpdate : public Node +@@ -477,12 +582,15 @@ class UpdateServiceActionsSimpleUpdate : public Node std::string fwFile = imageURI.substr(separator + 1); BMCWEB_LOG_DEBUG << "Server: " << tftpServer + " File: " << fwFile; @@ -294,7 +292,7 @@ index 6d44171..8eda265 100644 // TFTP can take up to 10 minutes depending on image size and // connection speed. Return to caller as soon as the TFTP operation -@@ -514,7 +623,8 @@ class UpdateServiceActionsSimpleUpdate : public Node +@@ -516,7 +624,8 @@ class UpdateServiceActionsSimpleUpdate : public Node class UpdateService : public Node { public: @@ -304,37 +302,38 @@ index 6d44171..8eda265 100644 { entityPrivileges = { {boost::beast::http::verb::get, {{"Login"}}}, -@@ -526,6 +636,8 @@ class UpdateService : public Node +@@ -528,6 +637,8 @@ class UpdateService : public Node } private: + std::vector httpPushUriTargets; + bool httpPushUriTargetBusy; - void doGet(crow::Response& res, const crow::Request&, - const std::vector&) override + void doGet(const std::shared_ptr& asyncResp, + const crow::Request&, const std::vector&) override { -@@ -536,6 +648,8 @@ class UpdateService : public Node - res.jsonValue["Description"] = "Service for Software Update"; - res.jsonValue["Name"] = "Update Service"; - res.jsonValue["HttpPushUri"] = "/redfish/v1/UpdateService"; -+ res.jsonValue["HttpPushUriTargets"] = httpPushUriTargets; -+ res.jsonValue["HttpPushUriTargetsBusy"] = httpPushUriTargetBusy; +@@ -538,6 +649,9 @@ class UpdateService : public Node + asyncResp->res.jsonValue["Description"] = "Service for Software Update"; + asyncResp->res.jsonValue["Name"] = "Update Service"; + asyncResp->res.jsonValue["HttpPushUri"] = "/redfish/v1/UpdateService"; ++ asyncResp->res.jsonValue["HttpPushUriTargets"] = httpPushUriTargets; ++ asyncResp->res.jsonValue["HttpPushUriTargetsBusy"] = ++ httpPushUriTargetBusy; // UpdateService cannot be disabled - res.jsonValue["ServiceEnabled"] = true; - res.jsonValue["FirmwareInventory"] = { -@@ -585,6 +699,31 @@ class UpdateService : public Node + asyncResp->res.jsonValue["ServiceEnabled"] = true; + asyncResp->res.jsonValue["FirmwareInventory"] = { +@@ -587,6 +701,32 @@ class UpdateService : public Node "/xyz/openbmc_project/software/apply_time", "org.freedesktop.DBus.Properties", "Get", "xyz.openbmc_project.Software.ApplyTime", "RequestedApplyTime"); + + // Get the ApplyOptions value + crow::connections::systemBus->async_method_call( -+ [aResp](const boost::system::error_code ec, -+ const std::variant applyOption) { ++ [asyncResp](const boost::system::error_code ec, ++ const std::variant applyOption) { + if (ec) + { + BMCWEB_LOG_DEBUG << "DBUS response error " << ec; -+ messages::internalError(aResp->res); ++ messages::internalError(asyncResp->res); + return; + } + @@ -342,10 +341,11 @@ index 6d44171..8eda265 100644 + + if (b) + { -+ aResp->res.jsonValue["Oem"]["ApplyOptions"]["@odata.type"] = ++ asyncResp->res ++ .jsonValue["Oem"]["ApplyOptions"]["@odata.type"] = + "#OemUpdateService.ApplyOptions"; -+ aResp->res.jsonValue["Oem"]["ApplyOptions"]["ClearConfig"] = -+ *b; ++ asyncResp->res ++ .jsonValue["Oem"]["ApplyOptions"]["ClearConfig"] = *b; + } + }, + "xyz.openbmc_project.Software.BMC.Updater", @@ -353,21 +353,20 @@ index 6d44171..8eda265 100644 + "Get", "xyz.openbmc_project.Software.ApplyOptions", "ClearConfig"); } - void doPatch(crow::Response& res, const crow::Request& req, -@@ -595,12 +734,61 @@ class UpdateService : public Node - std::shared_ptr asyncResp = std::make_shared(res); + void doPatch(const std::shared_ptr& asyncResp, +@@ -596,12 +736,61 @@ class UpdateService : public Node + BMCWEB_LOG_DEBUG << "doPatch..."; std::optional pushUriOptions; -- if (!json_util::readJson(req, res, "HttpPushUriOptions", -- pushUriOptions)) + std::optional> imgTargets; + std::optional imgTargetBusy; + std::optional oemProps; + -+ if (!json_util::readJson(req, res, "HttpPushUriOptions", pushUriOptions, -+ "HttpPushUriTargets", imgTargets, -+ "HttpPushUriTargetsBusy", imgTargetBusy, "Oem", -+ oemProps)) + 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; @@ -377,7 +376,7 @@ index 6d44171..8eda265 100644 + { + std::optional applyOptions; + -+ if (!json_util::readJson(*oemProps, res, "ApplyOptions", ++ if (!json_util::readJson(*oemProps, asyncResp->res, "ApplyOptions", + applyOptions)) + { + return; @@ -386,8 +385,8 @@ index 6d44171..8eda265 100644 + if (applyOptions) + { + std::optional clearConfig; -+ if (!json_util::readJson(*applyOptions, res, "ClearConfig", -+ clearConfig)) ++ if (!json_util::readJson(*applyOptions, asyncResp->res, ++ "ClearConfig", clearConfig)) + { + return; + } @@ -418,7 +417,7 @@ index 6d44171..8eda265 100644 if (pushUriOptions) { std::optional pushUriApplyTime; -@@ -665,6 +853,98 @@ class UpdateService : public Node +@@ -666,6 +855,98 @@ class UpdateService : public Node } } } @@ -516,9 +515,9 @@ index 6d44171..8eda265 100644 + } } - void doPost(crow::Response& res, const crow::Request& req, -@@ -675,8 +955,8 @@ class UpdateService : public Node - std::shared_ptr asyncResp = std::make_shared(res); + void doPost(const std::shared_ptr& asyncResp, +@@ -675,8 +956,8 @@ class UpdateService : public Node + BMCWEB_LOG_DEBUG << "doPost..."; // Setup callback for when new software detected - monitorForSoftwareAvailable(asyncResp, req, @@ -528,7 +527,7 @@ index 6d44171..8eda265 100644 std::string filepath( "/tmp/images/" + -@@ -761,7 +1041,7 @@ class SoftwareInventoryCollection : public Node +@@ -759,7 +1040,7 @@ class SoftwareInventoryCollection : public Node "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/xyz/openbmc_project/software", static_cast(0), @@ -537,7 +536,7 @@ index 6d44171..8eda265 100644 } }; -@@ -943,7 +1223,7 @@ class SoftwareInventory : public Node +@@ -940,7 +1221,7 @@ class SoftwareInventory : public Node }, obj.second[0].first, obj.first, "org.freedesktop.DBus.Properties", "GetAll", @@ -546,7 +545,7 @@ index 6d44171..8eda265 100644 } if (!found) { -@@ -964,8 +1244,7 @@ class SoftwareInventory : public Node +@@ -961,8 +1242,7 @@ class SoftwareInventory : public Node "xyz.openbmc_project.ObjectMapper", "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/", @@ -557,19 +556,19 @@ index 6d44171..8eda265 100644 }; diff --git a/static/redfish/v1/$metadata/index.xml b/static/redfish/v1/$metadata/index.xml -index 514f3dd..c068d4f 100644 +index 9d9fd1f..6cbc0d1 100644 --- a/static/redfish/v1/$metadata/index.xml +++ b/static/redfish/v1/$metadata/index.xml -@@ -2142,6 +2142,9 @@ - - +@@ -2145,6 +2145,9 @@ + + + + + - - - + + + diff --git a/static/redfish/v1/JsonSchemas/OemUpdateService/index.json b/static/redfish/v1/JsonSchemas/OemUpdateService/index.json new file mode 100644 index 0000000..74e39cd diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Invalid-status-code-from-InsertMedia-REST-methods.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Invalid-status-code-from-InsertMedia-REST-methods.patch deleted file mode 100644 index c9a4119a1..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Invalid-status-code-from-InsertMedia-REST-methods.patch +++ /dev/null @@ -1,182 +0,0 @@ - -From 1bbabe4ecdeea20da809b9f1d8e194683629517c Mon Sep 17 00:00:00 2001 -From: Alicja Rybak -Date: Tue, 20 Apr 2021 16:32:37 +0200 -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 -checks which mode is used and set suitable status code: -Not allowed for Legacy and Not found for Proxy. - -Change-Id: Ib4c0a3e9a2a8853caa74c59239d9fcfed99c5e8b -Signed-off-by: Alicja Rybak ---- - redfish-core/lib/virtual_media.hpp | 154 +++++++++++++++++++++++++++++ - 1 file changed, 154 insertions(+) - -diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index 8353ce7..66bf220 100644 ---- a/redfish-core/lib/virtual_media.hpp -+++ b/redfish-core/lib/virtual_media.hpp -@@ -530,6 +530,160 @@ class VirtualMediaActionInsertMedia : public Node - return true; - } - -+ /** -+ * @brief Function checks if insert media request is Legacy or Proxy type -+ * and sets suitable response code for unsupported REST method. -+ * -+ */ -+ void CheckProxyMode(crow::Response& res, -+ const crow::Request& req, -+ const std::vector& params) -+ { -+ auto aResp = std::make_shared(res); -+ -+ if (params.size() != 2) -+ { -+ messages::internalError(res); -+ return; -+ } -+ -+ // take resource name from URL -+ const std::string& resName = params[1]; -+ -+ if (params[0] != "bmc") -+ { -+ messages::resourceNotFound(res, "VirtualMedia.Insert", resName); -+ -+ return; -+ } -+ -+ crow::connections::systemBus->async_method_call( -+ [this, aResp{std::move(aResp)}, req, -+ resName](const boost::system::error_code ec, -+ const GetObjectType& getObjectType) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " -+ << ec; -+ aResp->res.result( -+ boost::beast::http::status::not_found); -+ -+ return; -+ } -+ std::string service = getObjectType.begin()->first; -+ BMCWEB_LOG_DEBUG << "GetObjectType: " << service; -+ -+ crow::connections::systemBus->async_method_call( -+ [this, service, resName, req, -+ aResp{aResp}](const boost::system::error_code ec, -+ ManagedObjectType& subtree) { -+ if (ec) -+ { -+ BMCWEB_LOG_DEBUG << "DBUS response error"; -+ -+ return; -+ } -+ -+ for (auto& item : subtree) -+ { -+ std::string thispath = item.first.filename(); -+ if (thispath.empty()) -+ { -+ continue; -+ } -+ -+ if (thispath != resName) -+ { -+ continue; -+ } -+ -+ auto mode = item.first.parent_path(); -+ auto type = mode.parent_path(); -+ if (mode.filename().empty() || -+ type.filename().empty()) -+ { -+ continue; -+ } -+ -+ if (type.filename() != "VirtualMedia") -+ { -+ continue; -+ } -+ -+ // Check if dbus path is Legacy type -+ if (mode.filename() == "Legacy") -+ { -+ BMCWEB_LOG_DEBUG << "InsertMedia only allowed " -+ "with POST method " -+ "in legacy mode"; -+ aResp->res.result( -+ boost::beast::http::status:: -+ method_not_allowed); -+ -+ return; -+ } -+ // Check if dbus path is Proxy type -+ if (mode.filename() == "Proxy") -+ { -+ // Not possible in proxy mode -+ BMCWEB_LOG_DEBUG << "InsertMedia not " -+ "allowed in proxy mode"; -+ aResp->res.result( -+ boost::beast::http::status::not_found); -+ -+ return; -+ } -+ } -+ -+ BMCWEB_LOG_DEBUG << "Parent item not found"; -+ aResp->res.result( -+ boost::beast::http::status::not_found); -+ }, -+ service, "/xyz/openbmc_project/VirtualMedia", -+ "org.freedesktop.DBus.ObjectManager", "GetManagedObjects"); -+ }, -+ "xyz.openbmc_project.ObjectMapper", -+ "/xyz/openbmc_project/object_mapper", -+ "xyz.openbmc_project.ObjectMapper", "GetObject", -+ "/xyz/openbmc_project/VirtualMedia", std::array()); -+ } -+ -+ /** -+ * @brief Function handles GET method request. -+ */ -+ void doGet(crow::Response& res, const crow::Request& req, -+ const std::vector& params) override -+ { -+ CheckProxyMode(res, req, params); -+ } -+ -+ /** -+ * @brief Function handles PATCH method request. -+ */ -+ void doPatch(crow::Response& res, const crow::Request& req, -+ const std::vector& params) override -+ { -+ CheckProxyMode(res, req, params); -+ } -+ -+ /** -+ * @brief Function handles PUT method request. -+ */ -+ void doPut(crow::Response& res, const crow::Request& req, -+ const std::vector& params) override -+ { -+ CheckProxyMode(res, req, params); -+ } -+ -+ /** -+ * @brief Function handles DELETE method request. -+ */ -+ void doDelete(crow::Response& res, const crow::Request& req, -+ const std::vector& params) override -+ { -+ CheckProxyMode(res, req, params); -+ } -+ - /** - * @brief Function handles POST method request. - * diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0003-Set-Inserted-redfish-property-for-not-inserted-resou.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0003-Set-Inserted-redfish-property-for-not-inserted-resou.patch deleted file mode 100644 index eaba041d5..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0003-Set-Inserted-redfish-property-for-not-inserted-resou.patch +++ /dev/null @@ -1,40 +0,0 @@ -From dab4adbf211b6867f86fcf6080b34a0e41f6f4a1 Mon Sep 17 00:00:00 2001 -From: Karol Wachowski -Date: Tue, 23 Feb 2021 15:53:16 +0000 -Subject: [PATCH] Set Inserted redfish property for not inserted resources - -Tested: Verified that Inserted property is returned and set to - "false" for not inserted media. -Signed-off-by: Karol Wachowski ---- - redfish-core/lib/virtual_media.hpp | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index 188248a..f477f63 100644 ---- a/redfish-core/lib/virtual_media.hpp -+++ b/redfish-core/lib/virtual_media.hpp -@@ -95,6 +95,7 @@ static void vmParseInterfaceObject(const DbusInterfaceType& interface, - BMCWEB_LOG_DEBUG << "Value Active not found"; - return; - } -+ aResp->res.jsonValue["Inserted"] = *activeValue; - - const std::string* endpointIdValue = - std::get_if(&endpointIdProperty->second); -@@ -106,7 +107,6 @@ static void vmParseInterfaceObject(const DbusInterfaceType& interface, - aResp->res.jsonValue["Oem"]["OpenBMC"]["WebSocketEndpoint"] = - *endpointIdValue; - aResp->res.jsonValue["TransferProtocolType"] = "OEM"; -- aResp->res.jsonValue["Inserted"] = *activeValue; - if (*activeValue == true) - { - aResp->res.jsonValue["ConnectedVia"] = "Applet"; -@@ -137,7 +137,6 @@ static void vmParseInterfaceObject(const DbusInterfaceType& interface, - } - - aResp->res.jsonValue["Image"] = *imageUrlValue; -- aResp->res.jsonValue["Inserted"] = *activeValue; - aResp->res.jsonValue["TransferProtocolType"] = - getTransferProtocolTypeFromUri(*imageUrlValue); - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-Bmcweb-handle-permission-denied-exception.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-Bmcweb-handle-permission-denied-exception.patch deleted file mode 100644 index 074718349..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-Bmcweb-handle-permission-denied-exception.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 81f2c022b22ef75990f30e5ba5bfd4ba5bd41754 Mon Sep 17 00:00:00 2001 -From: Alicja Rybak -Date: Wed, 14 Apr 2021 16:26:59 +0200 -Subject: [PATCH] Bmcweb handle permission denied exception - -Add handling of permission denied exception (EPERM) that -can be thrown by VirtualMedia service during Mount/Unmount dbus operations. - -Tested: -Verified that after mounting/unmounting HTTPS resource twice in a row in legacy mode, -VirtualMedia returns EPERM, which bmcweb handles as 403 status code. - -Change-Id: Ibc18d5ec822c5072605b1fc4651389982002798b -Signed-off-by: Alicja Rybak ---- - redfish-core/lib/virtual_media.hpp | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index 365290b..bbdc91b 100644 ---- a/redfish-core/lib/virtual_media.hpp -+++ b/redfish-core/lib/virtual_media.hpp -@@ -900,6 +900,10 @@ class VirtualMediaActionInsertMedia : public Node - { - messages::resourceInUse(asyncResp->res); - } -+ else if (ec == boost::system::errc::permission_denied) -+ { -+ messages::accessDenied(asyncResp->res, "VirtualMedia.Insert"); -+ } - else - { - messages::internalError(asyncResp->res); -@@ -1092,6 +1096,10 @@ class VirtualMediaActionEjectMedia : public Node - { - messages::resourceInUse(asyncResp->res); - } -+ else if (ec == boost::system::errc::permission_denied) -+ { -+ messages::accessDenied(asyncResp->res, "VirtualMedia.Eject"); -+ } - else - { - messages::internalError(asyncResp->res); diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-bmcweb-handle-device-or-resource-busy-exception.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-bmcweb-handle-device-or-resource-busy-exception.patch deleted file mode 100644 index 01c1c858c..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-bmcweb-handle-device-or-resource-busy-exception.patch +++ /dev/null @@ -1,219 +0,0 @@ -From 76480c6a5b1708113f28aecab32a85984371243c Mon Sep 17 00:00:00 2001 -From: Karol Wachowski -Date: Fri, 10 Jul 2020 09:54:06 +0000 -Subject: [PATCH] bmcweb handle device or resource busy exception - -Use async_method_call_timed() for mount/unmount dbus oprations. -Long mount/unmount times are supported by VirtualMedia service, -this works because of settable timeout property, available for each block -device. -Default dbus calls will timeout when mount/unmount timeout is long enough. - -Get mount/unmount timeout property and use it for mount/unmount calls. -Add handling of device or resource busy exception (EBUSY) that -can be thrown by VirtualMedia service during Mount/Unmount dbus operations. - -Tested: Verified that after mounting non-existing HTTPS resource - in proxy mode, VirtualMedia recovers restoring ready state - and returns EBUSY during that transition. - Verfied that resources can be mounted/unmounted in both legacy - and proxy mode. -Signed-off-by: Karol Wachowski -Change-Id: Ica62c34db0cce24c4c6169fc661edfde49e948d0 ---- - redfish-core/lib/virtual_media.hpp | 144 ++++++++++++++++++++++------- - 1 file changed, 110 insertions(+), 34 deletions(-) - -diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index 95a8881..188248a 100644 ---- a/redfish-core/lib/virtual_media.hpp -+++ b/redfish-core/lib/virtual_media.hpp -@@ -24,6 +24,8 @@ - #include - #include - -+#include -+ - namespace redfish - - { -@@ -160,6 +162,26 @@ static void vmParseInterfaceObject(const DbusInterfaceType& interface, - } - } - -+/** -+ * @brief parses Timeout property and converts to microseconds -+ */ -+static std::optional -+ vmParseTimeoutProperty(const std::variant& timeoutProperty) -+{ -+ const int* timeoutValue = std::get_if(&timeoutProperty); -+ if (timeoutValue) -+ { -+ constexpr int timeoutMarginSeconds = 10; -+ return std::chrono::duration_cast( -+ std::chrono::seconds(*timeoutValue + timeoutMarginSeconds)) -+ .count(); -+ } -+ else -+ { -+ return std::nullopt; -+ } -+} -+ - /** - * @brief Fill template for Virtual Media Item. - */ -@@ -856,22 +878,54 @@ class VirtualMediaActionInsertMedia : public Node - } - - crow::connections::systemBus->async_method_call( -- [asyncResp, secretPipe](const boost::system::error_code ec, -- bool success) { -+ [asyncResp, service, name, imageUrl, rw, unixFd, -+ secretPipe](const boost::system::error_code ec, -+ const std::variant timeoutProperty) { - if (ec) - { - BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec; - messages::internalError(asyncResp->res); -+ return; - } -- else if (!success) -+ -+ auto timeout = vmParseTimeoutProperty(timeoutProperty); -+ if (timeout == std::nullopt) - { -- BMCWEB_LOG_ERROR << "Service responded with error"; -- messages::generalError(asyncResp->res); -+ BMCWEB_LOG_ERROR << "Timeout property is empty."; -+ messages::internalError(asyncResp->res); -+ return; - } -+ -+ crow::connections::systemBus->async_method_call_timed( -+ [asyncResp, secretPipe](const boost::system::error_code ec, -+ bool success) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "Bad D-Bus request error: " -+ << ec; -+ if (ec == -+ boost::system::errc::device_or_resource_busy) -+ { -+ messages::resourceInUse(asyncResp->res); -+ } -+ else -+ { -+ messages::internalError(asyncResp->res); -+ } -+ } -+ else if (!success) -+ { -+ BMCWEB_LOG_ERROR << "Service responded with error"; -+ messages::generalError(asyncResp->res); -+ } -+ }, -+ service, "/xyz/openbmc_project/VirtualMedia/Legacy/" + name, -+ "xyz.openbmc_project.VirtualMedia.Legacy", "Mount", -+ *timeout, imageUrl, rw, unixFd); - }, - service, "/xyz/openbmc_project/VirtualMedia/Legacy/" + name, -- "xyz.openbmc_project.VirtualMedia.Legacy", "Mount", imageUrl, rw, -- unixFd); -+ "org.freedesktop.DBus.Properties", "Get", -+ "xyz.openbmc_project.VirtualMedia.MountPoint", "Timeout"); - } - }; - -@@ -1003,38 +1057,60 @@ class VirtualMediaActionEjectMedia : public Node - const std::string& service, const std::string& name, - bool legacy) - { -- -- // Legacy mount requires parameter with image -+ std::string objectPath = "/xyz/openbmc_project/VirtualMedia/"; -+ std::string ifaceName = "xyz.openbmc_project.VirtualMedia"; - if (legacy) - { -- crow::connections::systemBus->async_method_call( -- [asyncResp](const boost::system::error_code ec) { -- if (ec) -- { -- BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec; -- -- messages::internalError(asyncResp->res); -- return; -- } -- }, -- service, "/xyz/openbmc_project/VirtualMedia/Legacy/" + name, -- "xyz.openbmc_project.VirtualMedia.Legacy", "Unmount"); -+ objectPath += "Legacy/"; -+ ifaceName += ".Legacy"; - } -- else // proxy -+ else - { -- crow::connections::systemBus->async_method_call( -- [asyncResp](const boost::system::error_code ec) { -- if (ec) -- { -- BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec; -- -- messages::internalError(asyncResp->res); -- return; -- } -- }, -- service, "/xyz/openbmc_project/VirtualMedia/Proxy/" + name, -- "xyz.openbmc_project.VirtualMedia.Proxy", "Unmount"); -+ objectPath += "Proxy/"; -+ ifaceName += ".Proxy"; - } -+ objectPath += name; -+ -+ crow::connections::systemBus->async_method_call( -+ [asyncResp, service, name, objectPath, -+ ifaceName](const boost::system::error_code ec, -+ const std::variant timeoutProperty) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ -+ auto timeout = vmParseTimeoutProperty(timeoutProperty); -+ if (timeout == std::nullopt) -+ { -+ BMCWEB_LOG_ERROR << "Timeout property is empty."; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ crow::connections::systemBus->async_method_call_timed( -+ [asyncResp](const boost::system::error_code ec) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "Bad D-Bus request error: " -+ << ec; -+ if (ec == -+ boost::system::errc::device_or_resource_busy) -+ { -+ messages::resourceInUse(asyncResp->res); -+ } -+ else -+ { -+ messages::internalError(asyncResp->res); -+ } -+ return; -+ } -+ }, -+ service, objectPath, ifaceName, "Unmount", *timeout); -+ }, -+ service, objectPath, "org.freedesktop.DBus.Properties", "Get", -+ "xyz.openbmc_project.VirtualMedia.MountPoint", "Timeout"); - } - }; - --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-EventService-https-client-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-EventService-https-client-support.patch deleted file mode 100644 index 54f00aa39..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-EventService-https-client-support.patch +++ /dev/null @@ -1,547 +0,0 @@ -From d340953bc925ff8535c5a8fac54db24b243ba8ad Mon Sep 17 00:00:00 2001 -From: AppaRao Puli -Date: Mon, 19 Oct 2020 13:21:42 +0530 -Subject: [PATCH] EventService: https client support - -Add https client support for push style -eventing. Using this BMC can push the event -logs/telemetry data to event listener over -secure http channel. - -Tested: - - Created subscription with https destination - url. Using SubmitTestEvent action set the - event and can see event on event listener. - - Validator passed. - -Change-Id: I44c3918b39baa2eb5fddda9d635f99aa280a422a -Signed-off-by: AppaRao Puli -Signed-off-by: P Dheeraj Srujan Kumar ---- - http/http_client.hpp | 370 +++++++++++++----- - .../include/event_service_manager.hpp | 2 +- - 2 files changed, 267 insertions(+), 105 deletions(-) - -diff --git a/http/http_client.hpp b/http/http_client.hpp -index 5c7b13f..d782dee 100644 ---- a/http/http_client.hpp -+++ b/http/http_client.hpp -@@ -31,12 +31,17 @@ namespace crow - { - - static constexpr uint8_t maxRequestQueueSize = 50; -+static constexpr unsigned int httpReadBodyLimit = 1024; - - enum class ConnState - { - initialized, -+ resolveInProgress, -+ resolveFailed, -+ resolved, - connectInProgress, - connectFailed, -+ sslHandshakeInProgress, - connected, - sendInProgress, - sendFailed, -@@ -50,53 +55,124 @@ enum class ConnState - class HttpClient : public std::enable_shared_from_this - { - private: -+ boost::asio::ip::tcp::resolver resolver; -+ boost::asio::ssl::context ctx{boost::asio::ssl::context::tlsv12_client}; - boost::beast::tcp_stream conn; -+ std::optional> sslConn; - boost::asio::steady_timer timer; -- boost::beast::flat_buffer buffer; -+ boost::beast::flat_static_buffer buffer; -+ std::optional< -+ boost::beast::http::response_parser> -+ parser; - boost::beast::http::request req; -- boost::beast::http::response res; - boost::asio::ip::tcp::resolver::results_type endpoint; -- std::vector> headers; -+ boost::beast::http::fields fields; - std::queue requestDataQueue; -- ConnState state; - std::string subId; - std::string host; - std::string port; - std::string uri; -+ bool useSsl; - uint32_t retryCount; - uint32_t maxRetryAttempts; - uint32_t retryIntervalSecs; - std::string retryPolicyAction; - bool runningTimer; -+ ConnState state; -+ -+ void doResolve() -+ { -+ BMCWEB_LOG_DEBUG << "Trying to resolve: " << host << ":" << port; -+ if (state == ConnState::resolveInProgress) -+ { -+ return; -+ } -+ state = ConnState::resolveInProgress; -+ // TODO: Use async_resolver. boost asio example -+ // code as is crashing with async_resolve(). -+ try -+ { -+ endpoint = resolver.resolve(host, port); -+ } -+ catch (const std::exception& e) -+ { -+ BMCWEB_LOG_ERROR << "Failed to resolve hostname: " << host << " - " -+ << e.what(); -+ state = ConnState::resolveFailed; -+ checkQueue(); -+ return; -+ } -+ state = ConnState::resolved; -+ checkQueue(); -+ } - - void doConnect() - { -- if (state == ConnState::connectInProgress) -+ if (useSsl) -+ { -+ sslConn.emplace(conn, ctx); -+ } -+ -+ if ((state == ConnState::connectInProgress) || -+ (state == ConnState::sslHandshakeInProgress)) - { - return; - } - state = ConnState::connectInProgress; - - BMCWEB_LOG_DEBUG << "Trying to connect to: " << host << ":" << port; -- // Set a timeout on the operation -+ -+ auto respHandler = -+ [self(shared_from_this())](const boost::beast::error_code ec, -+ const boost::asio::ip::tcp::resolver:: -+ results_type::endpoint_type& ep) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "Connect " << ep -+ << " failed: " << ec.message(); -+ self->state = ConnState::connectFailed; -+ self->checkQueue(); -+ return; -+ } -+ BMCWEB_LOG_DEBUG << "Connected to: " << ep; -+ if (self->sslConn) -+ { -+ self->performHandshake(); -+ } -+ else -+ { -+ self->state = ConnState::connected; -+ self->checkQueue(); -+ } -+ }; -+ - conn.expires_after(std::chrono::seconds(30)); -- conn.async_connect(endpoint, [self(shared_from_this())]( -- const boost::beast::error_code& ec, -- const boost::asio::ip::tcp::resolver:: -- results_type::endpoint_type& ep) { -- if (ec) -- { -- BMCWEB_LOG_ERROR << "Connect " << ep -- << " failed: " << ec.message(); -- self->state = ConnState::connectFailed; -- self->checkQueue(); -- return; -- } -- self->state = ConnState::connected; -- BMCWEB_LOG_DEBUG << "Connected to: " << ep; -+ conn.async_connect(endpoint, std::move(respHandler)); -+ } -+ -+ void performHandshake() -+ { -+ if (state == ConnState::sslHandshakeInProgress) -+ { -+ return; -+ } -+ state = ConnState::sslHandshakeInProgress; -+ -+ sslConn->async_handshake( -+ boost::asio::ssl::stream_base::client, -+ [self(shared_from_this())](const boost::beast::error_code ec) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "SSL handshake failed: " -+ << ec.message(); -+ self->doCloseAndCheckQueue(ConnState::connectFailed); -+ return; -+ } -+ self->state = ConnState::connected; -+ BMCWEB_LOG_DEBUG << "SSL Handshake successfull"; - -- self->checkQueue(); -- }); -+ self->checkQueue(); -+ }); - } - - void sendMessage(const std::string& data) -@@ -107,100 +183,170 @@ class HttpClient : public std::enable_shared_from_this - } - state = ConnState::sendInProgress; - -- BMCWEB_LOG_DEBUG << __FUNCTION__ << "(): " << host << ":" << port; -+ BMCWEB_LOG_DEBUG << host << ":" << port; - -- req.version(static_cast(11)); // HTTP 1.1 -- req.target(uri); -- req.method(boost::beast::http::verb::post); -- -- // Set headers -- for (const auto& [key, value] : headers) -+ req = {}; -+ for (const auto& field : fields) - { -- req.set(key, value); -+ req.set(field.name_string(), field.value()); - } - req.set(boost::beast::http::field::host, host); -+ req.set(boost::beast::http::field::content_type, "text/plain"); -+ -+ req.version(static_cast(11)); // HTTP 1.1 -+ req.target(uri); -+ req.method(boost::beast::http::verb::post); - req.keep_alive(true); - - req.body() = data; - req.prepare_payload(); - -- // Set a timeout on the operation -- conn.expires_after(std::chrono::seconds(30)); -+ auto respHandler = [self(shared_from_this())]( -+ const boost::beast::error_code ec, -+ const std::size_t& bytesTransferred) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "sendMessage() failed: " << ec.message(); -+ self->doCloseAndCheckQueue(ConnState::sendFailed); -+ return; -+ } -+ BMCWEB_LOG_DEBUG << "sendMessage() bytes transferred: " -+ << bytesTransferred; -+ boost::ignore_unused(bytesTransferred); - -- // Send the HTTP request to the remote host -- boost::beast::http::async_write( -- conn, req, -- [self(shared_from_this())](const boost::beast::error_code& ec, -- const std::size_t& bytesTransferred) { -- if (ec) -- { -- BMCWEB_LOG_ERROR << "sendMessage() failed: " -- << ec.message(); -- self->state = ConnState::sendFailed; -- self->checkQueue(); -- return; -- } -- BMCWEB_LOG_DEBUG << "sendMessage() bytes transferred: " -- << bytesTransferred; -- boost::ignore_unused(bytesTransferred); -+ self->recvMessage(); -+ }; - -- self->recvMessage(); -- }); -+ conn.expires_after(std::chrono::seconds(30)); -+ if (sslConn) -+ { -+ boost::beast::http::async_write(*sslConn, req, -+ std::move(respHandler)); -+ } -+ else -+ { -+ boost::beast::http::async_write(conn, req, std::move(respHandler)); -+ } - } - - void recvMessage() - { -- // Receive the HTTP response -- boost::beast::http::async_read( -- conn, buffer, res, -- [self(shared_from_this())](const boost::beast::error_code& ec, -- const std::size_t& bytesTransferred) { -+ auto respHandler = [self(shared_from_this())]( -+ const boost::beast::error_code ec, -+ const std::size_t& bytesTransferred) { -+ if (ec && ec != boost::beast::http::error::partial_message) -+ { -+ BMCWEB_LOG_ERROR << "recvMessage() failed: " << ec.message(); -+ self->doCloseAndCheckQueue(ConnState::recvFailed); -+ return; -+ } -+ BMCWEB_LOG_DEBUG << "recvMessage() bytes transferred: " -+ << bytesTransferred; -+ boost::ignore_unused(bytesTransferred); -+ -+ // TODO: check for return status code and perform -+ // retry if fails(Ex: 40x). Take action depending on -+ // retry policy. -+ BMCWEB_LOG_DEBUG << "recvMessage() data: " -+ << self->parser->get().body(); -+ -+ // Send is successful, Lets remove data from queue -+ // check for next request data in queue. -+ self->requestDataQueue.pop(); -+ -+ // Transfer ownership of the response -+ self->parser->release(); -+ -+ // TODO: Implement the keep-alive connections. -+ // Most of the web servers close connection abruptly -+ // and might be reason due to which its observed that -+ // stream_truncated(Next read) or partial_message -+ // errors. So for now, closing connection and re-open -+ // for all cases. -+ self->doCloseAndCheckQueue(ConnState::closed); -+ }; -+ -+ parser.emplace(std::piecewise_construct, std::make_tuple()); -+ parser->body_limit(httpReadBodyLimit); -+ // Since these are all push style eventing, we are not -+ // bothered about response parsing. -+ parser->skip(true); -+ buffer.consume(buffer.size()); -+ -+ conn.expires_after(std::chrono::seconds(30)); -+ if (sslConn) -+ { -+ boost::beast::http::async_read(*sslConn, buffer, *parser, -+ std::move(respHandler)); -+ } -+ else -+ { -+ boost::beast::http::async_read(conn, buffer, *parser, -+ std::move(respHandler)); -+ } -+ } -+ -+ void doCloseAndCheckQueue(const ConnState setState = ConnState::closed) -+ { -+ if (sslConn) -+ { -+ conn.expires_after(std::chrono::seconds(30)); -+ sslConn->async_shutdown([self = shared_from_this(), -+ setState{std::move(setState)}]( -+ const boost::system::error_code ec) { - if (ec) - { -- BMCWEB_LOG_ERROR << "recvMessage() failed: " -- << ec.message(); -- self->state = ConnState::recvFailed; -- self->checkQueue(); -- return; -+ // Many https server closes connection abruptly -+ // i.e witnout close_notify. More details are at -+ // https://github.com/boostorg/beast/issues/824 -+ if (ec == boost::asio::ssl::error::stream_truncated) -+ { -+ BMCWEB_LOG_ERROR -+ << "doCloseAndCheckQueue(): Connection " -+ "closed by server. "; -+ } -+ else -+ { -+ BMCWEB_LOG_ERROR << "doCloseAndCheckQueue() failed: " -+ << ec.message(); -+ } - } -- BMCWEB_LOG_DEBUG << "recvMessage() bytes transferred: " -- << bytesTransferred; -- boost::ignore_unused(bytesTransferred); -- -- // Discard received data. We are not interested. -- BMCWEB_LOG_DEBUG << "recvMessage() data: " << self->res; -- -- // Send is successful, Lets remove data from queue -- // check for next request data in queue. -- self->requestDataQueue.pop(); -- self->state = ConnState::idle; -+ else -+ { -+ BMCWEB_LOG_DEBUG << "Connection closed gracefully..."; -+ } -+ self->conn.cancel(); -+ self->state = setState; - self->checkQueue(); - }); -- } -- -- void doClose() -- { -- boost::beast::error_code ec; -- conn.socket().shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec); -- -- state = ConnState::closed; -- // not_connected happens sometimes so don't bother reporting it. -- if (ec && ec != boost::beast::errc::not_connected) -+ } -+ else - { -- BMCWEB_LOG_ERROR << "shutdown failed: " << ec.message(); -- return; -+ boost::beast::error_code ec; -+ conn.expires_after(std::chrono::seconds(30)); -+ conn.socket().shutdown(boost::asio::ip::tcp::socket::shutdown_both, -+ ec); -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "doCloseAndCheckQueue() failed: " -+ << ec.message(); -+ } -+ else -+ { -+ BMCWEB_LOG_DEBUG << "Connection closed gracefully..."; -+ } -+ -+ conn.close(); -+ state = setState; -+ checkQueue(); - } -- BMCWEB_LOG_DEBUG << "Connection closed gracefully"; -+ return; - } - - void checkQueue(const bool newRecord = false) - { - if (requestDataQueue.empty()) - { -- // TODO: Having issue in keeping connection alive. So lets close if -- // nothing to be transferred. -- doClose(); -- - BMCWEB_LOG_DEBUG << "requestDataQueue is empty\n"; - return; - } -@@ -232,6 +378,7 @@ class HttpClient : public std::enable_shared_from_this - } - - if ((state == ConnState::connectFailed) || -+ (state == ConnState::resolveFailed) || - (state == ConnState::sendFailed) || - (state == ConnState::recvFailed)) - { -@@ -256,14 +403,18 @@ class HttpClient : public std::enable_shared_from_this - << " seconds. RetryCount = " << retryCount; - timer.expires_after(std::chrono::seconds(retryIntervalSecs)); - timer.async_wait( -- [self = shared_from_this()](const boost::system::error_code&) { -+ [self = shared_from_this()](boost::system::error_code) { - self->runningTimer = false; - self->connStateCheck(); - }); - return; - } -- // reset retry count. -- retryCount = 0; -+ -+ if (state == ConnState::idle) -+ { -+ // State idle means, previous attempt is successful. -+ retryCount = 0; -+ } - connStateCheck(); - - return; -@@ -273,15 +424,21 @@ class HttpClient : public std::enable_shared_from_this - { - switch (state) - { -+ case ConnState::initialized: -+ case ConnState::resolveFailed: -+ case ConnState::connectFailed: -+ doResolve(); -+ break; - case ConnState::connectInProgress: -+ case ConnState::resolveInProgress: -+ case ConnState::sslHandshakeInProgress: - case ConnState::sendInProgress: - case ConnState::suspended: - case ConnState::terminated: - // do nothing - break; -- case ConnState::initialized: - case ConnState::closed: -- case ConnState::connectFailed: -+ case ConnState::resolved: - case ConnState::sendFailed: - case ConnState::recvFailed: - { -@@ -297,22 +454,22 @@ class HttpClient : public std::enable_shared_from_this - sendMessage(data); - break; - } -+ default: -+ break; - } - } - - public: - explicit HttpClient(boost::asio::io_context& ioc, const std::string& id, - const std::string& destIP, const std::string& destPort, -- const std::string& destUri) : -- conn(ioc), -- timer(ioc), subId(id), host(destIP), port(destPort), uri(destUri), -- retryCount(0), maxRetryAttempts(5), retryIntervalSecs(0), -- retryPolicyAction("TerminateAfterRetries"), runningTimer(false) -- { -- boost::asio::ip::tcp::resolver resolver(ioc); -- endpoint = resolver.resolve(host, port); -- state = ConnState::initialized; -- } -+ const std::string& destUri, -+ const bool inUseSsl = true) : -+ resolver(ioc), -+ conn(ioc), timer(ioc), subId(id), host(destIP), port(destPort), -+ uri(destUri), useSsl(inUseSsl), retryCount(0), maxRetryAttempts(5), -+ retryPolicyAction("TerminateAfterRetries"), runningTimer(false), -+ state(ConnState::initialized) -+ {} - - void sendData(const std::string& data) - { -@@ -337,7 +494,12 @@ class HttpClient : public std::enable_shared_from_this - void setHeaders( - const std::vector>& httpHeaders) - { -- headers = httpHeaders; -+ // Set headers -+ for (const auto& [key, value] : httpHeaders) -+ { -+ // TODO: Validate the header fileds before assign. -+ fields.set(key, value); -+ } - } - - void setRetryConfig(const uint32_t retryAttempts, -diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index 54dafb4..f68ae1d 100644 ---- a/redfish-core/include/event_service_manager.hpp -+++ b/redfish-core/include/event_service_manager.hpp -@@ -387,7 +387,7 @@ class Subscription - { - conn = std::make_shared( - crow::connections::systemBus->get_io_context(), id, host, port, -- path); -+ path, (uriProto == "https" ? true : false)); - } - - Subscription(const std::shared_ptr& adaptor) : --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-Fix-unmounting-image-in-proxy-mode.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-Fix-unmounting-image-in-proxy-mode.patch deleted file mode 100644 index acfd9225b..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-Fix-unmounting-image-in-proxy-mode.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 9493bb8e2f5c708e187313c86e6033de5f103c51 Mon Sep 17 00:00:00 2001 -From: Alicja Rybak -Date: Fri, 23 Apr 2021 17:35:52 +0200 -Subject: [PATCH] Fix unmounting image in proxy mode. - -Sometimes Slot0 got higher key than Slot1 and erase function for Slot1 -invalidates elements with keys not less than the erased element. -In that case invalid slot0 will be unmounted. -Change order of calling close() and erase() functions to -unmount correct device. - -Change-Id: I7a40a4518982f697d3eed635cde6d06978149cf0 -Signed-off-by: Alicja Rybak ---- - include/nbd_proxy.hpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp -index 7b90e90..fa7f647 100644 ---- a/include/nbd_proxy.hpp -+++ b/include/nbd_proxy.hpp -@@ -428,9 +428,9 @@ inline void requestRoutes(App& app) - BMCWEB_LOG_DEBUG << "No session to close"; - return; - } -+ session->second->close(); - // Remove reference to session in global map - sessions.erase(session); -- session->second->close(); - }) - .onmessage([](crow::websocket::Connection& conn, - const std::string& data, bool) { diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0006-Define-Redfish-interface-Registries-Bios.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0006-Define-Redfish-interface-Registries-Bios.patch deleted file mode 100644 index b2627644b..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0006-Define-Redfish-interface-Registries-Bios.patch +++ /dev/null @@ -1,850 +0,0 @@ -From c645c011bb3ea2a2aaf52560cb9fcc461d048cae Mon Sep 17 00:00:00 2001 -From: Kuiying Wang -Date: Fri, 4 Sep 2020 19:24:25 +0800 -Subject: [PATCH] Define Redfish interface "/Registries/Bios" and enable - Attributes property - -1. Define Redfish interface "/Registries/Bios" for BIOS Attribute Registry - RBC Daemon provide method to get BIOS attribute registry. -2. Eanble Attributes property for BIOS resource -3. Define Redfish interface "/Systems/system/Bios/Settings" for BIOS -settings -4. RBC daemon is at -https://gerrit.openbmc-project.xyz/#/c/openbmc/bios-settings-mgr/+/35563/ -5. IPMI command implementation is at -https://gerrit.openbmc-project.xyz/#/c/openbmc/intel-ipmi-oem/+/30827/ -6. Property design is at -https://github.com/openbmc/phosphor-dbus-interfaces/tree/master/xyz/openbmc_project/BIOSConfig -7. Design doc is at -https://github.com/openbmc/docs/blob/master/designs/remote-bios-configuration.md -8. There will be 95 test cases for this feature in the validation team. - -Tested: - -1. Use postman (Redfish tool) could get all the attributes in bios -resouce, get bios settings, get bios attribute -registry. -https://IP_ADDR/redfish/v1/Systems/system/Bios -{ - "@Redfish.Settings": { - "@odata.type": "#Settings.v1_3_0.Settings", - "SettingsObject": { - "@odata.id": "/redfish/v1/Systems/system/Bios/Settings" - } - }, - "@odata.id": "/redfish/v1/Systems/system/Bios", - "@odata.type": "#Bios.v1_1_0.Bios", - "Actions": { - "#Bios.ChangePassword": { - "target": "/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword" - }, - "#Bios.ResetBios": { - "target": "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios" - } - }, - "AttributeRegistry": "BiosAttributeRegistry", - "Attributes": { - "attr0": "current value" - }, - "Description": "BIOS Configuration Service", - "Id": "BIOS", - "Links": { - "ActiveSoftwareImage": { - "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/bios_active" - }, - "SoftwareImages": [ - { - "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/bios_active" - } - ], - "SoftwareImages@odata.count": 1 - }, - "Name": "BIOS Configuration" -} - -Redfish interface: https://BMCIP/redfish/v1/Registries/BiosAttributeRegistry -{ - "@odata.id": "/redfish/v1/Registries/BiosAttributeRegistry", - "@odata.type": "#MessageRegistryFile.v1_1_0.MessageRegistryFile", - "Description": "BiosAttributeRegistry Message Registry File Location", - "Id": "BiosAttributeRegistry", - "Languages": [ - "en" - ], - "Languages@odata.count": 1, - "Location": [ - { - "Language": "en", - "Uri": "/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry" - } - ], - "Location@odata.count": 1, - "Name": "BiosAttributeRegistry Message Registry File", - "Registry": "BiosAttributeRegistry.1.0.0" -} - -Redfish interface: https://BMCIP/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry -{ - "@odata.id": "/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry", - "@odata.type": "#AttributeRegistry.v1_3_2.AttributeRegistry", - "Id": "BiosAttributeRegistry", - "Language": "en", - "Name": "Bios Attribute Registry", - "OwningEntity": "OpenBMC", - "RegistryEntries": { - "Attributes": [ - { - "AttributeName": "attr0", - "CurrentValue": "current value", - "DefaultValue": "default value", - "DisplayName": "display name for attr0", - "HelpText": "description for attr0", - "MenuPath": "./menu/path/for/attr0", - "ReadOnly": false, - "Type": "String", - "Value": [] - } - ] - }, - "RegistryVersion": "1.0.0" -} - -https://BMC_IPADDR/redfish/v1/Systems/system/Bios/Settings -{ - "@odata.id": "/redfish/v1/Systems/system/Bios/Settings", - "@odata.type": "#Bios.v1_1_0.Bios", - "AttributeRegistry": "BiosAttributeRegistry", - "Attributes": { - "QuietBoot": "0x0" - }, - "Id": "BiosSettingsV1", - "Name": "Bios Settings Version 1" -} - -2. Passed Validator check for bios resource and bios attribute registry -*** /redfish/v1/Systems/system/Bios -INFO - Type (#Bios.v1_1_0.Bios), GET SUCCESS (time: 1.57377) -INFO - PASS -*** /redfish/v1/Registries/BiosAttributeRegistry -INFO - Type (#MessageRegistryFile.v1_1_0.MessageRegistryFile), GET SUCCESS (time: 0.075438) -INFO - PASS -INFO - -*** /redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry -INFO - Type (#AttributeRegistry.v1_3_2.AttributeRegistry), GET SUCCESS (time: 0.075751) -INFO - PASS - -@odata.id /redfish/v1/Systems/system/Bios odata Exists PASS -@odata.type #Settings.v1_3_0.Settings odata Exists PASS -Links [JSON Object] Bios.v1_1_0.Links Yes complex -Links.ActiveSoftwareImage Link: /redfish/v1/UpdateService/FirmwareInventory/bios_active link to: SoftwareInventory Yes PASS -Links.SoftwareImages Array (size: 1) array of: SoftwareInventory Yes ... -Links.SoftwareImages[0] Link: /redfish/v1/UpdateService/FirmwareInventory/bios_active SoftwareInventory Yes PASS -Links.Oem - Resource.Oem No Optional -SoftwareImages@odata.count 1 odata Exists PASS -AttributeRegistry BiosAttributeRegistry string Yes PASS -Actions [JSON Object] Bios.v1_0_0.Actions Yes complex -Actions.#Bios.ResetBios Action - Yes PASS -Actions.#Bios.ChangePassword Action - Yes PASS -Attributes [JSON Object] Bios.v1_0_0.Attributes Yes complex -Attributes.attr0 current value primitive Yes PASS -Id BIOS string Yes PASS -Description BIOS Configuration Service string Yes PASS -Name BIOS Configuration string Yes PASS -Oem - Resource.Oem No Optional -@Redfish.Settings [JSON Object] Settings.Settings Yes complex -@Redfish.Settings.MaintenanceWindowResource - link to: ItemOrCollection No Optional -@Redfish.Settings.SupportedApplyTimes - string (enum) No Optional -@Redfish.Settings.Time - date No Optional -@Redfish.Settings.ETag - string No Optional -@Redfish.Settings.SettingsObject Link: /redfish/v1/Systems/system/Bios/Settings link to: Item Yes PASS -@Redfish.Settings.Messages - Message No Optional - -@odata.id /redfish/v1/Registries/BiosAttributeRegistry odata Exists PASS -@odata.type #MessageRegistryFile.v1_1_0.MessageRegistryFile odata Exists PASS -Languages@odata.count 1 odata Exists PASS -Location@odata.count 1 odata Exists PASS -Actions - MessageRegistryFile.v1_1_0.Actions No Optional -Languages Array (size: 1) string Yes ... -Languages[0] en string Yes PASS -Registry BiosAttributeRegistry.1.0.0 string Yes PASS -Location Array (size: 1) array of: Location Yes ... -Location[0] [JSON Object] Location Yes complex -Location[0].Language en string Yes PASS -Location[0].Uri /redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry string Yes PASS -Location[0].ArchiveUri - string No Optional -Location[0].PublicationUri - string No Optional -Location[0].ArchiveFile - string No Optional -Id BiosAttributeRegistry string Yes PASS -Description BiosAttributeRegistry Message Registry File Location string Yes PASS -Name BiosAttributeRegistry Message Registry File string Yes PASS -Oem - Resource.Oem No Optional - -@odata.id /redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry odata Exists PASS -@odata.type #AttributeRegistry.v1_3_2.AttributeRegistry odata Exists PASS -Actions - AttributeRegistry.v1_1_0.Actions No Optional -Language en string Yes PASS -RegistryVersion 1.0.0 string Yes PASS -OwningEntity OpenBMC string Yes PASS -SupportedSystems - SupportedSystems No Optional -RegistryEntries [JSON Object] AttributeRegistry.v1_0_0.RegistryEntries Yes complex -RegistryEntries.Attributes Array (size: 1) array of: Attributes Yes ... -RegistryEntries.Attributes[0] [JSON Object] Attributes Yes complex -RegistryEntries.Attributes[0].Oem - Resource.Oem No Optional -RegistryEntries.Attributes[0].ResetRequired - boolean No Optional -RegistryEntries.Attributes[0].UefiDevicePath - string No Optional -RegistryEntries.Attributes[0].UefiKeywordName - string No Optional -RegistryEntries.Attributes[0].UefiNamespaceId - string No Optional -RegistryEntries.Attributes[0].AttributeName attr0 string Yes PASS -RegistryEntries.Attributes[0].Type String string (enum) Yes PASS -RegistryEntries.Attributes[0].Value Array (size: 0) array of: AttributeValue Yes ... -RegistryEntries.Attributes[0].DisplayName display name for attr0 string Yes PASS -RegistryEntries.Attributes[0].HelpText description for attr0 string Yes PASS -RegistryEntries.Attributes[0].WarningText - string No Optional -RegistryEntries.Attributes[0].CurrentValue current value primitive Yes PASS -RegistryEntries.Attributes[0].DefaultValue default value primitive Yes PASS -RegistryEntries.Attributes[0].DisplayOrder - number No Optional -RegistryEntries.Attributes[0].MenuPath ./menu/path/for/attr0 string Yes PASS -RegistryEntries.Attributes[0].ReadOnly False boolean Yes PASS -RegistryEntries.Attributes[0].WriteOnly - boolean No Optional -RegistryEntries.Attributes[0].GrayOut - boolean No Optional -RegistryEntries.Attributes[0].Hidden - boolean No Optional -RegistryEntries.Attributes[0].Immutable - boolean No Optional -RegistryEntries.Attributes[0].IsSystemUniqueProperty - boolean No Optional -RegistryEntries.Attributes[0].MaxLength - number No Optional -RegistryEntries.Attributes[0].MinLength - number No Optional -RegistryEntries.Attributes[0].ScalarIncrement - number No Optional -RegistryEntries.Attributes[0].UpperBound - number No Optional -RegistryEntries.Attributes[0].LowerBound - number No Optional -RegistryEntries.Attributes[0].ValueExpression - string No Optional -RegistryEntries.Menus - Menus No Optional -RegistryEntries.Dependencies - Dependencies No Optional -Id BiosAttributeRegistry string Yes PASS -Description - string No Optional -Name Bios Attribute Registry string Yes PASS -Oem - Resource.Oem No Optional - -Change-Id: Iecc61018c350f0b8c89df59b2864b941508b1916 -Signed-off-by: Kuiying Wang ---- - redfish-core/include/redfish.hpp | 2 + - .../include/registries/bios_registry.hpp | 31 ++ - redfish-core/lib/bios.hpp | 503 ++++++++++++++++++ - redfish-core/lib/message_registries.hpp | 9 +- - 4 files changed, 544 insertions(+), 1 deletion(-) - create mode 100644 redfish-core/include/registries/bios_registry.hpp - -diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp -index 5d5eb7b..a8e5cf2 100644 ---- a/redfish-core/include/redfish.hpp -+++ b/redfish-core/include/redfish.hpp -@@ -157,6 +157,8 @@ class RedfishService - nodes.emplace_back(std::make_unique(app)); - nodes.emplace_back(std::make_unique(app)); - nodes.emplace_back(std::make_unique(app)); -+ nodes.emplace_back(std::make_unique(app)); -+ nodes.emplace_back(std::make_unique(app)); - nodes.emplace_back(std::make_unique(app)); - #ifdef BMCWEB_ENABLE_VM_NBDPROXY - nodes.emplace_back(std::make_unique(app)); -diff --git a/redfish-core/include/registries/bios_registry.hpp b/redfish-core/include/registries/bios_registry.hpp -new file mode 100644 -index 0000000..88ef782 ---- /dev/null -+++ b/redfish-core/include/registries/bios_registry.hpp -@@ -0,0 +1,31 @@ -+/* -+// Copyright (c) 2020 Intel Corporation -+// -+// Licensed under the Apache License, Version 2.0 (the "License"); -+// you may not use this file except in compliance with the License. -+// You may obtain a copy of the License at -+// -+// http://www.apache.org/licenses/LICENSE-2.0 -+// -+// Unless required by applicable law or agreed to in writing, software -+// distributed under the License is distributed on an "AS IS" BASIS, -+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+// See the License for the specific language governing permissions and -+// limitations under the License. -+*/ -+#pragma once -+ -+namespace redfish::message_registries::bios -+{ -+const Header header = { -+ "Copyright 2020 OpenBMC. All rights reserved.", -+ "#MessageRegistry.v1_4_0.MessageRegistry", -+ "BiosAttributeRegistry.1.0.0", -+ "Bios Attribute Registry", -+ "en", -+ "This registry defines the messages for bios attribute registry.", -+ "BiosAttributeRegistry", -+ "1.0.0", -+ "OpenBMC", -+}; -+} // namespace redfish::message_registries::bios -\ No newline at end of file -diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index 2c31077..5f8c91b 100644 ---- a/redfish-core/lib/bios.hpp -+++ b/redfish-core/lib/bios.hpp -@@ -3,8 +3,140 @@ - #include "node.hpp" - - #include -+ - namespace redfish - { -+ -+/*baseBIOSTable -+map{attributeName,struct{attributeType,readonlyStatus,displayname, -+ description,menuPath,current,default, -+ array{struct{optionstring,optionvalue}}}} -+*/ -+using BiosBaseTableType = std::vector, std::variant, -+ std::vector< -+ std::tuple>>>>>; -+using BiosBaseTableItemType = std::pair< -+ std::string, -+ std::tuple< -+ std::string, bool, std::string, std::string, std::string, -+ std::variant, std::variant, -+ std::vector< -+ std::tuple>>>>; -+using OptionsItemType = -+ std::tuple>; -+ -+enum BiosBaseTableIndex -+{ -+ biosBaseAttrType = 0, -+ biosBaseReadonlyStatus, -+ biosBaseDisplayName, -+ biosBaseDescription, -+ biosBaseMenuPath, -+ biosBaseCurrValue, -+ biosBaseDefaultValue, -+ biosBaseOptions -+}; -+enum OptionsItemIndex -+{ -+ optItemType = 0, -+ optItemValue -+}; -+/* -+ The Pending attribute name and new value. -+ ex- { {"QuietBoot",Type.Integer, 0x1}, -+ { "DdrFreqLimit",Type.String,"2933"} -+ } -+*/ -+using PendingAttributesType = std::vector>>>; -+using PendingAttributesItemType = -+ std::pair>>; -+enum PendingAttributesIndex -+{ -+ pendingAttrType = 0, -+ pendingAttrValue -+}; -+static std::string mapAttrTypeToRedfish(const std::string_view typeDbus) -+{ -+ std::string ret; -+ if (typeDbus == "xyz.openbmc_project.BIOSConfig.Manager." -+ "AttributeType.Enumeration") -+ { -+ ret = "Enumeration"; -+ } -+ else if (typeDbus == "xyz.openbmc_project.BIOSConfig." -+ "Manager.AttributeType.String") -+ { -+ ret = "String"; -+ } -+ else if (typeDbus == "xyz.openbmc_project.BIOSConfig." -+ "Manager.AttributeType.Password") -+ { -+ ret = "Password"; -+ } -+ else if (typeDbus == "xyz.openbmc_project.BIOSConfig." -+ "Manager.AttributeType.Integer") -+ { -+ ret = "Integer"; -+ } -+ else if (typeDbus == "xyz.openbmc_project.BIOSConfig." -+ "Manager.AttributeType.Boolean") -+ { -+ ret = "Boolean"; -+ } -+ else -+ { -+ ret = "UNKNOWN"; -+ } -+ -+ return ret; -+} -+static std::string mapBoundTypeToRedfish(const std::string_view typeDbus) -+{ -+ std::string ret; -+ if (typeDbus == -+ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.ScalarIncrement") -+ { -+ ret = "ScalarIncrement"; -+ } -+ else if (typeDbus == -+ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.LowerBound") -+ { -+ ret = "LowerBound"; -+ } -+ else if (typeDbus == -+ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.UpperBound") -+ { -+ ret = "UpperBound"; -+ } -+ else if (typeDbus == -+ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.MinStringLength") -+ { -+ ret = "MinStringLength"; -+ } -+ else if (typeDbus == -+ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.MaxStringLength") -+ { -+ ret = "MaxStringLength"; -+ } -+ else if (typeDbus == -+ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.OneOf") -+ { -+ ret = "OneOf"; -+ } -+ else -+ { -+ ret = "UNKNOWN"; -+ } -+ -+ return ret; -+} -+ - /** - * BiosService class supports handle get method for bios. - */ -@@ -35,6 +167,377 @@ class BiosService : public Node - // Get the ActiveSoftwareImage and SoftwareImages - fw_util::populateFirmwareInformation(asyncResp, fw_util::biosPurpose, - "", true); -+ asyncResp->res.jsonValue["@Redfish.Settings"] = { -+ {"@odata.type", "#Settings.v1_3_0.Settings"}, -+ {"SettingsObject", -+ {{"@odata.id", "/redfish/v1/Systems/system/Bios/Settings"}}}}; -+ asyncResp->res.jsonValue["AttributeRegistry"] = "BiosAttributeRegistry"; -+ asyncResp->res.jsonValue["Attributes"] = {}; -+ -+ crow::connections::systemBus->async_method_call( -+ [asyncResp](const boost::system::error_code ec, -+ const GetObjectType& getObjectType) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " -+ << ec; -+ messages::internalError(asyncResp->res); -+ -+ return; -+ } -+ const std::string& service = getObjectType.begin()->first; -+ -+ crow::connections::systemBus->async_method_call( -+ [asyncResp]( -+ const boost::system::error_code ec, -+ const std::variant& retBiosTable) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "getBiosAttributes DBUS error: " -+ << ec; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ const BiosBaseTableType* baseBiosTable = -+ std::get_if(&retBiosTable); -+ nlohmann::json& attributesJson = -+ asyncResp->res.jsonValue["Attributes"]; -+ if (baseBiosTable == nullptr) -+ { -+ BMCWEB_LOG_ERROR << "baseBiosTable == nullptr "; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ for (const BiosBaseTableItemType& item : *baseBiosTable) -+ { -+ const std::string& key = item.first; -+ const std::string& itemType = -+ std::get(item.second); -+ std::string attrType = -+ mapAttrTypeToRedfish(itemType); -+ if (attrType == "String") -+ { -+ const std::string* currValue = -+ std::get_if( -+ &std::get( -+ item.second)); -+ attributesJson.emplace(key, currValue != nullptr -+ ? *currValue -+ : ""); -+ } -+ else if (attrType == "Integer") -+ { -+ const int64_t* currValue = std::get_if( -+ &std::get(item.second)); -+ attributesJson.emplace( -+ key, currValue != nullptr ? *currValue : 0); -+ } -+ else -+ { -+ BMCWEB_LOG_ERROR -+ << "Unsupported attribute type."; -+ messages::internalError(asyncResp->res); -+ } -+ } -+ }, -+ service, "/xyz/openbmc_project/bios_config/manager", -+ "org.freedesktop.DBus.Properties", "Get", -+ "xyz.openbmc_project.BIOSConfig.Manager", "BaseBIOSTable"); -+ }, -+ "xyz.openbmc_project.ObjectMapper", -+ "/xyz/openbmc_project/object_mapper", -+ "xyz.openbmc_project.ObjectMapper", "GetObject", -+ "/xyz/openbmc_project/bios_config/manager", -+ std::array()); -+ } -+}; -+ -+/** -+ * BiosSettings class supports handle GET/PATCH method for -+ * BIOS configuration pending settings. -+ */ -+class BiosSettings : public Node -+{ -+ public: -+ BiosSettings(App& app) : -+ Node(app, "/redfish/v1/Systems/system/Bios/Settings") -+ { -+ entityPrivileges = {{boost::beast::http::verb::get, {{"Login"}}}}; -+ } -+ -+ private: -+ void doGet(crow::Response& res, const crow::Request&, -+ const std::vector&) override -+ { -+ auto asyncResp = std::make_shared(res); -+ asyncResp->res.jsonValue["@odata.id"] = -+ "/redfish/v1/Systems/system/Bios/Settings"; -+ asyncResp->res.jsonValue["@odata.type"] = "#Bios.v1_1_0.Bios"; -+ asyncResp->res.jsonValue["Name"] = "Bios Settings Version 1"; -+ asyncResp->res.jsonValue["Id"] = "BiosSettingsV1"; -+ asyncResp->res.jsonValue["AttributeRegistry"] = "BiosAttributeRegistry"; -+ asyncResp->res.jsonValue["Attributes"] = {}; -+ -+ crow::connections::systemBus->async_method_call( -+ [asyncResp](const boost::system::error_code ec, -+ const GetObjectType& getObjectType) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " -+ << ec; -+ messages::internalError(asyncResp->res); -+ -+ return; -+ } -+ std::string service = getObjectType.begin()->first; -+ -+ crow::connections::systemBus->async_method_call( -+ [asyncResp](const boost::system::error_code ec, -+ const std::variant& -+ retPendingAttributes) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "getBiosSettings DBUS error: " -+ << ec; -+ messages::resourceNotFound(asyncResp->res, -+ "Systems/system/Bios", -+ "Settings"); -+ return; -+ } -+ const PendingAttributesType* pendingAttributes = -+ std::get_if( -+ &retPendingAttributes); -+ nlohmann::json& attributesJson = -+ asyncResp->res.jsonValue["Attributes"]; -+ if (pendingAttributes == nullptr) -+ { -+ BMCWEB_LOG_ERROR << "pendingAttributes == nullptr "; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ for (const PendingAttributesItemType& item : -+ *pendingAttributes) -+ { -+ const std::string& key = item.first; -+ const std::string& itemType = -+ std::get(item.second); -+ std::string attrType = -+ mapAttrTypeToRedfish(itemType); -+ if (attrType == "String") -+ { -+ const std::string* currValue = -+ std::get_if( -+ &std::get( -+ item.second)); -+ attributesJson.emplace(key, currValue != nullptr -+ ? *currValue -+ : ""); -+ } -+ else if (attrType == "Integer") -+ { -+ const int64_t* currValue = std::get_if( -+ &std::get(item.second)); -+ attributesJson.emplace( -+ key, currValue != nullptr ? *currValue : 0); -+ } -+ else -+ { -+ BMCWEB_LOG_ERROR -+ << "Unsupported attribute type."; -+ messages::internalError(asyncResp->res); -+ } -+ } -+ }, -+ service, "/xyz/openbmc_project/bios_config/manager", -+ "org.freedesktop.DBus.Properties", "Get", -+ "xyz.openbmc_project.BIOSConfig.Manager", -+ "PendingAttributes"); -+ }, -+ "xyz.openbmc_project.ObjectMapper", -+ "/xyz/openbmc_project/object_mapper", -+ "xyz.openbmc_project.ObjectMapper", "GetObject", -+ "/xyz/openbmc_project/bios_config/manager", -+ std::array()); -+ } -+}; -+/** -+ * BiosAttributeRegistry class supports handle get method for BIOS attribute -+ * registry. -+ */ -+class BiosAttributeRegistry : public Node -+{ -+ public: -+ BiosAttributeRegistry(App& app) : -+ Node(app, "/redfish/v1/Registries/BiosAttributeRegistry/" -+ "BiosAttributeRegistry") -+ { -+ entityPrivileges = {{boost::beast::http::verb::get, {{"Login"}}}}; -+ } -+ -+ private: -+ void doGet(crow::Response& res, const crow::Request&, -+ const std::vector&) override -+ { -+ auto asyncResp = std::make_shared(res); -+ asyncResp->res.jsonValue["@odata.id"] = -+ "/redfish/v1/Registries/BiosAttributeRegistry/" -+ "BiosAttributeRegistry"; -+ asyncResp->res.jsonValue["@odata.type"] = -+ "#AttributeRegistry.v1_3_2.AttributeRegistry"; -+ asyncResp->res.jsonValue["Name"] = "Bios Attribute Registry"; -+ asyncResp->res.jsonValue["Id"] = "BiosAttributeRegistry"; -+ asyncResp->res.jsonValue["RegistryVersion"] = "1.0.0"; -+ asyncResp->res.jsonValue["Language"] = "en"; -+ asyncResp->res.jsonValue["OwningEntity"] = "OpenBMC"; -+ asyncResp->res.jsonValue["RegistryEntries"]["Attributes"] = -+ nlohmann::json::array(); -+ -+ crow::connections::systemBus->async_method_call( -+ [asyncResp](const boost::system::error_code ec, -+ const GetObjectType& getObjectType) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " -+ << ec; -+ messages::internalError(asyncResp->res); -+ -+ return; -+ } -+ std::string service = getObjectType.begin()->first; -+ -+ crow::connections::systemBus->async_method_call( -+ [asyncResp]( -+ const boost::system::error_code ec, -+ const std::variant& retBiosTable) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR -+ << "getBiosAttributeRegistry DBUS error: " -+ << ec; -+ messages::resourceNotFound( -+ asyncResp->res, "Registries/Bios", "Bios"); -+ return; -+ } -+ const BiosBaseTableType* baseBiosTable = -+ std::get_if(&retBiosTable); -+ nlohmann::json& attributeArray = -+ asyncResp->res -+ .jsonValue["RegistryEntries"]["Attributes"]; -+ nlohmann::json optionsArray = nlohmann::json::array(); -+ if (baseBiosTable == nullptr) -+ { -+ BMCWEB_LOG_ERROR << "baseBiosTable == nullptr "; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ for (const BiosBaseTableItemType& item : *baseBiosTable) -+ { -+ const std::string& itemType = -+ std::get(item.second); -+ std::string attrType = -+ mapAttrTypeToRedfish(itemType); -+ if (attrType == "UNKNOWN") -+ { -+ BMCWEB_LOG_ERROR << "attrType == UNKNOWN"; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ nlohmann::json attributeItem; -+ attributeItem["AttributeName"] = item.first; -+ attributeItem["Type"] = attrType; -+ attributeItem["ReadOnly"] = -+ std::get(item.second); -+ attributeItem["DisplayName"] = -+ std::get(item.second); -+ attributeItem["HelpText"] = -+ std::get(item.second); -+ attributeItem["MenuPath"] = -+ std::get(item.second); -+ -+ if (attrType == "String") -+ { -+ const std::string* currValue = -+ std::get_if( -+ &std::get( -+ item.second)); -+ const std::string* defValue = -+ std::get_if( -+ &std::get( -+ item.second)); -+ attributeItem["CurrentValue"] = -+ currValue != nullptr ? *currValue : ""; -+ attributeItem["DefaultValue"] = -+ defValue != nullptr ? *defValue : ""; -+ } -+ else if (attrType == "Integer") -+ { -+ const int64_t* currValue = std::get_if( -+ &std::get(item.second)); -+ const int64_t* defValue = std::get_if( -+ &std::get( -+ item.second)); -+ attributeItem["CurrentValue"] = -+ currValue != nullptr ? *currValue : 0; -+ attributeItem["DefaultValue"] = -+ defValue != nullptr ? *defValue : 0; -+ } -+ else -+ { -+ BMCWEB_LOG_ERROR -+ << "Unsupported attribute type."; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ -+ const std::vector& optionsVector = -+ std::get(item.second); -+ for (const OptionsItemType& optItem : optionsVector) -+ { -+ nlohmann::json optItemJson; -+ const std::string& strOptItemType = -+ std::get(optItem); -+ std::string optItemTypeRedfish = -+ mapBoundTypeToRedfish(strOptItemType); -+ if (optItemTypeRedfish == "UNKNOWN") -+ { -+ BMCWEB_LOG_ERROR -+ << "optItemTypeRedfish == UNKNOWN"; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ if (optItemTypeRedfish == "OneOf") -+ { -+ const std::string* currValue = -+ std::get_if( -+ &std::get(optItem)); -+ optItemJson[optItemTypeRedfish] = -+ currValue != nullptr ? *currValue : ""; -+ } -+ else -+ { -+ const int64_t* currValue = -+ std::get_if( -+ &std::get(optItem)); -+ optItemJson[optItemTypeRedfish] = -+ currValue != nullptr ? *currValue : 0; -+ } -+ -+ optionsArray.push_back(optItemJson); -+ } -+ -+ attributeItem["Value"] = optionsArray; -+ attributeArray.push_back(attributeItem); -+ } -+ }, -+ service, "/xyz/openbmc_project/bios_config/manager", -+ "org.freedesktop.DBus.Properties", "Get", -+ "xyz.openbmc_project.BIOSConfig.Manager", "BaseBIOSTable"); -+ }, -+ "xyz.openbmc_project.ObjectMapper", -+ "/xyz/openbmc_project/object_mapper", -+ "xyz.openbmc_project.ObjectMapper", "GetObject", -+ "/xyz/openbmc_project/bios_config/manager", -+ std::array()); - } - }; - /** -diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp -index 77fc10e..0caf01c 100644 ---- a/redfish-core/lib/message_registries.hpp -+++ b/redfish-core/lib/message_registries.hpp -@@ -18,6 +18,7 @@ - #include "node.hpp" - #include "registries.hpp" - #include "registries/base_message_registry.hpp" -+#include "registries/bios_registry.hpp" - #include "registries/openbmc_message_registry.hpp" - #include "registries/resource_event_message_registry.hpp" - #include "registries/task_event_message_registry.hpp" -@@ -56,11 +57,12 @@ class MessageRegistryFileCollection : public Node - {"@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"}}}}}; - - res.end(); -@@ -118,6 +120,11 @@ class MessageRegistryFile : public Node - 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/0007-BIOS-config-Add-support-for-PATCH-operation.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0007-BIOS-config-Add-support-for-PATCH-operation.patch deleted file mode 100644 index 6f3794478..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0007-BIOS-config-Add-support-for-PATCH-operation.patch +++ /dev/null @@ -1,153 +0,0 @@ -From ad2b1c83bd9cb1bb6eb86bebd1867b0172e5a7a8 Mon Sep 17 00:00:00 2001 -From: Kuiying Wang -Date: Wed, 23 Dec 2020 16:50:45 +0800 -Subject: [PATCH] BaseBiosTable: Add support for PATCH operation - -This commit brings in support for PATCH operation of the -bios variables that updates the BaseBiosTable. - -Tested-By: -* Passed Redfish validator - -* Single Attribute: -PATCH https://${bmc}/redfish/v1/Systems/system/Bios/Settings -d -'{"data":[{"AttributeName": , "AttributeType": -, "AttributeValue": }]}' - -* Multiple Attributes: -PATCH https://${bmc}/redfish/v1/Systems/system/Bios/Settings -d -'{"data":[{"AttributeName": , "AttributeType": -, "AttributeValue": }, -{"AttributeName": , "AttributeType": -, "AttributeValue": }]}' - -This makes use of the "Set" of "PendingAttributes" in the -backend and that updates the BaseBiosTable. - -Signed-off-by: Kuiying Wang ---- - redfish-core/lib/bios.hpp | 94 ++++++++++++++++++++++++++++++++++++++- - 1 file changed, 93 insertions(+), 1 deletion(-) - -diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index 5f8c91b..cf76fe0 100644 ---- a/redfish-core/lib/bios.hpp -+++ b/redfish-core/lib/bios.hpp -@@ -96,6 +96,29 @@ static std::string mapAttrTypeToRedfish(const std::string_view typeDbus) - - return ret; - } -+static std::string mapRedfishToAttrType(const std::string_view type) -+{ -+ std::string ret; -+ if (type == "string") -+ { -+ ret = "xyz.openbmc_project.BIOSConfig.Manager.AttributeType.String"; -+ } -+ else if (type == "int") -+ { -+ ret = "xyz.openbmc_project.BIOSConfig.Manager.AttributeType.Integer"; -+ } -+ else if (type == "enum") -+ { -+ ret = "xyz.openbmc_project.BIOSConfig.Manager.AttributeType." -+ "Enumeration"; -+ } -+ else -+ { -+ ret = "UNKNOWN"; -+ } -+ -+ return ret; -+} - static std::string mapBoundTypeToRedfish(const std::string_view typeDbus) - { - std::string ret; -@@ -262,7 +285,9 @@ class BiosSettings : public Node - BiosSettings(App& app) : - Node(app, "/redfish/v1/Systems/system/Bios/Settings") - { -- entityPrivileges = {{boost::beast::http::verb::get, {{"Login"}}}}; -+ entityPrivileges = { -+ {boost::beast::http::verb::get, {{"Login"}}}, -+ {boost::beast::http::verb::patch, {{"ConfigureComponents"}}}}; - } - - private: -@@ -359,6 +384,73 @@ class BiosSettings : public Node - "/xyz/openbmc_project/bios_config/manager", - std::array()); - } -+ -+ void doPatch(crow::Response& res, const crow::Request& req, -+ const std::vector&) override -+ { -+ auto asyncResp = std::make_shared(res); -+ -+ nlohmann::json inpJson; -+ -+ if (!redfish::json_util::readJson(req, asyncResp->res, "data", inpJson)) -+ { -+ return; -+ } -+ -+ for (auto& attrInfo : inpJson) -+ { -+ std::optional attrName; -+ std::optional attrType; -+ std::optional attrValue; -+ if (!json_util::getValueFromJsonObject(attrInfo, "AttributeName", -+ attrName)) -+ { -+ messages::propertyMissing(asyncResp->res, "AttributeName"); -+ return; -+ } -+ if (!json_util::getValueFromJsonObject(attrInfo, "AttributeType", -+ attrType)) -+ { -+ messages::propertyMissing(asyncResp->res, "AttributeType"); -+ return; -+ } -+ if (!json_util::getValueFromJsonObject(attrInfo, "AttributeValue", -+ attrValue)) -+ { -+ messages::propertyMissing(asyncResp->res, "AttributeValue"); -+ return; -+ } -+ std::string biosAttrType = mapRedfishToAttrType(*attrType); -+ -+ if (biosAttrType == "UNKNOWN") -+ { -+ BMCWEB_LOG_ERROR << "Invalid attribute type"; -+ messages::propertyValueNotInList(asyncResp->res, -+ "AttributeType", *attrType); -+ return; -+ } -+ -+ PendingAttributesType pendingAttributes; -+ pendingAttributes.emplace_back(std::make_pair( -+ *attrName, std::make_tuple(biosAttrType, *attrValue))); -+ -+ crow::connections::systemBus->async_method_call( -+ [asyncResp](const boost::system::error_code ec) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "doPatch resp_handler got error " -+ << ec; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ }, -+ "xyz.openbmc_project.BIOSConfigManager", -+ "/xyz/openbmc_project/bios_config/manager", -+ "org.freedesktop.DBus.Properties", "Set", -+ "xyz.openbmc_project.BIOSConfig.Manager", "PendingAttributes", -+ std::variant(pendingAttributes)); -+ } -+ } - }; - /** - * BiosAttributeRegistry class supports handle get method for BIOS attribute --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0008-Add-support-to-ResetBios-action.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0008-Add-support-to-ResetBios-action.patch deleted file mode 100644 index 7e4e2e8d8..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0008-Add-support-to-ResetBios-action.patch +++ /dev/null @@ -1,62 +0,0 @@ -From a78eecb032eefeb84da3ec042700a40f55ae8f10 Mon Sep 17 00:00:00 2001 -From: Kuiying Wang -Date: Wed, 23 Dec 2020 22:47:56 +0800 -Subject: [PATCH] Add support to ResetBios action - -Tested: - -Bios reset flag can be modified throw redfish -POST https://IP_ADDR/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios - -Change-Id: I5e5fbdd70d4a3ce3b976cc2eb0a7d9a2a3adb124 -Signed-off-by: Kuiying Wang - ---- - redfish-core/lib/bios.hpp | 16 ++++++++++------ - 1 file changed, 10 insertions(+), 6 deletions(-) - -diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index cf76fe0..7b6fc3d 100644 ---- a/redfish-core/lib/bios.hpp -+++ b/redfish-core/lib/bios.hpp -@@ -643,7 +643,7 @@ class BiosReset : public Node - Node(app, "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios/") - { - entityPrivileges = { -- {boost::beast::http::verb::post, {{"ConfigureManager"}}}}; -+ {boost::beast::http::verb::post, {{"ConfigureComponents"}}}}; - } - - private: -@@ -655,19 +655,23 @@ class BiosReset : public Node - const std::vector&) override - { - auto asyncResp = std::make_shared(res); -- -+ std::string resetFlag = -+ "xyz.openbmc_project.BIOSConfig.Manager.ResetFlag.FactoryDefaults"; - crow::connections::systemBus->async_method_call( - [asyncResp](const boost::system::error_code ec) { - if (ec) - { -- BMCWEB_LOG_ERROR << "Failed to reset bios: " << ec; -+ BMCWEB_LOG_ERROR << "doPost bios reset got error " << ec; - messages::internalError(asyncResp->res); - return; - } -+ BMCWEB_LOG_DEBUG << "bios reset action is done"; - }, -- "org.open_power.Software.Host.Updater", -- "/xyz/openbmc_project/software", -- "xyz.openbmc_project.Common.FactoryReset", "Reset"); -+ "xyz.openbmc_project.BIOSConfigManager", -+ "/xyz/openbmc_project/bios_config/manager", -+ "org.freedesktop.DBus.Properties", "Set", -+ "xyz.openbmc_project.BIOSConfig.Manager", "ResetBIOSSettings", -+ std::variant(resetFlag)); - } - }; - } // namespace redfish --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0009-Add-support-to-ChangePassword-action.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0009-Add-support-to-ChangePassword-action.patch deleted file mode 100644 index 976292197..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0009-Add-support-to-ChangePassword-action.patch +++ /dev/null @@ -1,139 +0,0 @@ -From ede8454491b554c2494a61f42993fa2e39b4d865 Mon Sep 17 00:00:00 2001 -From: Kuiying Wang -Date: Wed, 23 Dec 2020 14:41:23 +0800 -Subject: [PATCH] Add support to ChangePassword action - -Tested: - -Passed Redfish validator. -Bios change password: -root@intel-obmc:~# cat /var/lib/bios-settings-manager/seedData -{ -"UserPwdHash": "08D91157785366CDC3AA64D87E5E3C621EDAB13E26B6E484397EBA5E459E54C567BF5B1FFB36A43B6142B18F8D642E9D", -"AdminPwdHash": "08D91157785366CDC3AA64D87E5E3C621EDAB13E26B6E484397EBA5E459E54C567BF5B1FFB36A43B6142B18F8D642E9D", -"Seed": "123456", -"HashAlgo": "SHA384" -} -POST https://IP_ADDR/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword -{ - "NewPassword": "12345678", - "OldPassword": "1234567890", - "PasswordName": "Administrator" -} -root@intel-obmc:~# cat /var/lib/bios-settings-manager/passwordData -{ - "CurrentPassword": "1234567890", - "IsAdminPwdChanged": 1, - "IsUserPwdChanged": 0, - "NewPassword": "2DD65D57EB60B1D92C5F3D2DC84724FCEE7BC02E57AA75E834712266ED94CAC704047B2FF7CEC1C36BED280B36BB5AC6", - "UserName": "Administrator" -} - -Change-Id: I90319a68da0b0a7f9c5cd65a8cb8cf52269a5f52 -Signed-off-by: Kuiying Wang ---- - redfish-core/include/redfish.hpp | 1 + - redfish-core/lib/bios.hpp | 70 ++++++++++++++++++++++++++++++++ - 2 files changed, 71 insertions(+) - -diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp -index a8e5cf2..dabf78e 100644 ---- a/redfish-core/include/redfish.hpp -+++ b/redfish-core/include/redfish.hpp -@@ -160,6 +160,7 @@ class RedfishService - nodes.emplace_back(std::make_unique(app)); - nodes.emplace_back(std::make_unique(app)); - nodes.emplace_back(std::make_unique(app)); -+ nodes.emplace_back(std::make_unique(app)); - #ifdef BMCWEB_ENABLE_VM_NBDPROXY - nodes.emplace_back(std::make_unique(app)); - nodes.emplace_back(std::make_unique(app)); -diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index 7b6fc3d..61b396b 100644 ---- a/redfish-core/lib/bios.hpp -+++ b/redfish-core/lib/bios.hpp -@@ -186,6 +186,9 @@ class BiosService : public Node - asyncResp->res.jsonValue["Actions"]["#Bios.ResetBios"] = { - {"target", - "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios"}}; -+ asyncResp->res.jsonValue["Actions"]["#Bios.ChangePassword"] = { -+ {"target", -+ "/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword"}}; - - // Get the ActiveSoftwareImage and SoftwareImages - fw_util::populateFirmwareInformation(asyncResp, fw_util::biosPurpose, -@@ -674,4 +677,71 @@ class BiosReset : public Node - std::variant(resetFlag)); - } - }; -+ -+/** -+ * BiosChangePassword class supports handle POST method for change bios -+ * password. The class retrieves and sends data directly to D-Bus. -+ */ -+class BiosChangePassword : public Node -+{ -+ public: -+ BiosChangePassword(App& app) : -+ Node(app, -+ "/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword/") -+ { -+ entityPrivileges = { -+ {boost::beast::http::verb::post, {{"ConfigureComponents"}}}}; -+ } -+ -+ private: -+ /** -+ * Function handles POST method request. -+ * Analyzes POST body message before sends Reset request data to D-Bus. -+ */ -+ void doPost(crow::Response& res, const crow::Request& req, -+ const std::vector&) override -+ { -+ auto asyncResp = std::make_shared(res); -+ std::string currentPassword, newPassword, userName; -+ if (!json_util::readJson(req, res, "NewPassword", newPassword, -+ "OldPassword", currentPassword, "PasswordName", -+ userName)) -+ { -+ return; -+ } -+ if (currentPassword.empty()) -+ { -+ messages::actionParameterUnknown(asyncResp->res, "ChangePassword", -+ "OldPassword"); -+ return; -+ } -+ if (newPassword.empty()) -+ { -+ messages::actionParameterUnknown(asyncResp->res, "ChangePassword", -+ "NewPassword"); -+ return; -+ } -+ if (userName.empty()) -+ { -+ messages::actionParameterUnknown(asyncResp->res, "ChangePassword", -+ "PasswordName"); -+ return; -+ } -+ crow::connections::systemBus->async_method_call( -+ [asyncResp](const boost::system::error_code ec) { -+ if (ec) -+ { -+ BMCWEB_LOG_CRITICAL << "Failed in doPost(BiosChangePassword) " -+ << ec; -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ }, -+ "xyz.openbmc_project.BIOSConfigPassword", -+ "/xyz/openbmc_project/bios_config/password", -+ "xyz.openbmc_project.BIOSConfig.Password", "ChangePassword", -+ userName, currentPassword, newPassword); -+ } -+}; -+ - } // namespace redfish --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0010-managers-add-attributes-for-Manager.CommandShell.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0010-managers-add-attributes-for-Manager.CommandShell.patch index a9c46f487..d962d3872 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0010-managers-add-attributes-for-Manager.CommandShell.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0010-managers-add-attributes-for-Manager.CommandShell.patch @@ -1,4 +1,4 @@ -From a76314cd29f5cbcf19142b7120c5bf83358910fd Mon Sep 17 00:00:00 2001 +From b5e4edfc26eec245427d3435de9acaa9363ae836 Mon Sep 17 00:00:00 2001 From: Jayaprakash Mutyala Date: Mon, 28 Dec 2020 18:55:57 +0000 Subject: [PATCH] managers: add attributes for Manager.CommandShell @@ -32,26 +32,36 @@ Response: Signed-off-by: Jayaprakash Mutyala --- - redfish-core/lib/managers.hpp | 6 ++++++ - 1 file changed, 6 insertions(+) + redfish-core/lib/managers.hpp | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp -index 6347caf..c401ca9 100644 +index 67f8d99..dcbc347 100644 --- a/redfish-core/lib/managers.hpp +++ b/redfish-core/lib/managers.hpp -@@ -1767,6 +1767,12 @@ class Manager : public Node - res.jsonValue["SerialConsole"]["MaxConcurrentSessions"] = 15; - res.jsonValue["SerialConsole"]["ConnectTypesSupported"] = {"IPMI", - "SSH"}; +@@ -1830,6 +1830,13 @@ class Manager : public Node + asyncResp->res.jsonValue["SerialConsole"]["MaxConcurrentSessions"] = 15; + asyncResp->res.jsonValue["SerialConsole"]["ConnectTypesSupported"] = { + "IPMI", "SSH"}; ++ + // Fill in CommandShell info -+ res.jsonValue["CommandShell"]["ServiceEnabled"] = true; -+ res.jsonValue["CommandShell"]["MaxConcurrentSessions"] = 4; -+ res.jsonValue["CommandShell"]["ConnectTypesSupported"] = {"SSH", -+ "IPMI"}; ++ asyncResp->res.jsonValue["CommandShell"]["ServiceEnabled"] = true; ++ asyncResp->res.jsonValue["CommandShell"]["MaxConcurrentSessions"] = 4; ++ asyncResp->res.jsonValue["CommandShell"]["ConnectTypesSupported"] = { ++ "SSH", "IPMI"}; + #ifdef BMCWEB_ENABLE_KVM // Fill in GraphicalConsole info - res.jsonValue["GraphicalConsole"]["ServiceEnabled"] = true; + asyncResp->res.jsonValue["GraphicalConsole"]["ServiceEnabled"] = true; +@@ -2272,7 +2279,7 @@ class Manager : public Node + } + + std::string uuid; +-}; ++}; // namespace redfish + + class ManagerCollection : public Node + { -- 2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0014-recommended-fixes-by-crypto-review-team.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0014-recommended-fixes-by-crypto-review-team.patch new file mode 100644 index 000000000..5ffc259c0 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0014-recommended-fixes-by-crypto-review-team.patch @@ -0,0 +1,75 @@ +From aaaa117817687a05284f8bfff07e2404e0d616b7 Mon Sep 17 00:00:00 2001 +From: Radivoje Jovanovic +Date: Thu, 10 Dec 2020 13:42:20 -0800 +Subject: [PATCH] recommended fixes by crypto review team + +some curves/cyphers are forbiden to be used by +Intel crypto team. +Only enable approved ones. +the patch was created by aleksandr.v.tereschenko@intel.com + +Signed-off-by: Radivoje Jovanovic +--- + include/ssl_key_handler.hpp | 39 ++++++++++++++++++++----------------- + 1 file changed, 21 insertions(+), 18 deletions(-) + +diff --git a/include/ssl_key_handler.hpp b/include/ssl_key_handler.hpp +index 39e83d7..8de7349 100644 +--- a/include/ssl_key_handler.hpp ++++ b/include/ssl_key_handler.hpp +@@ -381,31 +381,34 @@ inline std::shared_ptr + mSslContext->use_private_key_file(sslPemFile, + boost::asio::ssl::context::pem); + +- // Set up EC curves to auto (boost asio doesn't have a method for this) +- // There is a pull request to add this. Once this is included in an asio +- // drop, use the right way +- // http://stackoverflow.com/questions/18929049/boost-asio-with-ecdsa-certificate-issue +- if (SSL_CTX_set_ecdh_auto(mSslContext->native_handle(), 1) != 1) ++ std::string handshakeCurves = "P-384:P-521:X448"; ++ if (SSL_CTX_set1_groups_list(mSslContext->native_handle(), handshakeCurves.c_str()) != 1) + { +- BMCWEB_LOG_ERROR << "Error setting tmp ecdh list\n"; ++ BMCWEB_LOG_ERROR << "Error setting ECDHE group list\n"; + } + +- std::string mozillaModern = "ECDHE-ECDSA-AES256-GCM-SHA384:" +- "ECDHE-RSA-AES256-GCM-SHA384:" +- "ECDHE-ECDSA-CHACHA20-POLY1305:" +- "ECDHE-RSA-CHACHA20-POLY1305:" +- "ECDHE-ECDSA-AES128-GCM-SHA256:" +- "ECDHE-RSA-AES128-GCM-SHA256:" +- "ECDHE-ECDSA-AES256-SHA384:" +- "ECDHE-RSA-AES256-SHA384:" +- "ECDHE-ECDSA-AES128-SHA256:" +- "ECDHE-RSA-AES128-SHA256"; ++ std::string tls12Ciphers = "ECDHE-ECDSA-AES256-GCM-SHA384:" ++ "ECDHE-RSA-AES256-GCM-SHA384"; ++ std::string tls13Ciphers = "TLS_AES_256_GCM_SHA384"; + + if (SSL_CTX_set_cipher_list(mSslContext->native_handle(), +- mozillaModern.c_str()) != 1) ++ tls12Ciphers.c_str()) != 1) + { +- BMCWEB_LOG_ERROR << "Error setting cipher list\n"; ++ BMCWEB_LOG_ERROR << "Error setting TLS 1.2 cipher list\n"; + } ++ ++ if (SSL_CTX_set_ciphersuites(mSslContext->native_handle(), ++ tls13Ciphers.c_str()) != 1) ++ { ++ BMCWEB_LOG_ERROR << "Error setting TLS 1.3 cipher list\n"; ++ } ++ ++ if ((SSL_CTX_set_options(mSslContext->native_handle(), ++ SSL_OP_CIPHER_SERVER_PREFERENCE) & SSL_OP_CIPHER_SERVER_PREFERENCE) == 0) ++ { ++ BMCWEB_LOG_ERROR << "Error setting TLS server preference option\n"; ++ } ++ + return mSslContext; + } + } // namespace ensuressl +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0015-Add-state-sensor-messages-to-the-registry.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0015-Add-state-sensor-messages-to-the-registry.patch new file mode 100644 index 000000000..b171a8b2c --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0015-Add-state-sensor-messages-to-the-registry.patch @@ -0,0 +1,98 @@ +From df571ddf0596f73c0318da3a90b9813e6df19dd9 Mon Sep 17 00:00:00 2001 +From: "Arun P. Mohanan" +Date: Wed, 27 Jan 2021 18:22:58 +0530 +Subject: [PATCH] Add state sensor messages to the registry + +Add messages to registry to indicate state sensor state change. + +Tested: +Build and redfish validator passes. +Logged these events and confirmed that they appear as expected on +Redfish. +GET: https:///redfish/v1/Systems/system/LogServices/EventLog/Entries/1612528180 +{ + "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/1612528180", + "@odata.type": "#LogEntry.v1_4_0.LogEntry", + "Created": "2021-02-05T12:29:40+00:00", + "EntryType": "Event", + "Id": "1612528180", + "Message": "Operational Fault Status of Card_health_1 state sensor changed from Error to Normal.", + "MessageArgs": [ + "Operational Fault Status", + "Card_health_1", + "Error", + "Normal" + ], + "MessageId": "OpenBMC.0.1.StateSensorNormal", + "Name": "System Event Log Entry", + "Severity": "OK" +} + +Signed-off-by: Arun P. Mohanan +--- + .../registries/openbmc_message_registry.hpp | 36 +++++++++++++++++-- + 1 file changed, 34 insertions(+), 2 deletions(-) + +diff --git a/redfish-core/include/registries/openbmc_message_registry.hpp b/redfish-core/include/registries/openbmc_message_registry.hpp +index 5eb9380..dbea97c 100644 +--- a/redfish-core/include/registries/openbmc_message_registry.hpp ++++ b/redfish-core/include/registries/openbmc_message_registry.hpp +@@ -29,7 +29,7 @@ const Header header = { + "0.1.0", + "OpenBMC", + }; +-constexpr std::array registry = { ++constexpr std::array registry = { + MessageEntry{ + "ADDDCCorrectable", + { +@@ -2318,6 +2318,39 @@ constexpr std::array registry = { + {}, + "None.", + }}, ++ MessageEntry{ ++ "StateSensorNormal", ++ { ++ "Indicates that a state sensor has changed state to normal.", ++ "%1 of %2 state sensor changed from %3 to %4.", ++ "OK", ++ "OK", ++ 4, ++ {"string", "string", "string", "string"}, ++ "None.", ++ }}, ++ MessageEntry{ ++ "StateSensorWarning", ++ { ++ "Indicates that a state sensor has changed state to warning.", ++ "%1 of %2 state sensor changed from %3 to %4.", ++ "Warning", ++ "Warning", ++ 4, ++ {"string", "string", "string", "string"}, ++ "Check sensor subsystem for errors.", ++ }}, ++ MessageEntry{ ++ "StateSensorCritical", ++ { ++ "Indicates that a state sensor has changed state to critical.", ++ "%1 of %2 state sensor changed from %3 to %4.", ++ "Critical", ++ "Critical", ++ 4, ++ {"string", "string", "string", "string"}, ++ "Check sensor subsystem for errors.", ++ }}, + MessageEntry{"SystemInterfaceDisabledProvisioned", + { + "Indicates that the system interface is in the disabled " +@@ -2410,6 +2443,5 @@ constexpr std::array registry = { + {"string"}, + "None.", + }}, +- + }; + } // namespace redfish::message_registries::openbmc +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0016-Fix-bmcweb-crashes-if-socket-directory-not-present.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0016-Fix-bmcweb-crashes-if-socket-directory-not-present.patch new file mode 100644 index 000000000..bc023839f --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0016-Fix-bmcweb-crashes-if-socket-directory-not-present.patch @@ -0,0 +1,44 @@ +From 48fe2a68d634970795f9ff13903afbedca801088 Mon Sep 17 00:00:00 2001 +From: Nidhin MS +Date: Wed, 14 Apr 2021 11:28:44 +0530 +Subject: [PATCH] Fix: bmcweb crashes if socket directory not present + +When trying to mount virtual media image bmcweb tries to create unix +socket and if the parent directory does not exist +stream_protocol::acceptor throws error and bmcweb crashes. Fix the same + +Tested: +Removed directory and mounted the vm image. bmcweb crash was not +observed + +Change-Id: I3aea1d8e197c06238f425a97435c01d3c80552a9 +Signed-off-by: Nidhin MS +--- + include/nbd_proxy.hpp | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp +index 7b90e90..3b28823 100644 +--- a/include/nbd_proxy.hpp ++++ b/include/nbd_proxy.hpp +@@ -397,6 +397,17 @@ inline void requestRoutes(App& app) + // If the socket file exists (i.e. after bmcweb crash), + // we cannot reuse it. + std::remove((*socketValue).c_str()); ++ std::filesystem::path socketPath(*socketValue); ++ std::error_code fsErr; ++ if (!std::filesystem::exists(socketPath.parent_path(), ++ fsErr)) ++ { ++ BMCWEB_LOG_ERROR ++ << "VirtualMedia socket directory not present. " ++ << socketPath.parent_path(); ++ conn.close("Unable to create unix socket"); ++ return; ++ } + + sessions[&conn] = std::make_shared( + conn, *socketValue, *endpointValue, +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0017-Add-msg-registry-for-subscription-related-actions.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0017-Add-msg-registry-for-subscription-related-actions.patch new file mode 100644 index 000000000..d0cfd1c44 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0017-Add-msg-registry-for-subscription-related-actions.patch @@ -0,0 +1,81 @@ +From 7282ab7756cdb8c844bef9affd8a8e894828678c Mon Sep 17 00:00:00 2001 +From: Ayushi Smriti +Date: Mon, 10 May 2021 12:32:30 +0530 +Subject: [PATCH] Add msg registry for subscription related actions + +For subscription event message log purpose, added message registry +entry for event service subscription related actions- add, update +and delete. + +Tested: + - Message registry entry appears in the log for the corresponding + subscription action. + +Signed-off-by: AppaRao Puli +Signed-off-by: Ayushi Smriti +--- + .../registries/openbmc_message_registry.hpp | 41 ++++++++++++++++++- + 1 file changed, 40 insertions(+), 1 deletion(-) + +diff --git a/redfish-core/include/registries/openbmc_message_registry.hpp b/redfish-core/include/registries/openbmc_message_registry.hpp +index e12a138..2f981db 100644 +--- a/redfish-core/include/registries/openbmc_message_registry.hpp ++++ b/redfish-core/include/registries/openbmc_message_registry.hpp +@@ -29,7 +29,7 @@ const Header header = { + "0.2.0", + "OpenBMC", + }; +-constexpr std::array registry = { ++constexpr std::array registry = { + MessageEntry{ + "ADDDCCorrectable", + { +@@ -417,6 +417,45 @@ constexpr std::array registry = { + {}, + "None.", + }}, ++ MessageEntry{"EventSubscriptionAdded", ++ { ++ "Indicates that an Event subscription with specific " ++ "id was added.", ++ "Event subscription with id %1 was added.", ++ "OK", ++ "OK", ++ 1, ++ { ++ "string", ++ }, ++ "None.", ++ }}, ++ MessageEntry{"EventSubscriptionRemoved", ++ { ++ "Indicates that an Event subscription with specific " ++ "id was removed.", ++ "Event subscription with id %1 was removed.", ++ "OK", ++ "OK", ++ 1, ++ { ++ "string", ++ }, ++ "None.", ++ }}, ++ MessageEntry{"EventSubscriptionUpdated", ++ { ++ "Indicates that an Event subscription with specific " ++ " id was updated.", ++ "Event subscription with id %1 was updated.", ++ "OK", ++ "OK", ++ 1, ++ { ++ "string", ++ }, ++ "None.", ++ }}, + MessageEntry{"FanInserted", + { + "Indicates that a system fan has been inserted.", +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0034-recommended-fixes-by-crypto-review-team.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0034-recommended-fixes-by-crypto-review-team.patch deleted file mode 100644 index 5ffc259c0..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0034-recommended-fixes-by-crypto-review-team.patch +++ /dev/null @@ -1,75 +0,0 @@ -From aaaa117817687a05284f8bfff07e2404e0d616b7 Mon Sep 17 00:00:00 2001 -From: Radivoje Jovanovic -Date: Thu, 10 Dec 2020 13:42:20 -0800 -Subject: [PATCH] recommended fixes by crypto review team - -some curves/cyphers are forbiden to be used by -Intel crypto team. -Only enable approved ones. -the patch was created by aleksandr.v.tereschenko@intel.com - -Signed-off-by: Radivoje Jovanovic ---- - include/ssl_key_handler.hpp | 39 ++++++++++++++++++++----------------- - 1 file changed, 21 insertions(+), 18 deletions(-) - -diff --git a/include/ssl_key_handler.hpp b/include/ssl_key_handler.hpp -index 39e83d7..8de7349 100644 ---- a/include/ssl_key_handler.hpp -+++ b/include/ssl_key_handler.hpp -@@ -381,31 +381,34 @@ inline std::shared_ptr - mSslContext->use_private_key_file(sslPemFile, - boost::asio::ssl::context::pem); - -- // Set up EC curves to auto (boost asio doesn't have a method for this) -- // There is a pull request to add this. Once this is included in an asio -- // drop, use the right way -- // http://stackoverflow.com/questions/18929049/boost-asio-with-ecdsa-certificate-issue -- if (SSL_CTX_set_ecdh_auto(mSslContext->native_handle(), 1) != 1) -+ std::string handshakeCurves = "P-384:P-521:X448"; -+ if (SSL_CTX_set1_groups_list(mSslContext->native_handle(), handshakeCurves.c_str()) != 1) - { -- BMCWEB_LOG_ERROR << "Error setting tmp ecdh list\n"; -+ BMCWEB_LOG_ERROR << "Error setting ECDHE group list\n"; - } - -- std::string mozillaModern = "ECDHE-ECDSA-AES256-GCM-SHA384:" -- "ECDHE-RSA-AES256-GCM-SHA384:" -- "ECDHE-ECDSA-CHACHA20-POLY1305:" -- "ECDHE-RSA-CHACHA20-POLY1305:" -- "ECDHE-ECDSA-AES128-GCM-SHA256:" -- "ECDHE-RSA-AES128-GCM-SHA256:" -- "ECDHE-ECDSA-AES256-SHA384:" -- "ECDHE-RSA-AES256-SHA384:" -- "ECDHE-ECDSA-AES128-SHA256:" -- "ECDHE-RSA-AES128-SHA256"; -+ std::string tls12Ciphers = "ECDHE-ECDSA-AES256-GCM-SHA384:" -+ "ECDHE-RSA-AES256-GCM-SHA384"; -+ std::string tls13Ciphers = "TLS_AES_256_GCM_SHA384"; - - if (SSL_CTX_set_cipher_list(mSslContext->native_handle(), -- mozillaModern.c_str()) != 1) -+ tls12Ciphers.c_str()) != 1) - { -- BMCWEB_LOG_ERROR << "Error setting cipher list\n"; -+ BMCWEB_LOG_ERROR << "Error setting TLS 1.2 cipher list\n"; - } -+ -+ if (SSL_CTX_set_ciphersuites(mSslContext->native_handle(), -+ tls13Ciphers.c_str()) != 1) -+ { -+ BMCWEB_LOG_ERROR << "Error setting TLS 1.3 cipher list\n"; -+ } -+ -+ if ((SSL_CTX_set_options(mSslContext->native_handle(), -+ SSL_OP_CIPHER_SERVER_PREFERENCE) & SSL_OP_CIPHER_SERVER_PREFERENCE) == 0) -+ { -+ BMCWEB_LOG_ERROR << "Error setting TLS server preference option\n"; -+ } -+ - return mSslContext; - } - } // namespace ensuressl --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0037-Add-state-sensor-messages-to-the-registry.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0037-Add-state-sensor-messages-to-the-registry.patch deleted file mode 100644 index b171a8b2c..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0037-Add-state-sensor-messages-to-the-registry.patch +++ /dev/null @@ -1,98 +0,0 @@ -From df571ddf0596f73c0318da3a90b9813e6df19dd9 Mon Sep 17 00:00:00 2001 -From: "Arun P. Mohanan" -Date: Wed, 27 Jan 2021 18:22:58 +0530 -Subject: [PATCH] Add state sensor messages to the registry - -Add messages to registry to indicate state sensor state change. - -Tested: -Build and redfish validator passes. -Logged these events and confirmed that they appear as expected on -Redfish. -GET: https:///redfish/v1/Systems/system/LogServices/EventLog/Entries/1612528180 -{ - "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/1612528180", - "@odata.type": "#LogEntry.v1_4_0.LogEntry", - "Created": "2021-02-05T12:29:40+00:00", - "EntryType": "Event", - "Id": "1612528180", - "Message": "Operational Fault Status of Card_health_1 state sensor changed from Error to Normal.", - "MessageArgs": [ - "Operational Fault Status", - "Card_health_1", - "Error", - "Normal" - ], - "MessageId": "OpenBMC.0.1.StateSensorNormal", - "Name": "System Event Log Entry", - "Severity": "OK" -} - -Signed-off-by: Arun P. Mohanan ---- - .../registries/openbmc_message_registry.hpp | 36 +++++++++++++++++-- - 1 file changed, 34 insertions(+), 2 deletions(-) - -diff --git a/redfish-core/include/registries/openbmc_message_registry.hpp b/redfish-core/include/registries/openbmc_message_registry.hpp -index 5eb9380..dbea97c 100644 ---- a/redfish-core/include/registries/openbmc_message_registry.hpp -+++ b/redfish-core/include/registries/openbmc_message_registry.hpp -@@ -29,7 +29,7 @@ const Header header = { - "0.1.0", - "OpenBMC", - }; --constexpr std::array registry = { -+constexpr std::array registry = { - MessageEntry{ - "ADDDCCorrectable", - { -@@ -2318,6 +2318,39 @@ constexpr std::array registry = { - {}, - "None.", - }}, -+ MessageEntry{ -+ "StateSensorNormal", -+ { -+ "Indicates that a state sensor has changed state to normal.", -+ "%1 of %2 state sensor changed from %3 to %4.", -+ "OK", -+ "OK", -+ 4, -+ {"string", "string", "string", "string"}, -+ "None.", -+ }}, -+ MessageEntry{ -+ "StateSensorWarning", -+ { -+ "Indicates that a state sensor has changed state to warning.", -+ "%1 of %2 state sensor changed from %3 to %4.", -+ "Warning", -+ "Warning", -+ 4, -+ {"string", "string", "string", "string"}, -+ "Check sensor subsystem for errors.", -+ }}, -+ MessageEntry{ -+ "StateSensorCritical", -+ { -+ "Indicates that a state sensor has changed state to critical.", -+ "%1 of %2 state sensor changed from %3 to %4.", -+ "Critical", -+ "Critical", -+ 4, -+ {"string", "string", "string", "string"}, -+ "Check sensor subsystem for errors.", -+ }}, - MessageEntry{"SystemInterfaceDisabledProvisioned", - { - "Indicates that the system interface is in the disabled " -@@ -2410,6 +2443,5 @@ constexpr std::array registry = { - {"string"}, - "None.", - }}, -- - }; - } // namespace redfish::message_registries::openbmc --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0038-Revert-Disable-nbd-proxy-from-the-build.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0038-Revert-Disable-nbd-proxy-from-the-build.patch deleted file mode 100644 index 3e3f69d1c..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0038-Revert-Disable-nbd-proxy-from-the-build.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 95f002dc969d7d6d64dbf2ee0db7dc1c1c6a9173 Mon Sep 17 00:00:00 2001 -From: Przemyslaw Czarnowski -Date: Thu, 18 Mar 2021 11:30:28 +0100 -Subject: [PATCH] Revert "Disable nbd proxy from the build" - -NBD Proxy has been disabled upstream. Reenable as we use it for Virtual -Media - -This reverts commit efb8062c306474942bc94f15d748b2eb0b58fbb6. ---- - meson.build | 2 +- - meson_options.txt | 9 +-------- - 2 files changed, 2 insertions(+), 9 deletions(-) - -diff --git a/meson.build b/meson.build -index 66a066b..cef0a49 100644 ---- a/meson.build -+++ b/meson.build -@@ -81,7 +81,7 @@ feature_map = { - 'static-hosting' : '-DBMCWEB_ENABLE_STATIC_HOSTING', - 'insecure-tftp-update' : '-DBMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE', - 'validate-unsecure-feature' : '-DBMCWEB_ENABLE_VALIDATION_UNSECURE_FEATURE', --#'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY', -+'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY', - 'vm-websocket' : '-DBMCWEB_ENABLE_VM_WEBSOCKET', - } - -diff --git a/meson_options.txt b/meson_options.txt -index 9611631..7ee3ebb 100644 ---- a/meson_options.txt -+++ b/meson_options.txt -@@ -3,14 +3,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.''') -- --# if you use this option and are seeing this comment, please comment here: --# https://github.com/openbmc/bmcweb/issues/188 and put forward your intentions --# for this code. At this point, no daemon has been upstreamed that implements --# this interface, so for the moment this appears to be dead code; In leiu of --# removing it, it has been disabled to try to give those that use it the --# 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('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.') --- -2.26.2 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-bmcweb-crashes-if-socket-directory-not-present.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-bmcweb-crashes-if-socket-directory-not-present.patch deleted file mode 100644 index bc023839f..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-bmcweb-crashes-if-socket-directory-not-present.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 48fe2a68d634970795f9ff13903afbedca801088 Mon Sep 17 00:00:00 2001 -From: Nidhin MS -Date: Wed, 14 Apr 2021 11:28:44 +0530 -Subject: [PATCH] Fix: bmcweb crashes if socket directory not present - -When trying to mount virtual media image bmcweb tries to create unix -socket and if the parent directory does not exist -stream_protocol::acceptor throws error and bmcweb crashes. Fix the same - -Tested: -Removed directory and mounted the vm image. bmcweb crash was not -observed - -Change-Id: I3aea1d8e197c06238f425a97435c01d3c80552a9 -Signed-off-by: Nidhin MS ---- - include/nbd_proxy.hpp | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp -index 7b90e90..3b28823 100644 ---- a/include/nbd_proxy.hpp -+++ b/include/nbd_proxy.hpp -@@ -397,6 +397,17 @@ inline void requestRoutes(App& app) - // If the socket file exists (i.e. after bmcweb crash), - // we cannot reuse it. - std::remove((*socketValue).c_str()); -+ std::filesystem::path socketPath(*socketValue); -+ std::error_code fsErr; -+ if (!std::filesystem::exists(socketPath.parent_path(), -+ fsErr)) -+ { -+ BMCWEB_LOG_ERROR -+ << "VirtualMedia socket directory not present. " -+ << socketPath.parent_path(); -+ conn.close("Unable to create unix socket"); -+ return; -+ } - - sessions[&conn] = std::make_shared( - conn, *socketValue, *endpointValue, --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-comparison-for-proxy-legacy-mode.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-comparison-for-proxy-legacy-mode.patch deleted file mode 100644 index f02e5e1a4..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-comparison-for-proxy-legacy-mode.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 7cde56820505a4f750cc67caa0dc9300688f3fd9 Mon Sep 17 00:00:00 2001 -From: Przemyslaw Czarnowski -Date: Tue, 13 Apr 2021 15:16:43 +0200 -Subject: [PATCH] Fix comparison for proxy/legacy mode - -After sdbusplus made available string path wrapper VM code has been -updated to use it. This makes legacy mode unusable as appropriate -change introduced a problem with comparison of DBus object path, which -is now fixed. - -Tested: -After applying this fix, legacy mode has InsertMedia action enabled -again. - -Change-Id: I062994f23b77cb7ab9c4421f296a65a80b9ce896 -Signed-off-by: Przemyslaw Czarnowski ---- - redfish-core/lib/virtual_media.hpp | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) - -diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index 365290b..dda73d8 100644 ---- a/redfish-core/lib/virtual_media.hpp -+++ b/redfish-core/lib/virtual_media.hpp -@@ -274,10 +274,22 @@ static void getVmData(const std::shared_ptr& aResp, - continue; - } - -+ auto mode = item.first.parent_path(); -+ auto type = mode.parent_path(); -+ if (mode.filename().empty() || type.filename().empty()) -+ { -+ continue; -+ } -+ -+ if (type.filename() != "VirtualMedia") -+ { -+ continue; -+ } -+ - aResp->res.jsonValue = vmItemTemplate(name, resName); - - // Check if dbus path is Legacy type -- if (thispath.find("VirtualMedia/Legacy") != std::string::npos) -+ if (mode.filename() == "Legacy") - { - aResp->res.jsonValue["Actions"]["#VirtualMedia.InsertMedia"] - ["target"] = --- -2.26.2 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch new file mode 100644 index 000000000..9cf4653d6 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch @@ -0,0 +1,848 @@ +From 72c273ae74bb6add062b89f59ebeee4d4eb7e523 Mon Sep 17 00:00:00 2001 +From: Kuiying Wang +Date: Fri, 4 Sep 2020 19:24:25 +0800 +Subject: [PATCH] Define Redfish interface "/Registries/Bios" and enable + Attributes property + +1. Define Redfish interface "/Registries/Bios" for BIOS Attribute Registry + RBC Daemon provide method to get BIOS attribute registry. +2. Eanble Attributes property for BIOS resource +3. Define Redfish interface "/Systems/system/Bios/Settings" for BIOS +settings +4. RBC daemon is at +https://gerrit.openbmc-project.xyz/#/c/openbmc/bios-settings-mgr/+/35563/ +5. IPMI command implementation is at +https://gerrit.openbmc-project.xyz/#/c/openbmc/intel-ipmi-oem/+/30827/ +6. Property design is at +https://github.com/openbmc/phosphor-dbus-interfaces/tree/master/xyz/openbmc_project/BIOSConfig +7. Design doc is at +https://github.com/openbmc/docs/blob/master/designs/remote-bios-configuration.md +8. There will be 95 test cases for this feature in the validation team. + +Tested: + +1. Use postman (Redfish tool) could get all the attributes in bios +resouce, get bios settings, get bios attribute +registry. +https://IP_ADDR/redfish/v1/Systems/system/Bios +{ + "@Redfish.Settings": { + "@odata.type": "#Settings.v1_3_0.Settings", + "SettingsObject": { + "@odata.id": "/redfish/v1/Systems/system/Bios/Settings" + } + }, + "@odata.id": "/redfish/v1/Systems/system/Bios", + "@odata.type": "#Bios.v1_1_0.Bios", + "Actions": { + "#Bios.ChangePassword": { + "target": "/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword" + }, + "#Bios.ResetBios": { + "target": "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios" + } + }, + "AttributeRegistry": "BiosAttributeRegistry", + "Attributes": { + "attr0": "current value" + }, + "Description": "BIOS Configuration Service", + "Id": "BIOS", + "Links": { + "ActiveSoftwareImage": { + "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/bios_active" + }, + "SoftwareImages": [ + { + "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/bios_active" + } + ], + "SoftwareImages@odata.count": 1 + }, + "Name": "BIOS Configuration" +} + +Redfish interface: https://BMCIP/redfish/v1/Registries/BiosAttributeRegistry +{ + "@odata.id": "/redfish/v1/Registries/BiosAttributeRegistry", + "@odata.type": "#MessageRegistryFile.v1_1_0.MessageRegistryFile", + "Description": "BiosAttributeRegistry Message Registry File Location", + "Id": "BiosAttributeRegistry", + "Languages": [ + "en" + ], + "Languages@odata.count": 1, + "Location": [ + { + "Language": "en", + "Uri": "/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry" + } + ], + "Location@odata.count": 1, + "Name": "BiosAttributeRegistry Message Registry File", + "Registry": "BiosAttributeRegistry.1.0.0" +} + +Redfish interface: https://BMCIP/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry +{ + "@odata.id": "/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry", + "@odata.type": "#AttributeRegistry.v1_3_2.AttributeRegistry", + "Id": "BiosAttributeRegistry", + "Language": "en", + "Name": "Bios Attribute Registry", + "OwningEntity": "OpenBMC", + "RegistryEntries": { + "Attributes": [ + { + "AttributeName": "attr0", + "CurrentValue": "current value", + "DefaultValue": "default value", + "DisplayName": "display name for attr0", + "HelpText": "description for attr0", + "MenuPath": "./menu/path/for/attr0", + "ReadOnly": false, + "Type": "String", + "Value": [] + } + ] + }, + "RegistryVersion": "1.0.0" +} + +https://BMC_IPADDR/redfish/v1/Systems/system/Bios/Settings +{ + "@odata.id": "/redfish/v1/Systems/system/Bios/Settings", + "@odata.type": "#Bios.v1_1_0.Bios", + "AttributeRegistry": "BiosAttributeRegistry", + "Attributes": { + "QuietBoot": "0x0" + }, + "Id": "BiosSettingsV1", + "Name": "Bios Settings Version 1" +} + +2. Passed Validator check for bios resource and bios attribute registry +*** /redfish/v1/Systems/system/Bios +INFO - Type (#Bios.v1_1_0.Bios), GET SUCCESS (time: 1.57377) +INFO - PASS +*** /redfish/v1/Registries/BiosAttributeRegistry +INFO - Type (#MessageRegistryFile.v1_1_0.MessageRegistryFile), GET SUCCESS (time: 0.075438) +INFO - PASS +INFO - +*** /redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry +INFO - Type (#AttributeRegistry.v1_3_2.AttributeRegistry), GET SUCCESS (time: 0.075751) +INFO - PASS + +@odata.id /redfish/v1/Systems/system/Bios odata Exists PASS +@odata.type #Settings.v1_3_0.Settings odata Exists PASS +Links [JSON Object] Bios.v1_1_0.Links Yes complex +Links.ActiveSoftwareImage Link: /redfish/v1/UpdateService/FirmwareInventory/bios_active link to: SoftwareInventory Yes PASS +Links.SoftwareImages Array (size: 1) array of: SoftwareInventory Yes ... +Links.SoftwareImages[0] Link: /redfish/v1/UpdateService/FirmwareInventory/bios_active SoftwareInventory Yes PASS +Links.Oem - Resource.Oem No Optional +SoftwareImages@odata.count 1 odata Exists PASS +AttributeRegistry BiosAttributeRegistry string Yes PASS +Actions [JSON Object] Bios.v1_0_0.Actions Yes complex +Actions.#Bios.ResetBios Action - Yes PASS +Actions.#Bios.ChangePassword Action - Yes PASS +Attributes [JSON Object] Bios.v1_0_0.Attributes Yes complex +Attributes.attr0 current value primitive Yes PASS +Id BIOS string Yes PASS +Description BIOS Configuration Service string Yes PASS +Name BIOS Configuration string Yes PASS +Oem - Resource.Oem No Optional +@Redfish.Settings [JSON Object] Settings.Settings Yes complex +@Redfish.Settings.MaintenanceWindowResource - link to: ItemOrCollection No Optional +@Redfish.Settings.SupportedApplyTimes - string (enum) No Optional +@Redfish.Settings.Time - date No Optional +@Redfish.Settings.ETag - string No Optional +@Redfish.Settings.SettingsObject Link: /redfish/v1/Systems/system/Bios/Settings link to: Item Yes PASS +@Redfish.Settings.Messages - Message No Optional + +@odata.id /redfish/v1/Registries/BiosAttributeRegistry odata Exists PASS +@odata.type #MessageRegistryFile.v1_1_0.MessageRegistryFile odata Exists PASS +Languages@odata.count 1 odata Exists PASS +Location@odata.count 1 odata Exists PASS +Actions - MessageRegistryFile.v1_1_0.Actions No Optional +Languages Array (size: 1) string Yes ... +Languages[0] en string Yes PASS +Registry BiosAttributeRegistry.1.0.0 string Yes PASS +Location Array (size: 1) array of: Location Yes ... +Location[0] [JSON Object] Location Yes complex +Location[0].Language en string Yes PASS +Location[0].Uri /redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry string Yes PASS +Location[0].ArchiveUri - string No Optional +Location[0].PublicationUri - string No Optional +Location[0].ArchiveFile - string No Optional +Id BiosAttributeRegistry string Yes PASS +Description BiosAttributeRegistry Message Registry File Location string Yes PASS +Name BiosAttributeRegistry Message Registry File string Yes PASS +Oem - Resource.Oem No Optional + +@odata.id /redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry odata Exists PASS +@odata.type #AttributeRegistry.v1_3_2.AttributeRegistry odata Exists PASS +Actions - AttributeRegistry.v1_1_0.Actions No Optional +Language en string Yes PASS +RegistryVersion 1.0.0 string Yes PASS +OwningEntity OpenBMC string Yes PASS +SupportedSystems - SupportedSystems No Optional +RegistryEntries [JSON Object] AttributeRegistry.v1_0_0.RegistryEntries Yes complex +RegistryEntries.Attributes Array (size: 1) array of: Attributes Yes ... +RegistryEntries.Attributes[0] [JSON Object] Attributes Yes complex +RegistryEntries.Attributes[0].Oem - Resource.Oem No Optional +RegistryEntries.Attributes[0].ResetRequired - boolean No Optional +RegistryEntries.Attributes[0].UefiDevicePath - string No Optional +RegistryEntries.Attributes[0].UefiKeywordName - string No Optional +RegistryEntries.Attributes[0].UefiNamespaceId - string No Optional +RegistryEntries.Attributes[0].AttributeName attr0 string Yes PASS +RegistryEntries.Attributes[0].Type String string (enum) Yes PASS +RegistryEntries.Attributes[0].Value Array (size: 0) array of: AttributeValue Yes ... +RegistryEntries.Attributes[0].DisplayName display name for attr0 string Yes PASS +RegistryEntries.Attributes[0].HelpText description for attr0 string Yes PASS +RegistryEntries.Attributes[0].WarningText - string No Optional +RegistryEntries.Attributes[0].CurrentValue current value primitive Yes PASS +RegistryEntries.Attributes[0].DefaultValue default value primitive Yes PASS +RegistryEntries.Attributes[0].DisplayOrder - number No Optional +RegistryEntries.Attributes[0].MenuPath ./menu/path/for/attr0 string Yes PASS +RegistryEntries.Attributes[0].ReadOnly False boolean Yes PASS +RegistryEntries.Attributes[0].WriteOnly - boolean No Optional +RegistryEntries.Attributes[0].GrayOut - boolean No Optional +RegistryEntries.Attributes[0].Hidden - boolean No Optional +RegistryEntries.Attributes[0].Immutable - boolean No Optional +RegistryEntries.Attributes[0].IsSystemUniqueProperty - boolean No Optional +RegistryEntries.Attributes[0].MaxLength - number No Optional +RegistryEntries.Attributes[0].MinLength - number No Optional +RegistryEntries.Attributes[0].ScalarIncrement - number No Optional +RegistryEntries.Attributes[0].UpperBound - number No Optional +RegistryEntries.Attributes[0].LowerBound - number No Optional +RegistryEntries.Attributes[0].ValueExpression - string No Optional +RegistryEntries.Menus - Menus No Optional +RegistryEntries.Dependencies - Dependencies No Optional +Id BiosAttributeRegistry string Yes PASS +Description - string No Optional +Name Bios Attribute Registry string Yes PASS +Oem - Resource.Oem No Optional + +Change-Id: Iecc61018c350f0b8c89df59b2864b941508b1916 +Signed-off-by: Kuiying Wang +--- + redfish-core/include/redfish.hpp | 2 + + .../include/registries/bios_registry.hpp | 31 ++ + redfish-core/lib/bios.hpp | 501 ++++++++++++++++++ + redfish-core/lib/message_registries.hpp | 9 +- + 4 files changed, 542 insertions(+), 1 deletion(-) + create mode 100644 redfish-core/include/registries/bios_registry.hpp + +diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp +index db58d60..298ebb8 100644 +--- a/redfish-core/include/redfish.hpp ++++ b/redfish-core/include/redfish.hpp +@@ -156,6 +156,8 @@ class RedfishService + nodes.emplace_back(std::make_unique(app)); + nodes.emplace_back(std::make_unique(app)); + nodes.emplace_back(std::make_unique(app)); ++ nodes.emplace_back(std::make_unique(app)); ++ nodes.emplace_back(std::make_unique(app)); + nodes.emplace_back(std::make_unique(app)); + #ifdef BMCWEB_ENABLE_VM_NBDPROXY + nodes.emplace_back(std::make_unique(app)); +diff --git a/redfish-core/include/registries/bios_registry.hpp b/redfish-core/include/registries/bios_registry.hpp +new file mode 100644 +index 0000000..88ef782 +--- /dev/null ++++ b/redfish-core/include/registries/bios_registry.hpp +@@ -0,0 +1,31 @@ ++/* ++// Copyright (c) 2020 Intel Corporation ++// ++// Licensed under the Apache License, Version 2.0 (the "License"); ++// you may not use this file except in compliance with the License. ++// You may obtain a copy of the License at ++// ++// http://www.apache.org/licenses/LICENSE-2.0 ++// ++// Unless required by applicable law or agreed to in writing, software ++// distributed under the License is distributed on an "AS IS" BASIS, ++// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++// See the License for the specific language governing permissions and ++// limitations under the License. ++*/ ++#pragma once ++ ++namespace redfish::message_registries::bios ++{ ++const Header header = { ++ "Copyright 2020 OpenBMC. All rights reserved.", ++ "#MessageRegistry.v1_4_0.MessageRegistry", ++ "BiosAttributeRegistry.1.0.0", ++ "Bios Attribute Registry", ++ "en", ++ "This registry defines the messages for bios attribute registry.", ++ "BiosAttributeRegistry", ++ "1.0.0", ++ "OpenBMC", ++}; ++} // namespace redfish::message_registries::bios +\ No newline at end of file +diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp +index 0917cc7..cb2b74d 100644 +--- a/redfish-core/lib/bios.hpp ++++ b/redfish-core/lib/bios.hpp +@@ -3,8 +3,140 @@ + #include "node.hpp" + + #include ++ + namespace redfish + { ++ ++/*baseBIOSTable ++map{attributeName,struct{attributeType,readonlyStatus,displayname, ++ description,menuPath,current,default, ++ array{struct{optionstring,optionvalue}}}} ++*/ ++using BiosBaseTableType = std::vector, std::variant, ++ std::vector< ++ std::tuple>>>>>; ++using BiosBaseTableItemType = std::pair< ++ std::string, ++ std::tuple< ++ std::string, bool, std::string, std::string, std::string, ++ std::variant, std::variant, ++ std::vector< ++ std::tuple>>>>; ++using OptionsItemType = ++ std::tuple>; ++ ++enum BiosBaseTableIndex ++{ ++ biosBaseAttrType = 0, ++ biosBaseReadonlyStatus, ++ biosBaseDisplayName, ++ biosBaseDescription, ++ biosBaseMenuPath, ++ biosBaseCurrValue, ++ biosBaseDefaultValue, ++ biosBaseOptions ++}; ++enum OptionsItemIndex ++{ ++ optItemType = 0, ++ optItemValue ++}; ++/* ++ The Pending attribute name and new value. ++ ex- { {"QuietBoot",Type.Integer, 0x1}, ++ { "DdrFreqLimit",Type.String,"2933"} ++ } ++*/ ++using PendingAttributesType = std::vector>>>; ++using PendingAttributesItemType = ++ std::pair>>; ++enum PendingAttributesIndex ++{ ++ pendingAttrType = 0, ++ pendingAttrValue ++}; ++static std::string mapAttrTypeToRedfish(const std::string_view typeDbus) ++{ ++ std::string ret; ++ if (typeDbus == "xyz.openbmc_project.BIOSConfig.Manager." ++ "AttributeType.Enumeration") ++ { ++ ret = "Enumeration"; ++ } ++ else if (typeDbus == "xyz.openbmc_project.BIOSConfig." ++ "Manager.AttributeType.String") ++ { ++ ret = "String"; ++ } ++ else if (typeDbus == "xyz.openbmc_project.BIOSConfig." ++ "Manager.AttributeType.Password") ++ { ++ ret = "Password"; ++ } ++ else if (typeDbus == "xyz.openbmc_project.BIOSConfig." ++ "Manager.AttributeType.Integer") ++ { ++ ret = "Integer"; ++ } ++ else if (typeDbus == "xyz.openbmc_project.BIOSConfig." ++ "Manager.AttributeType.Boolean") ++ { ++ ret = "Boolean"; ++ } ++ else ++ { ++ ret = "UNKNOWN"; ++ } ++ ++ return ret; ++} ++static std::string mapBoundTypeToRedfish(const std::string_view typeDbus) ++{ ++ std::string ret; ++ if (typeDbus == ++ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.ScalarIncrement") ++ { ++ ret = "ScalarIncrement"; ++ } ++ else if (typeDbus == ++ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.LowerBound") ++ { ++ ret = "LowerBound"; ++ } ++ else if (typeDbus == ++ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.UpperBound") ++ { ++ ret = "UpperBound"; ++ } ++ else if (typeDbus == ++ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.MinStringLength") ++ { ++ ret = "MinStringLength"; ++ } ++ else if (typeDbus == ++ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.MaxStringLength") ++ { ++ ret = "MaxStringLength"; ++ } ++ else if (typeDbus == ++ "xyz.openbmc_project.BIOSConfig.Manager.BoundType.OneOf") ++ { ++ ret = "OneOf"; ++ } ++ else ++ { ++ ret = "UNKNOWN"; ++ } ++ ++ return ret; ++} ++ + /** + * BiosService class supports handle get method for bios. + */ +@@ -33,6 +165,375 @@ class BiosService : public Node + // Get the ActiveSoftwareImage and SoftwareImages + fw_util::populateFirmwareInformation(asyncResp, fw_util::biosPurpose, + "", true); ++ asyncResp->res.jsonValue["@Redfish.Settings"] = { ++ {"@odata.type", "#Settings.v1_3_0.Settings"}, ++ {"SettingsObject", ++ {{"@odata.id", "/redfish/v1/Systems/system/Bios/Settings"}}}}; ++ asyncResp->res.jsonValue["AttributeRegistry"] = "BiosAttributeRegistry"; ++ asyncResp->res.jsonValue["Attributes"] = {}; ++ ++ crow::connections::systemBus->async_method_call( ++ [asyncResp](const boost::system::error_code ec, ++ const GetObjectType& getObjectType) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " ++ << ec; ++ messages::internalError(asyncResp->res); ++ ++ return; ++ } ++ const std::string& service = getObjectType.begin()->first; ++ ++ crow::connections::systemBus->async_method_call( ++ [asyncResp]( ++ const boost::system::error_code ec, ++ const std::variant& retBiosTable) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "getBiosAttributes DBUS error: " ++ << ec; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ const BiosBaseTableType* baseBiosTable = ++ std::get_if(&retBiosTable); ++ nlohmann::json& attributesJson = ++ asyncResp->res.jsonValue["Attributes"]; ++ if (baseBiosTable == nullptr) ++ { ++ BMCWEB_LOG_ERROR << "baseBiosTable == nullptr "; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ for (const BiosBaseTableItemType& item : *baseBiosTable) ++ { ++ const std::string& key = item.first; ++ const std::string& itemType = ++ std::get(item.second); ++ std::string attrType = ++ mapAttrTypeToRedfish(itemType); ++ if (attrType == "String") ++ { ++ const std::string* currValue = ++ std::get_if( ++ &std::get( ++ item.second)); ++ attributesJson.emplace(key, currValue != nullptr ++ ? *currValue ++ : ""); ++ } ++ else if (attrType == "Integer") ++ { ++ const int64_t* currValue = std::get_if( ++ &std::get(item.second)); ++ attributesJson.emplace( ++ key, currValue != nullptr ? *currValue : 0); ++ } ++ else ++ { ++ BMCWEB_LOG_ERROR ++ << "Unsupported attribute type."; ++ messages::internalError(asyncResp->res); ++ } ++ } ++ }, ++ service, "/xyz/openbmc_project/bios_config/manager", ++ "org.freedesktop.DBus.Properties", "Get", ++ "xyz.openbmc_project.BIOSConfig.Manager", "BaseBIOSTable"); ++ }, ++ "xyz.openbmc_project.ObjectMapper", ++ "/xyz/openbmc_project/object_mapper", ++ "xyz.openbmc_project.ObjectMapper", "GetObject", ++ "/xyz/openbmc_project/bios_config/manager", ++ std::array()); ++ } ++}; ++ ++/** ++ * BiosSettings class supports handle GET/PATCH method for ++ * BIOS configuration pending settings. ++ */ ++class BiosSettings : public Node ++{ ++ public: ++ BiosSettings(App& app) : ++ Node(app, "/redfish/v1/Systems/system/Bios/Settings") ++ { ++ entityPrivileges = {{boost::beast::http::verb::get, {{"Login"}}}}; ++ } ++ ++ private: ++ void doGet(const std::shared_ptr& asyncResp, ++ const crow::Request&, const std::vector&) override ++ { ++ asyncResp->res.jsonValue["@odata.id"] = ++ "/redfish/v1/Systems/system/Bios/Settings"; ++ asyncResp->res.jsonValue["@odata.type"] = "#Bios.v1_1_0.Bios"; ++ asyncResp->res.jsonValue["Name"] = "Bios Settings Version 1"; ++ asyncResp->res.jsonValue["Id"] = "BiosSettingsV1"; ++ asyncResp->res.jsonValue["AttributeRegistry"] = "BiosAttributeRegistry"; ++ asyncResp->res.jsonValue["Attributes"] = {}; ++ ++ crow::connections::systemBus->async_method_call( ++ [asyncResp](const boost::system::error_code ec, ++ const GetObjectType& getObjectType) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " ++ << ec; ++ messages::internalError(asyncResp->res); ++ ++ return; ++ } ++ std::string service = getObjectType.begin()->first; ++ ++ crow::connections::systemBus->async_method_call( ++ [asyncResp](const boost::system::error_code ec, ++ const std::variant& ++ retPendingAttributes) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "getBiosSettings DBUS error: " ++ << ec; ++ messages::resourceNotFound(asyncResp->res, ++ "Systems/system/Bios", ++ "Settings"); ++ return; ++ } ++ const PendingAttributesType* pendingAttributes = ++ std::get_if( ++ &retPendingAttributes); ++ nlohmann::json& attributesJson = ++ asyncResp->res.jsonValue["Attributes"]; ++ if (pendingAttributes == nullptr) ++ { ++ BMCWEB_LOG_ERROR << "pendingAttributes == nullptr "; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ for (const PendingAttributesItemType& item : ++ *pendingAttributes) ++ { ++ const std::string& key = item.first; ++ const std::string& itemType = ++ std::get(item.second); ++ std::string attrType = ++ mapAttrTypeToRedfish(itemType); ++ if (attrType == "String") ++ { ++ const std::string* currValue = ++ std::get_if( ++ &std::get( ++ item.second)); ++ attributesJson.emplace(key, currValue != nullptr ++ ? *currValue ++ : ""); ++ } ++ else if (attrType == "Integer") ++ { ++ const int64_t* currValue = std::get_if( ++ &std::get(item.second)); ++ attributesJson.emplace( ++ key, currValue != nullptr ? *currValue : 0); ++ } ++ else ++ { ++ BMCWEB_LOG_ERROR ++ << "Unsupported attribute type."; ++ messages::internalError(asyncResp->res); ++ } ++ } ++ }, ++ service, "/xyz/openbmc_project/bios_config/manager", ++ "org.freedesktop.DBus.Properties", "Get", ++ "xyz.openbmc_project.BIOSConfig.Manager", ++ "PendingAttributes"); ++ }, ++ "xyz.openbmc_project.ObjectMapper", ++ "/xyz/openbmc_project/object_mapper", ++ "xyz.openbmc_project.ObjectMapper", "GetObject", ++ "/xyz/openbmc_project/bios_config/manager", ++ std::array()); ++ } ++}; ++/** ++ * BiosAttributeRegistry class supports handle get method for BIOS attribute ++ * registry. ++ */ ++class BiosAttributeRegistry : public Node ++{ ++ public: ++ BiosAttributeRegistry(App& app) : ++ Node(app, "/redfish/v1/Registries/BiosAttributeRegistry/" ++ "BiosAttributeRegistry") ++ { ++ entityPrivileges = {{boost::beast::http::verb::get, {{"Login"}}}}; ++ } ++ ++ private: ++ void doGet(const std::shared_ptr& asyncResp, ++ const crow::Request&, const std::vector&) override ++ { ++ asyncResp->res.jsonValue["@odata.id"] = ++ "/redfish/v1/Registries/BiosAttributeRegistry/" ++ "BiosAttributeRegistry"; ++ asyncResp->res.jsonValue["@odata.type"] = ++ "#AttributeRegistry.v1_3_2.AttributeRegistry"; ++ asyncResp->res.jsonValue["Name"] = "Bios Attribute Registry"; ++ asyncResp->res.jsonValue["Id"] = "BiosAttributeRegistry"; ++ asyncResp->res.jsonValue["RegistryVersion"] = "1.0.0"; ++ asyncResp->res.jsonValue["Language"] = "en"; ++ asyncResp->res.jsonValue["OwningEntity"] = "OpenBMC"; ++ asyncResp->res.jsonValue["RegistryEntries"]["Attributes"] = ++ nlohmann::json::array(); ++ ++ crow::connections::systemBus->async_method_call( ++ [asyncResp](const boost::system::error_code ec, ++ const GetObjectType& getObjectType) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " ++ << ec; ++ messages::internalError(asyncResp->res); ++ ++ return; ++ } ++ std::string service = getObjectType.begin()->first; ++ ++ crow::connections::systemBus->async_method_call( ++ [asyncResp]( ++ const boost::system::error_code ec, ++ const std::variant& retBiosTable) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR ++ << "getBiosAttributeRegistry DBUS error: " ++ << ec; ++ messages::resourceNotFound( ++ asyncResp->res, "Registries/Bios", "Bios"); ++ return; ++ } ++ const BiosBaseTableType* baseBiosTable = ++ std::get_if(&retBiosTable); ++ nlohmann::json& attributeArray = ++ asyncResp->res ++ .jsonValue["RegistryEntries"]["Attributes"]; ++ nlohmann::json optionsArray = nlohmann::json::array(); ++ if (baseBiosTable == nullptr) ++ { ++ BMCWEB_LOG_ERROR << "baseBiosTable == nullptr "; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ for (const BiosBaseTableItemType& item : *baseBiosTable) ++ { ++ const std::string& itemType = ++ std::get(item.second); ++ std::string attrType = ++ mapAttrTypeToRedfish(itemType); ++ if (attrType == "UNKNOWN") ++ { ++ BMCWEB_LOG_ERROR << "attrType == UNKNOWN"; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ nlohmann::json attributeItem; ++ attributeItem["AttributeName"] = item.first; ++ attributeItem["Type"] = attrType; ++ attributeItem["ReadOnly"] = ++ std::get(item.second); ++ attributeItem["DisplayName"] = ++ std::get(item.second); ++ attributeItem["HelpText"] = ++ std::get(item.second); ++ attributeItem["MenuPath"] = ++ std::get(item.second); ++ ++ if (attrType == "String") ++ { ++ const std::string* currValue = ++ std::get_if( ++ &std::get( ++ item.second)); ++ const std::string* defValue = ++ std::get_if( ++ &std::get( ++ item.second)); ++ attributeItem["CurrentValue"] = ++ currValue != nullptr ? *currValue : ""; ++ attributeItem["DefaultValue"] = ++ defValue != nullptr ? *defValue : ""; ++ } ++ else if (attrType == "Integer") ++ { ++ const int64_t* currValue = std::get_if( ++ &std::get(item.second)); ++ const int64_t* defValue = std::get_if( ++ &std::get( ++ item.second)); ++ attributeItem["CurrentValue"] = ++ currValue != nullptr ? *currValue : 0; ++ attributeItem["DefaultValue"] = ++ defValue != nullptr ? *defValue : 0; ++ } ++ else ++ { ++ BMCWEB_LOG_ERROR ++ << "Unsupported attribute type."; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ ++ const std::vector& optionsVector = ++ std::get(item.second); ++ for (const OptionsItemType& optItem : optionsVector) ++ { ++ nlohmann::json optItemJson; ++ const std::string& strOptItemType = ++ std::get(optItem); ++ std::string optItemTypeRedfish = ++ mapBoundTypeToRedfish(strOptItemType); ++ if (optItemTypeRedfish == "UNKNOWN") ++ { ++ BMCWEB_LOG_ERROR ++ << "optItemTypeRedfish == UNKNOWN"; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ if (optItemTypeRedfish == "OneOf") ++ { ++ const std::string* currValue = ++ std::get_if( ++ &std::get(optItem)); ++ optItemJson[optItemTypeRedfish] = ++ currValue != nullptr ? *currValue : ""; ++ } ++ else ++ { ++ const int64_t* currValue = ++ std::get_if( ++ &std::get(optItem)); ++ optItemJson[optItemTypeRedfish] = ++ currValue != nullptr ? *currValue : 0; ++ } ++ ++ optionsArray.push_back(optItemJson); ++ } ++ ++ attributeItem["Value"] = optionsArray; ++ attributeArray.push_back(attributeItem); ++ } ++ }, ++ service, "/xyz/openbmc_project/bios_config/manager", ++ "org.freedesktop.DBus.Properties", "Get", ++ "xyz.openbmc_project.BIOSConfig.Manager", "BaseBIOSTable"); ++ }, ++ "xyz.openbmc_project.ObjectMapper", ++ "/xyz/openbmc_project/object_mapper", ++ "xyz.openbmc_project.ObjectMapper", "GetObject", ++ "/xyz/openbmc_project/bios_config/manager", ++ std::array()); + } + }; + /** +diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp +index 455bf70..7afbfc2 100644 +--- a/redfish-core/lib/message_registries.hpp ++++ b/redfish-core/lib/message_registries.hpp +@@ -18,6 +18,7 @@ + #include "node.hpp" + #include "registries.hpp" + #include "registries/base_message_registry.hpp" ++#include "registries/bios_registry.hpp" + #include "registries/openbmc_message_registry.hpp" + #include "registries/resource_event_message_registry.hpp" + #include "registries/task_event_message_registry.hpp" +@@ -56,11 +57,12 @@ class MessageRegistryFileCollection : public Node + {"@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"}}}}}; + } + }; +@@ -116,6 +118,11 @@ class MessageRegistryFile : public Node + 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/biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch new file mode 100644 index 000000000..21a21e8db --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch @@ -0,0 +1,152 @@ +From 9c498d683be59ce25dd0124ba7ec5e026c59bbbf Mon Sep 17 00:00:00 2001 +From: Kuiying Wang +Date: Wed, 23 Dec 2020 16:50:45 +0800 +Subject: [PATCH] BaseBiosTable: Add support for PATCH operation + +This commit brings in support for PATCH operation of the +bios variables that updates the BaseBiosTable. + +Tested-By: +* Passed Redfish validator + +* Single Attribute: +PATCH https://${bmc}/redfish/v1/Systems/system/Bios/Settings -d +'{"data":[{"AttributeName": , "AttributeType": +, "AttributeValue": }]}' + +* Multiple Attributes: +PATCH https://${bmc}/redfish/v1/Systems/system/Bios/Settings -d +'{"data":[{"AttributeName": , "AttributeType": +, "AttributeValue": }, +{"AttributeName": , "AttributeType": +, "AttributeValue": }]}' + +This makes use of the "Set" of "PendingAttributes" in the +backend and that updates the BaseBiosTable. + +Signed-off-by: Kuiying Wang +--- + redfish-core/lib/bios.hpp | 93 ++++++++++++++++++++++++++++++++++++++- + 1 file changed, 92 insertions(+), 1 deletion(-) + +diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp +index cb2b74d..860a643 100644 +--- a/redfish-core/lib/bios.hpp ++++ b/redfish-core/lib/bios.hpp +@@ -96,6 +96,29 @@ static std::string mapAttrTypeToRedfish(const std::string_view typeDbus) + + return ret; + } ++static std::string mapRedfishToAttrType(const std::string_view type) ++{ ++ std::string ret; ++ if (type == "string") ++ { ++ ret = "xyz.openbmc_project.BIOSConfig.Manager.AttributeType.String"; ++ } ++ else if (type == "int") ++ { ++ ret = "xyz.openbmc_project.BIOSConfig.Manager.AttributeType.Integer"; ++ } ++ else if (type == "enum") ++ { ++ ret = "xyz.openbmc_project.BIOSConfig.Manager.AttributeType." ++ "Enumeration"; ++ } ++ else ++ { ++ ret = "UNKNOWN"; ++ } ++ ++ return ret; ++} + static std::string mapBoundTypeToRedfish(const std::string_view typeDbus) + { + std::string ret; +@@ -260,7 +283,9 @@ class BiosSettings : public Node + BiosSettings(App& app) : + Node(app, "/redfish/v1/Systems/system/Bios/Settings") + { +- entityPrivileges = {{boost::beast::http::verb::get, {{"Login"}}}}; ++ entityPrivileges = { ++ {boost::beast::http::verb::get, {{"Login"}}}, ++ {boost::beast::http::verb::patch, {{"ConfigureComponents"}}}}; + } + + private: +@@ -356,6 +381,72 @@ class BiosSettings : public Node + "/xyz/openbmc_project/bios_config/manager", + std::array()); + } ++ ++ void doPatch(const std::shared_ptr& asyncResp, ++ const crow::Request& req, ++ const std::vector&) override ++ { ++ nlohmann::json inpJson; ++ ++ if (!redfish::json_util::readJson(req, asyncResp->res, "data", inpJson)) ++ { ++ return; ++ } ++ ++ for (auto& attrInfo : inpJson) ++ { ++ std::optional attrName; ++ std::optional attrType; ++ std::optional attrValue; ++ if (!json_util::getValueFromJsonObject(attrInfo, "AttributeName", ++ attrName)) ++ { ++ messages::propertyMissing(asyncResp->res, "AttributeName"); ++ return; ++ } ++ if (!json_util::getValueFromJsonObject(attrInfo, "AttributeType", ++ attrType)) ++ { ++ messages::propertyMissing(asyncResp->res, "AttributeType"); ++ return; ++ } ++ if (!json_util::getValueFromJsonObject(attrInfo, "AttributeValue", ++ attrValue)) ++ { ++ messages::propertyMissing(asyncResp->res, "AttributeValue"); ++ return; ++ } ++ std::string biosAttrType = mapRedfishToAttrType(*attrType); ++ ++ if (biosAttrType == "UNKNOWN") ++ { ++ BMCWEB_LOG_ERROR << "Invalid attribute type"; ++ messages::propertyValueNotInList(asyncResp->res, ++ "AttributeType", *attrType); ++ return; ++ } ++ ++ PendingAttributesType pendingAttributes; ++ pendingAttributes.emplace_back(std::make_pair( ++ *attrName, std::make_tuple(biosAttrType, *attrValue))); ++ ++ crow::connections::systemBus->async_method_call( ++ [asyncResp](const boost::system::error_code ec) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "doPatch resp_handler got error " ++ << ec; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ }, ++ "xyz.openbmc_project.BIOSConfigManager", ++ "/xyz/openbmc_project/bios_config/manager", ++ "org.freedesktop.DBus.Properties", "Set", ++ "xyz.openbmc_project.BIOSConfig.Manager", "PendingAttributes", ++ std::variant(pendingAttributes)); ++ } ++ } + }; + /** + * BiosAttributeRegistry class supports handle get method for BIOS attribute +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch new file mode 100644 index 000000000..5a24996a0 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch @@ -0,0 +1,61 @@ +From 4e85ce8a5f34038c289504855d21ebfa3d6b94f0 Mon Sep 17 00:00:00 2001 +From: Kuiying Wang +Date: Wed, 23 Dec 2020 22:47:56 +0800 +Subject: [PATCH] Add support to ResetBios action + +Tested: + +Bios reset flag can be modified throw redfish +POST https://IP_ADDR/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios + +Change-Id: I5e5fbdd70d4a3ce3b976cc2eb0a7d9a2a3adb124 +Signed-off-by: Kuiying Wang +--- + redfish-core/lib/bios.hpp | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp +index 860a643..1eb7bef 100644 +--- a/redfish-core/lib/bios.hpp ++++ b/redfish-core/lib/bios.hpp +@@ -638,7 +638,7 @@ class BiosReset : public Node + Node(app, "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios/") + { + entityPrivileges = { +- {boost::beast::http::verb::post, {{"ConfigureManager"}}}}; ++ {boost::beast::http::verb::post, {{"ConfigureComponents"}}}}; + } + + private: +@@ -649,19 +649,24 @@ class BiosReset : public Node + void doPost(const std::shared_ptr& asyncResp, + const crow::Request&, const std::vector&) override + { ++ std::string resetFlag = ++ "xyz.openbmc_project.BIOSConfig.Manager.ResetFlag.FactoryDefaults"; + + crow::connections::systemBus->async_method_call( + [asyncResp](const boost::system::error_code ec) { + if (ec) + { +- BMCWEB_LOG_ERROR << "Failed to reset bios: " << ec; ++ BMCWEB_LOG_ERROR << "doPost bios reset got error " << ec; + messages::internalError(asyncResp->res); + return; + } ++ BMCWEB_LOG_DEBUG << "bios reset action is done"; + }, +- "org.open_power.Software.Host.Updater", +- "/xyz/openbmc_project/software", +- "xyz.openbmc_project.Common.FactoryReset", "Reset"); ++ "xyz.openbmc_project.BIOSConfigManager", ++ "/xyz/openbmc_project/bios_config/manager", ++ "org.freedesktop.DBus.Properties", "Set", ++ "xyz.openbmc_project.BIOSConfig.Manager", "ResetBIOSSettings", ++ std::variant(resetFlag)); + } + }; + } // namespace redfish +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch new file mode 100644 index 000000000..e87995aca --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch @@ -0,0 +1,139 @@ +From 0ce94f6caf5d76d7f1abc71f6f8f7dc320517984 Mon Sep 17 00:00:00 2001 +From: Kuiying Wang +Date: Wed, 23 Dec 2020 14:41:23 +0800 +Subject: [PATCH] Add support to ChangePassword action + +Tested: + +Passed Redfish validator. +Bios change password: +root@intel-obmc:~# cat /var/lib/bios-settings-manager/seedData +{ +"UserPwdHash": "08D91157785366CDC3AA64D87E5E3C621EDAB13E26B6E484397EBA5E459E54C567BF5B1FFB36A43B6142B18F8D642E9D", +"AdminPwdHash": "08D91157785366CDC3AA64D87E5E3C621EDAB13E26B6E484397EBA5E459E54C567BF5B1FFB36A43B6142B18F8D642E9D", +"Seed": "123456", +"HashAlgo": "SHA384" +} +POST https://IP_ADDR/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword +{ + "NewPassword": "12345678", + "OldPassword": "1234567890", + "PasswordName": "Administrator" +} +root@intel-obmc:~# cat /var/lib/bios-settings-manager/passwordData +{ + "CurrentPassword": "1234567890", + "IsAdminPwdChanged": 1, + "IsUserPwdChanged": 0, + "NewPassword": "2DD65D57EB60B1D92C5F3D2DC84724FCEE7BC02E57AA75E834712266ED94CAC704047B2FF7CEC1C36BED280B36BB5AC6", + "UserName": "Administrator" +} + +Change-Id: I90319a68da0b0a7f9c5cd65a8cb8cf52269a5f52 +Signed-off-by: Kuiying Wang +--- + redfish-core/include/redfish.hpp | 1 + + redfish-core/lib/bios.hpp | 70 ++++++++++++++++++++++++++++++++ + 2 files changed, 71 insertions(+) + +diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp +index 298ebb8..4418c3d 100644 +--- a/redfish-core/include/redfish.hpp ++++ b/redfish-core/include/redfish.hpp +@@ -159,6 +159,7 @@ class RedfishService + nodes.emplace_back(std::make_unique(app)); + nodes.emplace_back(std::make_unique(app)); + nodes.emplace_back(std::make_unique(app)); ++ nodes.emplace_back(std::make_unique(app)); + #ifdef BMCWEB_ENABLE_VM_NBDPROXY + nodes.emplace_back(std::make_unique(app)); + nodes.emplace_back(std::make_unique(app)); +diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp +index 1eb7bef..12ec472 100644 +--- a/redfish-core/lib/bios.hpp ++++ b/redfish-core/lib/bios.hpp +@@ -184,6 +184,9 @@ class BiosService : public Node + asyncResp->res.jsonValue["Actions"]["#Bios.ResetBios"] = { + {"target", + "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios"}}; ++ asyncResp->res.jsonValue["Actions"]["#Bios.ChangePassword"] = { ++ {"target", ++ "/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword"}}; + + // Get the ActiveSoftwareImage and SoftwareImages + fw_util::populateFirmwareInformation(asyncResp, fw_util::biosPurpose, +@@ -669,4 +672,71 @@ class BiosReset : public Node + std::variant(resetFlag)); + } + }; ++ ++/** ++ * BiosChangePassword class supports handle POST method for change bios ++ * password. The class retrieves and sends data directly to D-Bus. ++ */ ++class BiosChangePassword : public Node ++{ ++ public: ++ BiosChangePassword(App& app) : ++ Node(app, ++ "/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword/") ++ { ++ entityPrivileges = { ++ {boost::beast::http::verb::post, {{"ConfigureComponents"}}}}; ++ } ++ ++ private: ++ /** ++ * Function handles POST method request. ++ * Analyzes POST body message before sends Reset request data to D-Bus. ++ */ ++ void doPost(const std::shared_ptr& asyncResp, ++ const crow::Request& req, ++ const std::vector&) override ++ { ++ std::string currentPassword, newPassword, userName; ++ if (!json_util::readJson(req, asyncResp->res, "NewPassword", ++ newPassword, "OldPassword", currentPassword, ++ "PasswordName", userName)) ++ { ++ return; ++ } ++ if (currentPassword.empty()) ++ { ++ messages::actionParameterUnknown(asyncResp->res, "ChangePassword", ++ "OldPassword"); ++ return; ++ } ++ if (newPassword.empty()) ++ { ++ messages::actionParameterUnknown(asyncResp->res, "ChangePassword", ++ "NewPassword"); ++ return; ++ } ++ if (userName.empty()) ++ { ++ messages::actionParameterUnknown(asyncResp->res, "ChangePassword", ++ "PasswordName"); ++ return; ++ } ++ crow::connections::systemBus->async_method_call( ++ [asyncResp](const boost::system::error_code ec) { ++ if (ec) ++ { ++ BMCWEB_LOG_CRITICAL ++ << "Failed in doPost(BiosChangePassword) " << ec; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ }, ++ "xyz.openbmc_project.BIOSConfigPassword", ++ "/xyz/openbmc_project/bios_config/password", ++ "xyz.openbmc_project.BIOSConfig.Password", "ChangePassword", ++ userName, currentPassword, newPassword); ++ } ++}; ++ + } // namespace redfish +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch new file mode 100644 index 000000000..75a78abb4 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch @@ -0,0 +1,44 @@ +From fedcdb7887b4d934ee763d75f7988825300c5cef Mon Sep 17 00:00:00 2001 +From: Ayushi Smriti +Date: Thu, 6 May 2021 11:56:38 +0530 +Subject: [PATCH] Fix:remove bios user pwd change option via Redfish + +BMC should not provide user bios setup password change option via +Redfish as per bios security requirements. Only Admin BIOS setup +password is supported. + +Added check for the password name action parameter and +do not allow if it has User Password value from redfish side. + +Tested: sent POST query in redfish on URI: +https:///redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword +error occurs for UserPassword parameter and allows for AdminPassword. + +Signed-off-by: Ayushi Smriti +--- + redfish-core/lib/bios.hpp | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp +index 12ec472..0416934 100644 +--- a/redfish-core/lib/bios.hpp ++++ b/redfish-core/lib/bios.hpp +@@ -722,6 +722,15 @@ class BiosChangePassword : public Node + "PasswordName"); + return; + } ++ ++ // In Intel BIOS, we are not supporting user password in BIOS setup ++ if (userName == "UserPassword") ++ { ++ messages::actionParameterUnknown(asyncResp->res, "ChangePassword", ++ "PasswordName"); ++ return; ++ } ++ + crow::connections::systemBus->async_method_call( + [asyncResp](const boost::system::error_code ec) { + if (ec) +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch index b46d30149..bda893a81 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch @@ -1,7 +1,7 @@ -From ae55e89c14ea5abef0895409c956f5f4c38f330f Mon Sep 17 00:00:00 2001 +From 3d6c3b3e91c04ff8f10bff49bcf2a7d7206c53df Mon Sep 17 00:00:00 2001 From: Sunitha Harish Date: Fri, 19 Feb 2021 13:38:31 +0530 -Subject: [PATCH 1/2] EventService : Fix retry handling for http-client +Subject: [PATCH] EventService : Fix retry handling for http-client When the event send/receive is failed, the bmcweb does not handle the failure to tear-down the complete connection and start a fresh @@ -23,17 +23,22 @@ Tested by: - Generate an event and see the same is received at the listener's console - Update the listner to change the keep-alive to true/false and observe the http-client connection states at bmcweb + - Changed listener client to return non success HTTP status code + and observed retry logic gets trigrred in http-client. + - Gave wrong fqdn and observed async resolve failure and retry logc. + - Stopped listener after connect and verified timeouts on http-client + side. Change-Id: Ibb45691f139916ba2954da37beda9d4f91c7cef3 Signed-off-by: Sunitha Harish Signed-off-by: AppaRao Puli --- - http/http_client.hpp | 289 ++++++++++-------- + http/http_client.hpp | 288 ++++++++++-------- .../include/event_service_manager.hpp | 2 +- - 2 files changed, 163 insertions(+), 128 deletions(-) + 2 files changed, 162 insertions(+), 128 deletions(-) diff --git a/http/http_client.hpp b/http/http_client.hpp -index 992ac2b..d116f6d 100644 +index 992ac2b..feabbba 100644 --- a/http/http_client.hpp +++ b/http/http_client.hpp @@ -34,22 +34,28 @@ namespace crow @@ -67,7 +72,7 @@ index 992ac2b..d116f6d 100644 }; class HttpClient : public std::enable_shared_from_this -@@ -58,11 +64,14 @@ class HttpClient : public std::enable_shared_from_this +@@ -58,11 +64,13 @@ class HttpClient : public std::enable_shared_from_this crow::async_resolve::Resolver resolver; boost::beast::tcp_stream conn; boost::asio::steady_timer timer; @@ -80,13 +85,12 @@ index 992ac2b..d116f6d 100644 + std::optional< + boost::beast::http::response_parser> + parser; -+ boost::asio::ip::tcp::endpoint endpoint; + boost::circular_buffer_space_optimized requestDataQueue{}; + std::vector endPoints; ConnState state; std::string subId; std::string host; -@@ -76,12 +85,7 @@ class HttpClient : public std::enable_shared_from_this +@@ -76,12 +84,7 @@ class HttpClient : public std::enable_shared_from_this void doResolve() { @@ -99,7 +103,7 @@ index 992ac2b..d116f6d 100644 BMCWEB_LOG_DEBUG << "Trying to resolve: " << host << ":" << port; auto respHandler = -@@ -89,78 +93,56 @@ class HttpClient : public std::enable_shared_from_this +@@ -89,78 +92,56 @@ class HttpClient : public std::enable_shared_from_this const boost::beast::error_code ec, const std::vector& endpointList) { @@ -191,7 +195,7 @@ index 992ac2b..d116f6d 100644 // Send the HTTP request to the remote host boost::beast::http::async_write( conn, req, -@@ -171,7 +153,7 @@ class HttpClient : public std::enable_shared_from_this +@@ -171,7 +152,7 @@ class HttpClient : public std::enable_shared_from_this BMCWEB_LOG_ERROR << "sendMessage() failed: " << ec.message(); self->state = ConnState::sendFailed; @@ -200,7 +204,7 @@ index 992ac2b..d116f6d 100644 return; } BMCWEB_LOG_DEBUG << "sendMessage() bytes transferred: " -@@ -184,9 +166,18 @@ class HttpClient : public std::enable_shared_from_this +@@ -184,9 +165,17 @@ class HttpClient : public std::enable_shared_from_this void recvMessage() { @@ -208,8 +212,7 @@ index 992ac2b..d116f6d 100644 + + parser.emplace(std::piecewise_construct, std::make_tuple()); + parser->body_limit(httpReadBodyLimit); -+ // Since these are all push style eventing, we are not -+ // bothered about response body parsing. ++ + // Check only for the response header + parser->skip(true); + @@ -220,7 +223,7 @@ index 992ac2b..d116f6d 100644 [self(shared_from_this())](const boost::beast::error_code& ec, const std::size_t& bytesTransferred) { if (ec) -@@ -194,30 +185,46 @@ class HttpClient : public std::enable_shared_from_this +@@ -194,30 +183,47 @@ class HttpClient : public std::enable_shared_from_this BMCWEB_LOG_ERROR << "recvMessage() failed: " << ec.message(); self->state = ConnState::recvFailed; @@ -257,7 +260,8 @@ index 992ac2b..d116f6d 100644 + // enabled + self->state = ConnState::abortConnection; + } -+ // Transfer ownership of the response ++ ++ // Returns ownership of the parsed message + self->parser->release(); + + self->handleConnState(); @@ -275,7 +279,7 @@ index 992ac2b..d116f6d 100644 // not_connected happens sometimes so don't bother reporting it. if (ec && ec != boost::beast::errc::not_connected) { -@@ -225,112 +232,139 @@ class HttpClient : public std::enable_shared_from_this +@@ -225,112 +231,139 @@ class HttpClient : public std::enable_shared_from_this return; } BMCWEB_LOG_DEBUG << "Connection closed gracefully"; @@ -369,7 +373,7 @@ index 992ac2b..d116f6d 100644 - retryCount = 0; - connStateCheck(); + runningTimer = true; - ++ + retryCount++; + + BMCWEB_LOG_DEBUG << "Attempt retry after " << retryIntervalSecs @@ -384,7 +388,7 @@ index 992ac2b..d116f6d 100644 + // sending the event as per the retry policy + } + self->runningTimer = false; -+ + + // Lets close connection and start from resolve. + self->doClose(); + }); @@ -469,7 +473,7 @@ index 992ac2b..d116f6d 100644 } } -@@ -339,37 +373,38 @@ class HttpClient : public std::enable_shared_from_this +@@ -339,37 +372,38 @@ class HttpClient : public std::enable_shared_from_this const std::string& destIP, const std::string& destPort, const std::string& destUri) : conn(ioc), @@ -526,10 +530,10 @@ index 992ac2b..d116f6d 100644 void setRetryConfig(const uint32_t retryAttempts, diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index 148c703..bffa68f 100644 +index fa4e41a..c999121 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp -@@ -412,7 +412,7 @@ class Subscription +@@ -423,7 +423,7 @@ class Subscription reqHeaders.emplace_back(std::pair(key, val)); } } 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 b1f61c6fd..7cbb406a5 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,7 +1,7 @@ -From 579fda953ec991b4e7f9d7194b08f6aa103fa0ec Mon Sep 17 00:00:00 2001 +From 5f19e5c8ebc5cb0ce331e4ef841526995b6bdb2e Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Mon, 22 Feb 2021 17:07:47 +0000 -Subject: [PATCH 2/2] EventService: https client support +Subject: [PATCH] EventService: https client support Add https client support for push style eventing. Using this BMC can push the event @@ -17,12 +17,12 @@ Tested: Change-Id: I44c3918b39baa2eb5fddda9d635f99aa280a422a Signed-off-by: AppaRao Puli --- - http/http_client.hpp | 255 ++++++++++++------ + http/http_client.hpp | 257 ++++++++++++------ .../include/event_service_manager.hpp | 2 +- - 2 files changed, 175 insertions(+), 82 deletions(-) + 2 files changed, 176 insertions(+), 83 deletions(-) diff --git a/http/http_client.hpp b/http/http_client.hpp -index d116f6d..cebc857 100644 +index feabbba..aaf1b2d 100644 --- a/http/http_client.hpp +++ b/http/http_client.hpp @@ -20,6 +20,7 @@ @@ -52,7 +52,7 @@ index d116f6d..cebc857 100644 boost::asio::steady_timer timer; boost::beast::flat_static_buffer buffer; boost::beast::http::request req; -@@ -112,23 +117,52 @@ class HttpClient : public std::enable_shared_from_this +@@ -111,23 +116,52 @@ class HttpClient : public std::enable_shared_from_this void doConnect() { state = ConnState::connectInProgress; @@ -113,7 +113,7 @@ index d116f6d..cebc857 100644 self->state = ConnState::connected; self->handleConnState(); }); -@@ -136,106 +170,159 @@ class HttpClient : public std::enable_shared_from_this +@@ -135,106 +169,159 @@ class HttpClient : public std::enable_shared_from_this void sendMessage(const std::string& data) { @@ -207,15 +207,15 @@ index d116f6d..cebc857 100644 + // Abort the connection since server is not keep-alive enabled + self->state = ConnState::abortConnection; + } -+ // Transfer ownership of the response ++ ++ // Returns ownership of the parsed message + self->parser->release(); + + self->handleConnState(); + }; parser.emplace(std::piecewise_construct, std::make_tuple()); parser->body_limit(httpReadBodyLimit); - // Since these are all push style eventing, we are not - // bothered about response body parsing. + // Check only for the response header parser->skip(true); + conn.expires_after(std::chrono::seconds(30)); @@ -296,7 +296,8 @@ index d116f6d..cebc857 100644 + self->state = ConnState::closed; + self->handleConnState(); } -- // Transfer ownership of the response +- +- // Returns ownership of the parsed message - self->parser->release(); - - self->handleConnState(); @@ -344,7 +345,7 @@ index d116f6d..cebc857 100644 } } -@@ -302,6 +389,7 @@ class HttpClient : public std::enable_shared_from_this +@@ -301,6 +388,7 @@ class HttpClient : public std::enable_shared_from_this { case ConnState::resolveInProgress: case ConnState::connectInProgress: @@ -352,7 +353,7 @@ index d116f6d..cebc857 100644 case ConnState::sendInProgress: case ConnState::recvInProgress: case ConnState::closeInProgress: -@@ -333,6 +421,7 @@ class HttpClient : public std::enable_shared_from_this +@@ -332,6 +420,7 @@ class HttpClient : public std::enable_shared_from_this } case ConnState::resolveFailed: case ConnState::connectFailed: @@ -360,7 +361,7 @@ index d116f6d..cebc857 100644 case ConnState::sendFailed: case ConnState::recvFailed: case ConnState::retry: -@@ -371,7 +460,8 @@ class HttpClient : public std::enable_shared_from_this +@@ -370,7 +459,8 @@ class HttpClient : public std::enable_shared_from_this public: explicit HttpClient(boost::asio::io_context& ioc, const std::string& id, const std::string& destIP, const std::string& destPort, @@ -370,7 +371,7 @@ index d116f6d..cebc857 100644 conn(ioc), timer(ioc), req(boost::beast::http::verb::post, destUri, 11), state(ConnState::initialized), subId(id), host(destIP), port(destPort), -@@ -384,8 +474,11 @@ class HttpClient : public std::enable_shared_from_this +@@ -383,8 +473,11 @@ class HttpClient : public std::enable_shared_from_this req.keep_alive(true); requestDataQueue.set_capacity(maxRequestQueueSize); @@ -384,10 +385,10 @@ index d116f6d..cebc857 100644 { if ((state == ConnState::suspended) || (state == ConnState::terminated)) diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index bffa68f..1e6f496 100644 +index c999121..267c857 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp -@@ -387,7 +387,7 @@ class Subscription +@@ -398,7 +398,7 @@ class Subscription { conn = std::make_shared( crow::connections::systemBus->get_io_context(), id, host, port, 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 0d31fbc72..cd59ed94d 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,7 +1,7 @@ -From e93a6a02b0fba3371144d474422fadacc3f25fde Mon Sep 17 00:00:00 2001 +From 0c531d959364192697290c1489d5f7b1bdd7a665 Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Fri, 12 Mar 2021 18:53:25 +0000 -Subject: [PATCH 4/6] Add Server-Sent-Events support +Subject: [PATCH] Add Server-Sent-Events support Server-Sent Events is a standard describing how servers can initiate data transmission towards clients once an initial @@ -24,13 +24,13 @@ Signed-off-by: AppaRao Puli --- http/http_connection.hpp | 14 +- http/http_response.hpp | 7 +- - http/routing.hpp | 70 ++++++++++ + http/routing.hpp | 71 ++++++++++ http/server_sent_event.hpp | 279 +++++++++++++++++++++++++++++++++++++ - 4 files changed, 364 insertions(+), 6 deletions(-) + 4 files changed, 365 insertions(+), 6 deletions(-) create mode 100644 http/server_sent_event.hpp diff --git a/http/http_connection.hpp b/http/http_connection.hpp -index 4482f8d..2c8bf40 100644 +index 6172b3a..fc9fc60 100644 --- a/http/http_connection.hpp +++ b/http/http_connection.hpp @@ -326,7 +326,7 @@ class Connection : @@ -63,7 +63,7 @@ index 4482f8d..2c8bf40 100644 // delete lambda with self shared_ptr // to enable connection destruction diff --git a/http/http_response.hpp b/http/http_response.hpp -index cd00ec8..ffd6dda 100644 +index 7965704..29c56e1 100644 --- a/http/http_response.hpp +++ b/http/http_response.hpp @@ -13,10 +13,15 @@ namespace crow @@ -93,7 +93,7 @@ index cd00ec8..ffd6dda 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 65c7b70..0824939 100644 +index dd07523..7ddc6b0 100644 --- a/http/routing.hpp +++ b/http/routing.hpp @@ -6,6 +6,7 @@ @@ -104,7 +104,7 @@ index 65c7b70..0824939 100644 #include "sessions.hpp" #include "utility.hpp" #include "websocket.hpp" -@@ -390,6 +391,67 @@ class WebSocketRule : public BaseRule +@@ -398,6 +399,68 @@ class WebSocketRule : public BaseRule std::function errorHandler; }; @@ -119,10 +119,11 @@ index 65c7b70..0824939 100644 + void validate() override + {} + -+ void handle(const Request&, Response& res, const RoutingParams&) override ++ void handle(const Request&, ++ const std::shared_ptr& asyncResp, ++ const RoutingParams&) override + { -+ res.result(boost::beast::http::status::not_found); -+ res.end(); ++ asyncResp->res.result(boost::beast::http::status::not_found); + } + + void handleUpgrade(const Request& req, Response&, @@ -172,7 +173,7 @@ index 65c7b70..0824939 100644 template struct RuleParameterTraits { -@@ -402,6 +464,14 @@ struct RuleParameterTraits +@@ -410,6 +473,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 02d28833f..37609c154 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,7 +1,7 @@ -From 698d2615c5bc30ab7f89f11ed5659df8bf248ea0 Mon Sep 17 00:00:00 2001 +From bcb80fc9a86555c74b56b5b37615601d3fbfae31 Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Tue, 16 Mar 2021 15:37:24 +0000 -Subject: [PATCH 5/6] Add SSE style subscription support to eventservice +Subject: [PATCH] Add SSE style subscription support to eventservice This commit adds the SSE style eventservice subscription style event. Using this, end user can subscribe for @@ -23,16 +23,16 @@ Change-Id: I7f4b7a34974080739c4ba968ed570489af0474de --- http/http_connection.hpp | 2 +- include/eventservice_sse.hpp | 75 +++++ - .../include/event_service_manager.hpp | 77 ++++- + .../include/event_service_manager.hpp | 109 +++++-- redfish-core/include/server_sent_events.hpp | 291 ------------------ redfish-core/lib/event_service.hpp | 4 +- src/webserver_main.cpp | 2 + - 6 files changed, 149 insertions(+), 302 deletions(-) + 6 files changed, 163 insertions(+), 320 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 2c8bf40..1ab776c 100644 +index fc9fc60..3afb4da 100644 --- a/http/http_connection.hpp +++ b/http/http_connection.hpp @@ -350,7 +350,7 @@ class Connection : @@ -126,7 +126,7 @@ index 0000000..6c98e6e +} // namespace eventservice_sse +} // namespace redfish diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index 5821e2e..f4d57c2 100644 +index fa4e41a..ac644c1 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -23,13 +23,15 @@ @@ -146,7 +146,7 @@ index 5821e2e..f4d57c2 100644 #include #include #include -@@ -46,9 +48,13 @@ using EventServiceConfig = std::tuple; +@@ -46,9 +48,27 @@ using EventServiceConfig = std::tuple; static constexpr const char* eventFormatType = "Event"; static constexpr const char* metricReportFormatType = "MetricReport"; @@ -157,11 +157,50 @@ index 5821e2e..f4d57c2 100644 +static constexpr const uint8_t maxNoOfSubscriptions = 20; +static constexpr const uint8_t maxNoOfSSESubscriptions = 10; + - #ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES - static std::optional inotifyConn; - static constexpr const char* redfishEventLogDir = "/var/log"; -@@ -391,11 +397,9 @@ class Subscription - path, uriProto); ++#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES ++static std::optional inotifyConn; ++static constexpr const char* redfishEventLogDir = "/var/log"; ++static constexpr const char* redfishEventLogFile = "/var/log/redfish"; ++static constexpr const size_t iEventSize = sizeof(inotify_event); ++static int inotifyFd = -1; ++static int dirWatchDesc = -1; ++static int fileWatchDesc = -1; ++ ++// ++using EventLogObjectsType = ++ std::tuple>; ++ + namespace message_registries + { + inline boost::beast::span +@@ -68,24 +88,6 @@ inline boost::beast::span + } + return boost::beast::span(openbmc::registry); + } +-} // namespace message_registries +- +-#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES +-static std::optional inotifyConn; +-static constexpr const char* redfishEventLogDir = "/var/log"; +-static constexpr const char* redfishEventLogFile = "/var/log/redfish"; +-static constexpr const size_t iEventSize = sizeof(inotify_event); +-static int inotifyFd = -1; +-static int dirWatchDesc = -1; +-static int fileWatchDesc = -1; +- +-// +-using EventLogObjectsType = +- std::tuple>; +- +-namespace message_registries +-{ + static const Message* + getMsgFromRegistry(const std::string& messageKey, + const boost::beast::span& registry) +@@ -401,11 +403,9 @@ class Subscription + path); } - Subscription(const std::shared_ptr& adaptor) : @@ -175,7 +214,7 @@ index 5821e2e..f4d57c2 100644 ~Subscription() = default; -@@ -420,7 +424,7 @@ class Subscription +@@ -430,7 +430,7 @@ class Subscription if (sseConn != nullptr) { @@ -184,7 +223,7 @@ index 5821e2e..f4d57c2 100644 } } -@@ -510,6 +514,7 @@ class Subscription +@@ -520,6 +520,7 @@ class Subscription this->sendEvent( msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace)); @@ -192,7 +231,7 @@ index 5821e2e..f4d57c2 100644 } #endif -@@ -565,14 +570,39 @@ class Subscription +@@ -590,14 +591,39 @@ class Subscription return eventSeqNum; } @@ -233,7 +272,7 @@ index 5821e2e..f4d57c2 100644 }; static constexpr const bool defaultEnabledState = true; -@@ -963,6 +993,8 @@ class EventServiceManager +@@ -988,6 +1014,8 @@ class EventServiceManager subValue->updateRetryConfig(retryAttempts, retryTimeoutInterval); subValue->updateRetryPolicy(); @@ -242,7 +281,7 @@ index 5821e2e..f4d57c2 100644 return id; } -@@ -987,11 +1019,40 @@ class EventServiceManager +@@ -1012,11 +1040,40 @@ class EventServiceManager } } @@ -581,7 +620,7 @@ index 578fa19..0000000 - -} // namespace crow diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp -index be6f04d..1875ec9 100644 +index 64a2009..7c9bb7a 100644 --- a/redfish-core/lib/event_service.hpp +++ b/redfish-core/lib/event_service.hpp @@ -34,8 +34,6 @@ static constexpr const std::array supportedResourceTypes = { @@ -603,7 +642,7 @@ index be6f04d..1875ec9 100644 {{"@odata.id", "/redfish/v1/EventService/Subscriptions"}}}, {"Actions", diff --git a/src/webserver_main.cpp b/src/webserver_main.cpp -index 902c32b..c871faa 100644 +index 902c32b..d4bd48c 100644 --- a/src/webserver_main.cpp +++ b/src/webserver_main.cpp @@ -5,6 +5,7 @@ @@ -614,14 +653,14 @@ index 902c32b..c871faa 100644 #include #include #include -@@ -83,6 +84,7 @@ int main(int /*argc*/, char** /*argv*/) +@@ -81,6 +82,7 @@ int main(int /*argc*/, char** /*argv*/) + #endif + #ifdef BMCWEB_ENABLE_REDFISH ++ redfish::eventservice_sse::requestRoutes(app); redfish::requestRoutes(app); redfish::RedfishService redfish(app); -+ redfish::eventservice_sse::requestRoutes(app); - // Create EventServiceManager instance and initialize Config - redfish::EventServiceManager::getInstance(); -- 2.17.1 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 4d99b2754..16e8affa5 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,7 +1,7 @@ -From 82185c52ae6e27cc1e086654a3b7d10e63ecc783 Mon Sep 17 00:00:00 2001 +From dda3c7a46391ef88e7c6a6f61fba7fe9133336bf Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Wed, 17 Mar 2021 01:16:50 +0000 -Subject: [PATCH 6/6] Add EventService SSE filter support +Subject: [PATCH] Add EventService SSE filter support This commit implements the Event Service SSE stream filters support. As per redfish specification: @@ -35,9 +35,9 @@ Change-Id: I55c6f53bb5e57aa1f2d1601f1a16525a33b13bd2 include/eventservice_sse.hpp | 94 ++++++++++++++++++- redfish-core/include/error_messages.hpp | 9 ++ .../include/event_service_manager.hpp | 5 + - redfish-core/lib/event_service.hpp | 4 - + redfish-core/lib/event_service.hpp | 5 - redfish-core/src/error_messages.cpp | 26 +++++ - 5 files changed, 130 insertions(+), 8 deletions(-) + 5 files changed, 130 insertions(+), 9 deletions(-) diff --git a/include/eventservice_sse.hpp b/include/eventservice_sse.hpp index 6c98e6e..ff72c4d 100644 @@ -171,7 +171,7 @@ index 7dfdc80..922dae9 100644 } // namespace redfish diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index f4d57c2..567fb9c 100644 +index ac644c1..3661fed 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 = @@ -180,24 +180,25 @@ index f4d57c2..567fb9c 100644 +static constexpr const std::array supportedEvtFormatTypes = { + eventFormatType, metricReportFormatType}; -+static constexpr const std::array supportedRegPrefixes = { -+ "Base", "OpenBMC", "Task"}; ++static constexpr const std::array supportedRegPrefixes = { ++ "OpenBMC", "TaskEvent"}; + #ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES static std::optional 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 1875ec9..4d1ac9f 100644 +index 7c9bb7a..297a4ea 100644 --- a/redfish-core/lib/event_service.hpp +++ b/redfish-core/lib/event_service.hpp -@@ -19,10 +19,6 @@ +@@ -18,11 +18,6 @@ + namespace redfish { - +- -static constexpr const std::array supportedEvtFormatTypes = { - eventFormatType, metricReportFormatType}; -static constexpr const std::array supportedRegPrefixes = { -- "Base", "OpenBMC", "Task"}; +- "Base", "OpenBMC", "TaskEvent"}; static constexpr const std::array supportedRetryPolicies = { "TerminateAfterRetries", "SuspendRetries", "RetryForever"}; 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 new file mode 100644 index 000000000..0b12671e5 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0007-EventService-Log-events-for-subscription-actions.patch @@ -0,0 +1,132 @@ +From 0a1390428fd6f5651669f4306f6105d33a24453c Mon Sep 17 00:00:00 2001 +From: Ayushi Smriti +Date: Mon, 10 May 2021 13:03:37 +0530 +Subject: [PATCH] EventService: Log events for subscription actions + +Log redfish event for below 3 actions + - Add new subscription + - Update existing subscription properties + - Delete existing subscription +in order to notify the subscribed clients on the subscription related +information. + +Modified method name accordingly to indicate the clear purpose and +added updateSubscription method with subscription id param +to log event for subscription update. + +Tested: + - Performed all the above actions and verified the redfish event + messages are logged. + +Change-Id: I528293e55b1f3401bc2bb09c11c63ae985fbfedb +Signed-off-by: AppaRao Puli +Signed-off-by: Ayushi Smriti +--- + .../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 9952ef1..2b957ea 100644 +--- a/redfish-core/include/event_service_manager.hpp ++++ b/redfish-core/include/event_service_manager.hpp +@@ -22,6 +22,7 @@ + #include "registries/task_event_message_registry.hpp" + + #include ++#include + + #include + #include +@@ -800,7 +801,7 @@ class EventServiceManager + return; + } + +- void updateSubscriptionData() ++ void persistSubscriptionData() + { + // Persist the config and subscription data. + nlohmann::json jsonData; +@@ -897,7 +898,7 @@ class EventServiceManager + + if (updateConfig) + { +- updateSubscriptionData(); ++ persistSubscriptionData(); + } + + if (updateRetryCfg) +@@ -992,7 +993,7 @@ class EventServiceManager + + if (updateFile) + { +- updateSubscriptionData(); ++ persistSubscriptionData(); + } + + #ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES +@@ -1007,6 +1008,13 @@ class EventServiceManager + + // Set Subscription ID for back trace + subValue->setSubscriptionId(id); ++ ++ /* Log event for subscription addition */ ++ sd_journal_send("MESSAGE=Event subscription added(Id: %s)", id.c_str(), ++ "PRIORITY=%i", LOG_INFO, "REDFISH_MESSAGE_ID=%s", ++ "OpenBMC.0.1.EventSubscriptionAdded", ++ "REDFISH_MESSAGE_ARGS=%s", id.c_str(), NULL); ++ + return id; + } + +@@ -1027,7 +1035,14 @@ class EventServiceManager + { + subscriptionsMap.erase(obj); + updateNoOfSubscribersCount(); +- updateSubscriptionData(); ++ ++ persistSubscriptionData(); ++ /* Log event for subscription delete. */ ++ sd_journal_send("MESSAGE=Event subscription removed.(Id = %s)", ++ id.c_str(), "PRIORITY=%i", LOG_INFO, ++ "REDFISH_MESSAGE_ID=%s", ++ "OpenBMC.0.1.EventSubscriptionRemoved", ++ "REDFISH_MESSAGE_ARGS=%s", id.c_str(), NULL); + } + } + +@@ -1049,6 +1064,18 @@ class EventServiceManager + } + } + ++ void updateSubscription(const std::string& id) ++ { ++ persistSubscriptionData(); ++ ++ /* Log event for subscription update. */ ++ sd_journal_send("MESSAGE=Event subscription updated.(Id = %s)", ++ id.c_str(), "PRIORITY=%i", LOG_INFO, ++ "REDFISH_MESSAGE_ID=%s", ++ "OpenBMC.0.1.EventSubscriptionUpdated", ++ "REDFISH_MESSAGE_ARGS=%s", id.c_str(), NULL); ++ } ++ + size_t getNumberOfSubscriptions() + { + return subscriptionsMap.size(); +diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp +index 297a4ea..ed4955e 100644 +--- a/redfish-core/lib/event_service.hpp ++++ b/redfish-core/lib/event_service.hpp +@@ -616,7 +616,7 @@ class EventDestination : public Node + subValue->updateRetryPolicy(); + } + +- EventServiceManager::getInstance().updateSubscriptionData(); ++ EventServiceManager::getInstance().updateSubscription(params[0]); + } + + void doDelete(const std::shared_ptr& asyncResp, +-- +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 3954e89c1..ae010dafb 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 @@ -4,16 +4,16 @@ thee gets merged upstream. Upstream revision information: - EventService : Fix retry handling for http-client - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/40731/18 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/40731/20 - EventService: https client support - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31735/38 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31735/39 - Add Server-Sent-Events support - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41258/5 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41258/6 - Add SSE style subscription support to eventservice - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41319/5 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41319/6 - Add EventService SSE filter support - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41349/2 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41349/3 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch index 03feec633..8b08c6c5e 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch @@ -1,7 +1,7 @@ -From b6ccf463b4cfb8df4a904f06c5f4852029a96c50 Mon Sep 17 00:00:00 2001 -From: "Wludzik, Jozef" -Date: Tue, 15 Dec 2020 12:28:17 +0100 -Subject: [PATCH 3/4] Add support for MetricDefinition scheme +From d664a145a96a642597c74819c183410d4a04fce0 Mon Sep 17 00:00:00 2001 +From: Krzysztof Grobelny +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 @@ -23,16 +23,16 @@ Change-Id: I3086e1302e1ba2e5442d1367939fd5507a0cbc00 --- redfish-core/include/redfish.hpp | 3 + .../include/utils/telemetry_utils.hpp | 2 + - redfish-core/lib/metric_definition.hpp | 283 ++++++++++++++++++ + redfish-core/lib/metric_definition.hpp | 335 ++++++++++++++++++ redfish-core/lib/telemetry_service.hpp | 2 + - 4 files changed, 290 insertions(+) + 4 files changed, 342 insertions(+) create mode 100644 redfish-core/lib/metric_definition.hpp diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp -index aad28ac..dfcb8cd 100644 +index 7a14969..d280a86 100644 --- a/redfish-core/include/redfish.hpp +++ b/redfish-core/include/redfish.hpp -@@ -25,6 +25,7 @@ +@@ -26,6 +26,7 @@ #include "../lib/managers.hpp" #include "../lib/memory.hpp" #include "../lib/message_registries.hpp" @@ -40,7 +40,7 @@ index aad28ac..dfcb8cd 100644 #include "../lib/metric_report.hpp" #include "../lib/metric_report_definition.hpp" #include "../lib/network_protocol.hpp" -@@ -215,6 +216,8 @@ class RedfishService +@@ -219,6 +220,8 @@ class RedfishService nodes.emplace_back(std::make_unique(app)); nodes.emplace_back(std::make_unique(app)); @@ -50,7 +50,7 @@ index aad28ac..dfcb8cd 100644 std::make_unique(app)); nodes.emplace_back(std::make_unique(app)); diff --git a/redfish-core/include/utils/telemetry_utils.hpp b/redfish-core/include/utils/telemetry_utils.hpp -index 0a3af5f..54b5133 100644 +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 @@ -64,12 +64,13 @@ index 0a3af5f..54b5133 100644 constexpr const char* metricReportUri = diff --git a/redfish-core/lib/metric_definition.hpp b/redfish-core/lib/metric_definition.hpp new file mode 100644 -index 0000000..f9c7779 +index 0000000..515fe86 --- /dev/null +++ b/redfish-core/lib/metric_definition.hpp -@@ -0,0 +1,283 @@ +@@ -0,0 +1,335 @@ +#pragma once + ++#include "async_resp.hpp" +#include "node.hpp" +#include "sensors.hpp" +#include "utils/telemetry_utils.hpp" @@ -80,150 +81,138 @@ index 0000000..f9c7779 +namespace utils +{ + ++class AsyncRespWithFinalizer ++{ ++ public: ++ AsyncRespWithFinalizer( ++ const std::shared_ptr& asyncResp) : ++ asyncResp(asyncResp) ++ {} ++ ++ AsyncRespWithFinalizer(const std::shared_ptr& asyncResp, ++ std::function finalizer) : ++ asyncResp(asyncResp), ++ finalizer(std::move(finalizer)) ++ {} ++ ++ AsyncRespWithFinalizer(const AsyncRespWithFinalizer&) = delete; ++ AsyncRespWithFinalizer(AsyncRespWithFinalizer&&) = delete; ++ ++ ~AsyncRespWithFinalizer() ++ { ++ if (finalizer) ++ { ++ try ++ { ++ finalizer(asyncResp->res); ++ } ++ catch (const std::exception& e) ++ { ++ BMCWEB_LOG_ERROR << "Executing finalizer failed: " << e.what(); ++ messages::internalError(asyncResp->res); ++ } ++ } ++ } ++ ++ void setFinalizer(std::function newFinalizer) ++ { ++ finalizer = std::move(newFinalizer); ++ } ++ ++ private: ++ std::shared_ptr asyncResp; ++ std::function finalizer; ++ ++ public: ++ crow::Response& res = asyncResp->res; ++}; ++ +template -+inline void getChassisNames(F&& cb, const std::shared_ptr& asyncResp) ++inline void getChassisNames(F&& cb) +{ + const std::array interfaces = { + "xyz.openbmc_project.Inventory.Item.Board", + "xyz.openbmc_project.Inventory.Item.Chassis"}; + + crow::connections::systemBus->async_method_call( -+ [asyncResp, -+ callback = std::move(cb)](const boost::system::error_code ec, -+ std::vector& chassis) { ++ [callback = std::move(cb)](const boost::system::error_code ec, ++ const std::vector& chassis) { ++ std::vector chassisNames; ++ + if (ec) + { -+ messages::internalError(asyncResp->res); -+ BMCWEB_LOG_DEBUG << "DBus call error: " << ec.value(); ++ callback(ec, chassisNames); + return; + } + -+ std::vector chassisNames; + chassisNames.reserve(chassis.size()); -+ for (const auto& path : chassis) ++ for (const std::string& path : chassis) + { + sdbusplus::message::object_path dbusPath = path; + std::string name = dbusPath.filename(); + if (name.empty()) + { -+ messages::internalError(asyncResp->res); -+ BMCWEB_LOG_ERROR << "Invalid chassis: " << dbusPath.str; ++ callback(boost::system::errc::make_error_code( ++ boost::system::errc::invalid_argument), ++ chassisNames); + return; + } + chassisNames.emplace_back(std::move(name)); + } + -+ callback(chassisNames); ++ 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 telemetry +{ + -+class MetricDefinitionCollectionReduce ++void addMembers(crow::Response& res, ++ const boost::container::flat_map& el) +{ -+ public: -+ MetricDefinitionCollectionReduce( -+ const std::shared_ptr& asyncResp) : -+ asyncResp{asyncResp} -+ {} -+ -+ ~MetricDefinitionCollectionReduce() ++ for (const auto& [_, dbusSensor] : el) + { -+ if (asyncResp->res.result() != boost::beast::http::status::ok) ++ sdbusplus::message::object_path path(dbusSensor); ++ sdbusplus::message::object_path parentPath = path.parent_path(); ++ std::string type = parentPath.filename(); ++ if (type.empty()) + { -+ return; ++ BMCWEB_LOG_ERROR << "Received invalid DBus Sensor Path = " ++ << dbusSensor; ++ continue; + } + -+ nlohmann::json& members = asyncResp->res.jsonValue["Members"]; -+ members = nlohmann::json::array(); ++ nlohmann::json& members = res.jsonValue["Members"]; + -+ for (const std::string& type : dbusTypes) -+ { -+ members.push_back( -+ {{"@odata.id", telemetry::metricDefinitionUri + type}}); -+ } -+ asyncResp->res.jsonValue["Members@odata.count"] = members.size(); -+ } ++ const std::string odataId = ++ telemetry::metricDefinitionUri + std::move(type); + -+ void insert(const boost::container::flat_map& el) -+ { -+ for (const auto& [_, dbusSensor] : el) -+ { -+ sdbusplus::message::object_path path(dbusSensor); -+ sdbusplus::message::object_path parentPath = path.parent_path(); -+ std::string type = parentPath.filename(); -+ if (type.empty()) -+ { -+ BMCWEB_LOG_ERROR << "Received invalid DBus Sensor Path = " -+ << dbusSensor; -+ continue; -+ } ++ const auto it = ++ std::find_if(members.begin(), members.end(), ++ [&odataId](const nlohmann::json& item) { ++ auto kt = item.find("@odata.id"); ++ if (kt == item.end()) ++ { ++ return false; ++ } ++ return kt->get() == odataId; ++ }); + -+ dbusTypes.insert(std::move(type)); -+ } -+ } -+ -+ private: -+ const std::shared_ptr asyncResp; -+ boost::container::flat_set dbusTypes; -+}; -+ -+class MetricDefinitionReduce -+{ -+ public: -+ MetricDefinitionReduce(const std::shared_ptr& asyncResp, -+ const std::string& id) : -+ id(id), -+ pattern{'/' + id + '/'}, asyncResp{asyncResp} -+ {} -+ ~MetricDefinitionReduce() -+ { -+ if (asyncResp->res.result() != boost::beast::http::status::ok) -+ { -+ return; -+ } -+ if (redfishSensors.empty()) ++ if (it == members.end()) + { -+ messages::resourceNotFound(asyncResp->res, "MetricDefinition", id); -+ return; ++ members.push_back({{"@odata.id", odataId}}); + } + -+ asyncResp->res.jsonValue["MetricProperties"] = redfishSensors; -+ asyncResp->res.jsonValue["Id"] = id; -+ asyncResp->res.jsonValue["Name"] = id; -+ asyncResp->res.jsonValue["@odata.id"] = -+ telemetry::metricDefinitionUri + id; -+ asyncResp->res.jsonValue["@odata.type"] = -+ "#MetricDefinition.v1_0_3.MetricDefinition"; -+ asyncResp->res.jsonValue["MetricDataType"] = "Decimal"; -+ asyncResp->res.jsonValue["MetricType"] = "Numeric"; -+ asyncResp->res.jsonValue["IsLinear"] = true; -+ asyncResp->res.jsonValue["Units"] = sensors::toReadingUnits(id); -+ } -+ -+ void insert(const boost::container::flat_map& el) -+ { -+ for (const auto& [redfishSensor, dbusSensor] : el) -+ { -+ if (dbusSensor.find(pattern) != std::string::npos) -+ { -+ redfishSensors.push_back(redfishSensor); -+ } -+ } ++ res.jsonValue["Members@odata.count"] = members.size(); + } ++} + -+ private: -+ const std::string id; -+ const std::string pattern; -+ const std::shared_ptr asyncResp; -+ std::vector redfishSensors; -+}; +} // namespace telemetry + +class MetricDefinitionCollection : public Node @@ -242,52 +231,83 @@ index 0000000..f9c7779 + } + + private: -+ void doGet(crow::Response& res, const crow::Request&, -+ const std::vector&) override ++ void doGet(const std::shared_ptr& asyncResp, ++ const crow::Request&, const std::vector&) override + { -+ res.jsonValue["@odata.type"] = "#MetricDefinitionCollection." -+ "MetricDefinitionCollection"; -+ res.jsonValue["@odata.id"] = ++ asyncResp->res.jsonValue["@odata.type"] = "#MetricDefinitionCollection." ++ "MetricDefinitionCollection"; ++ asyncResp->res.jsonValue["@odata.id"] = + "/redfish/v1/TelemetryService/MetricDefinitions"; -+ res.jsonValue["Name"] = "Metric Definition Collection"; -+ res.jsonValue["Members"] = nlohmann::json::array(); -+ res.jsonValue["Members@odata.count"] = 0; ++ asyncResp->res.jsonValue["Name"] = "Metric Definition Collection"; ++ asyncResp->res.jsonValue["Members"] = nlohmann::json::array(); ++ asyncResp->res.jsonValue["Members@odata.count"] = 0; ++ ++ auto handleRetrieveUriToDbusMap = ++ [asyncResp]( ++ const boost::beast::http::status status, ++ const boost::container::flat_map& ++ uriToDbus) { ++ if (status != boost::beast::http::status::ok) ++ { ++ BMCWEB_LOG_ERROR << "Failed to retrieve URI to dbus " ++ "sensors map with err " ++ << static_cast(status); ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ telemetry::addMembers(asyncResp->res, uriToDbus); ++ }; + -+ auto asyncResp = std::make_shared(res); + utils::getChassisNames( -+ [asyncResp](const std::vector& chassisNames) { -+ auto collectionReduce = std::make_shared< -+ telemetry::MetricDefinitionCollectionReduce>(asyncResp); ++ [handleRetrieveUriToDbusMap = std::move(handleRetrieveUriToDbusMap), ++ asyncResp](boost::system::error_code ec, ++ const std::vector& chassisNames) { ++ if (ec) ++ { ++ messages::internalError(asyncResp->res); ++ BMCWEB_LOG_ERROR << "getChassisNames error: " << ec.value(); ++ return; ++ } ++ + for (const std::string& chassisName : chassisNames) + { + for (const auto& [sensorNode, _] : sensors::dbus::paths) + { -+ BMCWEB_LOG_INFO << "Chassis: " << chassisName -+ << " sensor: " << sensorNode; -+ retrieveUriToDbusMap( -+ chassisName, sensorNode.data(), -+ [asyncResp, collectionReduce]( -+ 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(status); -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ collectionReduce->insert(uriToDbus); -+ }); ++ BMCWEB_LOG_DEBUG << "Chassis: " << chassisName ++ << " sensor: " << sensorNode; ++ retrieveUriToDbusMap(chassisName, sensorNode.data(), ++ handleRetrieveUriToDbusMap); + } + } -+ }, -+ asyncResp); ++ }); + } +}; + ++namespace telemetry ++{ ++ ++void addMetricProperty( ++ utils::AsyncRespWithFinalizer& asyncResp, const std::string& id, ++ const boost::container::flat_map& el) ++{ ++ nlohmann::json& metricProperties = ++ asyncResp.res.jsonValue["MetricProperties"]; ++ ++ for (const auto& [redfishSensor, dbusSensor] : el) ++ { ++ std::string sensorId; ++ if (dbus::utility::getNthStringFromPath(dbusSensor, 3, sensorId)) ++ { ++ if (sensorId == id) ++ { ++ metricProperties.push_back(redfishSensor); ++ } ++ } ++ } ++} ++ ++} // namespace telemetry ++ +class MetricDefinition : public Node +{ + public: @@ -305,65 +325,97 @@ index 0000000..f9c7779 + } + + private: -+ void doGet(crow::Response& res, const crow::Request&, ++ void doGet(const std::shared_ptr& asyncResp, ++ const crow::Request&, + const std::vector& params) override + { -+ auto asyncResp = std::make_shared(res); ++ auto telemetryAsyncResp = ++ std::make_shared(asyncResp); ++ + if (params.size() != 1) + { -+ messages::internalError(asyncResp->res); ++ messages::internalError(telemetryAsyncResp->res); + return; + } + + const std::string& id = params[0]; ++ telemetryAsyncResp->setFinalizer([id](crow::Response& res) { ++ if (res.jsonValue["MetricProperties"].empty()) ++ { ++ messages::resourceNotFound(res, "MetricDefinition", id); ++ } ++ }); ++ ++ telemetryAsyncResp->res.jsonValue["MetricProperties"] = ++ nlohmann::json::array(); ++ telemetryAsyncResp->res.jsonValue["Id"] = id; ++ telemetryAsyncResp->res.jsonValue["Name"] = id; ++ telemetryAsyncResp->res.jsonValue["@odata.id"] = ++ telemetry::metricDefinitionUri + id; ++ telemetryAsyncResp->res.jsonValue["@odata.type"] = ++ "#MetricDefinition.v1_0_3.MetricDefinition"; ++ telemetryAsyncResp->res.jsonValue["MetricDataType"] = "Decimal"; ++ telemetryAsyncResp->res.jsonValue["MetricType"] = "Numeric"; ++ telemetryAsyncResp->res.jsonValue["IsLinear"] = true; ++ telemetryAsyncResp->res.jsonValue["Units"] = ++ sensors::toReadingUnits(id); ++ ++ auto handleRetrieveUriToDbusMap = ++ [telemetryAsyncResp, ++ id](const boost::beast::http::status status, ++ const boost::container::flat_map& ++ uriToDbus) { ++ if (status != boost::beast::http::status::ok) ++ { ++ BMCWEB_LOG_ERROR << "Failed to retrieve URI to dbus " ++ "sensors map with err " ++ << static_cast(status); ++ messages::internalError(telemetryAsyncResp->res); ++ return; ++ } ++ telemetry::addMetricProperty(*telemetryAsyncResp, id, ++ uriToDbus); ++ }; ++ + utils::getChassisNames( -+ [asyncResp, id](const std::vector& chassisNames) { -+ auto definitionGather = -+ std::make_shared( -+ asyncResp, id); ++ [handleRetrieveUriToDbusMap = std::move(handleRetrieveUriToDbusMap), ++ telemetryAsyncResp, ++ id](boost::system::error_code ec, ++ const std::vector& chassisNames) { ++ if (ec) ++ { ++ messages::internalError(telemetryAsyncResp->res); ++ BMCWEB_LOG_ERROR << "getChassisNames error: " << ec.value(); ++ return; ++ } ++ + for (const std::string& chassisName : chassisNames) + { + for (const auto& [sensorNode, dbusPaths] : + sensors::dbus::paths) + { -+ retrieveUriToDbusMap( -+ chassisName, sensorNode.data(), -+ [asyncResp, definitionGather]( -+ 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(status); -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ definitionGather->insert(uriToDbus); -+ }); ++ retrieveUriToDbusMap(chassisName, sensorNode.data(), ++ handleRetrieveUriToDbusMap); + } + } -+ }, -+ asyncResp); ++ }); + } +}; + +} // namespace redfish diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp -index 61ca891..a8c8b03 100644 +index 9ec0737..de9c800 100644 --- a/redfish-core/lib/telemetry_service.hpp +++ b/redfish-core/lib/telemetry_service.hpp @@ -32,6 +32,8 @@ class TelemetryService : public Node - res.jsonValue["Id"] = "TelemetryService"; - res.jsonValue["Name"] = "Telemetry Service"; + asyncResp->res.jsonValue["Id"] = "TelemetryService"; + asyncResp->res.jsonValue["Name"] = "Telemetry Service"; -+ res.jsonValue["MetricDefinitions"]["@odata.id"] = ++ asyncResp->res.jsonValue["MetricDefinitions"]["@odata.id"] = + "/redfish/v1/TelemetryService/MetricDefinitions"; - res.jsonValue["MetricReportDefinitions"]["@odata.id"] = + asyncResp->res.jsonValue["MetricReportDefinitions"]["@odata.id"] = "/redfish/v1/TelemetryService/MetricReportDefinitions"; - res.jsonValue["MetricReports"]["@odata.id"] = + asyncResp->res.jsonValue["MetricReports"]["@odata.id"] = -- 2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch index f2ebce6e3..4119045f1 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch @@ -1,7 +1,7 @@ -From efcd128a3d66fce33200fd4211ba5abf13a81375 Mon Sep 17 00:00:00 2001 +From 0ed9ff4f37e7d3ea81073ad35acd530730104033 Mon Sep 17 00:00:00 2001 From: "Wludzik, Jozef" Date: Tue, 15 Dec 2020 12:30:31 +0100 -Subject: [PATCH 4/4] Sync Telmetry service with EventService +Subject: [PATCH] Sync Telmetry service with EventService Synced the latest changes in Telemetry service with Event Service code. Now assembling MetricReport is covered in single place in @@ -22,7 +22,7 @@ Signed-off-by: Wludzik, Jozef 2 files changed, 69 insertions(+), 115 deletions(-) diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index 148c703..27e41e3 100644 +index c3c110a..dc99cda 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -14,6 +14,7 @@ @@ -33,7 +33,7 @@ index 148c703..27e41e3 100644 #include "node.hpp" #include "registries.hpp" #include "registries/base_message_registry.hpp" -@@ -512,47 +513,32 @@ class Subscription +@@ -529,47 +530,32 @@ class Subscription } #endif @@ -92,7 +92,7 @@ index 148c703..27e41e3 100644 this->sendEvent( msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace)); } -@@ -1348,75 +1334,6 @@ class EventServiceManager +@@ -1421,75 +1407,6 @@ class EventServiceManager } #endif @@ -168,7 +168,7 @@ index 148c703..27e41e3 100644 void unregisterMetricReportSignal() { if (matchTelemetryMonitor) -@@ -1436,9 +1353,11 @@ class EventServiceManager +@@ -1509,9 +1426,11 @@ class EventServiceManager } BMCWEB_LOG_DEBUG << "Metrics report signal - Register"; @@ -183,7 +183,7 @@ index 148c703..27e41e3 100644 matchTelemetryMonitor = std::make_shared( *crow::connections::systemBus, matchStr, -@@ -1449,10 +1368,43 @@ class EventServiceManager +@@ -1522,10 +1441,43 @@ class EventServiceManager return; } @@ -232,14 +232,14 @@ index 148c703..27e41e3 100644 } diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp -index 9caf4a3..e79a41c 100644 +index ad15a05..18a6dcc 100644 --- a/redfish-core/lib/metric_report.hpp +++ b/redfish-core/lib/metric_report.hpp @@ -31,16 +31,14 @@ inline nlohmann::json toMetricValues(const Readings& readings) return metricValues; } --inline void fillReport(const std::shared_ptr& asyncResp, +-inline void fillReport(const std::shared_ptr& asyncResp, - const std::string& id, +inline bool fillReport(nlohmann::json& json, const std::string& id, const std::variant& var) @@ -258,7 +258,7 @@ index 9caf4a3..e79a41c 100644 telemetry::metricReportDefinitionUri + id; const TimestampReadings* timestampReadings = -@@ -48,14 +46,14 @@ inline void fillReport(const std::shared_ptr& asyncResp, +@@ -48,14 +46,14 @@ inline void fillReport(const std::shared_ptr& asyncResp, if (!timestampReadings) { BMCWEB_LOG_ERROR << "Property type mismatch or property is missing"; @@ -277,7 +277,7 @@ index 9caf4a3..e79a41c 100644 } } // namespace telemetry -@@ -146,7 +144,11 @@ class MetricReport : public Node +@@ -145,7 +143,11 @@ class MetricReport : public Node return; } 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 46128f7ae..20c93c08e 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README @@ -3,8 +3,8 @@ Until change is integrated they will be manually merged here to enable feature i Current revisions: - Add support for MetricDefinition scheme - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/33363/60 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/33363/72 - Sync Telmetry service with EventService - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38798/26 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38798/30 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 new file mode 100644 index 000000000..3e3f69d1c --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch @@ -0,0 +1,50 @@ +From 95f002dc969d7d6d64dbf2ee0db7dc1c1c6a9173 Mon Sep 17 00:00:00 2001 +From: Przemyslaw Czarnowski +Date: Thu, 18 Mar 2021 11:30:28 +0100 +Subject: [PATCH] Revert "Disable nbd proxy from the build" + +NBD Proxy has been disabled upstream. Reenable as we use it for Virtual +Media + +This reverts commit efb8062c306474942bc94f15d748b2eb0b58fbb6. +--- + meson.build | 2 +- + meson_options.txt | 9 +-------- + 2 files changed, 2 insertions(+), 9 deletions(-) + +diff --git a/meson.build b/meson.build +index 66a066b..cef0a49 100644 +--- a/meson.build ++++ b/meson.build +@@ -81,7 +81,7 @@ feature_map = { + 'static-hosting' : '-DBMCWEB_ENABLE_STATIC_HOSTING', + 'insecure-tftp-update' : '-DBMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE', + 'validate-unsecure-feature' : '-DBMCWEB_ENABLE_VALIDATION_UNSECURE_FEATURE', +-#'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY', ++'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY', + 'vm-websocket' : '-DBMCWEB_ENABLE_VM_WEBSOCKET', + } + +diff --git a/meson_options.txt b/meson_options.txt +index 9611631..7ee3ebb 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -3,14 +3,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.''') +- +-# if you use this option and are seeing this comment, please comment here: +-# https://github.com/openbmc/bmcweb/issues/188 and put forward your intentions +-# for this code. At this point, no daemon has been upstreamed that implements +-# this interface, so for the moment this appears to be dead code; In leiu of +-# removing it, it has been disabled to try to give those that use it the +-# 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('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.') +-- +2.26.2 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0002-bmcweb-handle-device-or-resource-busy-exception.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0002-bmcweb-handle-device-or-resource-busy-exception.patch new file mode 100644 index 000000000..01c1c858c --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0002-bmcweb-handle-device-or-resource-busy-exception.patch @@ -0,0 +1,219 @@ +From 76480c6a5b1708113f28aecab32a85984371243c Mon Sep 17 00:00:00 2001 +From: Karol Wachowski +Date: Fri, 10 Jul 2020 09:54:06 +0000 +Subject: [PATCH] bmcweb handle device or resource busy exception + +Use async_method_call_timed() for mount/unmount dbus oprations. +Long mount/unmount times are supported by VirtualMedia service, +this works because of settable timeout property, available for each block +device. +Default dbus calls will timeout when mount/unmount timeout is long enough. + +Get mount/unmount timeout property and use it for mount/unmount calls. +Add handling of device or resource busy exception (EBUSY) that +can be thrown by VirtualMedia service during Mount/Unmount dbus operations. + +Tested: Verified that after mounting non-existing HTTPS resource + in proxy mode, VirtualMedia recovers restoring ready state + and returns EBUSY during that transition. + Verfied that resources can be mounted/unmounted in both legacy + and proxy mode. +Signed-off-by: Karol Wachowski +Change-Id: Ica62c34db0cce24c4c6169fc661edfde49e948d0 +--- + redfish-core/lib/virtual_media.hpp | 144 ++++++++++++++++++++++------- + 1 file changed, 110 insertions(+), 34 deletions(-) + +diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp +index 95a8881..188248a 100644 +--- a/redfish-core/lib/virtual_media.hpp ++++ b/redfish-core/lib/virtual_media.hpp +@@ -24,6 +24,8 @@ + #include + #include + ++#include ++ + namespace redfish + + { +@@ -160,6 +162,26 @@ static void vmParseInterfaceObject(const DbusInterfaceType& interface, + } + } + ++/** ++ * @brief parses Timeout property and converts to microseconds ++ */ ++static std::optional ++ vmParseTimeoutProperty(const std::variant& timeoutProperty) ++{ ++ const int* timeoutValue = std::get_if(&timeoutProperty); ++ if (timeoutValue) ++ { ++ constexpr int timeoutMarginSeconds = 10; ++ return std::chrono::duration_cast( ++ std::chrono::seconds(*timeoutValue + timeoutMarginSeconds)) ++ .count(); ++ } ++ else ++ { ++ return std::nullopt; ++ } ++} ++ + /** + * @brief Fill template for Virtual Media Item. + */ +@@ -856,22 +878,54 @@ class VirtualMediaActionInsertMedia : public Node + } + + crow::connections::systemBus->async_method_call( +- [asyncResp, secretPipe](const boost::system::error_code ec, +- bool success) { ++ [asyncResp, service, name, imageUrl, rw, unixFd, ++ secretPipe](const boost::system::error_code ec, ++ const std::variant timeoutProperty) { + if (ec) + { + BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec; + messages::internalError(asyncResp->res); ++ return; + } +- else if (!success) ++ ++ auto timeout = vmParseTimeoutProperty(timeoutProperty); ++ if (timeout == std::nullopt) + { +- BMCWEB_LOG_ERROR << "Service responded with error"; +- messages::generalError(asyncResp->res); ++ BMCWEB_LOG_ERROR << "Timeout property is empty."; ++ messages::internalError(asyncResp->res); ++ return; + } ++ ++ crow::connections::systemBus->async_method_call_timed( ++ [asyncResp, secretPipe](const boost::system::error_code ec, ++ bool success) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "Bad D-Bus request error: " ++ << ec; ++ if (ec == ++ boost::system::errc::device_or_resource_busy) ++ { ++ messages::resourceInUse(asyncResp->res); ++ } ++ else ++ { ++ messages::internalError(asyncResp->res); ++ } ++ } ++ else if (!success) ++ { ++ BMCWEB_LOG_ERROR << "Service responded with error"; ++ messages::generalError(asyncResp->res); ++ } ++ }, ++ service, "/xyz/openbmc_project/VirtualMedia/Legacy/" + name, ++ "xyz.openbmc_project.VirtualMedia.Legacy", "Mount", ++ *timeout, imageUrl, rw, unixFd); + }, + service, "/xyz/openbmc_project/VirtualMedia/Legacy/" + name, +- "xyz.openbmc_project.VirtualMedia.Legacy", "Mount", imageUrl, rw, +- unixFd); ++ "org.freedesktop.DBus.Properties", "Get", ++ "xyz.openbmc_project.VirtualMedia.MountPoint", "Timeout"); + } + }; + +@@ -1003,38 +1057,60 @@ class VirtualMediaActionEjectMedia : public Node + const std::string& service, const std::string& name, + bool legacy) + { +- +- // Legacy mount requires parameter with image ++ std::string objectPath = "/xyz/openbmc_project/VirtualMedia/"; ++ std::string ifaceName = "xyz.openbmc_project.VirtualMedia"; + if (legacy) + { +- crow::connections::systemBus->async_method_call( +- [asyncResp](const boost::system::error_code ec) { +- if (ec) +- { +- BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec; +- +- messages::internalError(asyncResp->res); +- return; +- } +- }, +- service, "/xyz/openbmc_project/VirtualMedia/Legacy/" + name, +- "xyz.openbmc_project.VirtualMedia.Legacy", "Unmount"); ++ objectPath += "Legacy/"; ++ ifaceName += ".Legacy"; + } +- else // proxy ++ else + { +- crow::connections::systemBus->async_method_call( +- [asyncResp](const boost::system::error_code ec) { +- if (ec) +- { +- BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec; +- +- messages::internalError(asyncResp->res); +- return; +- } +- }, +- service, "/xyz/openbmc_project/VirtualMedia/Proxy/" + name, +- "xyz.openbmc_project.VirtualMedia.Proxy", "Unmount"); ++ objectPath += "Proxy/"; ++ ifaceName += ".Proxy"; + } ++ objectPath += name; ++ ++ crow::connections::systemBus->async_method_call( ++ [asyncResp, service, name, objectPath, ++ ifaceName](const boost::system::error_code ec, ++ const std::variant timeoutProperty) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ ++ auto timeout = vmParseTimeoutProperty(timeoutProperty); ++ if (timeout == std::nullopt) ++ { ++ BMCWEB_LOG_ERROR << "Timeout property is empty."; ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ crow::connections::systemBus->async_method_call_timed( ++ [asyncResp](const boost::system::error_code ec) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "Bad D-Bus request error: " ++ << ec; ++ if (ec == ++ boost::system::errc::device_or_resource_busy) ++ { ++ messages::resourceInUse(asyncResp->res); ++ } ++ else ++ { ++ messages::internalError(asyncResp->res); ++ } ++ return; ++ } ++ }, ++ service, objectPath, ifaceName, "Unmount", *timeout); ++ }, ++ service, objectPath, "org.freedesktop.DBus.Properties", "Get", ++ "xyz.openbmc_project.VirtualMedia.MountPoint", "Timeout"); + } + }; + +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch new file mode 100644 index 000000000..41c1c9836 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch @@ -0,0 +1,28 @@ +From d303bfdd6778c43096401ff78fab70f9041cd4cf Mon Sep 17 00:00:00 2001 +From: Karol Wachowski +Date: Thu, 11 Feb 2021 08:35:41 +0000 +Subject: [PATCH] Add ConnectedVia property to virtual media item template + +Tested: Verified that ConnectedVia property is returned and set to + "NotConnected" for disconnected media. + +Signed-off-by: Karol Wachowski +--- + redfish-core/lib/virtual_media.hpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp +index c45fed2..aa7c639 100644 +--- a/redfish-core/lib/virtual_media.hpp ++++ b/redfish-core/lib/virtual_media.hpp +@@ -193,6 +193,7 @@ static nlohmann::json vmItemTemplate(const std::string& name, + item["@odata.id"] = + "/redfish/v1/Managers/" + name + "/VirtualMedia/" + resName; + item["@odata.type"] = "#VirtualMedia.v1_3_0.VirtualMedia"; ++ item["ConnectedVia"] = "NotConnected"; + item["Name"] = "Virtual Removable Media"; + item["Id"] = resName; + item["WriteProtected"] = true; +-- +2.17.1 + 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 new file mode 100644 index 000000000..3a9e67217 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0004-Invalid-status-code-from-InsertMedia-REST-methods.patch @@ -0,0 +1,185 @@ +From 805641a2d189da9befc05168f51cef76da1ba326 Mon Sep 17 00:00:00 2001 +From: Alicja Rybak +Date: Tue, 20 Apr 2021 16:32:37 +0200 +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 +checks which mode is used and set suitable status code: +Not allowed for Legacy and Not found for Proxy. + +Change-Id: Ib4c0a3e9a2a8853caa74c59239d9fcfed99c5e8b +Signed-off-by: Alicja Rybak +--- + redfish-core/lib/virtual_media.hpp | 155 +++++++++++++++++++++++++++++ + 1 file changed, 155 insertions(+) + +diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp +index aa7c639..3e28164 100644 +--- a/redfish-core/lib/virtual_media.hpp ++++ b/redfish-core/lib/virtual_media.hpp +@@ -548,6 +548,161 @@ class VirtualMediaActionInsertMedia : public Node + return true; + } + ++ /** ++ * @brief Function checks if insert media request is Legacy or Proxy type ++ * and sets suitable response code for unsupported REST method. ++ * ++ */ ++ void CheckProxyMode(const std::shared_ptr& aResp, ++ const crow::Request& req, ++ const std::vector& params) ++ { ++ if (params.size() != 2) ++ { ++ messages::internalError(aResp->res); ++ return; ++ } ++ ++ // take resource name from URL ++ const std::string& resName = params[1]; ++ ++ if (params[0] != "bmc") ++ { ++ messages::resourceNotFound(aResp->res, "VirtualMedia.Insert", ++ resName); ++ ++ return; ++ } ++ ++ crow::connections::systemBus->async_method_call( ++ [this, aResp{std::move(aResp)}, req, ++ resName](const boost::system::error_code ec, ++ const GetObjectType& getObjectType) { ++ if (ec) ++ { ++ BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " ++ << ec; ++ aResp->res.result(boost::beast::http::status::not_found); ++ ++ return; ++ } ++ std::string service = getObjectType.begin()->first; ++ BMCWEB_LOG_DEBUG << "GetObjectType: " << service; ++ ++ crow::connections::systemBus->async_method_call( ++ [this, service, resName, req, ++ aResp{aResp}](const boost::system::error_code ec, ++ ManagedObjectType& subtree) { ++ if (ec) ++ { ++ BMCWEB_LOG_DEBUG << "DBUS response error"; ++ ++ return; ++ } ++ ++ for (auto& item : subtree) ++ { ++ std::string thispath = item.first.filename(); ++ if (thispath.empty()) ++ { ++ continue; ++ } ++ ++ if (thispath != resName) ++ { ++ continue; ++ } ++ ++ auto mode = item.first.parent_path(); ++ auto type = mode.parent_path(); ++ if (mode.filename().empty() || ++ type.filename().empty()) ++ { ++ continue; ++ } ++ ++ if (type.filename() != "VirtualMedia") ++ { ++ continue; ++ } ++ ++ // Check if dbus path is Legacy type ++ if (mode.filename() == "Legacy") ++ { ++ BMCWEB_LOG_DEBUG << "InsertMedia only allowed " ++ "with POST method " ++ "in legacy mode"; ++ aResp->res.result(boost::beast::http::status:: ++ method_not_allowed); ++ ++ return; ++ } ++ // Check if dbus path is Proxy type ++ if (mode.filename() == "Proxy") ++ { ++ // Not possible in proxy mode ++ BMCWEB_LOG_DEBUG << "InsertMedia not " ++ "allowed in proxy mode"; ++ aResp->res.result( ++ boost::beast::http::status::not_found); ++ ++ return; ++ } ++ } ++ ++ BMCWEB_LOG_DEBUG << "Parent item not found"; ++ aResp->res.result( ++ boost::beast::http::status::not_found); ++ }, ++ service, "/xyz/openbmc_project/VirtualMedia", ++ "org.freedesktop.DBus.ObjectManager", "GetManagedObjects"); ++ }, ++ "xyz.openbmc_project.ObjectMapper", ++ "/xyz/openbmc_project/object_mapper", ++ "xyz.openbmc_project.ObjectMapper", "GetObject", ++ "/xyz/openbmc_project/VirtualMedia", std::array()); ++ } ++ ++ /** ++ * @brief Function handles GET method request. ++ */ ++ void doGet(const std::shared_ptr& asyncResp, ++ const crow::Request& req, ++ const std::vector& params) override ++ { ++ CheckProxyMode(asyncResp, req, params); ++ } ++ ++ /** ++ * @brief Function handles PATCH method request. ++ */ ++ void doPatch(const std::shared_ptr& asyncResp, ++ const crow::Request& req, ++ const std::vector& params) override ++ { ++ CheckProxyMode(asyncResp, req, params); ++ } ++ ++ /** ++ * @brief Function handles PUT method request. ++ */ ++ void doPut(const std::shared_ptr& asyncResp, ++ const crow::Request& req, ++ const std::vector& params) override ++ { ++ CheckProxyMode(asyncResp, req, params); ++ } ++ ++ /** ++ * @brief Function handles DELETE method request. ++ */ ++ void doDelete(const std::shared_ptr& asyncResp, ++ const crow::Request& req, ++ const std::vector& params) override ++ { ++ CheckProxyMode(asyncResp, req, params); ++ } ++ + /** + * @brief Function handles POST method request. + * +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0005-Set-Inserted-redfish-property-for-not-inserted-resou.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0005-Set-Inserted-redfish-property-for-not-inserted-resou.patch new file mode 100644 index 000000000..3d80aeb20 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0005-Set-Inserted-redfish-property-for-not-inserted-resou.patch @@ -0,0 +1,43 @@ +From 89ca38dbc3433b3b734a20068e599809f3bd7b90 Mon Sep 17 00:00:00 2001 +From: Karol Wachowski +Date: Tue, 23 Feb 2021 15:53:16 +0000 +Subject: [PATCH] Set Inserted redfish property for not inserted resources + +Tested: Verified that Inserted property is returned and set to + "false" for not inserted media. +Signed-off-by: Karol Wachowski +--- + redfish-core/lib/virtual_media.hpp | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp +index 3e28164..4c475b7 100644 +--- a/redfish-core/lib/virtual_media.hpp ++++ b/redfish-core/lib/virtual_media.hpp +@@ -96,6 +96,7 @@ static void + BMCWEB_LOG_DEBUG << "Value Active not found"; + return; + } ++ aResp->res.jsonValue["Inserted"] = *activeValue; + + const std::string* endpointIdValue = + std::get_if(&endpointIdProperty->second); +@@ -107,7 +108,6 @@ static void + aResp->res.jsonValue["Oem"]["OpenBMC"]["WebSocketEndpoint"] = + *endpointIdValue; + aResp->res.jsonValue["TransferProtocolType"] = "OEM"; +- aResp->res.jsonValue["Inserted"] = *activeValue; + if (*activeValue == true) + { + aResp->res.jsonValue["ConnectedVia"] = "Applet"; +@@ -138,7 +138,6 @@ static void + } + + aResp->res.jsonValue["Image"] = *imageUrlValue; +- aResp->res.jsonValue["Inserted"] = *activeValue; + aResp->res.jsonValue["TransferProtocolType"] = + getTransferProtocolTypeFromUri(*imageUrlValue); + +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0006-Bmcweb-handle-permission-denied-exception.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0006-Bmcweb-handle-permission-denied-exception.patch new file mode 100644 index 000000000..efce3e72c --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0006-Bmcweb-handle-permission-denied-exception.patch @@ -0,0 +1,47 @@ +From e7018ea9e3ad1a17e096aec3717a4764c3feac2e Mon Sep 17 00:00:00 2001 +From: Alicja Rybak +Date: Wed, 14 Apr 2021 16:26:59 +0200 +Subject: [PATCH] Bmcweb handle permission denied exception + +Add handling of permission denied exception (EPERM) that +can be thrown by VirtualMedia service during Mount/Unmount dbus operations. + +Tested: +Verified that after mounting/unmounting HTTPS resource twice in a row in legacy mode, +VirtualMedia returns EPERM, which bmcweb handles as 403 status code. + +Change-Id: Ibc18d5ec822c5072605b1fc4651389982002798b +Signed-off-by: Alicja Rybak +--- + redfish-core/lib/virtual_media.hpp | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp +index 4c475b7..8151ac0 100644 +--- a/redfish-core/lib/virtual_media.hpp ++++ b/redfish-core/lib/virtual_media.hpp +@@ -1073,6 +1073,10 @@ class VirtualMediaActionInsertMedia : public Node + { + messages::resourceInUse(asyncResp->res); + } ++ else if (ec == boost::system::errc::permission_denied) ++ { ++ messages::accessDenied(asyncResp->res, "VirtualMedia.Insert"); ++ } + else + { + messages::internalError(asyncResp->res); +@@ -1267,6 +1271,10 @@ class VirtualMediaActionEjectMedia : public Node + { + messages::resourceInUse(asyncResp->res); + } ++ else if (ec == boost::system::errc::permission_denied) ++ { ++ messages::accessDenied(asyncResp->res, "VirtualMedia.Eject"); ++ } + else + { + messages::internalError(asyncResp->res); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0007-Fix-unmounting-image-in-proxy-mode.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0007-Fix-unmounting-image-in-proxy-mode.patch new file mode 100644 index 000000000..88fa89465 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0007-Fix-unmounting-image-in-proxy-mode.patch @@ -0,0 +1,35 @@ +From 6f4b5fc1879f39b0f5fee0838f0ecbc481275d5e Mon Sep 17 00:00:00 2001 +From: Alicja Rybak +Date: Fri, 23 Apr 2021 17:35:52 +0200 +Subject: [PATCH] Fix unmounting image in proxy mode. + +Sometimes Slot0 got higher key than Slot1 and erase function for Slot1 +invalidates elements with keys not less than the erased element. +In that case invalid slot0 will be unmounted. +Change order of calling close() and erase() functions to +unmount correct device. + +Change-Id: I7a40a4518982f697d3eed635cde6d06978149cf0 +Signed-off-by: Alicja Rybak +--- + include/nbd_proxy.hpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp +index 3b28823..897bcf2 100644 +--- a/include/nbd_proxy.hpp ++++ b/include/nbd_proxy.hpp +@@ -439,9 +439,9 @@ inline void requestRoutes(App& app) + BMCWEB_LOG_DEBUG << "No session to close"; + return; + } ++ session->second->close(); + // Remove reference to session in global map + sessions.erase(session); +- session->second->close(); + }) + .onmessage([](crow::websocket::Connection& conn, + const std::string& data, bool) { +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0008-Fix-VM-NBDPROXY-build-issue-with-AsyncResp.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0008-Fix-VM-NBDPROXY-build-issue-with-AsyncResp.patch new file mode 100644 index 000000000..c188b2105 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0008-Fix-VM-NBDPROXY-build-issue-with-AsyncResp.patch @@ -0,0 +1,37 @@ +From d31d913a8c5dbacf6a36407532cf777852099ced Mon Sep 17 00:00:00 2001 +From: AppaRao Puli +Date: Sun, 2 May 2021 11:07:16 +0000 +Subject: [PATCH] Fix VM NBDPROXY build issue with AsyncResp + +8d1b46d7 moves bmcweb to using AsyncResp everywhere, and not have +each individual handler creating its own object. + +This commit fixes the build failure when enabling virtual media +compile flag(BMCWEB_ENABLE_VM_NBDPROXY). This is caused by above +mentioned recent change. + +Tested: + - Build is successful with enabled virtual media flag. + +Signed-off-by: AppaRao Puli +Change-Id: I363a41a08fae9dc05b3553695b96ffd26948f696 +--- + redfish-core/lib/virtual_media.hpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp +index 685ee5c..99542c4 100644 +--- a/redfish-core/lib/virtual_media.hpp ++++ b/redfish-core/lib/virtual_media.hpp +@@ -635,7 +635,7 @@ class VirtualMediaActionInsertMedia : public Node + } + + bool paramsValid = validateParams( +- asyncResp->res, imageUrl, inserted, ++ asyncResp, imageUrl, inserted, + transferMethod, transferProtocolType); + + if (paramsValid == false) +-- +2.17.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 d9b32f5ae..7e9d42228 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend @@ -1,5 +1,5 @@ SRC_URI = "git://github.com/openbmc/bmcweb.git" -SRCREV = "dab0604af234bdd5010407031a01343d6c242edf" +SRCREV = "2ebb9683287cf6b1a2f2cc3c077bd99aceefa8dd" DEPENDS += "boost-url" RDEPENDS_${PN} += "phosphor-nslcd-authority-cert-config" @@ -14,20 +14,33 @@ 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://0004-bmcweb-handle-device-or-resource-busy-exception.patch \ - file://0006-Define-Redfish-interface-Registries-Bios.patch \ - file://0007-BIOS-config-Add-support-for-PATCH-operation.patch \ - file://0008-Add-support-to-ResetBios-action.patch \ - file://0009-Add-support-to-ChangePassword-action.patch \ file://0010-managers-add-attributes-for-Manager.CommandShell.patch \ - file://0034-recommended-fixes-by-crypto-review-team.patch \ file://0011-bmcweb-Add-PhysicalContext-to-Thermal-resources.patch \ file://0012-Log-RedFish-event-for-Invalid-login-attempt.patch \ file://0013-Add-UART-routing-logic-into-host-console-connection-.patch \ + file://0014-recommended-fixes-by-crypto-review-team.patch \ + file://0015-Add-state-sensor-messages-to-the-registry.patch \ + file://0016-Fix-bmcweb-crashes-if-socket-directory-not-present.patch \ + file://0017-Add-msg-registry-for-subscription-related-actions.patch \ " -# Temporary downstream mirror of upstream patch to enable feature in Intel builds. -SRC_URI += "file://0037-Add-state-sensor-messages-to-the-registry.patch \ +# OOB Bios Config: +SRC_URI += "file://biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch \ + file://biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch \ + file://biosconfig/0003-Add-support-to-ResetBios-action.patch \ + file://biosconfig/0004-Add-support-to-ChangePassword-action.patch \ + file://biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.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 \ + 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 \ + file://vm/0005-Set-Inserted-redfish-property-for-not-inserted-resou.patch \ + file://vm/0006-Bmcweb-handle-permission-denied-exception.patch \ + file://vm/0007-Fix-unmounting-image-in-proxy-mode.patch \ + file://vm/0008-Fix-VM-NBDPROXY-build-issue-with-AsyncResp.patch \ " # EventService: Temporary pulled to downstream. See eventservice\README for details @@ -36,26 +49,12 @@ SRC_URI += "file://eventservice/0001-EventService-Fix-retry-handling-for-http-cl file://eventservice/0004-Add-Server-Sent-Events-support.patch \ file://eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch \ file://eventservice/0006-Add-EventService-SSE-filter-support.patch \ + file://eventservice/0007-EventService-Log-events-for-subscription-actions.patch \ " # Temporary downstream mirror of upstream patches, see telemetry\README for details -SRC_URI += "file://telemetry/0003-Add-support-for-MetricDefinition-scheme.patch \ - file://telemetry/0004-Sync-Telmetry-service-with-EventService.patch \ -" - -SRC_URI += "file://0001-Add-ConnectedVia-property-to-virtual-media-item-temp.patch \ - file://0002-Invalid-status-code-from-InsertMedia-REST-methods.patch \ - file://0003-Set-Inserted-redfish-property-for-not-inserted-resou.patch \ - file://0004-Bmcweb-handle-permission-denied-exception.patch \ - file://0005-Fix-unmounting-image-in-proxy-mode.patch \ -" - -SRC_URI += "file://0038-Revert-Disable-nbd-proxy-from-the-build.patch \ - file://0039-Fix-comparison-for-proxy-legacy-mode.patch \ -" - -# Fix to avoid bmcweb crash on VM mount -SRC_URI += "file://0039-Fix-bmcweb-crashes-if-socket-directory-not-present.patch \ +SRC_URI += " file://telemetry/0003-Add-support-for-MetricDefinition-scheme.patch \ + file://telemetry/0004-Sync-Telmetry-service-with-EventService.patch \ " # Temporary fix: Move it to service file diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json index 656207de6..73fb214a2 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json @@ -36,6 +36,7 @@ "name" : "eth0", "is_valid" : true, "active_sessions" : 0, + "is_management_nic" : true, "channel_info" : { "medium_type" : "lan-802.3", "protocol_type" : "ipmb-1.0", diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend index cc9f2d025..a84352929 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend @@ -11,7 +11,7 @@ SMM_DEVICE = "ipmi_kcs4" SYSTEMD_SERVICE_${PN}_append = " ${PN}@${SMM_DEVICE}.service " SRC_URI = "git://github.com/openbmc/kcsbridge.git" -SRCREV = "3b170152ddc967f270939f4c351be987c451f0ca" +SRCREV = "03e6defcbca99c9c00cd37c4afb1d2b415a92acd" SRC_URI += "file://99-ipmi-kcs.rules" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend index 7fe91fd1f..56b581ce7 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 = "d4a4bed525f79c39705fa526b20ab663bb2c2069" +SRCREV = "7b645018775b85a0c61148e592d951841809eef9" USERADD_PACKAGES = "${PN}" # add a group called ipmi diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/leds/phosphor-led-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/leds/phosphor-led-manager_%.bbappend new file mode 100644 index 000000000..83fd20bdb --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/leds/phosphor-led-manager_%.bbappend @@ -0,0 +1,13 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +RDEPENDS_${PN}_remove = "clear-once" + +do_compile_prepend(){ + install -m 0644 ${STAGING_DATADIR_NATIVE}/${PN}/led.yaml ${S} +} + +do_install_append(){ + rm -f ${S}/led.yaml +} + + 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 6c930876f..6881a8065 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb @@ -2,7 +2,7 @@ SUMMARY = "libmctp_intel" DESCRIPTION = "Implementation of MCTP(DMTF DSP0236)" SRC_URI = "git://github.com/Intel-BMC/libmctp.git;protocol=ssh" -SRCREV = "37ea118aa8653cc6220c4fd6da0224f0797f4bdc" +SRCREV = "807b80296c9793900f46ba5675e5e739fc18dafd" 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 ee6fd12ee..67b7d2b42 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb @@ -2,7 +2,7 @@ SUMMARY = "libpldm_intel" DESCRIPTION = "Provides encode/decode APIs for PLDM specifications" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "196f057fe8efea8080ec71ad4159df0675dd6a4c" +SRCREV = "0b73929a2116d9e1386e7e95190787bed7e715a8" S = "${WORKDIR}/git/libpldm_intel" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb index b9d3c0ca4..7527e949d 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=bcd9ada3a943f58551867d72893cc9ab" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "196f057fe8efea8080ec71ad4159df0675dd6a4c" +SRCREV = "5ee1b657ccfc61f4dac4a4d59da62a781065b0ad" S = "${WORKDIR}/git/mctp_emulator" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb index afe199192..f9c2adcb5 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=bcd9ada3a943f58551867d72893cc9ab" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "196f057fe8efea8080ec71ad4159df0675dd6a4c" +SRCREV = "5ee1b657ccfc61f4dac4a4d59da62a781065b0ad" S = "${WORKDIR}/git/mctp_wrapper" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb index 96582c76e..78244d0ba 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://${PN}/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "196f057fe8efea8080ec71ad4159df0675dd6a4c" +SRCREV = "e850d4ad2f72698e51f0a95bb949aa7a6055ccd6" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb index c36c0d926..055b9b7e4 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=615045c30a05cde5c0e924854d43c327" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "196f057fe8efea8080ec71ad4159df0675dd6a4c" +SRCREV = "5ee1b657ccfc61f4dac4a4d59da62a781065b0ad" S = "${WORKDIR}/git/mctpwplus" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/nvmemi-daemon.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/nvmemi-daemon.bb index 8a73394e5..2f0e2c8e7 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/nvmemi-daemon.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/nvmemi-daemon.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" SRC_URI = "git://github.com/Intel-BMC/nvme-mi.git;protocol=ssh" -SRCREV = "832c63d3db86788859f4afb911840f5ba100d230" +SRCREV = "f3ba26e5fd3542d3c30b1069c4c1439a637f42ba" 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 4a2a33878..3d747004a 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" SRC_URI += "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "196f057fe8efea8080ec71ad4159df0675dd6a4c" +SRCREV = "0b73929a2116d9e1386e7e95190787bed7e715a8" S = "${WORKDIR}/git/pldmd" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb index 134cd9fdd..1ad639ba1 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "196f057fe8efea8080ec71ad4159df0675dd6a4c" +SRCREV = "5ee1b657ccfc61f4dac4a4d59da62a781065b0ad" S = "${WORKDIR}/git/pmci_launcher" 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 new file mode 100644 index 000000000..fb38b0348 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0006-CPUSensor-create-RequirediTempSensor-if-defined.patch @@ -0,0 +1,234 @@ +From f516fc884fcbc03bf560b4ef975ad236232bd1e6 Mon Sep 17 00:00:00 2001 +From: Zhikui Ren +Date: Tue, 11 May 2021 11:14:55 -0700 +Subject: [PATCH] CPUSensor: create RequiredTempSensor if defined + +When BMC fails to talk to CPU through PECI, no +CPU sensors are created. Fan speed control only boost +fan when input sensor is not available. It does not +have the knowledge of which sensors are expected to +be present and can't treat "missing" sensor as failed one. +The failure on PECI goes unnoticed and we can have a thermal +run away. + +Query sensor config for RequiredTempSensor for any present +CPUs. Create a CPU sensor that is not available. +This sensor will be replaced by a normal CPU sensor when +peci detect the CPU and associated hwmon file is discovered. + +This is an initial patch that target to address the particular +failure case. More work will follow to support a more generic +"Required" sensor config. + +Signed-off-by: Zhikui Ren +--- + include/CPUSensor.hpp | 9 ++++++ + src/CPUSensor.cpp | 69 +++++++++++++++++++++++++++++++++++++++++++ + src/CPUSensorMain.cpp | 54 ++++++++++++++++++++++++++++----- + 3 files changed, 124 insertions(+), 8 deletions(-) + +diff --git a/include/CPUSensor.hpp b/include/CPUSensor.hpp +index 29b8209..5d09e4e 100644 +--- a/include/CPUSensor.hpp ++++ b/include/CPUSensor.hpp +@@ -26,6 +26,15 @@ class CPUSensor : public Sensor + std::vector&& thresholds, + const std::string& configuration, int cpuId, bool show, + double dtsOffset); ++ ++ // Create a CPUSensor without a path to sensor value ++ CPUSensor(const std::string& objectType, ++ sdbusplus::asio::object_server& objectServer, ++ std::shared_ptr& conn, ++ boost::asio::io_service& io, const std::string& sensorName, ++ std::vector&& thresholdsIn, ++ const std::string& sensorConfiguration); ++ + ~CPUSensor() override; + static constexpr unsigned int sensorScaleFactor = 1000; + static constexpr unsigned int sensorPollMs = 1000; +diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp +index 7f9a2c5..7c29cf0 100644 +--- a/src/CPUSensor.cpp ++++ b/src/CPUSensor.cpp +@@ -99,6 +99,75 @@ CPUSensor::CPUSensor(const std::string& path, const std::string& objectType, + setupRead(); + } + ++// Create a dummy "not available" CPUSensor ++// This is used to indicate a missing required sensor for ++// other services like fan control ++CPUSensor::CPUSensor(const std::string& objectType, ++ sdbusplus::asio::object_server& objectServer, ++ std::shared_ptr& conn, ++ boost::asio::io_service& io, const std::string& sensorName, ++ std::vector&& thresholdsIn, ++ const std::string& sensorConfiguration) : ++ Sensor(boost::replace_all_copy(sensorName, " ", "_"), ++ std::move(thresholdsIn), sensorConfiguration, objectType, 0, 0, conn, ++ PowerState::on), ++ objServer(objectServer), inputDev(io), waitTimer(io), ++ privTcontrol(std::numeric_limits::quiet_NaN()), dtsOffset(0), ++ show(true), pollTime(CPUSensor::sensorPollMs), minMaxReadCounter(0) ++{ ++ // assume it is a temperature sensor for now ++ // support for other type can be added later ++ std::string interfacePath = ++ "/xyz/openbmc_project/sensors/temperature/" + name; ++ const char* units = sensor_paths::unitDegreesC; ++ minValue = -128; ++ maxValue = 127; ++ ++ sensorInterface = objectServer.add_interface( ++ interfacePath, "xyz.openbmc_project.Sensor.Value"); ++ ++ sensorInterface->register_property("Unit", units); ++ sensorInterface->register_property("MaxValue", maxValue); ++ sensorInterface->register_property("MinValue", minValue); ++ sensorInterface->register_property( ++ "Value", value, [&](const double& newValue, double& oldValue) { ++ return setSensorValue(newValue, oldValue); ++ }); ++ if (!sensorInterface->initialize()) ++ { ++ std::cerr << "error initializing value interface\n"; ++ } ++ ++ if (!availableInterface) ++ { ++ availableInterface = std::make_shared( ++ conn, sensorInterface->get_object_path(), availableInterfaceName); ++ availableInterface->register_property( ++ "Available", false, [this](const bool propIn, bool& old) { ++ if (propIn == old) ++ { ++ return 1; ++ } ++ old = propIn; ++ if (!propIn) ++ { ++ updateValue(std::numeric_limits::quiet_NaN()); ++ } ++ return 1; ++ }); ++ availableInterface->initialize(); ++ } ++ if (!operationalInterface) ++ { ++ operationalInterface = ++ std::make_shared( ++ conn, sensorInterface->get_object_path(), ++ operationalInterfaceName); ++ operationalInterface->register_property("Functional", true); ++ operationalInterface->initialize(); ++ } ++} ++ + CPUSensor::~CPUSensor() + { + // close the input dev to cancel async operations +diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp +index 92c1716..4c00551 100644 +--- a/src/CPUSensorMain.cpp ++++ b/src/CPUSensorMain.cpp +@@ -332,10 +332,9 @@ bool createSensors(boost::asio::io_service& io, + { + if (debug) + { +- std::cout << "Skipped: " << inputPath << ": " << sensorName +- << " is already created\n"; ++ std::cout << "Will be replaced: " << inputPath << ": " ++ << sensorName << " is already created\n"; + } +- continue; + } + + // check hidden properties +@@ -636,9 +635,9 @@ void detectCpuAsync( + }); + } + +-bool getCpuConfig(const std::shared_ptr& systemBus, ++bool getCpuConfig(std::shared_ptr& systemBus, + boost::container::flat_set& cpuConfigs, +- ManagedObjectType& sensorConfigs, ++ ManagedObjectType& sensorConfigs, boost::asio::io_service& io, + sdbusplus::asio::object_server& objectServer) + { + bool useCache = false; +@@ -700,6 +699,45 @@ bool getCpuConfig(const std::shared_ptr& systemBus, + iface->register_property("Present", *present); + iface->initialize(); + inventoryIfaces[name] = std::move(iface); ++ if (*present) ++ { ++ // create required CPU sensors here in unavailable state ++ auto findRequiredTempSensor = ++ config.second.find("RequiredTempSensor"); ++ auto findCpuId = config.second.find("CpuID"); ++ if (findRequiredTempSensor != config.second.end() && ++ findCpuId != config.second.end()) ++ { ++ std::string label = ++ std::visit(VariantToStringVisitor(), ++ findRequiredTempSensor->second); ++ // for temp sensor hwmon sysfs use input ++ std::string item{"input"}; ++ int cpuId = ++ std::visit(VariantToUnsignedIntVisitor(), ++ findCpuId->second); ++ std::string requiredSensorName = ++ createSensorName(label, item, cpuId); ++ ++ auto& sensorPtr = gCpuSensors[requiredSensorName]; ++ if (sensorPtr == nullptr) ++ { ++ // created a dummy sensor for required sensor, ++ // will be replaced with a real one if it is ++ // detected ++ std::string objectType{}; ++ std::vector ++ emptyThreshold{}; ++ std::string emptyConfig{}; ++ sensorPtr = std::make_unique( ++ objectType, objectServer, systemBus, io, ++ requiredSensorName, ++ std::move(emptyThreshold), emptyConfig); ++ std::cout << "created required CPU sensor " ++ << requiredSensorName << "\n"; ++ } ++ } ++ } + } + + auto findBus = config.second.find("Bus"); +@@ -728,7 +766,6 @@ bool getCpuConfig(const std::shared_ptr& systemBus, + std::cout << "name: " << name << "\n"; + std::cout << "type: " << type << "\n"; + } +- + cpuConfigs.emplace(bus, addr, name, State::OFF); + } + } +@@ -764,7 +801,8 @@ int main() + return; // we're being canceled + } + +- if (getCpuConfig(systemBus, cpuConfigs, sensorConfigs, objectServer)) ++ if (getCpuConfig(systemBus, cpuConfigs, sensorConfigs, io, ++ objectServer)) + { + detectCpuAsync(pingTimer, creationTimer, io, objectServer, + systemBus, cpuConfigs, sensorConfigs); +@@ -792,7 +830,7 @@ int main() + return; // we're being canceled + } + +- if (getCpuConfig(systemBus, cpuConfigs, sensorConfigs, ++ if (getCpuConfig(systemBus, cpuConfigs, sensorConfigs, io, + objectServer)) + { + detectCpuAsync(pingTimer, creationTimer, io, objectServer, +-- +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 c00b5d4cf..361e425e5 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend @@ -1,7 +1,7 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" PROJECT_SRC_DIR := "${THISDIR}/${PN}" -SRCREV = "6b6891c52e550c42507d4b413cbc4c6a09235535" +SRCREV = "13b63f8f597d396db8b5bd182ac2e5814d599e2f" #SRC_URI = "git://github.com/openbmc/dbus-sensors.git" SRC_URI += "\ @@ -11,6 +11,7 @@ SRC_URI += "\ file://0003-Fix-missing-threshold-de-assert-event-when-threshold.patch \ file://0004-Fan-Tach-Sensor-Threshold-Ignore-Zero.patch \ file://0005-Fix-PECI-ioctl-number.patch \ + file://0006-CPUSensor-create-RequirediTempSensor-if-defined.patch \ " DEPENDS_append = " libgpiod libmctp" 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 c77e5ace6..adcdd0588 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb @@ -9,7 +9,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/special-mode-manager.git;protocol=ssh" -SRCREV = "32ea1e19df9e5179054d87617468664367dfab80" +SRCREV = "4f4f122790b999dc7db973a80727dbc1ca785e57" 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/system/callback-manager.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb index 0dae2be3c..e0e10f7b7 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 = "291d6388e0b770e89091935bc4edc7f371874666" +SRCREV = "52639bebada24990c3514786d65598dc5557477a" 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 42f23dd9e..34a93fb6c 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend @@ -1,6 +1,6 @@ SRC_URI = "git://github.com/openbmc/telemetry.git" -SRCREV = "f763c9e3bbe0f86a4a41e7bb0dc70bffde0af9b2" +SRCREV = "32859b634e366a015331fb8ab62766340df9c7b8" -EXTRA_OEMESON += " -Dmax-reports=5" +EXTRA_OEMESON += " -Dmax-reports=10" EXTRA_OEMESON += " -Dmax-reading-parameters=200" -EXTRA_OEMESON += " -Dmin-interval=5000" +EXTRA_OEMESON += " -Dmin-interval=1000" 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 c9f14f54c..43fd25df4 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend @@ -1,7 +1,7 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" SRC_URI = "git://github.com/openbmc/phosphor-user-manager" -SRCREV = "18c1b42c1612e0e8d8f5cd9973bba09b447c7185" +SRCREV = "e6500a493a156dd58a92b384c77aef2cbd3addac" EXTRA_OECONF += "${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'allow-root-login' ], '', '--disable-root_user_mgmt', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch index a634b1588..07ac95c89 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch @@ -1,4 +1,4 @@ -From 67797d726b6eb6fa8e1dad063c7d2021cec47ab3 Mon Sep 17 00:00:00 2001 +From 5760937ef1ae9a4610b47ba64fdebe594fc2c9df Mon Sep 17 00:00:00 2001 From: James Feist Date: Mon, 17 Jun 2019 12:00:58 -0700 Subject: [PATCH] Customize phosphor-watchdog for Intel platforms @@ -22,14 +22,14 @@ Signed-off-by: Sunita Kumari %% original patch: 0001-Customize-phosphor-watchdog-for-Intel-platforms.patch --- - watchdog.cpp | 230 ++++++++++++++++++++++++++++++++++++++++++++++++--- - watchdog.hpp | 23 +++++- + src/watchdog.cpp | 230 ++++++++++++++++++++++++++++++++++++++++++++--- + src/watchdog.hpp | 23 ++++- 2 files changed, 242 insertions(+), 11 deletions(-) -diff --git a/watchdog.cpp b/watchdog.cpp -index 57e9050..1204db4 100644 ---- a/watchdog.cpp -+++ b/watchdog.cpp +diff --git a/src/watchdog.cpp b/src/watchdog.cpp +index 57e905059153..1204db4cab0f 100644 +--- a/src/watchdog.cpp ++++ b/src/watchdog.cpp @@ -1,11 +1,14 @@ #include "watchdog.hpp" @@ -300,10 +300,10 @@ index 57e9050..1204db4 100644 } catch (const SdBusError& e) { -diff --git a/watchdog.hpp b/watchdog.hpp -index 7de9bb3..b004b7a 100644 ---- a/watchdog.hpp -+++ b/watchdog.hpp +diff --git a/src/watchdog.hpp b/src/watchdog.hpp +index 7de9bb38419c..b004b7ab4e3f 100644 +--- a/src/watchdog.hpp ++++ b/src/watchdog.hpp @@ -68,7 +68,18 @@ class Watchdog : public WatchdogInherits WatchdogInherits(bus, objPath), bus(bus), actionTargetMap(std::move(actionTargetMap)), 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 7ebf1d4d6..618f4dddb 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 = "5ed21f2d1e8b82be699a623bfdef550dfd598dbb" +SRCREV = "71114feb9a800d42f6eeddfa477077a8ab8e44f6" do_compile_prepend() { cp -vf ${S}/.env.intel ${S}/.env -- cgit v1.2.3