Confirm presence of NIC devices described in channel_config
Confirm presence of NIC devices described in channel_config

The channel_config.json file describes the IPMI channel arrangement
assigned to the BMC. There is an implied expectation that this
configuration file is a 1:1 description of a set of channels assigned
to the BMC and the baseboard containing the BMC. There are vendors who
may prefer to create a smaller subset of firmware images, and apply
them to mulitple different final assemblies. One example of this is
the use of two final assemblies that differ only in the number of
network PHY devices populated on the board.

This commit compares the channel_config entries for the LAN channels
against the LAN devices reported by getifaddrs. If a LAN channel is
described in the channel_config file, but is missing from the
getifaddrs device list, the channel is marked as invalid, effectively
removing the channel from IPMI. This permits run time identification
of the LAN devices without adding unique vendor specific
identification tests.

Tested:
Used a channel_config file that defined two NIC devices, one on
channel 1, and the other on channel 3. The configuration file marked
both of these entries "isValid = true".
This change was then run on a BMC with only a single NIC attached. The
getifaddrs function returned only the "lo" and the "eth0" devices. The
"eth0" device matched the channel_config entry for channelId == 3, and
a channel name == "eth0".
Using "ipmitool raw 6 0x42 3" returns channel information for eth0.
Using "ipmitool raw 6 0x42 1" returns a 0xcc response code.
Prior to this change this command returned a success response code, and
data for an unknown NIC device.

Used these same commands on a baseboard which populated both NIC eth0,
and eth1.
The ipmitool commands return a success response code, and modify their
respective NIC channels.

Change-Id: I8b52cecdd815ec56efc6af97ad53325cb5d54c06
Signed-off-by: Johnathan Mantey <0048b8e2f791bacb0830da233adbf1612889167c@intel.com>

openbmc/phosphor-host-ipmid,openbmc/phosphor-host-ipmid,openbmc/phosphor-host-ipmid