Skip to content

Commit a2c2048

Browse files
authored
fix(net.configuration): add missing 802.1X password field definition (#10)
- Add CONFIG_802_1X_PASSWORD to NetworkConfigurationPropertyNames enum - Add password field definition to network configuration metadata - Ensures 802.1X authentication password field is properly exposed in configuration Signed-off-by: MMaiero <matteo.maiero@eurotech.com>
1 parent 03aae93 commit a2c2048

File tree

5 files changed

+64
-5
lines changed

5 files changed

+64
-5
lines changed

bundles/org.eclipse.kura.net.configuration/src/main/java/org/eclipse/kura/net/configuration/NetworkConfigurationPropertyNames.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* Contributors:
1111
* Eurotech
1212
*******************************************************************************/
13+
// Content with portions generated by generative AI platform
1314
package org.eclipse.kura.net.configuration;
1415

1516
public enum NetworkConfigurationPropertyNames {
@@ -61,6 +62,7 @@ public enum NetworkConfigurationPropertyNames {
6162
CONFIG_WIFI_INFRA_BGSCAN,
6263
CONFIG_WIFI_INFRA_PING_AP,
6364
CONFIG_WIFI_INFRA_IGNORE_SSID,
65+
CONFIG_802_1X_PASSWORD,
6466
CONFIG_WIFI_MASTER_SSID,
6567
CONFIG_WIFI_MASTER_BROADCAST_ENABLED,
6668
CONFIG_WIFI_MASTER_RADIO_MODE,

bundles/org.eclipse.kura.net.configuration/src/main/java/org/eclipse/kura/net/configuration/NetworkConfigurationServiceCommon.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* Contributors:
1111
* Eurotech
1212
*******************************************************************************/
13+
// Content with portions generated by generative AI platform
1314
package org.eclipse.kura.net.configuration;
1415

1516
import java.util.HashMap;
@@ -301,6 +302,9 @@ private static void getWifiInfraDefinition(Tocd tocd, String ifaceName) {
301302
NetworkConfigurationPropertyNames.CONFIG_WIFI_INFRA_IGNORE_SSID, Tscalar.BOOLEAN)
302303
.withDefault(String.valueOf(NetworkConfigurationConstants.DEFAULT_WIFI_IGNORE_SSID_VALUE))
303304
.build());
305+
306+
tocd.addAD(builder(String.format(PREFIX + "%s.config.802-1x.password", ifaceName),
307+
NetworkConfigurationPropertyNames.CONFIG_802_1X_PASSWORD, Tscalar.PASSWORD).build());
304308
}
305309

306310
private static void getWifiCommonDefinition(Tocd tocd, String ifaceName) {

bundles/org.eclipse.kura.net.configuration/src/main/resources/org/eclipse/kura/net/configuration/messages/NetworkConfigurationMessagesBundle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2023 Eurotech and/or its affiliates and others
2+
# Copyright (c) 2023, 2025 Eurotech and/or its affiliates and others
33
#
44
# This program and the accompanying materials are made
55
# available under the terms of the Eclipse Public License 2.0
@@ -79,6 +79,7 @@ CONFIG_WIFI_MASTER_CHANNEL=The wifi channel to use.
7979
CONFIG_WIFI_MASTER_IGNORE_SSID=Specify if the SSID broadcast is ignored.
8080
CONFIG_WIFI_MASTER_PAIRWISE_CIPHERS=Pariwise Ciphers.
8181
CONFIG_WIFI_MASTER_GROUP_CIPHERS=Group Ciphers.
82+
CONFIG_802_1X_PASSWORD=The password for 802.1X authentication.
8283

8384
CONFIG_MODEM_ENABLED=Enable the interface.
8485
CONFIG_MODEM_IDLE=The idle option of the PPP daemon.

tests/org.eclipse.kura.net.configuration.test/src/test/java/org/eclipse/kura/net/configuration/NetworkConfigurationServiceCommonTest.java

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public void shouldWrapStringPasswords() throws KuraException {
9898
givenConfigurationProperty("net.interface.1-4.config.password", "foo");
9999
givenConfigurationProperty("net.interface.wlp1s0.config.wifi.master.passphrase", "bar");
100100
givenConfigurationProperty("net.interface.wlp1s0.config.wifi.infra.passphrase", "baz");
101+
givenConfigurationProperty("net.interface.wlp1s0.config.802-1x.password", "qux");
101102

102103
whenConfigurationPropertiesAreRetrieved();
103104

@@ -107,6 +108,8 @@ public void shouldWrapStringPasswords() throws KuraException {
107108
new Password(new char[] { 'b', 'a', 'r' }));
108109
thenReturnedPropertyEqualsPassword("net.interface.wlp1s0.config.wifi.infra.passphrase",
109110
new Password(new char[] { 'b', 'a', 'z' }));
111+
thenReturnedPropertyEqualsPassword("net.interface.wlp1s0.config.802-1x.password",
112+
new Password(new char[] { 'q', 'u', 'x' }));
110113

111114
}
112115

@@ -118,6 +121,8 @@ public void shouldNotChangeWrappedPasswords() throws KuraException {
118121
new Password(new char[] { 'b', 'a', 'r' }));
119122
givenConfigurationProperty("net.interface.wlp1s0.config.wifi.infra.passphrase",
120123
new Password(new char[] { 'b', 'a', 'z' }));
124+
givenConfigurationProperty("net.interface.wlp1s0.config.802-1x.password",
125+
new Password(new char[] { 'q', 'u', 'x' }));
121126

122127
whenConfigurationPropertiesAreRetrieved();
123128

@@ -127,6 +132,8 @@ public void shouldNotChangeWrappedPasswords() throws KuraException {
127132
new Password(new char[] { 'b', 'a', 'r' }));
128133
thenReturnedPropertyEqualsPassword("net.interface.wlp1s0.config.wifi.infra.passphrase",
129134
new Password(new char[] { 'b', 'a', 'z' }));
135+
thenReturnedPropertyEqualsPassword("net.interface.wlp1s0.config.802-1x.password",
136+
new Password(new char[] { 'q', 'u', 'x' }));
130137

131138
}
132139

@@ -324,7 +331,7 @@ private void thenComponentDefinitionHasBasicProperties() {
324331

325332
private void thenComponentDefinitionHasCorrectNumberOfResources() {
326333
assertNotNull(this.ads);
327-
assertEquals(189, this.ads.size());
334+
assertEquals(190, this.ads.size());
328335
}
329336

330337
private void thenReturnedPropertyEquals(final String key, final Object value) {
@@ -624,7 +631,7 @@ private void thenComponentDefinitionHasCorrectProperties() {
624631
}
625632

626633
private void thenComponentDefinitionHasWifiProperties() {
627-
assertEquals(50, this.ads.stream().filter(ad -> ad.getName().contains("wlp1s0")).count());
634+
assertEquals(51, this.ads.stream().filter(ad -> ad.getName().contains("wlp1s0")).count());
628635
}
629636

630637
private void thenComponentDefinitionHasModemProperties() {
@@ -845,8 +852,53 @@ private void thenComponentDefinitionHasWifiProperties(String interfaceName) {
845852
assertEquals(WifiMode.UNKNOWN.name(), ad.getDefault());
846853
adsConfigured++;
847854
}
855+
856+
if (String.format("net.interface.%s.config.wifi.infra.bgscan", interfaceName).equals(ad.getId())) {
857+
assertTrue(ad.getDefault().isEmpty());
858+
adsConfigured++;
859+
}
860+
861+
if (String.format("net.interface.%s.config.wifi.infra.pingAccessPoint", interfaceName).equals(ad.getId())) {
862+
assertFalse(Boolean.parseBoolean(ad.getDefault()));
863+
adsConfigured++;
864+
}
865+
866+
if (String.format("net.interface.%s.config.wifi.infra.ignoreSSID", interfaceName).equals(ad.getId())) {
867+
assertFalse(Boolean.parseBoolean(ad.getDefault()));
868+
adsConfigured++;
869+
}
870+
871+
if (String.format("net.interface.%s.config.802-1x.password", interfaceName).equals(ad.getId())) {
872+
assertTrue(ad.getDefault().isEmpty());
873+
adsConfigured++;
874+
}
875+
876+
if (String.format("net.interface.%s.config.wifi.master.broadcast", interfaceName).equals(ad.getId())) {
877+
assertFalse(Boolean.parseBoolean(ad.getDefault()));
878+
adsConfigured++;
879+
}
880+
881+
if (String.format("net.interface.%s.config.wifi.master.ignoreSSID", interfaceName).equals(ad.getId())) {
882+
assertFalse(Boolean.parseBoolean(ad.getDefault()));
883+
adsConfigured++;
884+
}
885+
886+
if (String.format("net.interface.%s.config.wifi.master.pairwiseCiphers", interfaceName).equals(ad.getId())) {
887+
assertEquals(WifiCiphers.CCMP_TKIP.name(), ad.getDefault());
888+
adsConfigured++;
889+
}
890+
891+
if (String.format("net.interface.%s.config.wifi.master.groupCiphers", interfaceName).equals(ad.getId())) {
892+
assertEquals(WifiCiphers.CCMP_TKIP.name(), ad.getDefault());
893+
adsConfigured++;
894+
}
895+
896+
if (String.format("net.interface.%s.wifi.capabilities", interfaceName).equals(ad.getId())) {
897+
assertTrue(ad.getDefault().isEmpty());
898+
adsConfigured++;
899+
}
848900
}
849-
assertEquals(24, adsConfigured);
901+
assertEquals(33, adsConfigured);
850902
}
851903

852904
private void thenComponentDefinitionHasModemProperties(String interfaceName) {

tests/org.eclipse.kura.nm.test/src/test/java/org/eclipse/kura/nm/configuration/NMConfigurationServiceImplTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ private void thenComponentDefinitionHasInterfaceTypes() {
610610
private void thenComponentDefinitionHasCorrectNumberOfResources() {
611611
assertEquals(105, this.retrievedProperties.size());
612612
assertNotNull(this.ads);
613-
assertEquals(155, this.ads.size());
613+
assertEquals(156, this.ads.size());
614614
}
615615

616616
private void thenComponentDefinitionHasCorrectProperties() {

0 commit comments

Comments
 (0)