History log of /openbmc/entity-manager/test/entity_manager/test_entity-manager.cpp (Results 1 – 2 of 2)
Revision Date Author Comments
# 7962944f 20-Aug-2025 Chau Ly <chaul@amperecomputing.com>

entity-manager: Handle left-over template vars

With current implementations for template variable replacement, if a
variable does not exist on D-Bus, it will be left as is and will appear
in the fin

entity-manager: Handle left-over template vars

With current implementations for template variable replacement, if a
variable does not exist on D-Bus, it will be left as is and will appear
in the final configuration. However, if the string is intended to be
replaced and not handled properly after a replacement failure, the
variable itself will possibly be shown to users via Redfish/IPMI if the
consuming properties are used by those.

After performing the template variable replacement, a post-processing
step is added to check for any leftover template variables. These
leftovers may occur if the probed property is not available on D-Bus.
Any such variables are replaced with an empty string to avoid
unresolved placeholders.

The boundary of a template var is decided to be from the character "$"
to before a " " character, or the end of the keyPair's value string.
This conforms to the implicit rules currently applied to template
variable configuration that a template variable should not be
immediately followed by an arbitrary string without a space separating
them. This pattern can also be found in how the math configurations are
extracted, which looks for a math operator at the position that is one
character away from the end of the template variable [1].

The unit tests are also updated to test the new function that handles
left-over template variables.

[1]: https://github.com/openbmc/entity-manager/blob/3911d80afb6956b17c4f4b9a76c7eb45bb76e3b9/src/entity_manager/utils.cpp#L134

Tested: Unit tests pass

Tested with real configuration:

`$PRODUCT_PRODUCT_KK_NAME`, `$PRODUCT_KK_VERSION` and
`$PRODUCT_SERIAL_KK_NUMBER` are non-existent probed property on D-Bus.

```
{
"Exposes": [
...
],
"Name": "Mt.Mitchell_Motherboard",
"Probe": [
"xyz.openbmc_project.FruDevice({'BOARD_PRODUCT_NAME': 'MB'})",
"AND",
"FOUND('Mt.Mitchell_DCSCM_BMC')"
],
"Type": "Board",
"xyz.openbmc_project.Common.UUID": {
"UUID": "$MULTIRECORD_UUID"
},
"xyz.openbmc_project.Inventory.Decorator.Asset": {
"BuildDate": "$BOARD_MANUFACTURE_DATE",
"Manufacturer": "$PRODUCT_MANUFACTURER",
"Model": "$PRODUCT_PRODUCT_KK_NAME $PRODUCT_KK_VERSION",
"PartNumber": "$PRODUCT_PART_NUMBER",
"SerialNumber": "$PRODUCT_SERIAL_KK_NUMBER"
}
}
```

D-Bus results after the configuration is processed:

- `Model` has a space character which is the space between
`$PRODUCT_PRODUCT_KK_NAME` and `$PRODUCT_KK_VERSION` in the
configuration.

- SerialNumber is empty.

```
$ busctl introspect xyz.openbmc_project.EntityManager \
/xyz/openbmc_project/inventory/system/board/Mt_Mitchell_Motherboard

xyz.openbmc_project.Common.UUID interface - -
.UUID property s "xx-xx"
xyz.openbmc_project.Inventory.Decorator.Asset interface - -
.BuildDate property s "20221018Z"
.Manufacturer property s "NULL"
.Model property s " "
.PartNumber property s "ProductPN"
.SerialNumber property s ""

Change-Id: I4499baf3ebe9560e13932a49e324d1c8b0255623
Signed-off-by: Chau Ly <chaul@amperecomputing.com>

show more ...


# 6f4c6b4e 27-Jun-2025 Alexander Hansen <alexander.hansen@9elements.com>

meson: separate directory for entity-manager tests

Since entity-manager is now built with a static library, the sources do
not have to be compiled twice for testing. Link with the static library
ins

meson: separate directory for entity-manager tests

Since entity-manager is now built with a static library, the sources do
not have to be compiled twice for testing. Link with the static library
instead.

Move the test file for entity-manager into a separate directory to split
it in later patches.

Tested: Unit Tests Pass

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

show more ...