diff options
author | Ratan Gupta <ratagupt@in.ibm.com> | 2017-04-21 08:45:23 +0530 |
---|---|---|
committer | Ratan Gupta <ratagupt@in.ibm.com> | 2017-05-23 12:16:52 +0530 |
commit | 82549ccaa0f6373f664b260c7461adfd9f7665ba (patch) | |
tree | d183620e29632d2ed6c95ba9f8186f3965d09663 /ethernet_interface.hpp | |
parent | db81a8acba51722b81ceeb22d0e6a3f688b652ad (diff) | |
download | phosphor-networkd-82549ccaa0f6373f664b260c7461adfd9f7665ba.tar.gz phosphor-networkd-82549ccaa0f6373f664b260c7461adfd9f7665ba.zip |
Implement create interface for ipaddress
Change-Id: Ia4598c27c11667dafb70a8af58871661b7042d0f
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
Diffstat (limited to 'ethernet_interface.hpp')
-rw-r--r-- | ethernet_interface.hpp | 56 |
1 files changed, 46 insertions, 10 deletions
diff --git a/ethernet_interface.hpp b/ethernet_interface.hpp index 71a3003..ab69a78 100644 --- a/ethernet_interface.hpp +++ b/ethernet_interface.hpp @@ -1,6 +1,10 @@ #pragma once +#include "ipaddress.hpp" +#include "types.hpp" + #include "xyz/openbmc_project/Network/EthernetInterface/server.hpp" +#include "xyz/openbmc_project/Network/IP/Create/server.hpp" #include <sdbusplus/bus.hpp> #include <sdbusplus/server/object.hpp> @@ -11,17 +15,14 @@ namespace phosphor { namespace network { -namespace details -{ -template <typename T> -using ServerObject = typename sdbusplus::server::object::object<T>; +using Ifaces = + sdbusplus::server::object::object< + sdbusplus::xyz::openbmc_project::Network::server::EthernetInterface, + sdbusplus::xyz::openbmc_project::Network::IP::server::Create>; -using EthernetIface = - sdbusplus::server::object::object < - sdbusplus::xyz::openbmc_project::Network::server::EthernetInterface >; +using IP = sdbusplus::xyz::openbmc_project::Network::server::IP; -} // namespace details using LinkSpeed = uint16_t; using DuplexMode = uint8_t; @@ -34,7 +35,7 @@ using InterfaceInfo = std::tuple<LinkSpeed, DuplexMode, Autoneg>; * @details A concrete implementation for the * xyz.openbmc_project.Network.EthernetInterface DBus API. */ -class EthernetInterface : public details::EthernetIface +class EthernetInterface : public Ifaces { public: EthernetInterface() = delete; @@ -52,7 +53,20 @@ class EthernetInterface : public details::EthernetIface */ EthernetInterface(sdbusplus::bus::bus& bus, const std::string& objPath, - bool dhcpEnabled); + bool dhcpEnabled, + const AddrList& addrs); + + /** @brief Function to create ipaddress dbus object. + * @param[in] addressType - Type of ip address. + * @param[in] ipaddress- IP adress. + * @param[in] prefixLength - Length of prefix. + * @param[in] gateway - Gateway ip address. + */ + + void iP(IP::Protocol addressType, + std::string ipaddress, + uint8_t prefixLength, + std::string gateway) override; /** @brief delete the dbus object of the given ipaddress. */ @@ -74,6 +88,28 @@ class EthernetInterface : public details::EthernetIface std::string getMACAddress() const; + /** @brief construct the ip address dbus object path. + * @param[in] addressType - Type of ip address. + * @return path of the address object. + */ + + std::string getAddressObjectPath(IP::Protocol addressType) const; + + /** @brief get the ipadress count for a specific type on this interface. + * @param[in] addressType - Type of ip address. + * @return count of ipaddreses for the incoming type. + */ + + size_t getAddressCount(IP::Protocol addressType) const; + + + /** @brief Persistent sdbusplus DBus bus connection. */ + sdbusplus::bus::bus& bus; + + /** @brief Persistent map of IPAddress dbus objects and their names */ + std::map<std::string, std::unique_ptr<IPAddress>> addrs; + + }; } // namespace network |