History log of /openbmc/bmcweb/redfish-core/lib/trigger.hpp (Results 1 – 25 of 38)
Revision Date Author Comments
# 46f780f7 09-Feb-2025 Ed Tanous <etanous@nvidia.com>

Move chassis and trigger to dbus utility

Using the utility classes reduces compile times and reduces the number
of template specializations that get generated. These are the last two
left in the co

Move chassis and trigger to dbus utility

Using the utility classes reduces compile times and reduces the number
of template specializations that get generated. These are the last two
left in the codebase for getProperty, so fix them.

Tested: On Last commit.

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

show more ...


# 504af5a0 03-Feb-2025 Patrick Williams <patrick@stwcx.xyz>

clang-format: update latest spec and reformat

Copy the latest format file from the docs repository and apply.

Change-Id: I2f0b9d0fb6e01ed36a2f34c750ba52de3b6d15d1
Signed-off-by: Patrick Williams <p

clang-format: update latest spec and reformat

Copy the latest format file from the docs repository and apply.

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

show more ...


# d7857201 28-Jan-2025 Ed Tanous <etanous@nvidia.com>

Fix includes

Clang-tidy misc-include-cleaner appears to now be enforcing
significantly more headers than previously. That is overall a good
thing, but forces us to fix some issues. This commit is

Fix includes

Clang-tidy misc-include-cleaner appears to now be enforcing
significantly more headers than previously. That is overall a good
thing, but forces us to fix some issues. This commit is largely just
taking the clang-recommended fixes and checking them in. Subsequent
patches will fix the more unique issues.

Note, that a number of new ignores are added into the .clang-tidy file.
These can be cleaned up over time as they're understood. The majority
are places where boost includes a impl/x.hpp and x.hpp, but expects you
to use the later. include-cleaner opts for the impl, but it isn't clear
why.

Change-Id: Id3fdd7ee6df6c33b2fd35626898523048dd51bfb
Signed-off-by: Ed Tanous <etanous@nvidia.com>
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>

show more ...


# 40e9b92e 10-Sep-2024 Ed Tanous <etanous@nvidia.com>

Use SPDX identifiers

SPDX identifiers are simpler, and reduce the amount of cruft we have in
code files. They are recommended by linux foundation, and therefore we
should do as they allow.

This pa

Use SPDX identifiers

SPDX identifiers are simpler, and reduce the amount of cruft we have in
code files. They are recommended by linux foundation, and therefore we
should do as they allow.

This patchset does not intend to modify any intent on any existing
copyrights or licenses, only to standardize their inclusion.

[1] https://www.linuxfoundation.org/blog/blog/copyright-notices-in-open-source-software-projects

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

show more ...


# 58c71488 19-Oct-2024 Ed Tanous <etanous@nvidia.com>

Transition to simpler trigger interface

Using this simpler interface allows us to simplify the unpacking code,
and remove the use of a variant containing a variant, which has caused
bugs in the past

Transition to simpler trigger interface

Using this simpler interface allows us to simplify the unpacking code,
and remove the use of a variant containing a variant, which has caused
bugs in the past. Splitting these apart allows us to replicate the
Redfish interfaces with less code.

Tested:

Discrete and Numeric triggers both create correctly
```
curl -k --user "root:0penBmc" -H "Content-Type: application/json" -X POST https://192.168.7.2/redfish/v1/TelemetryService/Triggers -d '{"Name": "eds", "NumericThresholds": {"LowerCritical": {"Reading": 1.0, "Activation": "Increasing", "DwellTime": "P1S"}}}'
curl -k --user "root:0penBmc" -H "Content-Type: application/json" -X POST https://192.168.7.2/redfish/v1/TelemetryService/Triggers -d '{"Name": "eds", "DiscreteTriggers": [{"DwellTime": "P1S", "Severity": "OK", "Value": "1234"}]}

```

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

show more ...


# e3648032 16-Oct-2024 Ed Tanous <etanous@nvidia.com>

Make trigger use common types

Trigger having its own variant causes us to duplicate code. This was
left out of the original refactoring because it was complex given
the variant of a variant status.

Make trigger use common types

Trigger having its own variant causes us to duplicate code. This was
left out of the original refactoring because it was complex given
the variant of a variant status.

This commit finally does the port.

Tested: Unclear what tests exist for triggers that would use this code
```
curl -k --user "root:0penBmc" -H "Content-Type: application/json" -X POST https://192.168.7.2/redfish/v1/TelemetryService/Triggers -d '{"Name": "eds", "NumericThresholds": {"LowerCritical": {"Reading": 1.0, "Activation": "Increasing", "DwellTime": "P1S"}}}'
```

Succeeds. GET on the resource results in:
{
"@odata.id": "/redfish/v1/TelemetryService/Triggers/eds",
"@odata.type": "#Triggers.v1_2_0.Triggers",
"Id": "eds",
"Links": {
"MetricReportDefinitions": []
},
"MetricProperties": [],
"MetricType": "Numeric",
"Name": "eds",
"NumericThresholds": {
"LowerCritical": {
"Activation": "Increasing",
"DwellTime": "PT1.000S",
"Reading": 1.0
}
},
"TriggerActions": []
}

Change-Id: I8f683cc9423ee2ba111d3ca1889e78f7d33433c9
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 ...


# 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 ...


# 5b90429a 16-Apr-2024 Ed Tanous <ed@tanous.net>

Add missing headers

Most of these were found by breaking every redfish class handler into
its own compile unit:

When that's done, these missing headers become compile errors. We
should just fix the

Add missing headers

Most of these were found by breaking every redfish class handler into
its own compile unit:

When that's done, these missing headers become compile errors. We
should just fix them.

In addition, this allows us to enable automatic header checking in
clang-tidy using misc-header-cleaner. Because the compiler can now
"see" all the defines, it no longer tries to remove headers that it
thinks are unused.

[1] https://github.com/openbmc/bmcweb/commit/4fdee9e39e9f03122ee16a6fb251a380681f56ac

Tested: Code compiles.

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

show more ...


# 4a7fbefd 06-Apr-2024 Ed Tanous <ed@tanous.net>

Fix large copies with url_view and segments_view

Despite these objects being called "view" they are still relatively
large, as clang-tidy correctly flags, and we ignore.

Change all function uses to

Fix large copies with url_view and segments_view

Despite these objects being called "view" they are still relatively
large, as clang-tidy correctly flags, and we ignore.

Change all function uses to capture by:
const boost::urls::url_view_base&

Which is the base class of all boost URL types, and any class (url,
url_view, etc) is convertible to that base.

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

show more ...


# 2932dcb6 06-Mar-2024 Ed Tanous <ed@tanous.net>

Clean up triggers to use readJson

Use multiple level direct read

Tested: Visual only. Need help if anyone wants to test.

Change-Id: I2595a7024f1d02e02874310d1911cd4855b867be
Signed-off-by: Ed Tano

Clean up triggers to use readJson

Use multiple level direct read

Tested: Visual only. Need help if anyone wants to test.

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

show more ...


# 5a39f77a 20-Oct-2023 Patrick Williams <patrick@stwcx.xyz>

clang-format: copy latest and re-format

clang-format-17 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest

clang-format: copy latest and re-format

clang-format-17 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.

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

show more ...


# 6fd29553 04-Oct-2023 Ed Tanous <edtanous@google.com>

Update to boost 1.83.0

In boost 1.83.0, the boost::url maintainers deprecated the header only
usage of the library without warning. A discussion with the
maintainers[1] made it clear that they remo

Update to boost 1.83.0

In boost 1.83.0, the boost::url maintainers deprecated the header only
usage of the library without warning. A discussion with the
maintainers[1] made it clear that they removed the abiliy on purpose,
and they're not going to add it back or add a deprecation strategy (they
did say they would update the documentation to actually match the
intent), and that from here on in we should be using the cmake boost
project to pull in the non-header-only boost libraries we use (which at
this point is ONLY boost url).

This commit updates to remove the usage of boost::urls::result typedef,
which was deprecated in this release (which causes a compile error) and
moves it to boost::system::result.

In addition, it updates our meson files to pull in the boost project as
a cmake dependency.

[1] https://cpplang.slack.com/archives/C01JR6C9C4U/p1696441238739129

Tested: Not yet.

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

show more ...


# 62598e31 17-Jul-2023 Ed Tanous <ed@tanous.net>

Replace logging with std::format

std::format is a much more modern logging solution, and gives us a lot
more flexibility, and better compile times when doing logging.

Unfortunately, given its level

Replace logging with std::format

std::format is a much more modern logging solution, and gives us a lot
more flexibility, and better compile times when doing logging.

Unfortunately, given its level of compile time checks, it needs to be a
method, instead of the stream style logging we had before. This
requires a pretty substantial change. Fortunately, this change can be
largely automated, via the script included in this commit under
scripts/replace_logs.py. This is to aid people in moving their
patchsets over to the new form in the short period where old patches
will be based on the old logging. The intention is that this script
eventually goes away.

The old style logging (stream based) looked like.

BMCWEB_LOG_DEBUG << "Foo " << foo;

The new equivalent of the above would be:
BMCWEB_LOG_DEBUG("Foo {}", foo);

In the course of doing this, this also cleans up several ignored linter
errors, including macro usage, and array to pointer deconstruction.

Note, This patchset does remove the timestamp from the log message. In
practice, this was duplicated between journald and bmcweb, and there's
no need for both to exist.

One design decision of note is the addition of logPtr. Because the
compiler can't disambiguate between const char* and const MyThing*, it's
necessary to add an explicit cast to void*. This is identical to how
fmt handled it.

Tested: compiled with logging meson_option enabled, and launched bmcweb

Saw the usual logging, similar to what was present before:
```
[Error include/webassets.hpp:60] Unable to find or open /usr/share/www/ static file hosting disabled
[Debug include/persistent_data.hpp:133] Restored Session Timeout: 1800
[Debug redfish-core/include/event_service_manager.hpp:671] Old eventService config not exist
[Info src/webserver_main.cpp:59] Starting webserver on port 18080
[Error redfish-core/include/event_service_manager.hpp:1301] inotify_add_watch failed for redfish log file.
[Info src/webserver_main.cpp:137] Start Hostname Monitor Service...
```
Signed-off-by: Ed Tanous <ed@tanous.net>

Change-Id: I86a46aa2454be7fe80df608cb7e5573ca4029ec8

show more ...


# d5736ef2 06-Jul-2023 Ed Tanous <edtanous@google.com>

Enable bugprone clang tidy checks

We pass basically all of these with flying colors now. Previously there
were clang-tidy bugs around bugprone-exception-escape, but those seem to
be resolved in cla

Enable bugprone clang tidy checks

We pass basically all of these with flying colors now. Previously there
were clang-tidy bugs around bugprone-exception-escape, but those seem to
be resolved in clang-tidy-16, so we can turn that check back on.

The only thing we had was an instance of
bugprone-assignment-in-if-condition, that was trivially fixed.

Tested: Clang-tidy passes.

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

show more ...


# dd1c4a9c 04-Mar-2022 Szymon Dompke <szymon.dompke@intel.com>

Add support for POST on TriggersCollection

Added POST method on /redfish/v1/TelemetryService/Triggers uri, which
creates new trigger in telemetry service, by using dbus call AddTrigger.

By DMTF, mo

Add support for POST on TriggersCollection

Added POST method on /redfish/v1/TelemetryService/Triggers uri, which
creates new trigger in telemetry service, by using dbus call AddTrigger.

By DMTF, most of the properties are not required, and as such are
treated as optional. Some values can be deduced from others (like
'MetricType', depending on 'DiscreteTriggers' or 'NumericThresholds').
All properties provided in POST body by user will be verified against
each other, and errors will be raised. Few examples of such situations:
- 'MetricType' is set to 'Discrete' but 'NumericThresholds' was passed.
- 'MetricType' is set to 'Numeric' but "DiscreteTriggers' or
'DiscreteTriggerCondition' were passed
- 'DiscreteTriggerCondition' is set to 'Specified' but
'DiscreteTriggers' is an empty array or was not passed.
- 'DiscreteTriggerCondition' is set to 'Changed' but 'DiscreteTriggers'
is passed and is not an empty array.

Example 1 – Trigger with discrete values:
```
{
"Id": "TestTrigger",
"MetricType": "Discrete",
"TriggerActions": [
"RedfishEvent"
],
"DiscreteTriggerCondition": "Specified",
"DiscreteTriggers": [
{
"Value": "55.88",
"DwellTime": "PT0.001S",
"Severity": "Warning"
},
{
"Name": "My discrete trigger",
"Value": "55.88",
"DwellTime": "PT0.001S",
"Severity": "OK"
},
{
"Value": "55.88",
"DwellTime": "PT0.001S",
"Severity": "Critical"
}
],
"MetricProperties": [
"/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/0/Reading"
],
"Links": {
"MetricReportDefinitions": []
}
}

Example 2 – trigger with numeric threshold:
{
"Id": "TestTrigger2",
"Name": "My Numeric Trigger",
"MetricType": "Numeric",
"TriggerActions": [
"RedfishEvent",
"RedfishMetricReport"
],
"NumericThresholds": {
"UpperCritical": {
"Reading": 50,
"Activation": "Increasing",
"DwellTime": "PT0.001S"
},
"UpperWarning": {
"Reading": 48.1,
"Activation": "Increasing",
"DwellTime": "PT0.004S"
}
},
"MetricProperties": [
"/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/0/Reading",
"/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/17/Reading"
],
"Links": {
"MetricReportDefinitions": [
"/redfish/v1/TelemetryService/MetricReportDefinitions/PowerMetrics",
"/redfish/v1/TelemetryService/MetricReportDefinitions/PowerMetricStats",
"/redfish/v1/TelemetryService/MetricReportDefinitions/PlatformPowerUsage"
]
}
}
```

Tested:
- Triggers were successfully created with above example message bodies.
This can be checked by calling:
'busctl tree xyz.openbmc_project.Telemetry'.
- Expected errors were returned for messages with incorrect or mutually
exclusive properties and incorrect values.
- Redfish service validator is passing.

Signed-off-by: Szymon Dompke <szymon.dompke@intel.com>
Change-Id: Ief8c76de8aa660ae0d2dbe4610c26a28186a290a

show more ...


# ef4c65b7 24-Apr-2023 Ed Tanous <edtanous@google.com>

Boost::urls::format

Boost 1.82 dropped a lovely new toy, boost::urls::format, which is a lot
like our urlFromPieces method, but better in that it makes the resulting
uris more readable, and allows d

Boost::urls::format

Boost 1.82 dropped a lovely new toy, boost::urls::format, which is a lot
like our urlFromPieces method, but better in that it makes the resulting
uris more readable, and allows doing things like fragments in a single
line instead of multiple. We should prefer it in some cases.

Tested:
Redfish service validator passes.
Spot checks of URLs work as expected.
Unit tests pass.

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

show more ...


# b2ba3072 12-May-2023 Patrick Williams <patrick@stwcx.xyz>

fix more push vs emplace calls

It seems like clang-tidy doesn't catch every place that an emplace could
be used instead of a push. Use a few grep/sed pairs to find and fix up
some common patterns.

fix more push vs emplace calls

It seems like clang-tidy doesn't catch every place that an emplace could
be used instead of a push. Use a few grep/sed pairs to find and fix up
some common patterns.

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

show more ...


# ad539545 12-May-2023 Patrick Williams <patrick@stwcx.xyz>

use emplace where appropriate per clang-tidy

The clang-tidy warning 'modernize-use-emplace' correctly flags a
few places where emplace should be used over push.

Signed-off-by: Patrick Williams <pat

use emplace where appropriate per clang-tidy

The clang-tidy warning 'modernize-use-emplace' correctly flags a
few places where emplace should be used over push.

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

show more ...


# 5e7e2dc5 16-Feb-2023 Ed Tanous <edtanous@google.com>

Take boost error_code by reference

By convention, we should be following boost here, and passing error_code
by reference, not by value. This makes our code consistent, and removes
the need for a co

Take boost error_code by reference

By convention, we should be following boost here, and passing error_code
by reference, not by value. This makes our code consistent, and removes
the need for a copy in some cases.

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

show more ...


# 3ccb3adb 13-Jan-2023 Ed Tanous <edtanous@google.com>

Fix a boatload of #includes

Most of these missing includes were found by running clang-tidy on all
files, including headers. The existing scripts just run clang-tidy on
source files, which doesn't

Fix a boatload of #includes

Most of these missing includes were found by running clang-tidy on all
files, including headers. The existing scripts just run clang-tidy on
source files, which doesn't catch most of these.

Tested: Code compiles

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

show more ...


# 7a1dbc48 07-Dec-2022 George Liu <liuxiwei@inspur.com>

Refactor GetSubTreePaths method

Since the GetSubTreePaths method has been implemented in dbus_utility
and this commit is to integrate all the places where the
GetSubTreePaths method is called, and u

Refactor GetSubTreePaths method

Since the GetSubTreePaths method has been implemented in dbus_utility
and this commit is to integrate all the places where the
GetSubTreePaths method is called, and use the method in dbus_utility
uniformly.

Requires https://gerrit.openbmc.org/c/openbmc/sdbusplus/+/60020 to
build.

Tested: Redfish Validator Passed

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ie4140d4484a7e4f4b943013f4371ffd2d44a22e9

show more ...


# ae9031f0 27-Sep-2022 Willy Tu <wltu@google.com>

Update CollectionMembers to use UrlFromPieces

Refactor getCollectionMembers to make sure all Url created with dbus
paths are generated via UrlFromPieces helper function. This allow us to
manage all

Update CollectionMembers to use UrlFromPieces

Refactor getCollectionMembers to make sure all Url created with dbus
paths are generated via UrlFromPieces helper function. This allow us to
manage all URL generated from dbus in one place and allow us to make
future changes to affect all resources.

We can make changes to all resources easier if they are all managed by
one function.

Tested:
Redfish Validator Passed. All Collections working as expected and match
previous implmentation.

Change-Id: I5d3b2b32f047ce4f20a2287a36a3e099efd6eace
Signed-off-by: Willy Tu <wltu@google.com>

show more ...


12