rainier: Add inventory associations JSON files

The phosphor-inventory-manager application supports creating
associations based on JSON files, where the JSON files have conditions
built into them that say which inventory-manager property values are
required for the associations files to be valid.

Add minimal associations files for the Rainier 2U, Rainier 4U, and
Everest systems that just contain the fan inventory associations for
now.  The condition is the 'IM' property on the com.ipzvpd.VSBP
interface on the system/chassis/motherboard path.

Change-Id: Ib6807d8982a2efeb94692b917804c53965d6c98a
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/meta-ibm/recipes-phosphor/inventory/phosphor-inventory-manager/rainier/ibm,everest_associations.json b/meta-ibm/recipes-phosphor/inventory/phosphor-inventory-manager/rainier/ibm,everest_associations.json
new file mode 100644
index 0000000..bf797d9
--- /dev/null
+++ b/meta-ibm/recipes-phosphor/inventory/phosphor-inventory-manager/rainier/ibm,everest_associations.json
@@ -0,0 +1,111 @@
+{
+    "condition":
+    {
+        "path": "system/chassis/motherboard",
+        "interface": "com.ibm.ipzvpd.VSBP",
+        "property": "IM",
+        "values": [
+            [80, 0, 48, 0]
+        ]
+    },
+    "associations":
+    [
+        {
+            "path": "system/chassis/motherboard/fan0",
+            "endpoints":
+            [
+                {
+                    "types":
+                    {
+                        "rType": "inventory",
+                        "fType": "sensors"
+                    },
+                    "paths":
+                    [
+                        "/xyz/openbmc_project/sensors/fan_tach/fan0_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan0_1"
+                    ]
+                }
+            ]
+        },
+        {
+            "path": "system/chassis/motherboard/fan1",
+            "endpoints":
+            [
+                {
+                    "types":
+                    {
+                        "rType": "inventory",
+                        "fType": "sensors"
+                    },
+                    "paths":
+                    [
+                        "/xyz/openbmc_project/sensors/fan_tach/fan1_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan1_1"
+                    ]
+                }
+            ]
+        },
+        {
+            "path": "system/chassis/motherboard/fan2",
+            "endpoints":
+            [
+                {
+                    "types":
+                    {
+                        "rType": "inventory",
+                        "fType": "sensors"
+                    },
+                    "paths":
+                    [
+                        "/xyz/openbmc_project/sensors/fan_tach/fan2_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan2_1"
+                    ]
+                }
+            ]
+        },
+        {
+            "path": "system/chassis/motherboard/fan3",
+            "endpoints":
+            [
+                {
+                    "types":
+                    {
+                        "rType": "inventory",
+                        "fType": "sensors"
+                    },
+                    "paths":
+                    [
+                        "/xyz/openbmc_project/sensors/fan_tach/fan3_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan3_1"
+                    ]
+                }
+            ]
+        },
+        {
+            "path": "system/chassis",
+            "endpoints":
+            [
+                {
+                    "types":
+                    {
+                        "rType": "chassis",
+                        "fType": "all_sensors"
+                    },
+                    "paths":
+                    [
+                        "/xyz/openbmc_project/sensors/fan_tach/fan0_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan0_1",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan1_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan1_1",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan2_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan2_1",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan3_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan3_1"
+                    ]
+                }
+            ]
+        }
+    ]
+}
+
diff --git a/meta-ibm/recipes-phosphor/inventory/phosphor-inventory-manager/rainier/ibm,rainier-2u_associations.json b/meta-ibm/recipes-phosphor/inventory/phosphor-inventory-manager/rainier/ibm,rainier-2u_associations.json
new file mode 100644
index 0000000..e27de98
--- /dev/null
+++ b/meta-ibm/recipes-phosphor/inventory/phosphor-inventory-manager/rainier/ibm,rainier-2u_associations.json
@@ -0,0 +1,150 @@
+{
+    "condition":
+    {
+        "path": "system/chassis/motherboard",
+        "interface": "com.ibm.ipzvpd.VSBP",
+        "property": "IM",
+        "values": [
+            [80, 0, 16, 1],
+            [80, 0, 16, 3]
+        ]
+    },
+    "associations":
+    [
+        {
+            "path": "system/chassis/motherboard/fan0",
+            "endpoints":
+            [
+                {
+                    "types":
+                    {
+                        "rType": "inventory",
+                        "fType": "sensors"
+                    },
+                    "paths":
+                    [
+                        "/xyz/openbmc_project/sensors/fan_tach/fan0_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan0_1"
+                    ]
+                }
+            ]
+        },
+        {
+            "path": "system/chassis/motherboard/fan1",
+            "endpoints":
+            [
+                {
+                    "types":
+                    {
+                        "rType": "inventory",
+                        "fType": "sensors"
+                    },
+                    "paths":
+                    [
+                        "/xyz/openbmc_project/sensors/fan_tach/fan1_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan1_1"
+                    ]
+                }
+            ]
+        },
+        {
+            "path": "system/chassis/motherboard/fan2",
+            "endpoints":
+            [
+                {
+                    "types":
+                    {
+                        "rType": "inventory",
+                        "fType": "sensors"
+                    },
+                    "paths":
+                    [
+                        "/xyz/openbmc_project/sensors/fan_tach/fan2_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan2_1"
+                    ]
+                }
+            ]
+        },
+        {
+            "path": "system/chassis/motherboard/fan3",
+            "endpoints":
+            [
+                {
+                    "types":
+                    {
+                        "rType": "inventory",
+                        "fType": "sensors"
+                    },
+                    "paths":
+                    [
+                        "/xyz/openbmc_project/sensors/fan_tach/fan3_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan3_1"
+                    ]
+                }
+            ]
+        },
+        {
+            "path": "system/chassis/motherboard/fan4",
+            "endpoints":
+            [
+                {
+                    "types":
+                    {
+                        "rType": "inventory",
+                        "fType": "sensors"
+                    },
+                    "paths":
+                    [
+                        "/xyz/openbmc_project/sensors/fan_tach/fan4_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan4_1"
+                    ]
+                }
+            ]
+        },
+        {
+            "path": "system/chassis/motherboard/fan5",
+            "endpoints":
+            [
+                {
+                    "types":
+                    {
+                        "rType": "inventory",
+                        "fType": "sensors"
+                    },
+                    "paths":
+                    [
+                        "/xyz/openbmc_project/sensors/fan_tach/fan5_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan5_1"
+                    ]
+                }
+            ]
+        },
+        {
+            "path": "system/chassis",
+            "endpoints":
+            [
+                {
+                    "types":
+                    {
+                        "rType": "chassis",
+                        "fType": "all_sensors"
+                    },
+                    "paths":
+                    [
+                        "/xyz/openbmc_project/sensors/fan_tach/fan0_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan0_1",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan1_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan1_1",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan2_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan2_1",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan3_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan3_1",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan4_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan4_1"
+                    ]
+                }
+            ]
+        }
+    ]
+}
+
diff --git a/meta-ibm/recipes-phosphor/inventory/phosphor-inventory-manager/rainier/ibm,rainier-4u_associations.json b/meta-ibm/recipes-phosphor/inventory/phosphor-inventory-manager/rainier/ibm,rainier-4u_associations.json
new file mode 100644
index 0000000..3ba8fea1
--- /dev/null
+++ b/meta-ibm/recipes-phosphor/inventory/phosphor-inventory-manager/rainier/ibm,rainier-4u_associations.json
@@ -0,0 +1,150 @@
+{
+    "condition":
+    {
+        "path": "system/chassis/motherboard",
+        "interface": "com.ibm.ipzvpd.VSBP",
+        "property": "IM",
+        "values": [
+            [80, 0, 16, 0],
+            [80, 0, 16, 2]
+        ]
+    },
+    "associations":
+    [
+        {
+            "path": "system/chassis/motherboard/fan0",
+            "endpoints":
+            [
+                {
+                    "types":
+                    {
+                        "rType": "inventory",
+                        "fType": "sensors"
+                    },
+                    "paths":
+                    [
+                        "/xyz/openbmc_project/sensors/fan_tach/fan0_0"
+                    ]
+                },
+                {
+                    "types":
+                    {
+                        "rType": "inventory",
+                        "fType": "leds"
+                    },
+                    "paths":
+                    [
+                        "/xyz/openbmc_project/led/physical/fan0"
+                    ]
+                }
+            ]
+        },
+        {
+            "path": "system/chassis/motherboard/fan1",
+            "endpoints":
+            [
+                {
+                    "types":
+                    {
+                        "rType": "inventory",
+                        "fType": "sensors"
+                    },
+                    "paths":
+                    [
+                        "/xyz/openbmc_project/sensors/fan_tach/fan1_0"
+                    ]
+                }
+            ]
+        },
+        {
+            "path": "system/chassis/motherboard/fan2",
+            "endpoints":
+            [
+                {
+                    "types":
+                    {
+                        "rType": "inventory",
+                        "fType": "sensors"
+                    },
+                    "paths":
+                    [
+                        "/xyz/openbmc_project/sensors/fan_tach/fan2_0"
+                    ]
+                }
+            ]
+        },
+        {
+            "path": "system/chassis/motherboard/fan3",
+            "endpoints":
+            [
+                {
+                    "types":
+                    {
+                        "rType": "inventory",
+                        "fType": "sensors"
+                    },
+                    "paths":
+                    [
+                        "/xyz/openbmc_project/sensors/fan_tach/fan3_0"
+                    ]
+                }
+            ]
+        },
+        {
+            "path": "system/chassis/motherboard/fan4",
+            "endpoints":
+            [
+                {
+                    "types":
+                    {
+                        "rType": "inventory",
+                        "fType": "sensors"
+                    },
+                    "paths":
+                    [
+                        "/xyz/openbmc_project/sensors/fan_tach/fan4_0"
+                    ]
+                }
+            ]
+        },
+        {
+            "path": "system/chassis/motherboard/fan5",
+            "endpoints":
+            [
+                {
+                    "types":
+                    {
+                        "rType": "inventory",
+                        "fType": "sensors"
+                    },
+                    "paths":
+                    [
+                        "/xyz/openbmc_project/sensors/fan_tach/fan5_0"
+                    ]
+                }
+            ]
+        },
+        {
+            "path": "system/chassis",
+            "endpoints":
+            [
+                {
+                    "types":
+                    {
+                        "rType": "chassis",
+                        "fType": "all_sensors"
+                    },
+                    "paths":
+                    [
+                        "/xyz/openbmc_project/sensors/fan_tach/fan0_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan1_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan2_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan3_0",
+                        "/xyz/openbmc_project/sensors/fan_tach/fan4_0"
+                    ]
+                }
+            ]
+        }
+    ]
+}
+
diff --git a/meta-ibm/recipes-phosphor/inventory/phosphor-inventory-manager_%.bbappend b/meta-ibm/recipes-phosphor/inventory/phosphor-inventory-manager_%.bbappend
index bdc3912..af51297 100644
--- a/meta-ibm/recipes-phosphor/inventory/phosphor-inventory-manager_%.bbappend
+++ b/meta-ibm/recipes-phosphor/inventory/phosphor-inventory-manager_%.bbappend
@@ -1,11 +1,23 @@
 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
 PACKAGECONFIG_append_ibm-ac-server = " associations"
 SRC_URI_append_ibm-ac-server = " file://associations.json"
-
-
 DEPENDS_append_ibm-ac-server = " inventory-cleanup"
 
+PACKAGECONFIG_append_rainier = " associations"
+SRC_URI_append_rainier = " \
+    file://ibm,rainier-2u_associations.json \
+    file://ibm,rainier-4u_associations.json \
+    file://ibm,everest_associations.json \
+    "
+
 do_install_append_ibm-ac-server() {
     install -d ${D}${base_datadir}
     install -m 0755 ${WORKDIR}/associations.json ${D}${base_datadir}/associations.json
 }
+
+do_install_append_rainier() {
+    install -d ${D}${base_datadir}
+    install -m 0755 ${WORKDIR}/ibm,rainier-2u_associations.json ${D}${base_datadir}/ibm,rainier-2u_associations.json
+    install -m 0755 ${WORKDIR}/ibm,rainier-4u_associations.json ${D}${base_datadir}/ibm,rainier-4u_associations.json
+    install -m 0755 ${WORKDIR}/ibm,everest_associations.json ${D}${base_datadir}/ibm,everest_associations.json
+}