control: PCIe card metadata wrapper class

This class introduces a PCIeCardMetadata class to manage JSON files
containing PCIe card floor indexes. These can then be used by actions
that want to set the fan floors based on which PCIe cards are present.

It provides a lookup() method that takes four properties from the
PCIeDevice D-Bus interface to uniquely identify a card, and then returns
the floor index for the card if it doesn't have a temperature sensor on
it, or the 'has temp sensor' value which will be true.

The code first loads /etc/phosphor-fan-presence/control/pcie_cards.json
if it exists.  If that isn't present, it then tries
/usr/share/phosphor-fan-presence/control/pcie_cards.json.  After
that, it tries
/usr/share/phosphor-fan-presence/control/<system-name>/pcie_cards.json
where <system-name> comes from the list of system names passed into
the constructor.

It will overwrite any file entries that match as it goes on, so if a
system has to override just a few of the floor indexes from a more
generic file it can be done without having to duplicate entries for
cards that are the same.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I81f2476dd58d1529ee6484243e7d8f1e49027cf9
3 files changed