summaryrefslogtreecommitdiffstats
path: root/net.cpp
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2017-12-22 14:03:06 -0800
committerTom Joseph <tomjoseph@in.ibm.com>2018-01-17 15:05:57 +0000
commitc01edf283dca792d1eecedd5c03b69b7eebb6f23 (patch)
tree4fab333c768b575412a513ec59988d5f546769c8 /net.cpp
parenta1adb0777e370103ab9f3e7f8788f74975c69897 (diff)
downloadphosphor-host-ipmid-c01edf283dca792d1eecedd5c03b69b7eebb6f23.tar.gz
phosphor-host-ipmid-c01edf283dca792d1eecedd5c03b69b7eebb6f23.zip
multiple-channel configuration via yaml
Handles converting a yaml file mapping IPMI channel to ethernet device and using this instead of a hard-coded map. Change-Id: Iedfe7cb52a2d0663b9c8a0f6f9d37fe733b63a58 Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'net.cpp')
-rw-r--r--net.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/net.cpp b/net.cpp
index 6c492a2..17be41e 100644
--- a/net.cpp
+++ b/net.cpp
@@ -1,6 +1,8 @@
#include <map>
#include <string>
+#include "utils.hpp"
+
// Not sure if this should live in utils. Because it's really a per-system
// configuration, instead of just hard-coding channel 1 to be eth0, one could
// conceivably configure it however they pleased.
@@ -12,23 +14,14 @@ namespace ipmi
namespace network
{
-// This map should come from a configuration yaml.
-// Also, no need to really be a map, could be just an array
-// we index into by channel. :D
-std::map<int, std::string> ethDeviceMap = {
- {1, "eth0"},
- {2, "eth1"},
-};
-
+extern const ipmi::network::ChannelEthMap ethdevices;
// Given a channel number, return a matching ethernet device, or empty string
// if there is no match.
-// TODO provide this from a configuration:
-// https://github.com/openbmc/openbmc/issues/2667
std::string ChanneltoEthernet(int channel)
{
- auto dev = ethDeviceMap.find(channel);
- if (dev == ethDeviceMap.end())
+ auto dev = ethdevices.find(channel);
+ if (dev == ethdevices.end())
{
return "";
}
OpenPOWER on IntegriCloud