blob: c308611c206d0611c9f9c5a57b09be34009c4a39 [file] [log] [blame]
Ratan Gupta3d3e4fc2017-07-25 13:38:19 +05301#pragma once
2
3#include "types.hpp"
4
Ratan Gupta5978dd12017-07-25 13:47:13 +05305#include "ethernet_interface.hpp"
Ratan Gupta3d3e4fc2017-07-25 13:38:19 +05306#include "xyz/openbmc_project/Object/Delete/server.hpp"
7#include "xyz/openbmc_project/Network/VLAN/server.hpp"
8
9#include <sdbusplus/bus.hpp>
10#include <sdbusplus/server/object.hpp>
11
12#include <string>
Ratan Gupta3d3e4fc2017-07-25 13:38:19 +053013
14namespace phosphor
15{
16namespace network
17{
18
19class EthernetInterface;
20class Manager;
21
22
23using VlanIface = sdbusplus::xyz::openbmc_project::Network::server::VLAN;
24using VlanIntfObject = sdbusplus::server::object::object<VlanIface>;
25
26/** @class VlanInterface
27 * @brief OpenBMC vlan Interface implementation.
28 * @details A concrete implementation for the vlan interface
29 */
30class VlanInterface : public VlanIntfObject, public EthernetInterface
31{
32 public:
33 VlanInterface() = delete;
34 VlanInterface(const VlanInterface&) = delete;
35 VlanInterface& operator=(const VlanInterface&) = delete;
36 VlanInterface(VlanInterface&&) = delete;
37 VlanInterface& operator=(VlanInterface&&) = delete;
38 virtual ~VlanInterface() = default;
39
40 /** @brief Constructor to put object onto bus at a dbus path.
41 * @param[in] bus - Bus to attach to.
42 * @param[in] objPath - Path to attach at.
43 * @param[in] dhcpEnabled - DHCP enable value.
44 * @param[in] vlanID - vlan identifier.
45 * @param[in] intf - ethernet interface object.
46 * @param[in] manager - network manager object.
47 */
48 VlanInterface(sdbusplus::bus::bus& bus,
49 const std::string& objPath,
50 bool dhcpEnabled,
51 uint32_t vlanID,
52 EthernetInterface& intf,
53 Manager& manager);
54
55 /** @brief writes the device configuration.
56 systemd reads this configuration file
57 and creates the vlan interface.*/
58 void writeDeviceFile();
59
60 private:
61
62 /** @brief VLAN Identifier. */
63 using VlanIface::id;
64
65 EthernetInterface& parentInterface;
66
67 friend class TestVlanInterface;
68};
69
70} // namespace network
71} // namespace phosphor