diff options
author | Ratan Gupta <ratagupt@in.ibm.com> | 2017-09-22 17:15:37 +0530 |
---|---|---|
committer | Ratan Gupta <ratagupt@in.ibm.com> | 2017-10-11 18:17:10 +0530 |
commit | e9c9b81c8c01e15306dad27a3281b582e775c44a (patch) | |
tree | 058292a2fb06c8070753dd34575e54993881262a /ethernet_interface.cpp | |
parent | b610caf66122dfc7293e2b11192f98eea731e5db (diff) | |
download | phosphor-networkd-e9c9b81c8c01e15306dad27a3281b582e775c44a.tar.gz phosphor-networkd-e9c9b81c8c01e15306dad27a3281b582e775c44a.zip |
Implement delete all interface.
deletes all the ipaddress object on the interface.
Resolves openbmc/openbmc#2141
Change-Id: I6f045758ff29080cb4a4dec9e8b0d23d932c55b6
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
Diffstat (limited to 'ethernet_interface.cpp')
-rw-r--r-- | ethernet_interface.cpp | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp index a9463c9..c3bac59 100644 --- a/ethernet_interface.cpp +++ b/ethernet_interface.cpp @@ -249,18 +249,8 @@ void EthernetInterface::deleteObject(const std::string& ipaddress) manager.writeToConfigurationFile(); } -void EthernetInterface::deleteVLANObject(const std::string& interface) +void EthernetInterface::deleteVLANFromSystem(const std::string& interface) { - using namespace std::string_literals; - - auto it = vlanInterfaces.find(interface); - if (it == vlanInterfaces.end()) - { - log<level::ERR>("DeleteVLANObject:Unable to find the object", - entry("INTERFACE=%s",interface.c_str())); - return; - } - auto confDir = manager.getConfDir(); fs::path networkFile = confDir; networkFile /= systemd::config::networkFilePrefix + interface + @@ -280,8 +270,6 @@ void EthernetInterface::deleteVLANObject(const std::string& interface) { fs::remove(deviceFile); } - // delete the interface - vlanInterfaces.erase(it); // TODO systemd doesn't delete the virtual network interface // even after deleting all the related configuartion. @@ -295,6 +283,22 @@ void EthernetInterface::deleteVLANObject(const std::string& interface) commit<InternalFailure>(); } +} + +void EthernetInterface::deleteVLANObject(const std::string& interface) +{ + auto it = vlanInterfaces.find(interface); + if (it == vlanInterfaces.end()) + { + log<level::ERR>("DeleteVLANObject:Unable to find the object", + entry("INTERFACE=%s",interface.c_str())); + return; + } + + deleteVLANFromSystem(interface); + // delete the interface + vlanInterfaces.erase(it); + manager.writeToConfigurationFile(); } @@ -579,5 +583,19 @@ std::string EthernetInterface::mACAddress(std::string value) } +void EthernetInterface::deleteAll() +{ + if(EthernetInterfaceIntf::dHCPEnabled()) + { + log<level::INFO>("DHCP enabled on the interface"), + entry("INTERFACE=%s", interfaceName().c_str()); + + } + + // clear all the ip on the interface + addrs.clear(); + manager.writeToConfigurationFile(); +} + }//namespace network }//namespace phosphor |