control: action to override a single fan in a zone - Action class

This change contains the OverrideFanTarget class to create the Action
from a json config. A very basic events.json would look like this:

[
  {
    "name": "test",
    "groups": [
      { "name": "fan0 sensor inventory", "interface": "xyz.openbmc_project.State.Decorator.OperationalStatus",
      "property": { "name": "Functional" } }
    ],
    "triggers": [
      { "class": "init", "method": "get_properties" },
      { "class": "signal", "signal": "properties_changed" }
    ],
    "actions": [ {
      "name": "override_fan_target",
      "count": 1,
      "state": false,
      "fans": [ "fan0", "fan2" ],
      "target": 9999
    } ]
  }
]

When the tach sensor for fan0 is set to non-funtional:

root@p10bmc:~# busctl set-property xyz.openbmc_project.Inventory.Manager
  /xyz/openbmc_project/inventory/system/chassis/motherboard/fan0/fan0_0
  xyz.openbmc_project.State.Decorator.OperationalStatus Functional b false

the run() method for the Action is called and all registered fans will
be locked at the "target" value given in the json "actions" section.

...
<output trimmed>
...
 FAN        TARGET(RPM)  FEEDBACKS(RPMS)   PRESENT   FUNCTIONAL
===============================================================
 fan0              9999       7019/9999      true         true
 fan1             10000       7020/10000     true         true
 fan2              9999       7019/9999      true         true
...

When the inventory registers the sensor back to functional, the override
lock is lifted and the fan is restored to its zone's current target.

Signed-off-by: Mike Capps <mikepcapps@gmail.com>
Change-Id: I6bf5bd55fd6eac2131aec02775a64ad287d3b3b0
4 files changed