blob: 3a06614d8798b19e6d02c7871390b13b08fccb48 [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
Ratan Guptabc886292017-07-25 18:29:57 +053023using DeleteIface = sdbusplus::xyz::openbmc_project::Object::server::Delete;
Ratan Gupta3d3e4fc2017-07-25 13:38:19 +053024using VlanIface = sdbusplus::xyz::openbmc_project::Network::server::VLAN;
Ratan Guptabc886292017-07-25 18:29:57 +053025using Interfaces =
26 sdbusplus::server::object::object<DeleteIface, VlanIface>;
Ratan Gupta3d3e4fc2017-07-25 13:38:19 +053027
28/** @class VlanInterface
29 * @brief OpenBMC vlan Interface implementation.
30 * @details A concrete implementation for the vlan interface
31 */
Ratan Guptabc886292017-07-25 18:29:57 +053032class VlanInterface : public Interfaces, public EthernetInterface
Ratan Gupta3d3e4fc2017-07-25 13:38:19 +053033{
34 public:
35 VlanInterface() = delete;
36 VlanInterface(const VlanInterface&) = delete;
37 VlanInterface& operator=(const VlanInterface&) = delete;
38 VlanInterface(VlanInterface&&) = delete;
39 VlanInterface& operator=(VlanInterface&&) = delete;
40 virtual ~VlanInterface() = default;
41
42 /** @brief Constructor to put object onto bus at a dbus path.
43 * @param[in] bus - Bus to attach to.
44 * @param[in] objPath - Path to attach at.
45 * @param[in] dhcpEnabled - DHCP enable value.
46 * @param[in] vlanID - vlan identifier.
47 * @param[in] intf - ethernet interface object.
48 * @param[in] manager - network manager object.
49 */
50 VlanInterface(sdbusplus::bus::bus& bus,
51 const std::string& objPath,
52 bool dhcpEnabled,
53 uint32_t vlanID,
54 EthernetInterface& intf,
55 Manager& manager);
56
Ratan Guptabc886292017-07-25 18:29:57 +053057 /** @brief Delete this d-bus object.
58 */
59 void delete_() override;
60
Ratan Gupta3d3e4fc2017-07-25 13:38:19 +053061 /** @brief writes the device configuration.
62 systemd reads this configuration file
63 and creates the vlan interface.*/
64 void writeDeviceFile();
65
66 private:
67
68 /** @brief VLAN Identifier. */
69 using VlanIface::id;
70
71 EthernetInterface& parentInterface;
72
73 friend class TestVlanInterface;
74};
75
76} // namespace network
77} // namespace phosphor