Closed pierantoniomerlino closed 3 days ago
Test performed on DG1014 in combination with #5533 (actually https://github.com/eurotech/kura_eth/pull/2349 in this case) on a freshly installed system.
At startup we have the following:
Nov 11 09:32:24 dynagate-10-14 ESF[866]: Update NetworkConfigurationService...
Nov 11 09:32:24 dynagate-10-14 ESF[866]: Applying configuration using NetworkManager Dbus connector
Nov 11 09:32:24 dynagate-10-14 ESF[866]: Device "lo" of type "NM_DEVICE_TYPE_LOOPBACK" with status "UNMANAGED"/"UNMANAGED" currently not supported
Nov 11 09:32:24 dynagate-10-14 ESF[866]: Settings iface "eth0":NM_DEVICE_TYPE_ETHERNET
Nov 11 09:32:25 dynagate-10-14 ESF[866]: Settings iface "eth1":NM_DEVICE_TYPE_ETHERNET
Nov 11 09:32:30 dynagate-10-14 ESF[866]: Device "p2p0" of type "NM_DEVICE_TYPE_WIFI" not configured. Disabling...
Nov 11 09:32:30 dynagate-10-14 ESF[866]: Device "wlan0" of type "NM_DEVICE_TYPE_WIFI" not configured. Disabling...
Nov 11 09:32:30 dynagate-10-14 ESF[866]: Device "3-1.3" of type "NM_DEVICE_TYPE_MODEM" not configured. Disabling...
Which is expected since 3-1.3
doesn't have a configuration in the snapshot0.
Then, when running the following RestAPI request:
curl -k -u admin:[REDACTED] -X PUT \
--location https://172.16.0.1/services/networkConfiguration/v1/configurableComponents/configurations/_update \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"configs\": [
{
\"pid\": \"org.eclipse.kura.net.admin.NetworkConfigurationService\",
\"properties\": {
\"net.interface.3-1.3.config.ip6.status\": {
\"value\": \"netIPv6StatusDisabled\",
\"type\": \"STRING\"
},
\"net.interface.3-1.3.config.ip4.status\": {
\"value\": \"netIPv4StatusEnabledWAN\",
\"type\": \"STRING\"
},
\"net.interface.3-1.3.config.dhcpClient4.enabled\": {
\"value\": true,
\"type\": \"BOOLEAN\"
},
\"net.interface.3-1.3.config.resetTimeout\": {
\"value\": 5,
\"type\": \"INTEGER\"
}
}
}
]
}"
the configuration is correctly applied:
Applying configuration using NetworkManager Dbus connector
Device "lo" of type "NM_DEVICE_TYPE_LOOPBACK" with status "UNMANAGED"/"UNMANAGED" currently not supported
Settings iface "eth0":NM_DEVICE_TYPE_ETHERNET
Ignoring parameter accept-all-mac-addresses [-1]: NetworkManager 1.32 or above is required
Settings iface "eth1":NM_DEVICE_TYPE_ETHERNET
Ignoring parameter accept-all-mac-addresses [-1]: NetworkManager 1.32 or above is required
Device "p2p0" of type "NM_DEVICE_TYPE_WIFI" not configured. Disabling...
Device "wlan0" of type "NM_DEVICE_TYPE_WIFI" not configured. Disabling...
Settings iface "3-1.3":NM_DEVICE_TYPE_MODEM
Performing the same test on our current Kura version will result in:
Applying configuration using NetworkManager Dbus connector
Device "lo" of type "NM_DEVICE_TYPE_LOOPBACK" with status "UNMANAGED"/"UNMANAGED" currently not supported
Settings iface "eth0":NM_DEVICE_TYPE_ETHERNET
Ignoring parameter accept-all-mac-addresses [-1]: NetworkManager 1.32 or above is required
Settings iface "eth1":NM_DEVICE_TYPE_ETHERNET
Ignoring parameter accept-all-mac-addresses [-1]: NetworkManager 1.32 or above is required
Device "p2p0" of type "NM_DEVICE_TYPE_WIFI" not configured. Disabling...
Settings iface "wlan0":NM_DEVICE_TYPE_WIFI
Device "3-1.3" of type "NM_DEVICE_TYPE_MODEM" not configured. Disabling...
Since the #5531 has been temporary dropped, we decided to adopt a easier approach to fix the issue about network rest configuration.
The fix is limited to the
org.eclipse.kura.internal.rest.network.configuration.NetworkConfigurationRestService
class. Now, when an update request is received, the code parses the property names and extracts the network interface names. They are compared with the ones in thenet.interfaces
property from the current configuration and, it they are not listed there, they are added.In this way the framework is aware if the new network interface and it can handle it correctly.
Any side note on the changes made: The
net.interface.<interface-name>.type
property is now mandatory, otherwise the value on the snapshot will beUNKNOWN
and this will cause troubles to the webUI.