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