Allow download and upload of Kura native snapshot
Currently, Device Snapshots downloaded from the Console or REST APIs cannot be directly applied to a Kura device, since the XML that is downloaded from the Console has a different format the one that Kura can deserialize. With this PR, bot "Standard" (old format) and "Native" (new, Kura-compatible format) snapshots can be both dowloaded and uploaded from the console. Native snapshots can also be directly applied to a device from the Kura console.
Related Issue Fixes #2704
Description of the solution adopted
Translation logic has been extracted from TranslatorAppConfigurationKuraKapua and TranslatorAppConfigurationKapuaKura to a utility class named KuraDeviceConfigurationUtils, in the kapua-device-call-kura module. The same logic is also called from the Download and Upload servlets to do necessary conversions.
Screenshots

Any side note on the changes made Do we agree on "Native" and "Standard" names?
Codecov Report
Merging #2859 (27b672d) into develop (aa12747) will increase coverage by
0.58%. The diff coverage is61.34%.
@@ Coverage Diff @@
## develop #2859 +/- ##
=============================================
+ Coverage 55.52% 56.10% +0.58%
- Complexity 2553 2588 +35
=============================================
Files 1048 1060 +12
Lines 22810 22982 +172
Branches 2051 2061 +10
=============================================
+ Hits 12665 12894 +229
+ Misses 9190 9137 -53
+ Partials 955 951 -4
| Impacted Files | Coverage Δ | |
|---|---|---|
| ...apua/kura/TranslatorAppConfigurationKapuaKura.java | 50.00% <ø> (+14.58%) |
:arrow_up: |
| ...ura/kapua/TranslatorAppConfigurationKuraKapua.java | 67.56% <ø> (-11.85%) |
:arrow_down: |
| ...el/configuration/KuraDeviceConfigurationUtils.java | 61.34% <61.34%> (ø) |
"Standard" term alternative wanted.
💰 1.000.000K reward 💰
I suggest "accepted", "common" or "general". Did I get the prize? 😸 😸
Can this be used to upload, via Kapua, a wiregraph that was downloaded via Kura web interface?
Hi @kcsj17, yes, you can either upload just a wire snapshot or snapshot of the whole system. Just be sure that you select the "Native" option in the UI as @lorthirk described above.
I have just tested this and it works fine.
After discussing with @Coduz and @stefanomorson, the following changes have been proposed:
- The format names will be "Platform" and "Device"
- Only one "Upload and Apply" button that can support and autodetect both formats
- The REST API has to be enhanced with the same support (autodetect for upload, query string parameter to choose download format)
Removing project tracking since it is tracked by the issue
Still needs some thinking as it involves other parts that were overlooked at the beginning. Adding the proposal label