Ratan Gupta | 3d3e4fc | 2017-07-25 13:38:19 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Ratan Gupta | 5978dd1 | 2017-07-25 13:47:13 +0530 | [diff] [blame] | 3 | #include "ethernet_interface.hpp" |
Patrick Venture | 189d44e | 2018-07-09 12:30:59 -0700 | [diff] [blame] | 4 | #include "types.hpp" |
Ratan Gupta | 3d3e4fc | 2017-07-25 13:38:19 +0530 | [diff] [blame] | 5 | #include "xyz/openbmc_project/Network/VLAN/server.hpp" |
| 6 | |
| 7 | #include <sdbusplus/bus.hpp> |
| 8 | #include <sdbusplus/server/object.hpp> |
Ratan Gupta | 3d3e4fc | 2017-07-25 13:38:19 +0530 | [diff] [blame] | 9 | #include <string> |
Patrick Venture | 189d44e | 2018-07-09 12:30:59 -0700 | [diff] [blame] | 10 | #include <xyz/openbmc_project/Object/Delete/server.hpp> |
Ratan Gupta | 3d3e4fc | 2017-07-25 13:38:19 +0530 | [diff] [blame] | 11 | |
| 12 | namespace phosphor |
| 13 | { |
| 14 | namespace network |
| 15 | { |
| 16 | |
| 17 | class EthernetInterface; |
| 18 | class Manager; |
| 19 | |
Ratan Gupta | bc88629 | 2017-07-25 18:29:57 +0530 | [diff] [blame] | 20 | using DeleteIface = sdbusplus::xyz::openbmc_project::Object::server::Delete; |
Ratan Gupta | 3d3e4fc | 2017-07-25 13:38:19 +0530 | [diff] [blame] | 21 | using VlanIface = sdbusplus::xyz::openbmc_project::Network::server::VLAN; |
Ratan Gupta | 3d3e4fc | 2017-07-25 13:38:19 +0530 | [diff] [blame] | 22 | |
| 23 | /** @class VlanInterface |
| 24 | * @brief OpenBMC vlan Interface implementation. |
| 25 | * @details A concrete implementation for the vlan interface |
| 26 | */ |
Ratan Gupta | 26e87a0 | 2017-08-18 01:08:40 +0530 | [diff] [blame] | 27 | class VlanInterface : public VlanIface, |
| 28 | public DeleteIface, |
| 29 | public EthernetInterface |
Ratan Gupta | 3d3e4fc | 2017-07-25 13:38:19 +0530 | [diff] [blame] | 30 | { |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 31 | public: |
| 32 | VlanInterface() = delete; |
| 33 | VlanInterface(const VlanInterface&) = delete; |
| 34 | VlanInterface& operator=(const VlanInterface&) = delete; |
| 35 | VlanInterface(VlanInterface&&) = delete; |
| 36 | VlanInterface& operator=(VlanInterface&&) = delete; |
| 37 | virtual ~VlanInterface() = default; |
Ratan Gupta | 3d3e4fc | 2017-07-25 13:38:19 +0530 | [diff] [blame] | 38 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 39 | /** @brief Constructor to put object onto bus at a dbus path. |
| 40 | * @param[in] bus - Bus to attach to. |
| 41 | * @param[in] objPath - Path to attach at. |
| 42 | * @param[in] dhcpEnabled - DHCP enable value. |
| 43 | * @param[in] vlanID - vlan identifier. |
| 44 | * @param[in] intf - ethernet interface object. |
| 45 | * @param[in] manager - network manager object. |
Manojkiran Eda | ca8b91b | 2020-05-28 09:28:42 +0530 | [diff] [blame] | 46 | * |
Manojkiran Eda | ca8b91b | 2020-05-28 09:28:42 +0530 | [diff] [blame] | 47 | * This constructor is called during loading the VLAN Interface |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 48 | */ |
| 49 | VlanInterface(sdbusplus::bus::bus& bus, const std::string& objPath, |
Johnathan Mantey | 817012a | 2020-01-30 15:07:39 -0800 | [diff] [blame] | 50 | DHCPConf dhcpEnabled, bool nicEnabled, uint32_t vlanID, |
| 51 | EthernetInterface& intf, Manager& parent); |
Ratan Gupta | 3d3e4fc | 2017-07-25 13:38:19 +0530 | [diff] [blame] | 52 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 53 | /** @brief Delete this d-bus object. |
| 54 | */ |
| 55 | void delete_() override; |
Ratan Gupta | bc88629 | 2017-07-25 18:29:57 +0530 | [diff] [blame] | 56 | |
William A. Kennington III | a2145bf | 2019-04-19 13:15:56 -0700 | [diff] [blame] | 57 | /** @brief sets the MAC address. |
| 58 | * @param[in] value - MAC address which needs to be set on the system. |
| 59 | * @returns macAddress of the interface or throws an error. |
| 60 | */ |
| 61 | std::string mACAddress(std::string value) override; |
| 62 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 63 | /** @brief writes the device configuration. |
| 64 | systemd reads this configuration file |
| 65 | and creates the vlan interface.*/ |
| 66 | void writeDeviceFile(); |
Ratan Gupta | 3d3e4fc | 2017-07-25 13:38:19 +0530 | [diff] [blame] | 67 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 68 | private: |
| 69 | /** @brief VLAN Identifier. */ |
| 70 | using VlanIface::id; |
Ratan Gupta | 3d3e4fc | 2017-07-25 13:38:19 +0530 | [diff] [blame] | 71 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 72 | EthernetInterface& parentInterface; |
Ratan Gupta | 3d3e4fc | 2017-07-25 13:38:19 +0530 | [diff] [blame] | 73 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 74 | friend class TestVlanInterface; |
Ratan Gupta | 3d3e4fc | 2017-07-25 13:38:19 +0530 | [diff] [blame] | 75 | }; |
| 76 | |
| 77 | } // namespace network |
| 78 | } // namespace phosphor |