use of org.eclipse.kura.net.NetInterfaceAddressConfig in project kura by eclipse.
the class NetworkConfiguration method addNetConfig.
public void addNetConfig(String interfaceName, NetInterfaceType netInterfaceType, NetConfig netConfig) throws KuraException {
NetInterfaceConfig<? extends NetInterfaceAddressConfig> netInterfaceConfig = this.m_netInterfaceConfigs.get(interfaceName);
if (netInterfaceConfig == null) {
switch(netInterfaceType) {
case LOOPBACK:
netInterfaceConfig = new LoopbackInterfaceConfigImpl(interfaceName);
break;
case ETHERNET:
netInterfaceConfig = new EthernetInterfaceConfigImpl(interfaceName);
break;
case WIFI:
netInterfaceConfig = new WifiInterfaceConfigImpl(interfaceName);
break;
case MODEM:
netInterfaceConfig = new ModemInterfaceConfigImpl(interfaceName);
default:
break;
}
}
List<? extends NetInterfaceAddressConfig> netInterfaceAddressConfigs = netInterfaceConfig.getNetInterfaceAddresses();
s_logger.trace("Adding a netConfig: {}", netConfig);
for (NetInterfaceAddressConfig netInterfaceAddressConfig : netInterfaceAddressConfigs) {
NetInterfaceAddressConfigImpl netInterfaceAddressConfigImpl = (NetInterfaceAddressConfigImpl) netInterfaceAddressConfig;
List<NetConfig> netConfigs = netInterfaceAddressConfig.getConfigs();
netConfigs.add(netConfig);
netInterfaceAddressConfigImpl.setNetConfigs(netConfigs);
}
this.m_recomputeProperties = true;
}
Aggregations