-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(rest.network.configuration): Fix net interfaces property management again #5535
fix(rest.network.configuration): Fix net interfaces property management again #5535
Conversation
93c19e0
to
ed3972b
Compare
...va/org/eclipse/kura/internal/rest/network/configuration/NetworkConfigurationRestService.java
Show resolved
Hide resolved
...va/org/eclipse/kura/internal/rest/network/configuration/NetworkConfigurationRestService.java
Outdated
Show resolved
Hide resolved
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:
Which is expected since 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:
Performing the same test on our current Kura version will result in:
|
ed3972b
to
72a61f5
Compare
...va/org/eclipse/kura/internal/rest/network/configuration/NetworkConfigurationRestService.java
Outdated
Show resolved
Hide resolved
...va/org/eclipse/kura/internal/rest/network/configuration/NetworkConfigurationRestService.java
Outdated
Show resolved
Hide resolved
Signed-off-by: pierantoniomerlino <[email protected]>
Signed-off-by: pierantoniomerlino <[email protected]>
Signed-off-by: pierantoniomerlino <[email protected]>
Signed-off-by: pierantoniomerlino <[email protected]>
…main/java/org/eclipse/kura/internal/rest/network/configuration/NetworkConfigurationRestService.java Co-authored-by: Mattia Dal Ben <[email protected]>
…main/java/org/eclipse/kura/internal/rest/network/configuration/NetworkConfigurationRestService.java Co-authored-by: Mattia Dal Ben <[email protected]>
f517515
to
9fcb5df
Compare
…nt again (#5535) * Added net.interfaces property management in NetworkConfiguration Rest Signed-off-by: pierantoniomerlino <[email protected]> * Changed parsing logic Signed-off-by: pierantoniomerlino <[email protected]> * Improved string parsing Signed-off-by: pierantoniomerlino <[email protected]> * Added tests for net.interfaces property Signed-off-by: pierantoniomerlino <[email protected]> * Update kura/org.eclipse.kura.rest.network.configuration.provider/src/main/java/org/eclipse/kura/internal/rest/network/configuration/NetworkConfigurationRestService.java Co-authored-by: Mattia Dal Ben <[email protected]> * Update kura/org.eclipse.kura.rest.network.configuration.provider/src/main/java/org/eclipse/kura/internal/rest/network/configuration/NetworkConfigurationRestService.java Co-authored-by: Mattia Dal Ben <[email protected]> --------- Signed-off-by: pierantoniomerlino <[email protected]> Co-authored-by: Mattia Dal Ben <[email protected]> (cherry picked from commit da1feb6)
…nt again [backport release-5.6.0] (#5538) fix(rest.network.configuration): Fix net interfaces property management again (#5535) * Added net.interfaces property management in NetworkConfiguration Rest Signed-off-by: pierantoniomerlino <[email protected]> * Changed parsing logic Signed-off-by: pierantoniomerlino <[email protected]> * Improved string parsing Signed-off-by: pierantoniomerlino <[email protected]> * Added tests for net.interfaces property Signed-off-by: pierantoniomerlino <[email protected]> * Update kura/org.eclipse.kura.rest.network.configuration.provider/src/main/java/org/eclipse/kura/internal/rest/network/configuration/NetworkConfigurationRestService.java Co-authored-by: Mattia Dal Ben <[email protected]> * Update kura/org.eclipse.kura.rest.network.configuration.provider/src/main/java/org/eclipse/kura/internal/rest/network/configuration/NetworkConfigurationRestService.java Co-authored-by: Mattia Dal Ben <[email protected]> --------- Signed-off-by: pierantoniomerlino <[email protected]> Co-authored-by: Mattia Dal Ben <[email protected]> (cherry picked from commit da1feb6) Co-authored-by: Pierantonio Merlino <[email protected]>
…nt again (#5535) * Added net.interfaces property management in NetworkConfiguration Rest Signed-off-by: pierantoniomerlino <[email protected]> * Changed parsing logic Signed-off-by: pierantoniomerlino <[email protected]> * Improved string parsing Signed-off-by: pierantoniomerlino <[email protected]> * Added tests for net.interfaces property Signed-off-by: pierantoniomerlino <[email protected]> * Update kura/org.eclipse.kura.rest.network.configuration.provider/src/main/java/org/eclipse/kura/internal/rest/network/configuration/NetworkConfigurationRestService.java Co-authored-by: Mattia Dal Ben <[email protected]> * Update kura/org.eclipse.kura.rest.network.configuration.provider/src/main/java/org/eclipse/kura/internal/rest/network/configuration/NetworkConfigurationRestService.java Co-authored-by: Mattia Dal Ben <[email protected]> --------- Signed-off-by: pierantoniomerlino <[email protected]> Co-authored-by: Mattia Dal Ben <[email protected]>
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 the
net.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.