ae0a8384 | 17-Nov-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: improve bad enum diagnostics
When unpacking an event from JSON, if a bad enum value was given a generic STL exception resulted:
``` terminate called after throwing an instance of '
sdbus++: events: improve bad enum diagnostics
When unpacking an event from JSON, if a bad enum value was given a generic STL exception resulted:
``` terminate called after throwing an instance of 'std::bad_optional_access' ```
Improve this by using the sdbusplus `InvalidEnumString` exception: ``` terminate called after throwing an instance of 'sdbusplus::exception::InvalidEnumString' ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I746f7265c8cf97e9a123915a123a4749d31e560c
show more ...
|
fe1ebd43 | 09-Nov-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: add object_path include
Event metadata often includes object_path. Add the header file into the generated events.hpp files.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Cha
sdbus++: events: add object_path include
Event metadata often includes object_path. Add the header file into the generated events.hpp files.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ia3da51483d25c6f65e6bcf977d47f65d59a37748
show more ...
|
17e54abc | 06-Nov-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: adjust schema for metadata
Switch the preferred format of metadata from SNAKE_CASE to CamelCase. This has no affect on the metadata names in the phosphor-logging object as those wil
sdbus++: events: adjust schema for metadata
Switch the preferred format of metadata from SNAKE_CASE to CamelCase. This has no affect on the metadata names in the phosphor-logging object as those will still be generated as SNAKE_CASE.
SNAKE_CASE is a lossy format. Consider `BMC_ADDRESS`; it cannot be identified if BMC is an acronym or a word. Our conversion functions will convert this to `bmcaddress` when becoming a camelCase format since there is special handling for acronyms and this will appear equivalent to an acronym.
All of the generators for events are explicit to use `foo.camelCase` or `foo.SNAKE_CASE` as appropriate, so switching to CamelCase has little effect. The primary thing it does is make the event class member variables named sanely: `numberOfLogs` rather than `numberoflogs`.
This will require a minor edit to the few events that are defined in phosphor-dbus-interfaces already, which will be done at the same time.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I10310986b9214aec99a3c7eabecf55f7054cdad0
show more ...
|
b08d14dd | 05-Nov-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: unpack an event from JSON
Generate code necessary to unpack a generated event from its JSON representation.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I7a28617f
sdbus++: events: unpack an event from JSON
Generate code necessary to unpack a generated event from its JSON representation.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I7a28617f3f0374968609328a44587b655a9141c1
show more ...
|
1800045e | 01-Nov-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: schema: explicitly prohibit unspecified properties
Modify the schema so that properties that do not belong are called out as a schema violation. It was easy for someone to accident
sdbus++: events: schema: explicitly prohibit unspecified properties
Modify the schema so that properties that do not belong are called out as a schema violation. It was easy for someone to accidentally add 'severity' on events, which should only be specified on errors. Adding it to the schema to prohibit makes it clearer what the expectations are.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I3decce5cddce2ce7215f7351339157a2597fdb0b
show more ...
|
7ffcdaac | 30-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: add source location and pid
Add the source code location and process ID to the generated events, which are useful for debug.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Cha
sdbus++: events: add source location and pid
Add the source code location and process ID to the generated events, which are useful for debug.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Iefaab6becc13292e1cd7835d97c6b3cc61a52776
show more ...
|
3b54a8e5 | 25-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: simplify handling of empty parameter lists
Add a template specialization of the type-tuple generation for empty parameter lists in order to simplify the Mako templates. This eliminates a sp
sdbus++: simplify handling of empty parameter lists
Add a template specialization of the type-tuple generation for empty parameter lists in order to simplify the Mako templates. This eliminates a special case for empty parameter lists in multiple places.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I7ca8d962ab1c7a65e0ad6d80ece1cd7e3847f2c6
show more ...
|
7377a0bf | 25-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: async: handle zero parameter signals
Adding a zero parameter signal results in the following compile failure:
``` ../include/sdbusplus/message/types.hpp: In instantiation of ‘constexpr aut
sdbus++: async: handle zero parameter signals
Adding a zero parameter signal results in the following compile failure:
``` ../include/sdbusplus/message/types.hpp: In instantiation of ‘constexpr auto sdbusplus::message::types::type_id() [with Args = {}]’: example/gen/net/poettering/Calculator/aserver.hpp:372:58: required from here ../include/sdbusplus/message/types.hpp:302:72: error: no matching function for call to ‘type_id_multiple<>()’ ```
Fix this by reusing logic from the non-async code to special case zero parameter length signals.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I0cde8810dfaf15afa2033a4c6699fb264facb9e8
show more ...
|
c012fde4 | 07-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
events: add severity to class generation
Use the severity field to add to the class generation for use by phosphor-logging to commit entries.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Cha
events: add severity to class generation
Use the severity field to add to the class generation for use by phosphor-logging to commit entries.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I82bb8482c0f95435275fb3a1fcdcb37bd29fc7ec
show more ...
|
760adffd | 05-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
events: add non-template base class
In order to allow non-template implementations that interact with the `sdbusplus::excception::generated_event<T>` class, it is useful to have a non-template base
events: add non-template base class
In order to allow non-template implementations that interact with the `sdbusplus::excception::generated_event<T>` class, it is useful to have a non-template base class. Add the `to_json` there for use by phosphor-logging.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ibed2c7c4fc0e23f1c82c4c003e16a6f438f7e68f
show more ...
|
f5b39215 | 03-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: add description for metadata
It is useful to document the purpose of a metadata field. Add it to the schema and make it required.
Signed-off-by: Patrick Williams <patrick@stwcx.xy
sdbus++: events: add description for metadata
It is useful to document the purpose of a metadata field. Add it to the schema and make it required.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I88f994a6004583bef586c86091dfff0c18d2bddf
show more ...
|
9213e158 | 03-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: fix for event-only YAML
If an event YAML file only had events and not errors, nothing would get generated. This was due to the wrong variable being checked for empty (error vs even
sdbus++: events: fix for event-only YAML
If an event YAML file only had events and not errors, nothing would get generated. This was due to the wrong variable being checked for empty (error vs event).
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I4fef5bd7b70b13e56682dce758a07f548005f549
show more ...
|
00fd0a8b | 24-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: use sd_bus_error_add_map to register
Register errors with `sd_bus_error_add_map` so that `errno` translation is handled appropriately.
Signed-off-by: Patrick Williams <patrick@stwc
sdbus++: events: use sd_bus_error_add_map to register
Register errors with `sd_bus_error_add_map` so that `errno` translation is handled appropriately.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I61e0cbed239a44842c6ea598904ac4411e195588
show more ...
|
14c4797c | 24-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: create json for events
Create JSON for the events containing their metadata and leverage that as the "message" portion of the `sd_bus_error`. This will allow unpacking the message
sdbus++: events: create json for events
Create JSON for the events containing their metadata and leverage that as the "message" portion of the `sd_bus_error`. This will allow unpacking the message on a client side back to the original exception.
Tested: ``` $ busctl --user call net.poettering.Calculator /net/poettering/calculator net.poettering.Calculator Divide xx 5 0 Call failed: {"net.poettering.Calculator.DivisionByZero":{"FOO":"unused"}} ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I4edd76d983267f28e51c4aa41902d45f5d6da793
show more ...
|
a4bfefde | 24-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
exception: move sd_bus_error_set calls to exception
In the future, generated exceptions will need to fill the sd_error with something other than the "description" in order to pass more metadata. Mo
exception: move sd_bus_error_set calls to exception
In the future, generated exceptions will need to fill the sd_error with something other than the "description" in order to pass more metadata. Move the sd_bus_error_set calls to exception as a virtual function so this can be accomplished.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I6e6947e4977701a8e7e27fef119bd35e837d866b
show more ...
|
ebe01794 | 24-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: simplify constructor
Consolidate consteval_string usage to simplify the generated code.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I6340eb369c117bb580a128e53381
sdbus++: events: simplify constructor
Consolidate consteval_string usage to simplify the generated code.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I6340eb369c117bb580a128e5338113a4b38a0f80
show more ...
|
d925c0bc | 23-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: generate exception constructors
Generate constructors for exceptions using the listed metadata.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I99dc912e4ad0746a14d3
sdbus++: events: generate exception constructors
Generate constructors for exceptions using the listed metadata.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I99dc912e4ad0746a14d3053a5653327ae12440dd
show more ...
|
0ac157a0 | 23-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++-gen-meson: fix [more] meson dependencies
As a follow on to 5800d07910384ffad8409515bc510812e4f34334, additional cases were noticed where the meson dependencies are not correctly updated when
sdbus++-gen-meson: fix [more] meson dependencies
As a follow on to 5800d07910384ffad8409515bc510812e4f34334, additional cases were noticed where the meson dependencies are not correctly updated when multiple YAML files are used (such as interfaces and events).
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ie47bc156c2b3954d3c47c9d07a2e106d7cc87c63
show more ...
|
093034c9 | 23-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: handle redfish-mapping events
Handle loading events with redfish-mapping without crashing.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I4140e948d938c775e52d41ec6
sdbus++: events: handle redfish-mapping events
Handle loading events with redfish-mapping without crashing.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I4140e948d938c775e52d41ec65793a70364ab831
show more ...
|
8bde6c7f | 23-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: specify redfish-mapping in schema
Redfish events are expected to conform to a specific format and our YAML format should omit the version identifiers (since we'll always be using th
sdbus++: events: specify redfish-mapping in schema
Redfish events are expected to conform to a specific format and our YAML format should omit the version identifiers (since we'll always be using the most recent Redfish event registry, which may be newer than the event YAML). Add this information to the schema for validation.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Id0c4eaab605f7230fe89670c06d0984e10db51a1
show more ...
|
d731d263 | 17-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: create event classes
Generate an equivalent amount of exception class as the `errors.yaml` supported and convert the examples to use it.
Tested:
``` ‣ Type=error Endian=l Flags=
sdbus++: events: create event classes
Generate an equivalent amount of exception class as the `errors.yaml` supported and convert the examples to use it.
Tested:
``` ‣ Type=error Endian=l Flags=1 Version=1 Cookie=9 ReplyCookie=2 Timestamp="Tue 2024-09-17 18:21:35.649674 UTC" Sender=:1.2489 Destination=:1.2495 ErrorName=net.poettering.Calculator.DivisionByZero ErrorMessage="Attempted to divide by zero." UniqueName=:1.2489 MESSAGE "s" { STRING "Attempted to divide by zero."; }; ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I4b2671838639d1e8be1ccdf655b699a98b9c2116
show more ...
|
b750136d | 16-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: generate markdown
Add enough content in event support to generate markdown documentation.
- Create python-translation from event YAML to internal classes and call mako re
sdbus++: events: generate markdown
Add enough content in event support to generate markdown documentation.
- Create python-translation from event YAML to internal classes and call mako renders. - Add empty mako templates for the C++ files. - Add mako templates necessary to generate markdown content.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ifd4aa16895b2ed5f72b3bc74170c1c666e29b02e
show more ...
|
0336a2fc | 05-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: add stubs to generate event files
Add options to `sdbus++` to generate the files for `events.yaml` files: header, cpp, markdown. Create simple stubs for these that generate empty files. E
sdbus++: add stubs to generate event files
Add options to `sdbus++` to generate the files for `events.yaml` files: header, cpp, markdown. Create simple stubs for these that generate empty files. Enable them in `sdbus++-gen-meson` and add an example for the Calculator.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ia1df9ca02e1de5fc3f6dadfd409d646e1341a3d6
show more ...
|
60138465 | 16-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: minor tweaks to schema
- Require metadata fields to be UPPER_SNAKE_CASE. - Reference syslog level constants rather than phosphor-logging.
Signed-off-by: Patrick Williams <patrick@s
sdbus++: events: minor tweaks to schema
- Require metadata fields to be UPPER_SNAKE_CASE. - Reference syslog level constants rather than phosphor-logging.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I97d6789518e304914e4cd1c807e4f3221d383b37
show more ...
|
6cb8baa8 | 12-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
sdbus++: events: allow metadata fields to be enums
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I2c659064a95b431de1de96baf90ef16824255f30 |