Resolve power supply errors when they're replaced

Add Witherspoon dbus-monitor rules to watch for power supplies
to become present.  When that happens, invoke the callback to
resolve all errors that have that power supply as a callout.

This will cause the enclosure fault LEDs to turn off when a power
supply is replaced (if no other faults were also setting those
LEDs.)

Change-Id: I16e603d18fe3c458e1f062e12a7aa0a6a2f4300e
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/meta-witherspoon/recipes-phosphor/power/witherspoon-power-supply-policy/power-supply-policy.yaml b/meta-witherspoon/recipes-phosphor/power/witherspoon-power-supply-policy/power-supply-policy.yaml
index 9309015..a97f4b8 100644
--- a/meta-witherspoon/recipes-phosphor/power/witherspoon-power-supply-policy/power-supply-policy.yaml
+++ b/meta-witherspoon/recipes-phosphor/power/witherspoon-power-supply-policy/power-supply-policy.yaml
@@ -155,3 +155,61 @@
     - name: xyz::openbmc_project::Inventory::NotPresent::CALLOUT_INVENTORY_PATH
       value: /xyz/openbmc_project/inventory/system/chassis/powersupply1
       type: string
+
+- name: resolve power supply0 errors if present
+  description: >
+    'If power supply0 is present, call the resolve ps0 errors callback.'
+  class: condition
+  condition: count
+  paths: power supply0
+  properties: power supply present
+  callback: resolve power supply0 errors
+  countop: '>'
+  countbound: 0
+  op: '=='
+  bound: true
+
+- name: resolve power supply1 errors if present
+  description: >
+    'If power supply1 is present, call the resolve ps1 errors callback.'
+  class: condition
+  condition: count
+  paths: power supply1
+  properties: power supply present
+  callback: resolve power supply1 errors
+  countop: '>'
+  countbound: 0
+  op: '=='
+  bound: true
+
+- name: resolve power supply0 errors
+  class: callback
+  callback: resolve callout
+  paths: power supply0
+  properties: power supply present
+  callout: /xyz/openbmc_project/inventory/system/chassis/powersupply0
+
+- name: resolve power supply1 errors
+  class: callback
+  callback: resolve callout
+  paths: power supply1
+  properties: power supply present
+  callout: /xyz/openbmc_project/inventory/system/chassis/powersupply1
+
+- name: watch power supply0 present for resolving error logs
+  description: >
+    'On supply present state changes, check if errors need to be resolved.'
+  class: watch
+  watch: property
+  paths: power supply0
+  properties: power supply present
+  callback: resolve power supply0 errors if present
+
+- name: watch power supply1 present for resolving error logs
+  description: >
+    'On supply present state changes, check if errors need to be resolved.'
+  class: watch
+  watch: property
+  paths: power supply1
+  properties: power supply present
+  callback: resolve power supply1 errors if present