associations: Add conditions support
Allow there to be multiple associations files that are selected based on
an inventory property condition specified inside of them. The file(s)
needs to be located in the same directory as the default associations
file, but can have any name as long as it ends in .json. If a
conditional associations file is found, the default associations file is
ignored.
For example:
{
"condition":
{
"path": "system/chassis/motherboard",
"interface": "xyz.openbmc_project.Inventory.Decorator.Asset",
"property": "Model",
"values": [
"ModelA",
"ModelB"
]
},
"associations":
[
// The same associations syntax as described above.
]
}
This states that the associations in this file are valid if the
motherboard inventory item has a Model property with a value of either
ModelA or ModelB.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Ib0f32815dee718ea268715896b5470ed2f25119e
diff --git a/manager.hpp b/manager.hpp
index ab1133c..744caa5 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -137,7 +137,12 @@
using Makers =
std::map<std::string, std::tuple<MakeInterfaceType, AssignInterfaceType,
SerializeInterfaceType<SerialOps>,
- DeserializeInterfaceType<SerialOps>>>;
+ DeserializeInterfaceType<SerialOps>
+#ifdef CREATE_ASSOCIATIONS
+ ,
+ GetPropertyValueType
+#endif
+ >>;
/** @brief Provides weak references to interface holders.
*