Implement ipaddress object
Change-Id: Ic4d7953c5aca2bf85a609c736e5c817322d29e4b
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
diff --git a/Makefile.am b/Makefile.am
index 6035365..2125952 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -16,6 +16,7 @@
phosphor_network_manager_SOURCES = \
ethernet_interface.cpp \
+ ipaddress.cpp \
network_manager.cpp \
network_manager_main.cpp \
xyz/openbmc_project/Network/VLAN/Create/server.cpp
diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp
index 3fcb489..f4adf28 100644
--- a/ethernet_interface.cpp
+++ b/ethernet_interface.cpp
@@ -137,5 +137,11 @@
}
return macAddress;
}
+
+void EthernetInterface::deleteObject(const std::string& ipaddress)
+{
+ //NOTE:- will be implemented in next commit.
+}
+
}//namespace network
}//namespace phosphor
diff --git a/ethernet_interface.hpp b/ethernet_interface.hpp
index 4c75f29..71a3003 100644
--- a/ethernet_interface.hpp
+++ b/ethernet_interface.hpp
@@ -54,6 +54,10 @@
const std::string& objPath,
bool dhcpEnabled);
+ /** @brief delete the dbus object of the given ipaddress.
+ */
+
+ void deleteObject(const std::string& ipaddress);
private:
diff --git a/ipaddress.cpp b/ipaddress.cpp
new file mode 100644
index 0000000..3241102
--- /dev/null
+++ b/ipaddress.cpp
@@ -0,0 +1,38 @@
+#include "ipaddress.hpp"
+#include "ethernet_interface.hpp"
+
+#include <phosphor-logging/log.hpp>
+
+namespace phosphor
+{
+namespace network
+{
+
+using namespace phosphor::logging;
+
+IPAddress::IPAddress(sdbusplus::bus::bus& bus,
+ const char* objPath,
+ EthernetInterface& parent,
+ IP::Protocol type,
+ const std::string& ipaddress,
+ uint8_t prefixLength,
+ const std::string& gateway):
+ IPIfaces(bus, objPath, true),
+ parent(parent)
+{
+ this->address(ipaddress);
+ this->prefixLength(prefixLength);
+ this->gateway(gateway);
+ this->type(type);
+ // Emit deferred signal.
+ emit_object_added();
+}
+
+
+void IPAddress::delete_()
+{
+ parent.deleteObject(address());
+}
+
+}//namespace network
+}//namespace phosphor