Search in sources :

Example 26 with NetInterfaceAddressConfig

use of org.eclipse.kura.net.NetInterfaceAddressConfig in project kura by eclipse.

the class IfcfgConfigWriter method writeKuraExtendedConfig.

public static void writeKuraExtendedConfig(NetInterfaceConfig<? extends NetInterfaceAddressConfig> netInterfaceConfig) throws KuraException {
    NetInterfaceStatus netInterfaceStatus = null;
    boolean gotNetConfigIP4 = false;
    List<? extends NetInterfaceAddressConfig> netInterfaceAddressConfigs = netInterfaceConfig.getNetInterfaceAddresses();
    if (netInterfaceAddressConfigs != null && netInterfaceAddressConfigs.size() > 0) {
        for (NetInterfaceAddressConfig netInterfaceAddressConfig : netInterfaceAddressConfigs) {
            List<NetConfig> netConfigs = netInterfaceAddressConfig.getConfigs();
            if (netConfigs != null && netConfigs.size() > 0) {
                for (int i = 0; i < netConfigs.size(); i++) {
                    NetConfig netConfig = netConfigs.get(i);
                    if (netConfig instanceof NetConfigIP4) {
                        netInterfaceStatus = ((NetConfigIP4) netConfig).getStatus();
                        gotNetConfigIP4 = true;
                    }
                }
            }
        }
    }
    if (!gotNetConfigIP4) {
        netInterfaceStatus = NetInterfaceStatus.netIPv4StatusDisabled;
    }
    s_logger.debug("Setting NetInterfaceStatus to " + netInterfaceStatus + " for " + netInterfaceConfig.getName());
    // set it all
    Properties kuraExtendedProps = KuranetConfig.getProperties();
    if (kuraExtendedProps == null) {
        s_logger.debug("kuraExtendedProps was null");
        kuraExtendedProps = new Properties();
    }
    StringBuilder sb = new StringBuilder().append("net.interface.").append(netInterfaceConfig.getName()).append(".config.ip4.status");
    kuraExtendedProps.put(sb.toString(), netInterfaceStatus.toString());
    // write it
    if (kuraExtendedProps != null && !kuraExtendedProps.isEmpty()) {
        try {
            KuranetConfig.storeProperties(kuraExtendedProps);
        } catch (IOException e) {
            throw new KuraException(KuraErrorCode.INTERNAL_ERROR, e);
        }
    }
}
Also used : NetInterfaceStatus(org.eclipse.kura.net.NetInterfaceStatus) KuraException(org.eclipse.kura.KuraException) NetConfig(org.eclipse.kura.net.NetConfig) IOException(java.io.IOException) Properties(java.util.Properties) NetInterfaceAddressConfig(org.eclipse.kura.net.NetInterfaceAddressConfig) NetConfigIP4(org.eclipse.kura.net.NetConfigIP4)

Example 27 with NetInterfaceAddressConfig

use of org.eclipse.kura.net.NetInterfaceAddressConfig in project kura by eclipse.

the class FirewallAutoNatConfigWriter method getNatConfigs.

private LinkedHashSet<NATRule> getNatConfigs(NetworkConfiguration networkConfig) {
    LinkedHashSet<NATRule> natConfigs = new LinkedHashSet<NATRule>();
    if (networkConfig != null) {
        ArrayList<String> wanList = new ArrayList<String>();
        ArrayList<String> natList = new ArrayList<String>();
        // get relevant interfaces
        for (NetInterfaceConfig<? extends NetInterfaceAddressConfig> netInterfaceConfig : networkConfig.getNetInterfaceConfigs()) {
            String interfaceName = netInterfaceConfig.getName();
            NetInterfaceStatus status = NetInterfaceStatus.netIPv4StatusUnknown;
            boolean isNat = false;
            for (NetInterfaceAddressConfig addressConfig : netInterfaceConfig.getNetInterfaceAddresses()) {
                for (NetConfig netConfig : addressConfig.getConfigs()) {
                    if (netConfig instanceof NetConfigIP4) {
                        status = ((NetConfigIP4) netConfig).getStatus();
                    } else if (netConfig instanceof FirewallAutoNatConfig) {
                        s_logger.debug("getNatConfigs() :: FirewallAutoNatConfig: {}", ((FirewallAutoNatConfig) netConfig).toString());
                        isNat = true;
                    } else if (netConfig instanceof FirewallNatConfig) {
                        s_logger.debug("getNatConfigs() ::  FirewallNatConfig: {}", ((FirewallNatConfig) netConfig).toString());
                    }
                }
            }
            if (NetInterfaceStatus.netIPv4StatusEnabledWAN.equals(status)) {
                wanList.add(interfaceName);
            } else if (NetInterfaceStatus.netIPv4StatusEnabledLAN.equals(status) && isNat) {
                natList.add(interfaceName);
            }
        }
        // create a nat rule for each interface to all potential wan interfaces
        for (String sourceInterface : natList) {
            for (String destinationInterface : wanList) {
                s_logger.debug("Got NAT rule for source: " + sourceInterface + ", destination: " + destinationInterface);
                natConfigs.add(new NATRule(sourceInterface, destinationInterface, true));
            }
        }
    }
    return natConfigs;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) FirewallAutoNatConfig(org.eclipse.kura.net.firewall.FirewallAutoNatConfig) NetInterfaceStatus(org.eclipse.kura.net.NetInterfaceStatus) ArrayList(java.util.ArrayList) NATRule(org.eclipse.kura.linux.net.iptables.NATRule) FirewallNatConfig(org.eclipse.kura.net.firewall.FirewallNatConfig) NetConfigIP4(org.eclipse.kura.net.NetConfigIP4) NetConfig(org.eclipse.kura.net.NetConfig) NetInterfaceAddressConfig(org.eclipse.kura.net.NetInterfaceAddressConfig)

Example 28 with NetInterfaceAddressConfig

use of org.eclipse.kura.net.NetInterfaceAddressConfig in project kura by eclipse.

the class WpaSupplicantConfigWriter method writeConfig.

private void writeConfig(NetInterfaceConfig<? extends NetInterfaceAddressConfig> netInterfaceConfig) throws KuraException {
    String interfaceName = netInterfaceConfig.getName();
    s_logger.debug("Writing wpa_supplicant config for {}", interfaceName);
    List<? extends NetInterfaceAddressConfig> netInterfaceAddressConfigs = netInterfaceConfig.getNetInterfaceAddresses();
    if (netInterfaceAddressConfigs.size() > 0) {
        for (NetInterfaceAddressConfig netInterfaceAddressConfig : netInterfaceAddressConfigs) {
            if (netInterfaceAddressConfig instanceof WifiInterfaceAddressConfigImpl) {
                List<NetConfig> netConfigs = netInterfaceAddressConfig.getConfigs();
                NetInterfaceStatus netInterfaceStatus = NetInterfaceStatus.netIPv4StatusDisabled;
                WifiMode wifiMode = ((WifiInterfaceAddressConfigImpl) netInterfaceAddressConfig).getMode();
                WifiConfig infraConfig = null;
                WifiConfig adhocConfig = null;
                WifiConfig wpaSupplicantConfig = null;
                // Get the wifi configs
                if (netConfigs != null) {
                    for (NetConfig netConfig : netConfigs) {
                        if (netConfig instanceof WifiConfig) {
                            if (((WifiConfig) netConfig).getMode() == WifiMode.ADHOC) {
                                adhocConfig = (WifiConfig) netConfig;
                            } else if (((WifiConfig) netConfig).getMode() == WifiMode.INFRA) {
                                infraConfig = (WifiConfig) netConfig;
                            }
                        } else if (netConfig instanceof NetConfigIP4) {
                            netInterfaceStatus = ((NetConfigIP4) netConfig).getStatus();
                        }
                    }
                }
                if (netInterfaceStatus == NetInterfaceStatus.netIPv4StatusDisabled) {
                    s_logger.info("Network interface status for " + interfaceName + " is disabled - not overwriting wpaconfig file");
                    return;
                }
                // Choose which config to write
                if (wifiMode == WifiMode.INFRA) {
                    if (infraConfig != null) {
                        StringBuilder key = new StringBuilder().append("net.interface.").append(interfaceName).append(".config.wifi.infra.pingAccessPoint");
                        try {
                            KuranetConfig.setProperty(key.toString(), Boolean.toString(infraConfig.pingAccessPoint()));
                        } catch (IOException e) {
                            s_logger.warn("Error setting KuranetConfig property", e);
                        }
                        key = new StringBuilder().append("net.interface.").append(interfaceName).append(".config.wifi.infra.ignoreSSID");
                        try {
                            KuranetConfig.setProperty(key.toString(), Boolean.toString(infraConfig.ignoreSSID()));
                        } catch (IOException e) {
                            s_logger.warn("Error setting KuranetConfig property", e);
                        }
                        wpaSupplicantConfig = infraConfig;
                    } else {
                        s_logger.debug("Not updating wpa_supplicant config - wifi mode is " + wifiMode + " but the infra config is null");
                    }
                } else if (wifiMode == WifiMode.ADHOC) {
                    if (adhocConfig != null) {
                        wpaSupplicantConfig = adhocConfig;
                    } else {
                        s_logger.debug("Not updating wpa_supplicant config - wifi mode is " + wifiMode + " but the adhoc config is null");
                    }
                } else if (wifiMode == WifiMode.MASTER) {
                    if (infraConfig != null && adhocConfig != null) {
                        // Choose the infra config if both are present?
                        wpaSupplicantConfig = infraConfig;
                    } else if (infraConfig != null) {
                        wpaSupplicantConfig = infraConfig;
                    } else if (adhocConfig != null) {
                        wpaSupplicantConfig = adhocConfig;
                    } else {
                        s_logger.debug("Not updating wpa_supplicant config - wifi mode is " + wifiMode + " and the infra and adhoc configs are null");
                    }
                }
                // Write the config
                try {
                    if (wpaSupplicantConfig != null) {
                        s_logger.debug("Writing wifiConfig: {}", wpaSupplicantConfig);
                        generateWpaSupplicantConf(wpaSupplicantConfig, interfaceName, WPA_TMP_CONFIG_FILE);
                        moveWpaSupplicantConf(interfaceName, WPA_TMP_CONFIG_FILE);
                    }
                } catch (Exception e) {
                    s_logger.error("Failed to configure WPA Supplicant");
                    throw KuraException.internalError(e);
                }
            }
        }
    }
}
Also used : NetInterfaceStatus(org.eclipse.kura.net.NetInterfaceStatus) WifiConfig(org.eclipse.kura.net.wifi.WifiConfig) IOException(java.io.IOException) KuraException(org.eclipse.kura.KuraException) IOException(java.io.IOException) NetConfigIP4(org.eclipse.kura.net.NetConfigIP4) WifiMode(org.eclipse.kura.net.wifi.WifiMode) NetConfig(org.eclipse.kura.net.NetConfig) NetInterfaceAddressConfig(org.eclipse.kura.net.NetInterfaceAddressConfig) WifiInterfaceAddressConfigImpl(org.eclipse.kura.core.net.WifiInterfaceAddressConfigImpl)

Example 29 with NetInterfaceAddressConfig

use of org.eclipse.kura.net.NetInterfaceAddressConfig in project kura by eclipse.

the class NetworkAdminServiceImpl method enableInterface.

@Override
public void enableInterface(String interfaceName, boolean dhcp) throws KuraException {
    try {
        NetInterfaceType type = LinuxNetworkUtil.getType(interfaceName);
        NetInterfaceStatus status = NetInterfaceStatus.netIPv4StatusUnknown;
        WifiMode wifiMode = WifiMode.UNKNOWN;
        WifiConfig wifiConfig = null;
        WifiInterfaceState wifiInterfaceState = null;
        if (type == NetInterfaceType.WIFI) {
            List<NetInterfaceConfig<? extends NetInterfaceAddressConfig>> wifiNetInterfaceConfigs = getWifiInterfaceConfigs();
            List<? extends NetInterfaceAddressConfig> wifiNetInterfaceAddressConfigs = getWifiNetInterfaceAddressConfigs(interfaceName, wifiNetInterfaceConfigs);
            WifiInterfaceAddressConfig wifiInterfaceAddressConfig = getWifiAddressConfig(wifiNetInterfaceAddressConfigs);
            wifiMode = wifiInterfaceAddressConfig.getMode();
            wifiInterfaceState = new WifiInterfaceState(interfaceName, wifiMode);
            for (NetConfig netConfig : wifiInterfaceAddressConfig.getConfigs()) {
                if (netConfig instanceof NetConfigIP4) {
                    status = ((NetConfigIP4) netConfig).getStatus();
                    s_logger.debug("Interface status is set to {}", status);
                } else if (netConfig instanceof WifiConfig && ((WifiConfig) netConfig).getMode() == wifiMode) {
                    wifiConfig = (WifiConfig) netConfig;
                }
            }
        }
        if (!LinuxNetworkUtil.hasAddress(interfaceName) || ((type == NetInterfaceType.WIFI) && (wifiInterfaceState != null) && !wifiInterfaceState.isLinkUp())) {
            s_logger.info("bringing interface {} up", interfaceName);
            if (type == NetInterfaceType.WIFI) {
                enableWifiInterface(interfaceName, status, wifiMode, wifiConfig);
            }
            if (dhcp) {
                renewDhcpLease(interfaceName);
            } else {
                LinuxNetworkUtil.enableInterface(interfaceName);
            }
            // if it isn't up - at least make sure the Ethernet controller is powered on
            if (!LinuxNetworkUtil.hasAddress(interfaceName)) {
                LinuxNetworkUtil.bringUpDeletingAddress(interfaceName);
            }
        } else {
            s_logger.info("not bringing interface {} up because it is already up", interfaceName);
            if (dhcp) {
                renewDhcpLease(interfaceName);
            }
        }
    } catch (Exception e) {
        throw new KuraException(KuraErrorCode.INTERNAL_ERROR, e);
    }
}
Also used : NetInterfaceConfig(org.eclipse.kura.net.NetInterfaceConfig) NetInterfaceStatus(org.eclipse.kura.net.NetInterfaceStatus) WifiConfig(org.eclipse.kura.net.wifi.WifiConfig) WifiInterfaceAddressConfig(org.eclipse.kura.net.wifi.WifiInterfaceAddressConfig) KuraException(org.eclipse.kura.KuraException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) NetConfigIP4(org.eclipse.kura.net.NetConfigIP4) NetInterfaceType(org.eclipse.kura.net.NetInterfaceType) KuraException(org.eclipse.kura.KuraException) WifiMode(org.eclipse.kura.net.wifi.WifiMode) NetConfig(org.eclipse.kura.net.NetConfig) WifiInterfaceState(org.eclipse.kura.net.admin.monitor.WifiInterfaceState) NetInterfaceAddressConfig(org.eclipse.kura.net.NetInterfaceAddressConfig)

Example 30 with NetInterfaceAddressConfig

use of org.eclipse.kura.net.NetInterfaceAddressConfig in project kura by eclipse.

the class NetworkAdminServiceImpl method updateEthernetInterfaceConfig.

@Override
public void updateEthernetInterfaceConfig(String interfaceName, boolean autoConnect, int mtu, List<NetConfig> netConfigs) throws KuraException {
    NetConfigIP4 netConfig4 = null;
    NetConfigIP6 netConfig6 = null;
    DhcpServerConfigIP4 dhcpServerConfigIP4 = null;
    FirewallAutoNatConfig natConfig = null;
    boolean hadNetConfig4 = false;
    boolean hadNetConfig6 = false;
    boolean hadDhcpServerConfigIP4 = false;
    boolean hadNatConfig = false;
    if (netConfigs != null && !netConfigs.isEmpty()) {
        for (NetConfig netConfig : netConfigs) {
            if (!netConfig.isValid()) {
                throw new KuraException(KuraErrorCode.CONFIGURATION_ERROR, "NetConfig Configuration is invalid: " + netConfig.toString());
            }
            if (netConfig instanceof NetConfigIP4) {
                netConfig4 = (NetConfigIP4) netConfig;
            } else if (netConfig instanceof NetConfigIP6) {
                netConfig6 = (NetConfigIP6) netConfig;
            } else if (netConfig instanceof DhcpServerConfigIP4) {
                dhcpServerConfigIP4 = (DhcpServerConfigIP4) netConfig;
            } else if (netConfig instanceof FirewallAutoNatConfig) {
                natConfig = (FirewallAutoNatConfig) netConfig;
            }
        }
    }
    // validation
    if (netConfig4 == null && netConfig6 == null) {
        throw new KuraException(KuraErrorCode.CONFIGURATION_REQUIRED_ATTRIBUTE_MISSING, "Either IPv4 or IPv6 configuration must be defined");
    }
    List<String> modifiedInterfaceNames = new ArrayList<String>();
    boolean configurationChanged = false;
    ComponentConfiguration originalNetworkComponentConfiguration = ((SelfConfiguringComponent) this.m_networkConfigurationService).getConfiguration();
    if (originalNetworkComponentConfiguration == null) {
        s_logger.debug("Returning for some unknown reason - no existing config???");
        return;
    }
    try {
        NetworkConfiguration newNetworkConfiguration = new NetworkConfiguration(originalNetworkComponentConfiguration.getConfigurationProperties());
        List<NetInterfaceConfig<? extends NetInterfaceAddressConfig>> netInterfaceConfigs = newNetworkConfiguration.getNetInterfaceConfigs();
        for (NetInterfaceConfig<? extends NetInterfaceAddressConfig> netInterfaceConfig : netInterfaceConfigs) {
            if (netInterfaceConfig.getName().equals(interfaceName)) {
                // handle MTU
                if (mtu != netInterfaceConfig.getMTU()) {
                    AbstractNetInterface<?> absNetInterfaceConfig = (AbstractNetInterface<?>) netInterfaceConfig;
                    s_logger.debug("updating MTU for {}", interfaceName);
                    absNetInterfaceConfig.setMTU(mtu);
                    configurationChanged = true;
                    if (!modifiedInterfaceNames.contains(interfaceName)) {
                        modifiedInterfaceNames.add(interfaceName);
                    }
                }
                // handle autoconnect
                if (autoConnect != netInterfaceConfig.isAutoConnect()) {
                    AbstractNetInterface<?> absNetInterfaceConfig = (AbstractNetInterface<?>) netInterfaceConfig;
                    s_logger.debug("updating autoConnect for {} to be {}", interfaceName, autoConnect);
                    absNetInterfaceConfig.setAutoConnect(autoConnect);
                    configurationChanged = true;
                    if (!modifiedInterfaceNames.contains(interfaceName)) {
                        modifiedInterfaceNames.add(interfaceName);
                    }
                }
                // replace existing configs
                List<? extends NetInterfaceAddressConfig> netInterfaceAddressConfigs = netInterfaceConfig.getNetInterfaceAddresses();
                if (netInterfaceAddressConfigs != null && !netInterfaceAddressConfigs.isEmpty()) {
                    for (NetInterfaceAddressConfig netInterfaceAddressConfig : netInterfaceAddressConfigs) {
                        List<NetConfig> existingNetConfigs = netInterfaceAddressConfig.getConfigs();
                        List<NetConfig> newNetConfigs = new ArrayList<NetConfig>();
                        for (NetConfig netConfig : existingNetConfigs) {
                            s_logger.debug("looking at existing NetConfig for {} with value: {}", interfaceName, netConfig);
                            if (netConfig instanceof NetConfigIP4) {
                                if (netConfig4 == null) {
                                    s_logger.debug("removing NetConfig4 for {}", interfaceName);
                                } else {
                                    hadNetConfig4 = true;
                                    newNetConfigs.add(netConfig4);
                                    if (!netConfig.equals(netConfig4)) {
                                        s_logger.debug("updating NetConfig4 for {}", interfaceName);
                                        s_logger.debug("Is new State DHCP? {}", netConfig4.isDhcp());
                                        configurationChanged = true;
                                        if (!modifiedInterfaceNames.contains(interfaceName)) {
                                            modifiedInterfaceNames.add(interfaceName);
                                        }
                                    } else {
                                        s_logger.debug("not updating NetConfig4 for {} because it is unchanged", interfaceName);
                                    }
                                }
                            } else if (netConfig instanceof NetConfig6) {
                                if (netConfig6 == null) {
                                    s_logger.debug("removing NetConfig6 for {}", interfaceName);
                                } else {
                                    hadNetConfig6 = true;
                                    newNetConfigs.add(netConfig6);
                                    if (!netConfig.equals(netConfig6)) {
                                        s_logger.debug("updating NetConfig6 for {}", interfaceName);
                                        configurationChanged = true;
                                        if (!modifiedInterfaceNames.contains(interfaceName)) {
                                            modifiedInterfaceNames.add(interfaceName);
                                        }
                                    } else {
                                        s_logger.debug("not updating NetConfig6 for {} because it is unchanged", interfaceName);
                                    }
                                }
                            } else if (netConfig instanceof DhcpServerConfigIP4) {
                                if (dhcpServerConfigIP4 == null) {
                                    s_logger.debug("removing DhcpServerConfigIP4 for {}", interfaceName);
                                    configurationChanged = true;
                                    if (!modifiedInterfaceNames.contains(interfaceName)) {
                                        modifiedInterfaceNames.add(interfaceName);
                                    }
                                } else {
                                    hadDhcpServerConfigIP4 = true;
                                    newNetConfigs.add(dhcpServerConfigIP4);
                                    if (!netConfig.equals(dhcpServerConfigIP4)) {
                                        s_logger.debug("updating DhcpServerConfigIP4 for {}", interfaceName);
                                        configurationChanged = true;
                                        if (!modifiedInterfaceNames.contains(interfaceName)) {
                                            modifiedInterfaceNames.add(interfaceName);
                                        }
                                    } else {
                                        s_logger.debug("not updating DhcpServerConfigIP4 for {} because it is unchanged", interfaceName);
                                    }
                                }
                            } else if (netConfig instanceof FirewallAutoNatConfig) {
                                if (natConfig == null) {
                                    s_logger.debug("removing FirewallAutoNatConfig for {}", interfaceName);
                                    configurationChanged = true;
                                    if (!modifiedInterfaceNames.contains(interfaceName)) {
                                        modifiedInterfaceNames.add(interfaceName);
                                    }
                                } else {
                                    hadNatConfig = true;
                                    newNetConfigs.add(natConfig);
                                    if (!netConfig.equals(natConfig)) {
                                        s_logger.debug("updating FirewallAutoNatConfig for {}", interfaceName);
                                        configurationChanged = true;
                                        if (!modifiedInterfaceNames.contains(interfaceName)) {
                                            modifiedInterfaceNames.add(interfaceName);
                                        }
                                    } else {
                                        s_logger.debug("not updating FirewallAutoNatConfig for {} because it is unchanged", interfaceName);
                                    }
                                }
                            } else {
                                s_logger.debug("Found unsupported configuration: {}", netConfig.toString());
                            }
                        }
                        // add configs that did not match any in the current configuration
                        if (netConfigs != null && !netConfigs.isEmpty()) {
                            for (NetConfig netConfig : netConfigs) {
                                if (netConfig instanceof NetConfigIP4 && !hadNetConfig4) {
                                    s_logger.debug("adding new NetConfig4 to existing config for {}", interfaceName);
                                    newNetConfigs.add(netConfig);
                                    configurationChanged = true;
                                    if (!modifiedInterfaceNames.contains(interfaceName)) {
                                        modifiedInterfaceNames.add(interfaceName);
                                    }
                                }
                                if (netConfig instanceof NetConfigIP6 && !hadNetConfig6) {
                                    s_logger.debug("adding new NetConfig6 to existing config for {}", interfaceName);
                                    newNetConfigs.add(netConfig);
                                    configurationChanged = true;
                                    if (!modifiedInterfaceNames.contains(interfaceName)) {
                                        modifiedInterfaceNames.add(interfaceName);
                                    }
                                }
                                if (netConfig instanceof DhcpServerConfigIP4 && !hadDhcpServerConfigIP4) {
                                    s_logger.debug("adding new DhcpServerConfigIP4 to existing config for {}", interfaceName);
                                    newNetConfigs.add(netConfig);
                                    configurationChanged = true;
                                    if (!modifiedInterfaceNames.contains(interfaceName)) {
                                        modifiedInterfaceNames.add(interfaceName);
                                    }
                                }
                                if (netConfig instanceof FirewallAutoNatConfig && !hadNatConfig) {
                                    s_logger.debug("adding new FirewallAutoNatConfig to existing config for {}", interfaceName);
                                    newNetConfigs.add(netConfig);
                                    configurationChanged = true;
                                    if (!modifiedInterfaceNames.contains(interfaceName)) {
                                        modifiedInterfaceNames.add(interfaceName);
                                    }
                                }
                            }
                        }
                        for (NetConfig netConfig : newNetConfigs) {
                            s_logger.debug("New NetConfig: {} :: {}", netConfig.getClass().toString(), netConfig.toString());
                        }
                        // replace with new list
                        ((NetInterfaceAddressConfigImpl) netInterfaceAddressConfig).setNetConfigs(newNetConfigs);
                    }
                }
            }
        }
        if (configurationChanged) {
            submitNetworkConfiguration(modifiedInterfaceNames, newNetworkConfiguration);
        }
    } catch (UnknownHostException e) {
        s_logger.warn("Exception while updating EthernetInterfaceConfig", e);
    }
}
Also used : NetInterfaceAddressConfigImpl(org.eclipse.kura.core.net.NetInterfaceAddressConfigImpl) DhcpServerConfigIP4(org.eclipse.kura.net.dhcp.DhcpServerConfigIP4) FirewallAutoNatConfig(org.eclipse.kura.net.firewall.FirewallAutoNatConfig) NetInterfaceConfig(org.eclipse.kura.net.NetInterfaceConfig) UnknownHostException(java.net.UnknownHostException) NetConfig6(org.eclipse.kura.net.NetConfig6) ArrayList(java.util.ArrayList) AbstractNetInterface(org.eclipse.kura.core.net.AbstractNetInterface) NetConfigIP4(org.eclipse.kura.net.NetConfigIP4) SelfConfiguringComponent(org.eclipse.kura.configuration.SelfConfiguringComponent) ComponentConfiguration(org.eclipse.kura.configuration.ComponentConfiguration) NetConfigIP6(org.eclipse.kura.net.NetConfigIP6) KuraException(org.eclipse.kura.KuraException) NetConfig(org.eclipse.kura.net.NetConfig) NetworkConfiguration(org.eclipse.kura.core.net.NetworkConfiguration) NetInterfaceAddressConfig(org.eclipse.kura.net.NetInterfaceAddressConfig)

Aggregations

NetInterfaceAddressConfig (org.eclipse.kura.net.NetInterfaceAddressConfig)36 NetConfig (org.eclipse.kura.net.NetConfig)31 KuraException (org.eclipse.kura.KuraException)21 NetConfigIP4 (org.eclipse.kura.net.NetConfigIP4)20 ArrayList (java.util.ArrayList)11 IOException (java.io.IOException)10 FirewallAutoNatConfig (org.eclipse.kura.net.firewall.FirewallAutoNatConfig)10 WifiMode (org.eclipse.kura.net.wifi.WifiMode)10 UnknownHostException (java.net.UnknownHostException)9 IP4Address (org.eclipse.kura.net.IP4Address)9 WifiConfig (org.eclipse.kura.net.wifi.WifiConfig)9 WifiInterfaceAddressConfig (org.eclipse.kura.net.wifi.WifiInterfaceAddressConfig)9 IPAddress (org.eclipse.kura.net.IPAddress)8 NetInterfaceConfig (org.eclipse.kura.net.NetInterfaceConfig)8 WifiInterfaceAddressConfigImpl (org.eclipse.kura.core.net.WifiInterfaceAddressConfigImpl)7 ModemInterfaceConfigImpl (org.eclipse.kura.core.net.modem.ModemInterfaceConfigImpl)7 NetInterfaceType (org.eclipse.kura.net.NetInterfaceType)7 Properties (java.util.Properties)6 NetConfigIP6 (org.eclipse.kura.net.NetConfigIP6)6 NetInterfaceStatus (org.eclipse.kura.net.NetInterfaceStatus)6