Add VLAN device binding
IPMI net channel supports the VLAN. This patch will bind the service
to VLAN device if the VLANID is set in net channel.
Tested:
In all the steps, use following commands to check if ipmi overlan is
still working and lan channel info is correct.
ipmitool -I lanplus ... mc info
ipmitool -I lanplus ... lan print 1
1. Start the phosphor-ipmi-net@eth0.service and this service binds to
eth0 device
# Command to get the binding device
journalctl -u phosphor-ipmi-net@eth0.service -o verbose | grep \
INTERFACE
INTERFACE=eth0
2. Set the VLANID (123) for channel 1 (eth0) and restart the service.
The service is binded to eth0.123
# Command to set the channel 1 VLANID
ipmitool -I lanplus ... lan set 1 vlan id 123
# Command to restart
systemctl restart phosphor-ipmi-net@eth0.service
# Command to check the binding
journalctl -u phosphor-ipmi-net@eth0.service -o verbose | grep \
INTERFACE
INTERFACE=eth0.123
3. Disable the VLANID for channel 0 and restart the service.
The service is binded to eth0
# Command to disable the channel 1 VLANID
ipmitool -I lanplus ... lan set 1 vlan id off
# Command to restart
systemctl restart phosphor-ipmi-net@eth0.service
# Command to check the binding
journalctl -u phosphor-ipmi-net@eth0.service -o verbose | grep \
INTERFACE
INTERFACE=eth0
Limitation: Need to restart this service when the VLANID is changed.
This should be done in phosphor-host-ipmid.
Change-Id: I6c05aacf6b18cb1fa0d1cabe6ad36f0d683948d1
Signed-off-by: Alvin Wang <alvinwang@msn.com>
diff --git a/sd_event_loop.hpp b/sd_event_loop.hpp
index 54b2946..9729078 100644
--- a/sd_event_loop.hpp
+++ b/sd_event_loop.hpp
@@ -19,6 +19,23 @@
namespace eventloop
{
+using DbusObjectPath = std::string;
+using DbusService = std::string;
+using DbusInterface = std::string;
+using ObjectTree =
+ std::map<DbusObjectPath, std::map<DbusService, std::vector<DbusInterface>>>;
+using Value = std::variant<bool, uint8_t, int16_t, uint16_t, int32_t, uint32_t,
+ int64_t, uint64_t, double, std::string>;
+// VLANs are a 12-bit value
+constexpr uint16_t VLAN_VALUE_MASK = 0x0fff;
+constexpr auto MAPPER_BUS_NAME = "xyz.openbmc_project.ObjectMapper";
+constexpr auto MAPPER_OBJ = "/xyz/openbmc_project/object_mapper";
+constexpr auto MAPPER_INTF = "xyz.openbmc_project.ObjectMapper";
+constexpr auto PATH_ROOT = "/xyz/openbmc_project/network";
+constexpr auto INTF_VLAN = "xyz.openbmc_project.Network.VLAN";
+constexpr auto INTF_ETHERNET = "xyz.openbmc_project.Network.EthernetInterface";
+constexpr auto METHOD_GET = "Get";
+constexpr auto PROP_INTF = "org.freedesktop.DBus.Properties";
class EventLoop
{
@@ -54,6 +71,9 @@
/** @brief register the async handler for incoming udp packets */
void startRmcpReceive();
+ /** @brief get vlanid */
+ int getVLANID(const std::string channel);
+
/** @brief boost::asio io context to run with
*/
std::shared_ptr<boost::asio::io_context> io;