summaryrefslogtreecommitdiffstats
path: root/ethernet_interface.cpp
diff options
context:
space:
mode:
authorRatan Gupta <ratagupt@in.ibm.com>2017-09-16 07:12:11 +0530
committerRatan Gupta <ratagupt@in.ibm.com>2017-10-03 10:04:46 +0530
commite05083ad3082e61388567c0c36c68dc08436188d (patch)
treefd4ea818178da8720fbdc563264cfbe20168675b /ethernet_interface.cpp
parentfd4b0f018b7d34292766cf9d871c391fa96ce8aa (diff)
downloadphosphor-networkd-e05083ad3082e61388567c0c36c68dc08436188d.tar.gz
phosphor-networkd-e05083ad3082e61388567c0c36c68dc08436188d.zip
Restart the network through networkManager
Extend the refresh timer once we get the Dbus request which requires network restart. Detaching the network restart from the writeConfiguration func. Write the configuration file for the vlan interface in writeConfiguration func. During creation of vlan,vlan interface should come up with dhcp as false. Change-Id: Iadc7b44554aca412d211d13e9569cc601ad04074 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
Diffstat (limited to 'ethernet_interface.cpp')
-rw-r--r--ethernet_interface.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp
index bcb8f6c..7c4e8bb 100644
--- a/ethernet_interface.cpp
+++ b/ethernet_interface.cpp
@@ -134,7 +134,7 @@ void EthernetInterface::iP(IP::Protocol protType,
prefixLength,
gateway));
- writeConfigurationFile();
+ manager.writeToConfigurationFile();
}
@@ -246,7 +246,7 @@ void EthernetInterface::deleteObject(const std::string& ipaddress)
return;
}
this->addrs.erase(it);
- writeConfigurationFile();
+ manager.writeToConfigurationFile();
}
void EthernetInterface::deleteVLANObject(const std::string& interface)
@@ -282,9 +282,6 @@ void EthernetInterface::deleteVLANObject(const std::string& interface)
}
// delete the interface
vlanInterfaces.erase(it);
- // restart the systemd-networkd
-
- restartSystemdUnit("systemd-networkd.service");
// TODO systemd doesn't delete the virtual network interface
// even after deleting all the related configuartion.
@@ -297,6 +294,8 @@ void EthernetInterface::deleteVLANObject(const std::string& interface)
{
commit<InternalFailure>();
}
+
+ manager.writeToConfigurationFile();
}
std::string EthernetInterface::generateObjectPath(IP::Protocol addressType,
@@ -323,7 +322,7 @@ bool EthernetInterface::dHCPEnabled(bool value)
}
EthernetInterfaceIntf::dHCPEnabled(value);
- writeConfigurationFile();
+ manager.writeToConfigurationFile();
return value;
}
@@ -364,19 +363,18 @@ void EthernetInterface::createVLAN(VlanId id)
auto vlanIntf = std::make_unique<phosphor::network::VlanInterface>(
bus,
path.c_str(),
- EthernetInterfaceIntf::dHCPEnabled(),
+ false,
id,
*this,
manager);
// write the device file for the vlan interface.
vlanIntf->writeDeviceFile();
- vlanIntf->writeConfigurationFile();
this->vlanInterfaces.emplace(vlanInterfaceName,
std::move(vlanIntf));
// write the new vlan device entry to the configuration(network) file.
- writeConfigurationFile();
+ manager.writeToConfigurationFile();
}
// Need to merge the below function with the code which writes the
@@ -391,6 +389,15 @@ void EthernetInterface::writeConfigurationFile()
using AddressOrigin =
sdbusplus::xyz::openbmc_project::Network::server::IP::AddressOrigin;
namespace fs = std::experimental::filesystem;
+
+ // if there is vlan interafce then write the configuration file
+ // for vlan also.
+
+ for (const auto& intf: vlanInterfaces)
+ {
+ intf.second->writeConfigurationFile();
+ }
+
fs::path confPath = manager.getConfDir();
std::string fileName = systemd::config::networkFilePrefix + interfaceName() +
@@ -429,7 +436,6 @@ void EthernetInterface::writeConfigurationFile()
// configured as dhcp.
writeDHCPSection(stream);
stream.close();
- restartSystemdUnit("systemd-networkd.service");
return;
}
@@ -475,7 +481,6 @@ void EthernetInterface::writeConfigurationFile()
}
stream.close();
- restartSystemdUnit("systemd-networkd.service");
}
void EthernetInterface::writeDHCPSection(std::fstream& stream)
OpenPOWER on IntegriCloud