History log of /openbmc/bmcweb/redfish-core/lib/sensors.hpp (Results 1 – 25 of 181)
Revision Date Author Comments
# daadfb2e 20-Dec-2024 Ed Tanous <etanous@nvidia.com>

Fix clang-tidy

Change-Id: Iefe1b695b86a640d8dfaafd1f77f374fa34246de
Signed-off-by: Ed Tanous <etanous@nvidia.com>


# deae6a78 11-Nov-2024 Ed Tanous <etanous@nvidia.com>

Move getProperty calls to utility

Having all dbus calls run through the same utility reduces the amount of
generated code, and more importantly, gives us a place where we can log
the requests and re

Move getProperty calls to utility

Having all dbus calls run through the same utility reduces the amount of
generated code, and more importantly, gives us a place where we can log
the requests and responses to help with debugging.

Tested: Redfish service validator passes.

Change-Id: Ic1bf45130b5069cd57f7af26e12c8d3159c87c67
Signed-off-by: Ed Tanous <etanous@nvidia.com>

show more ...


# afc474ae 09-Oct-2024 Myung Bae <myungbae@us.ibm.com>

Format readjson

clang-format may potentially reformat the readJson calls if they may
have more keys or key names are longer. This makes formatting in a way
that's readable by forcing to break a line

Format readjson

clang-format may potentially reformat the readJson calls if they may
have more keys or key names are longer. This makes formatting in a way
that's readable by forcing to break a line for each key using an
empty-comment (`//`) each line.

It also allows trivially alphabetizing the list such that new additions
are less likely to have merge conflicts.

Tested:
- Check whitespace only.
- Code compiles.
- Redfish Service Validator with the same results before this

Change-Id: I3824a8c4faa9fa7c820d5d2fab6b565404926e2c
Signed-off-by: Ed Tanous <etanous@nvidia.com>
Signed-off-by: Myung Bae <myungbae@us.ibm.com>

show more ...


# 4e196b9a 27-Sep-2024 Ed Tanous <etanous@nvidia.com>

json utility: Update sort algorithms

Modified sort utility to be able to sort on a specified key.
New utility function sortJsonArrayByKey() added.

Note:
- Function odataObjectCmp() renamed to obje

json utility: Update sort algorithms

Modified sort utility to be able to sort on a specified key.
New utility function sortJsonArrayByKey() added.

Note:
- Function odataObjectCmp() renamed to objectKeyCmp()
- New function odataObjectCmp() created which calls objectKeyCmp() with
@odata.id key specified.
- Comments for odataObjectCmp() didn't match behavior for object
without key. These objects are sorted as less than objects with the
key.
- sortJSONResponse() modified to use the new sortJsonArrayByKey().

Tested:
- Added new unit tests. These tests are in addition to the existing
tests. So they focus on testing comparing by different keys.
The existing tests already cover the different permutations of the
basic comparisons.
- Redfish Service validator passes

Change-Id: I949b7cb868c59a8eeda3798e6a82a1572bbc5792
Signed-off-by: Ed Tanous <etanous@nvidia.com>
Signed-off-by: Janet Adkins <janeta@us.ibm.com>

show more ...


# 6be832e2 10-Sep-2024 Ed Tanous <etanous@nvidia.com>

Remove duplicated block comments

Static analysis flags that these two comments are redundant[1], which
seem to be duplicated a lot in copyright headers. Although there is a
larger discussion that c

Remove duplicated block comments

Static analysis flags that these two comments are redundant[1], which
seem to be duplicated a lot in copyright headers. Although there is a
larger discussion that can likely be had.

[1] https://sonarcloud.io/project/issues?issueStatuses=OPEN%2CCONFIRMED&id=edtanous_bmcweb&open=AY9_HYjgKXKyw1ZFwgVP

Tested: Comment change only. Code compiles.

Change-Id: Ia960317761f558a87842347ca0b5f3da63f8e730
Signed-off-by: Ed Tanous <etanous@nvidia.com>

show more ...


# 4ff0f1f4 04-Sep-2024 Ed Tanous <etanous@nvidia.com>

static -> inline

Declaring a function static in a header makes no sense, because a header
isn't a compile unit. Find all the issues and replace them with inline.

Change-Id: Icfc2b72d94b41a3a880da1

static -> inline

Declaring a function static in a header makes no sense, because a header
isn't a compile unit. Find all the issues and replace them with inline.

Change-Id: Icfc2b72d94b41a3a880da1ae6975beaa30a6792b
Signed-off-by: Ed Tanous <etanous@nvidia.com>

show more ...


# f836c1d8 06-Sep-2024 Ed Tanous <etanous@nvidia.com>

Fix static analysis

Making these const means that we can no longer use std::move on this
struct, which static analysis flags.

[1] https://sonarcloud.io/project/issues?impactSeverities=HIGH&issueSta

Fix static analysis

Making these const means that we can no longer use std::move on this
struct, which static analysis flags.

[1] https://sonarcloud.io/project/issues?impactSeverities=HIGH&issueStatuses=OPEN%2CCONFIRMED&tags=since-c%2B%2B11&types=CODE_SMELL&id=edtanous_bmcweb&open=AZHJOZJsIkxRoiGIkzZz

Change-Id: I10c33f37ce14650962a7840729d75639ee8edb2e
Signed-off-by: Ed Tanous <etanous@nvidia.com>

show more ...


# 4e0d8789 06-Sep-2024 Ed Tanous <etanous@nvidia.com>

Fix std::forwards

Static analyzer flags that these are wrong. Should only std::forward on
the same thing that's passed

[1] https://sonarcloud.io/project/issues?severities=BLOCKER%2CCRITICAL%2CMAJO

Fix std::forwards

Static analyzer flags that these are wrong. Should only std::forward on
the same thing that's passed

[1] https://sonarcloud.io/project/issues?severities=BLOCKER%2CCRITICAL%2CMAJOR%2CMINOR&sinceLeakPeriod=true&issueStatuses=OPEN%2CCONFIRMED&types=BUG&id=edtanous_bmcweb&open=AZHJOZJsIkxRoiGIkzaq

Change-Id: Ib2b77a0c56e5dbf9e0d038f0eb1361ccce7ac1d9
Signed-off-by: Ed Tanous <etanous@nvidia.com>

show more ...


# 0c728b42 29-Aug-2024 Janet Adkins <janeta@us.ibm.com>

Sensors: Add enum for chassis sub nodes

Added ChassisSubNode enum for defining the different chassis subNode
paths to retrieving sensor data.

Modified path building sensor data to use the enum. Oth

Sensors: Add enum for chassis sub nodes

Added ChassisSubNode enum for defining the different chassis subNode
paths to retrieving sensor data.

Modified path building sensor data to use the enum. Other paths were
left still using the string. Specifically the paths using
SensorsAsyncResp as these primarily use the strings for human readable
output.

Added utility functions to convert to/from enum to string value.
Added unit tests for new utility functions.

Tested:
- Verified sensor paths before and after change had no change:
- /redfish/v1/Chassis/chassis/Sensors
- /redfish/v1/Chassis/chassis/Thermal
- /redfish/v1/Chassis/chassis/Power
- Selection of: /redfish/v1/Chassis/chassis/Sensors/<sensor>
- /redfish/v1/Chassis/chassis/Sensors?\$expand=*
- Redfish Validator passes

Change-Id: I02bb5f3c0c49d85dbd1dff911d9f1a8467d6b1db
Signed-off-by: Janet Adkins <janeta@us.ibm.com>

show more ...


# c9563608 28-Aug-2024 Janet Adkins <janeta@us.ibm.com>

Sensors: Move objectPropertiesToJson() to sensor_utils

This commit move objectPropertiesToJson() to the sensor_utils class.
This is in preparation for building sensor excerpts using the same code
wh

Sensors: Move objectPropertiesToJson() to sensor_utils

This commit move objectPropertiesToJson() to the sensor_utils class.
This is in preparation for building sensor excerpts using the same code
which builds a sensor. By moving the function into the sensor utility
class it should help with compile time by not needing to include all of
sensor code by the files implementing the excerpts.

Additional functions and definitions were moved into the sensor_utils
class as well due to dependencies from objectPropertiesToJson().

Tested:
- Confirmed output unchanged for following URI:
- /redfish/v1/Chassis/chassis/Sensors
- Selection of: /redfish/v1/Chassis/chassis/Sensors/<sensorId>
- /redfish/v1/Chassis/chassis/Sensors?\$expand=*
- Redfish Validator passes

Change-Id: I563a560b5b2760e0421c1402d51216101af40be2
Signed-off-by: Janet Adkins <janeta@us.ibm.com>

show more ...


# 1516c21b 14-Aug-2024 Janet Adkins <janeta@us.ibm.com>

Sensors: Create utility class for sensors

Create a separate utility class for sensors. The goal is to make these
functions easily available for use outside of sensors for paths which
need reference

Sensors: Create utility class for sensors

Create a separate utility class for sensors. The goal is to make these
functions easily available for use outside of sensors for paths which
need reference sensors.

Moved splitSensorNameAndType() into new utility class.

Created new utility function getSensorId(). The Id for a sensor is
built from its name and type in a few different locations. These are
modified to call the new function. The function has also been
simplified to use std::format() to build the Id.

Tested:
- Checked before and after results for queries using this function:
(Note: I was not able to confirm the setSensorsOverride() caller as
it is only being used for redfish-allow-deprecated-power-thermal
URI.)
'''
- https://${bmc}/redfish/v1/Chassis/chassis/Sensors
- https://${bmc}/redfish/v1/Chassis/chassis/Sensors/<str>
where <str> was sensors of different types
- https://${bmc}/redfish/v1/Chassis/chassis/Sensors?\$expand=*
- https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans
- https://${bmc}/redfish/v1/Chassis/chassis/PowerSubsystem/PowerSupplies
'''
- Redfish Validator passed

Change-Id: Ifa200b6e63f8e52d47f70c33d350999f5c527bbd
Signed-off-by: Janet Adkins <janeta@us.ibm.com>

show more ...


# bd79bce8 16-Aug-2024 Patrick Williams <patrick@stwcx.xyz>

clang-format: re-format for clang-18

clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda forma

clang-format: re-format for clang-18

clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.

See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.

Change-Id: Iceec1dc95b6c908ec6c21fb40093de9dd18bf11a
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...


# 539d8c6b 19-Jun-2024 Ed Tanous <ed@tanous.net>

Consistently use generated enumerations

This commit causes all of Redfish to use generated enum values for enum
types. Using generated code prevents problems, and makes it more clear
what types are

Consistently use generated enumerations

This commit causes all of Redfish to use generated enum values for enum
types. Using generated code prevents problems, and makes it more clear
what types are allowed.

Doing this found two places where we had structs that didn't fulfill the
schema. They have been commented, but will be fixed with a breaking
change at some point in the future.

Tested: WIP

Change-Id: I5fdd2f2dfb6ec05606a522e1f4e331f982c8e476
Signed-off-by: Ed Tanous <ed@tanous.net>

show more ...


# e93abac6 14-Jun-2024 Ginu George <ginugeorge@ami.com>

Pass redfishPropertyName earlier argument

It was pointed out that the setDbusProperty method should have an end
that approximately matches dbus-send and busctl set-property in its
arguments, to aid

Pass redfishPropertyName earlier argument

It was pointed out that the setDbusProperty method should have an end
that approximately matches dbus-send and busctl set-property in its
arguments, to aid with debug. This seems reasonable.

Tested: Redfish service validator passes.

Change-Id: Ic20295d93c71c957e3e76704e1eda9da187861b1
Signed-off-by: Ginu George <ginugeorge@ami.com>
Signed-off-by: Ed Tanous <ed@tanous.net>

show more ...


# 25b54dba 17-Apr-2024 Ed Tanous <ed@tanous.net>

Bring consistency to config options

The configuration options that exist in bmcweb are an amalgimation of
CROW options, CMAKE options using #define, pre-bmcweb ifdef mechanisms
and meson options usi

Bring consistency to config options

The configuration options that exist in bmcweb are an amalgimation of
CROW options, CMAKE options using #define, pre-bmcweb ifdef mechanisms
and meson options using a config file. This history has led to a lot of
different ways to configure code in the codebase itself, which has led
to problems, and issues in consistency.

ifdef options do no compile time checking of code not within the branch.
This is good when you have optional dependencies, but not great when
you're trying to ensure both options compile.

This commit moves all internal configuration options to:
1. A namespace called bmcweb
2. A naming scheme matching the meson option. hyphens are replaced with
underscores, and the option is uppercased. This consistent transform
allows matching up option keys with their code counterparts, without
naming changes.
3. All options are bool true = enabled, and any options with _ENABLED or
_DISABLED postfixes have those postfixes removed. (note, there are
still some options with disable in the name, those are left as-is)
4. All options are now constexpr booleans, without an explicit compare.

To accomplish this, unfortunately an option list in config/meson.build
is required, given that meson doesn't provide a way to dump all options,
as is a manual entry in bmcweb_config.h.in, in addition to the
meson_options. This obsoletes the map in the main meson.build, which
helps some of the complexity.

Now that we've done this, we have some rules that will be documented.
1. Runtime behavior changes should be added as a constexpr bool to
bmcweb_config.h
2. Options that require optionally pulling in a dependency shall use an
ifdef, defined in the primary meson.build. (note, there are no
options that currently meet this class, but it's included for
completeness.)

Note, that this consolidation means that at configure time, all options
are printed. This is a good thing and allows direct comparison of
configs in log files.

Tested: Code compiles
Server boots, and shows options configured in the default build. (HTTPS,
log level, etc)

Change-Id: I94e79a56bcdc01755036e4e7278c7e69e25809ce
Signed-off-by: Ed Tanous <ed@tanous.net>

show more ...


# 8cb2c024 27-Mar-2024 Ed Tanous <ed@tanous.net>

Fix moves/forward

Clang has new checks for std::move/std::forward correctness, which
catches quite a few "wrong" things where we were making copies of
callback handlers.

Unfortunately, the lambda s

Fix moves/forward

Clang has new checks for std::move/std::forward correctness, which
catches quite a few "wrong" things where we were making copies of
callback handlers.

Unfortunately, the lambda syntax of

callback{std::forward<Callback>(callback)}

in a capture confuses it, so change usages to
callback = std::forward<Callback>(callback)

to be consistent.

Tested: Redfish service validator passes.

Change-Id: I7a111ec00cf78ecb7d5f5b102c786c1c14d74384
Signed-off-by: Ed Tanous <ed@tanous.net>

show more ...


# 4da0490b 19-Mar-2024 Ed Tanous <ed@tanous.net>

Use no-switch-default on clang

clang-18 improves this check so that we can actually use it. Enable it
and fix all violations.

Change-Id: Ibe4ce19c423d447a4cbe593d1abba948362426af
Signed-off-by: Ed

Use no-switch-default on clang

clang-18 improves this check so that we can actually use it. Enable it
and fix all violations.

Change-Id: Ibe4ce19c423d447a4cbe593d1abba948362426af
Signed-off-by: Ed Tanous <ed@tanous.net>

show more ...


# d02aad39 13-Feb-2024 Ed Tanous <ed@tanous.net>

Create Redfish specific setProperty call

There are currently 78 sdbusplus::asio::setProperty calls in
redfish-core. The error handler for nearly all of them looks something
like:

```
if (ec)
{

Create Redfish specific setProperty call

There are currently 78 sdbusplus::asio::setProperty calls in
redfish-core. The error handler for nearly all of them looks something
like:

```
if (ec)
{
const sd_bus_error* dbusError = msg.get_error();
if ((dbusError != nullptr) &&
(dbusError->name ==
std::string_view(
"xyz.openbmc_project.Common.Error.InvalidArgument")))
{
BMCWEB_LOG_WARNING("DBUS response error: {}", ec);
messages::propertyValueIncorrect(asyncResp->res, "<PropertyName>", <PropertyValue>);
return;
}
messages::internalError(asyncResp->res);
return;
}
messages::success(asyncResp->res);

```

In some cases there are more errors handled that translate to more error
messages, but the vast majority only handle InvalidArgument. Many of
these, like the ones in account_service.hpp, do the error handling in a
lambda, which causes readability problems. This commit starts to make
things more consistent, and easier for trivial property sets.

This commit invents a setDbusProperty method in the redfish namespace
that tries to handle all DBus errors in a consistent manner. Looking
for input on whether this will work before changing over the other 73
calls. Overall this is less code, fewer inline lambdas, and defaults
that should work for MOST use cases of calling an OpenBMC daemon, and
fall back to more generic errors when calling a "normal" dbus daemon.

As part of this, I've ported over several examples. Some things that
might be up in the air:
1. Do we always return 204 no_content on property sets? Today there's a
mix of 200, with a Base::Success message, and 204, with an empty body.
2. Do all DBus response codes map to the same error? A majority are
covered by xyz.openbmc_project.Common.Error.InvalidArgument, but there
are likely differences. If we allow any daemon to return any return
code, does that cause compatibility problems later?

Tested:
```
curl -k --user "root:0penBmc" -H "Content-Type: application/json" -X PATCH -d '{"HostName":"openbmc@#"}' https://192.168.7.2/redfish/v1/Managers/bmc/EthernetInterfaces/eth0
```

Returns the appropriate error in the response
Base.1.16.0.PropertyValueIncorrect

Change-Id: If033a1112ba516792c9386c997d090c8f9094f3a
Signed-off-by: Ed Tanous <ed@tanous.net>

show more ...


# 0885057c 06-Mar-2024 Ed Tanous <ed@tanous.net>

Clean up power/thermal to use readJsonObject

Change-Id: I69ed29472b209e8782be63c3f0f2e8ca63dc14a4
Signed-off-by: Ed Tanous <ed@tanous.net>


# 6f4bd290 08-Mar-2024 Alexander Hansen <alexander.hansen@9elements.com>

fix usage of std::ranges::replace_copy

As hinted at in the usage example [1], the destination range must
have sufficient size to contain the elements.

If the destination range has size 0, then it w

fix usage of std::ranges::replace_copy

As hinted at in the usage example [1], the destination range must
have sufficient size to contain the elements.

If the destination range has size 0, then it will be empty after the
function call. Then the "Name" property in powersupply json will be ""
and there will only be one powersupply because of the deduplication
code.

Tested: Powersupplies appear as usual

References:

[1] https://en.cppreference.com/w/cpp/algorithm/ranges/replace_copy

Change-Id: I81dd21a2dd6eb9b29a67007d6d6229d3a752690f
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>

show more ...


# aaf08ac7 04-Oct-2023 Matt Simmering <matthew.simmering@intel.com>

Add StandbyOffline to Redfish sensor getState

Currently in Redfish a sensor's state will only be "Absent" or
"Enabled". In the case where a sensor is marked as not available on
D-Bus it would be mo

Add StandbyOffline to Redfish sensor getState

Currently in Redfish a sensor's state will only be "Absent" or
"Enabled". In the case where a sensor is marked as not available on
D-Bus it would be more accurate and informative to have the state as
"StandbyOffline". A sensor's availability will be published on its
xyz.openbmc_project.State.Decorator.Availability interface.

Tested on Intel system. Put sensors into an unavailable state by
putting CPU into S5 power state, and verified that Redfish state is
"StandbyOffline". Then when sensors are back in an available state
their Redfish state is back to "Enabled".

Change-Id: I4b846b678a0f90f60d182ac38f1becd21265cdd2
Signed-off-by: Matt Simmering <matthew.simmering@intel.com>

show more ...


# 18f8f608 18-Jul-2023 Ed Tanous <edtanous@google.com>

Remove some boost includes

The less we rely on boost, and more on std algorithms, the less people
have to look up, and the more likely that our code will deduplicate.

Replace all uses of boost::alg

Remove some boost includes

The less we rely on boost, and more on std algorithms, the less people
have to look up, and the more likely that our code will deduplicate.

Replace all uses of boost::algorithms with std alternatives.

Tested: Redfish Service Validator passes.

Change-Id: I8a26f39b5709adc444b4178e92f5f3c7b988b05b
Signed-off-by: Ed Tanous <edtanous@google.com>

show more ...


# 8ece0e45 02-Jan-2024 Ed Tanous <ed@tanous.net>

Fix spelling mistakes

These were found with:
codespell -w $(git ls-files | grep "\.[hc]\(pp\)\?$")

At some point in the future, we might want to get this enabled in CI.

Change-Id: Iccb57b2adfd06a2

Fix spelling mistakes

These were found with:
codespell -w $(git ls-files | grep "\.[hc]\(pp\)\?$")

At some point in the future, we might want to get this enabled in CI.

Change-Id: Iccb57b2adfd06a2e177e99db2923fe4e8e329118
Signed-off-by: Ed Tanous <ed@tanous.net>

show more ...


# 931edc79 01-Nov-2023 Ed Tanous <edtanous@google.com>

Make callback a template to avoid memory leak

Tested: Gunnar built this and below for a p10bmc, webui-vue looks
reasonable and the Validator had no new errors. Did a few operations:
delete a log, se

Make callback a template to avoid memory leak

Tested: Gunnar built this and below for a p10bmc, webui-vue looks
reasonable and the Validator had no new errors. Did a few operations:
delete a log, set an ntp server, etc.

Change-Id: I587ccd04515164fce1ea0bf5baf9f820347c63e6
Signed-off-by: Ed Tanous <edtanous@google.com>
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>

show more ...


# 6804b5c8 31-Oct-2023 Ed Tanous <edtanous@google.com>

Remove use after free in error handling path

Change-Id: I04476b016584f1d19af035ae51e0c04076b4de0b
Signed-off-by: Ed Tanous <edtanous@google.com>


12345678