kapua icon indicating copy to clipboard operation
kapua copied to clipboard

Allow download and upload of Kura native snapshot

Open lorthirk opened this issue 5 years ago • 7 comments

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 Schermata 2020-02-20 alle 17 08 19 Schermata 2020-02-20 alle 17 08 22

Any side note on the changes made Do we agree on "Native" and "Standard" names?

lorthirk avatar Feb 20 '20 16:02 lorthirk

Codecov Report

Merging #2859 (27b672d) into develop (aa12747) will increase coverage by 0.58%. The diff coverage is 61.34%.

Impacted file tree graph

@@              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%> (ø)

... and 144 files with indirect coverage changes

codecov[bot] avatar Feb 20 '20 17:02 codecov[bot]

"Standard" term alternative wanted.

💰 1.000.000K reward 💰

I suggest "accepted", "common" or "general". Did I get the prize? 😸 😸

LeoNerdoG avatar Feb 24 '20 11:02 LeoNerdoG

Can this be used to upload, via Kapua, a wiregraph that was downloaded via Kura web interface?

kcsj17 avatar Feb 27 '20 18:02 kcsj17

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.

LeoNerdoG avatar Feb 28 '20 06:02 LeoNerdoG

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)

lorthirk avatar Apr 22 '20 11:04 lorthirk

Removing project tracking since it is tracked by the issue

Coduz avatar May 13 '20 14:05 Coduz

Still needs some thinking as it involves other parts that were overlooked at the beginning. Adding the proposal label

lorthirk avatar May 15 '20 07:05 lorthirk