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/generated.mako.cpp b/generated.mako.cpp
index fee8745..4adb55e 100644
--- a/generated.mako.cpp
+++ b/generated.mako.cpp
@@ -1,6 +1,7 @@
## This file is a template. The comment below is emitted
## into the rendered file; feel free to edit this file.
// This file was auto generated. Do not edit.
+#include "config.h"
#include "manager.hpp"
#include "utils.hpp"
#include "functor.hpp"
@@ -35,6 +36,11 @@
DeserializeInterface<
ServerObject<
${i.namespace()}>, SerialOps>::op
+#ifdef CREATE_ASSOCIATIONS
+ , GetPropertyValue<
+ ServerObject<
+ ${i.namespace()}>>::op
+#endif
)
},
% endfor