blob: 51e9d2c4790f0dc80cdbc7ef490b36c6df507fe9 [file] [log] [blame]
Ratan Gupta05eb1092017-04-14 16:33:53 +05301#pragma once
2
3#include "ethernet_interface.hpp"
4#include "xyz/openbmc_project/Network/VLAN/Create/server.hpp"
5
6#include <sdbusplus/bus.hpp>
7
8#include <list>
9#include <string>
10#include <vector>
11
12namespace phosphor
13{
14namespace network
15{
16
17namespace details
18{
19
20template <typename T>
21using ServerObject = typename sdbusplus::server::object::object<T>;
22
23using VLANCreateIface =
24 details::ServerObject<sdbusplus::xyz::openbmc_project::
25 Network::VLAN::server::Create>;
26
27using IntfName = std::string;
28
29struct AddrInfo {
30 short addrType;
31 std::string ipaddress;
32};
33
34using AddrList = std::list<AddrInfo>;
35using IntfAddrMap = std::map<IntfName, AddrList>;
36
37} // namespace details
38
39/** @class Manager
40 * @brief OpenBMC network manager implementation.
41 */
42class Manager : public details::VLANCreateIface
43{
44 public:
45 Manager() = delete;
46 Manager(const Manager&) = delete;
47 Manager& operator=(const Manager&) = delete;
48 Manager(Manager&&) = delete;
49 Manager& operator=(Manager&&) = delete;
50 virtual ~Manager() = default;
51
52 /** @brief Constructor to put object onto bus at a dbus path.
53 * @param[in] bus - Bus to attach to.
54 * @param[in] objPath - Path to attach at.
55 */
56 Manager(sdbusplus::bus::bus& bus, const char* objPath);
57
58 void vLAN(details::IntfName interfaceName, uint16_t id) override;
59
60 private:
61 /** @brief Get all the interfaces from the system.
62 * @returns list of interface names.
63 */
64 details::IntfAddrMap getInterfaceAndaddrs() const;
65
66 /** @brief Persistent map of EthernetInterface dbus objects and their names */
67 std::map<details::IntfName, std::unique_ptr<EthernetInterface>> interfaces;
68
69};
70
71} // namespace network
72} // namespace phosphor