Create Witherspoon fan errors

Moved the code to create NotPresent and Nonfunctional errors to a new
yaml, fan-errors.yaml.
Fixed the problem with duplicate errors, caused by a 2nd fan
going nonfunctional or not present which would create a 2nd error
for the 1st fan previously nonfunctional or not present.

Create a notpresent error if fan 0, 1, 2, or 3 is not present for more
than 20 seconds. Create a Nonfunctional error if fan 0, 1, 2, or 3 is not
functional for any amount of time.
The system must be powered on in both of these cases.
If a water cooled system, don't create errors for fan 1.
An error is created each time the chassis powers on if a fan is
removed or nonfunctional.

Resolves openbmc/openbmc#2472

Change-Id: Ibd71bf3a3b2381df623e7310a510a2f044c525e4
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/meta-witherspoon/recipes-phosphor/fans/witherspoon-fan-policy/water-cooled.yaml b/meta-witherspoon/recipes-phosphor/fans/witherspoon-fan-policy/water-cooled.yaml
index dd0ce00..92d7325 100644
--- a/meta-witherspoon/recipes-phosphor/fans/witherspoon-fan-policy/water-cooled.yaml
+++ b/meta-witherspoon/recipes-phosphor/fans/witherspoon-fan-policy/water-cooled.yaml
@@ -4,27 +4,6 @@
 # If the number of functional fans drops below that
 # power the system off.
 
-- name: fan0
-  class: group
-  group: path
-  members:
-    - meta: FAN
-      path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan0
-
-- name: fan2
-  class: group
-  group: path
-  members:
-    - meta: FAN
-      path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan2
-
-- name: fan3
-  class: group
-  group: path
-  members:
-    - meta: FAN
-      path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan3
-
 - name: fans
   description: >
     'A water cooled Witherspoon has three fans to monitor.'
@@ -163,35 +142,12 @@
 
 - name: check fans
   description: >
-    'Verify there are at least two functional fans, power off if not.
-     Create an error if a fan is nonfuncitonal or not present'
+    'Verify there are at least two functional fans, power off if not.'
   class: callback
   callback: group
   members:
     - check group presence
     - check group functional
-    - check individual presence
-    - check individual functional
-
-- name: check individual presence
-  description: >
-    'Verify each of the 3 fans are present.'
-  class: callback
-  callback: group
-  members:
-    - check fan0 presence
-    - check fan2 presence
-    - check fan3 presence
-
-- name: check individual functional
-  description: >
-    'Verify each of the 3 fans are functional.'
-  class: callback
-  callback: group
-  members:
-    - check fan0 functional
-    - check fan2 functional
-    - check fan3 functional
 
 - name: check group presence
   description: >
@@ -233,87 +189,6 @@
   op: '=='
   bound: false
 
-- name: check fan0 presence
-  description: >
-    'If this condition passes fan0 has been unplugged for more than 20 seconds.'
-  class: condition
-  condition: count
-  paths: fan0
-  properties: fan present
-  defer: 20000000us
-  callback: notpresent fan0 error
-  countop: '<'
-  countbound: 1
-  op: '=='
-  bound: true
-
-- name: check fan0 functional
-  description: >
-    'If this condition passes fan0 has been marked as nonfunctional.'
-  class: condition
-  condition: count
-  paths: fan0
-  properties: fan functional
-  callback: nonfunctional fan0 error
-  countop: '>'
-  countbound: 0
-  op: '=='
-  bound: false
-
-- name: check fan2 presence
-  description: >
-    'If this condition passes fan2 has been unplugged for more than 20 seconds.'
-  class: condition
-  condition: count
-  paths: fan2
-  properties: fan present
-  defer: 20000000us
-  callback: notpresent fan2 error
-  countop: '<'
-  countbound: 1
-  op: '=='
-  bound: true
-
-- name: check fan2 functional
-  description: >
-    'If this condition passes fan2 has been marked as nonfunctional.'
-  class: condition
-  condition: count
-  paths: fan2
-  properties: fan functional
-  callback: nonfunctional fan2 error
-  countop: '>'
-  countbound: 0
-  op: '=='
-  bound: false
-
-- name: check fan3 presence
-  description: >
-    'If this condition passes fan3 has been unplugged for more than 20 seconds.'
-  class: condition
-  condition: count
-  paths: fan3
-  properties: fan present
-  defer: 20000000us
-  callback: notpresent fan3 error
-  countop: '<'
-  countbound: 1
-  op: '=='
-  bound: true
-
-- name: check fan3 functional
-  description: >
-    'If this condition passes fan3 has been marked as nonfunctional.'
-  class: condition
-  condition: count
-  paths: fan3
-  properties: fan functional
-  callback: nonfunctional fan3 error
-  countop: '>'
-  countbound: 0
-  op: '=='
-  bound: false
-
 - name: log and shutdown
   description: >
     'Shut the system down, log an event in the journal, and create an
@@ -350,72 +225,6 @@
   severity: ERR
   message: Shutting down system.  There are not enough functional fans.
 
-- name: notpresent fan0 error
-  class: callback
-  callback: elog
-  paths: fan0
-  properties: fan present
-  error: xyz::openbmc_project::Inventory::Error::NotPresent
-  metadata:
-    - name: xyz::openbmc_project::Inventory::NotPresent::CALLOUT_INVENTORY_PATH
-      value: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan0
-      type: string
-
-- name: nonfunctional fan0 error
-  class: callback
-  callback: elog
-  paths: fan0
-  properties: fan functional
-  error: xyz::openbmc_project::Inventory::Error::Nonfunctional
-  metadata:
-    - name: xyz::openbmc_project::Inventory::Nonfunctional::CALLOUT_INVENTORY_PATH
-      value: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan0
-      type: string
-
-- name: notpresent fan2 error
-  class: callback
-  callback: elog
-  paths: fan2
-  properties: fan present
-  error: xyz::openbmc_project::Inventory::Error::NotPresent
-  metadata:
-    - name: xyz::openbmc_project::Inventory::NotPresent::CALLOUT_INVENTORY_PATH
-      value: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan2
-      type: string
-
-- name: nonfunctional fan2 error
-  class: callback
-  callback: elog
-  paths: fan2
-  properties: fan functional
-  error: xyz::openbmc_project::Inventory::Error::Nonfunctional
-  metadata:
-    - name: xyz::openbmc_project::Inventory::Nonfunctional::CALLOUT_INVENTORY_PATH
-      value: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan2
-      type: string
-
-- name: notpresent fan3 error
-  class: callback
-  callback: elog
-  paths: fan3
-  properties: fan present
-  error: xyz::openbmc_project::Inventory::Error::NotPresent
-  metadata:
-    - name: xyz::openbmc_project::Inventory::NotPresent::CALLOUT_INVENTORY_PATH
-      value: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan3
-      type: string
-
-- name: nonfunctional fan3 error
-  class: callback
-  callback: elog
-  paths: fan3
-  properties: fan functional
-  error: xyz::openbmc_project::Inventory::Error::Nonfunctional
-  metadata:
-    - name: xyz::openbmc_project::Inventory::Nonfunctional::CALLOUT_INVENTORY_PATH
-      value: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan3
-      type: string
-
 - name: create shutdown error
   description: >
     'Create a Fan Shutdown Error log.'