diff --git a/bundles/org.eclipse.kura.net.configuration/src/main/java/org/eclipse/kura/net/configuration/NetworkConfigurationPropertyNames.java b/bundles/org.eclipse.kura.net.configuration/src/main/java/org/eclipse/kura/net/configuration/NetworkConfigurationPropertyNames.java index b272dfe..3e01ea4 100644 --- a/bundles/org.eclipse.kura.net.configuration/src/main/java/org/eclipse/kura/net/configuration/NetworkConfigurationPropertyNames.java +++ b/bundles/org.eclipse.kura.net.configuration/src/main/java/org/eclipse/kura/net/configuration/NetworkConfigurationPropertyNames.java @@ -10,6 +10,7 @@ * Contributors: * Eurotech *******************************************************************************/ +// Content with portions generated by generative AI platform package org.eclipse.kura.net.configuration; public enum NetworkConfigurationPropertyNames { @@ -61,6 +62,7 @@ public enum NetworkConfigurationPropertyNames { CONFIG_WIFI_INFRA_BGSCAN, CONFIG_WIFI_INFRA_PING_AP, CONFIG_WIFI_INFRA_IGNORE_SSID, + CONFIG_802_1X_PASSWORD, CONFIG_WIFI_MASTER_SSID, CONFIG_WIFI_MASTER_BROADCAST_ENABLED, CONFIG_WIFI_MASTER_RADIO_MODE, diff --git a/bundles/org.eclipse.kura.net.configuration/src/main/java/org/eclipse/kura/net/configuration/NetworkConfigurationServiceCommon.java b/bundles/org.eclipse.kura.net.configuration/src/main/java/org/eclipse/kura/net/configuration/NetworkConfigurationServiceCommon.java index 78b461d..c6fbdb6 100644 --- a/bundles/org.eclipse.kura.net.configuration/src/main/java/org/eclipse/kura/net/configuration/NetworkConfigurationServiceCommon.java +++ b/bundles/org.eclipse.kura.net.configuration/src/main/java/org/eclipse/kura/net/configuration/NetworkConfigurationServiceCommon.java @@ -10,6 +10,7 @@ * Contributors: * Eurotech *******************************************************************************/ +// Content with portions generated by generative AI platform package org.eclipse.kura.net.configuration; import java.util.HashMap; @@ -301,6 +302,9 @@ private static void getWifiInfraDefinition(Tocd tocd, String ifaceName) { NetworkConfigurationPropertyNames.CONFIG_WIFI_INFRA_IGNORE_SSID, Tscalar.BOOLEAN) .withDefault(String.valueOf(NetworkConfigurationConstants.DEFAULT_WIFI_IGNORE_SSID_VALUE)) .build()); + + tocd.addAD(builder(String.format(PREFIX + "%s.config.802-1x.password", ifaceName), + NetworkConfigurationPropertyNames.CONFIG_802_1X_PASSWORD, Tscalar.PASSWORD).build()); } private static void getWifiCommonDefinition(Tocd tocd, String ifaceName) { diff --git a/bundles/org.eclipse.kura.net.configuration/src/main/resources/org/eclipse/kura/net/configuration/messages/NetworkConfigurationMessagesBundle.properties b/bundles/org.eclipse.kura.net.configuration/src/main/resources/org/eclipse/kura/net/configuration/messages/NetworkConfigurationMessagesBundle.properties index 166cfc8..2516b07 100644 --- a/bundles/org.eclipse.kura.net.configuration/src/main/resources/org/eclipse/kura/net/configuration/messages/NetworkConfigurationMessagesBundle.properties +++ b/bundles/org.eclipse.kura.net.configuration/src/main/resources/org/eclipse/kura/net/configuration/messages/NetworkConfigurationMessagesBundle.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Eurotech and/or its affiliates and others +# Copyright (c) 2023, 2025 Eurotech and/or its affiliates and others # # This program and the accompanying materials are made # available under the terms of the Eclipse Public License 2.0 @@ -79,6 +79,7 @@ CONFIG_WIFI_MASTER_CHANNEL=The wifi channel to use. CONFIG_WIFI_MASTER_IGNORE_SSID=Specify if the SSID broadcast is ignored. CONFIG_WIFI_MASTER_PAIRWISE_CIPHERS=Pariwise Ciphers. CONFIG_WIFI_MASTER_GROUP_CIPHERS=Group Ciphers. +CONFIG_802_1X_PASSWORD=The password for 802.1X authentication. CONFIG_MODEM_ENABLED=Enable the interface. CONFIG_MODEM_IDLE=The idle option of the PPP daemon. diff --git a/tests/org.eclipse.kura.net.configuration.test/src/test/java/org/eclipse/kura/net/configuration/NetworkConfigurationServiceCommonTest.java b/tests/org.eclipse.kura.net.configuration.test/src/test/java/org/eclipse/kura/net/configuration/NetworkConfigurationServiceCommonTest.java index 7aad73b..ebf0bf8 100644 --- a/tests/org.eclipse.kura.net.configuration.test/src/test/java/org/eclipse/kura/net/configuration/NetworkConfigurationServiceCommonTest.java +++ b/tests/org.eclipse.kura.net.configuration.test/src/test/java/org/eclipse/kura/net/configuration/NetworkConfigurationServiceCommonTest.java @@ -98,6 +98,7 @@ public void shouldWrapStringPasswords() throws KuraException { givenConfigurationProperty("net.interface.1-4.config.password", "foo"); givenConfigurationProperty("net.interface.wlp1s0.config.wifi.master.passphrase", "bar"); givenConfigurationProperty("net.interface.wlp1s0.config.wifi.infra.passphrase", "baz"); + givenConfigurationProperty("net.interface.wlp1s0.config.802-1x.password", "qux"); whenConfigurationPropertiesAreRetrieved(); @@ -107,6 +108,8 @@ public void shouldWrapStringPasswords() throws KuraException { new Password(new char[] { 'b', 'a', 'r' })); thenReturnedPropertyEqualsPassword("net.interface.wlp1s0.config.wifi.infra.passphrase", new Password(new char[] { 'b', 'a', 'z' })); + thenReturnedPropertyEqualsPassword("net.interface.wlp1s0.config.802-1x.password", + new Password(new char[] { 'q', 'u', 'x' })); } @@ -118,6 +121,8 @@ public void shouldNotChangeWrappedPasswords() throws KuraException { new Password(new char[] { 'b', 'a', 'r' })); givenConfigurationProperty("net.interface.wlp1s0.config.wifi.infra.passphrase", new Password(new char[] { 'b', 'a', 'z' })); + givenConfigurationProperty("net.interface.wlp1s0.config.802-1x.password", + new Password(new char[] { 'q', 'u', 'x' })); whenConfigurationPropertiesAreRetrieved(); @@ -127,6 +132,8 @@ public void shouldNotChangeWrappedPasswords() throws KuraException { new Password(new char[] { 'b', 'a', 'r' })); thenReturnedPropertyEqualsPassword("net.interface.wlp1s0.config.wifi.infra.passphrase", new Password(new char[] { 'b', 'a', 'z' })); + thenReturnedPropertyEqualsPassword("net.interface.wlp1s0.config.802-1x.password", + new Password(new char[] { 'q', 'u', 'x' })); } @@ -324,7 +331,7 @@ private void thenComponentDefinitionHasBasicProperties() { private void thenComponentDefinitionHasCorrectNumberOfResources() { assertNotNull(this.ads); - assertEquals(189, this.ads.size()); + assertEquals(190, this.ads.size()); } private void thenReturnedPropertyEquals(final String key, final Object value) { @@ -624,7 +631,7 @@ private void thenComponentDefinitionHasCorrectProperties() { } private void thenComponentDefinitionHasWifiProperties() { - assertEquals(50, this.ads.stream().filter(ad -> ad.getName().contains("wlp1s0")).count()); + assertEquals(51, this.ads.stream().filter(ad -> ad.getName().contains("wlp1s0")).count()); } private void thenComponentDefinitionHasModemProperties() { @@ -845,8 +852,53 @@ private void thenComponentDefinitionHasWifiProperties(String interfaceName) { assertEquals(WifiMode.UNKNOWN.name(), ad.getDefault()); adsConfigured++; } + + if (String.format("net.interface.%s.config.wifi.infra.bgscan", interfaceName).equals(ad.getId())) { + assertTrue(ad.getDefault().isEmpty()); + adsConfigured++; + } + + if (String.format("net.interface.%s.config.wifi.infra.pingAccessPoint", interfaceName).equals(ad.getId())) { + assertFalse(Boolean.parseBoolean(ad.getDefault())); + adsConfigured++; + } + + if (String.format("net.interface.%s.config.wifi.infra.ignoreSSID", interfaceName).equals(ad.getId())) { + assertFalse(Boolean.parseBoolean(ad.getDefault())); + adsConfigured++; + } + + if (String.format("net.interface.%s.config.802-1x.password", interfaceName).equals(ad.getId())) { + assertTrue(ad.getDefault().isEmpty()); + adsConfigured++; + } + + if (String.format("net.interface.%s.config.wifi.master.broadcast", interfaceName).equals(ad.getId())) { + assertFalse(Boolean.parseBoolean(ad.getDefault())); + adsConfigured++; + } + + if (String.format("net.interface.%s.config.wifi.master.ignoreSSID", interfaceName).equals(ad.getId())) { + assertFalse(Boolean.parseBoolean(ad.getDefault())); + adsConfigured++; + } + + if (String.format("net.interface.%s.config.wifi.master.pairwiseCiphers", interfaceName).equals(ad.getId())) { + assertEquals(WifiCiphers.CCMP_TKIP.name(), ad.getDefault()); + adsConfigured++; + } + + if (String.format("net.interface.%s.config.wifi.master.groupCiphers", interfaceName).equals(ad.getId())) { + assertEquals(WifiCiphers.CCMP_TKIP.name(), ad.getDefault()); + adsConfigured++; + } + + if (String.format("net.interface.%s.wifi.capabilities", interfaceName).equals(ad.getId())) { + assertTrue(ad.getDefault().isEmpty()); + adsConfigured++; + } } - assertEquals(24, adsConfigured); + assertEquals(33, adsConfigured); } private void thenComponentDefinitionHasModemProperties(String interfaceName) { diff --git a/tests/org.eclipse.kura.nm.test/src/test/java/org/eclipse/kura/nm/configuration/NMConfigurationServiceImplTest.java b/tests/org.eclipse.kura.nm.test/src/test/java/org/eclipse/kura/nm/configuration/NMConfigurationServiceImplTest.java index 976c7f9..da26ac9 100644 --- a/tests/org.eclipse.kura.nm.test/src/test/java/org/eclipse/kura/nm/configuration/NMConfigurationServiceImplTest.java +++ b/tests/org.eclipse.kura.nm.test/src/test/java/org/eclipse/kura/nm/configuration/NMConfigurationServiceImplTest.java @@ -610,7 +610,7 @@ private void thenComponentDefinitionHasInterfaceTypes() { private void thenComponentDefinitionHasCorrectNumberOfResources() { assertEquals(105, this.retrievedProperties.size()); assertNotNull(this.ads); - assertEquals(155, this.ads.size()); + assertEquals(156, this.ads.size()); } private void thenComponentDefinitionHasCorrectProperties() {