Skip to content

feat: support Cumulocity legacy file upload/download operations#3285

Merged
reubenmiller merged 1 commit intothin-edge:mainfrom
reubenmiller:feat-support-legacy-config-upload-download-operations
Dec 10, 2024
Merged

feat: support Cumulocity legacy file upload/download operations#3285
reubenmiller merged 1 commit intothin-edge:mainfrom
reubenmiller:feat-support-legacy-config-upload-download-operations

Conversation

@reubenmiller
Copy link
Copy Markdown
Contributor

@reubenmiller reubenmiller commented Dec 6, 2024

Proposed changes

Support Cumulocity Legacy configuration upload/download operations which don't have a type property.

Since the legacy configuration operations and the new type-based file operations both use the same root fragment (c8y_UploadConfigFile and c8y_DownloadConfigFile), the only main difference is that the legacy versions don't have a type. The Cumulocity server will take responsibility of setting the c8y_ConfigurationDump inventory fragment when processing the operation status updates (see the documentation listed below).

Note: The Cumulocity legacy c8y_UploadConfigFile operation will not follow the exact legacy contract. Instead the user should use the "default" type to request the configuration from the device so that it aligns with the requesting other type-based configurations which are already supported by thin-edge.io.

Below shows an example of the operation data structure, and a reference to the Cumulocity documentation:

Legacy Config Upload Operation example

Documentation: https://cumulocity.com/docs/device-integration/fragment-library/#upload-current-legacy-configuration

Example operation body:

{
   "c8y_UploadConfigFile": {}
}

Legacy Config Download Operation

Documentation: https://cumulocity.com/docs/device-integration/fragment-library/#install-legacy-configuration

Example operation body:

{
   "c8y_DownloadConfigFile": {
       "url": "https://demos.cumulocity.com/inventory/binaries/9100",
       "c8y_ConfigurationDump": {
           "id": "9200"
       }
   }
}

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (general improvements like code refactoring that doesn't explicitly fix a bug or add any new functionality)
  • Documentation Update (if none of the other choices apply)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Paste Link to the issue

#3284

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA (in all commits with git commit -s)
  • I ran cargo fmt as mentioned in CODING_GUIDELINES
  • I used cargo clippy as mentioned in CODING_GUIDELINES
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

@reubenmiller reubenmiller added theme:configuration Theme: Configuration management theme:c8y Theme: Cumulocity related topics labels Dec 6, 2024
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 6, 2024

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/core/c8y_api/src/json_c8y_deserializer.rs 0.00% 3 Missing ⚠️
Additional details and impacted files

📢 Thoughts on this report? Let us know!

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 6, 2024

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
539 0 2 539 100 1h29m17.722378s

Copy link
Copy Markdown
Member

@rina23q rina23q left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good surprise to support the legacy configuration management with such small changes! I really think it was a good decision to change the operation input from SR2 to JSON :)

I left a minor test modification suggestion.

@reubenmiller reubenmiller force-pushed the feat-support-legacy-config-upload-download-operations branch from 7a8632e to 64ddcfb Compare December 9, 2024 16:13
Copy link
Copy Markdown
Contributor

@didier-wenzek didier-wenzek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

Copy link
Copy Markdown
Contributor

@didier-wenzek didier-wenzek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is correct, but naming can be improved.

Copy link
Copy Markdown
Contributor

@albinsuresh albinsuresh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for the missing c8y_ConfigurationDump MO creation for the c8y_UploadConfigFile operation, the rest looks fine.

@reubenmiller reubenmiller force-pushed the feat-support-legacy-config-upload-download-operations branch from 2b1fd5e to c3f895c Compare December 10, 2024 14:04
@reubenmiller reubenmiller force-pushed the feat-support-legacy-config-upload-download-operations branch from c3f895c to 2ce9ee7 Compare December 10, 2024 14:04
@reubenmiller reubenmiller added this pull request to the merge queue Dec 10, 2024
Merged via the queue into thin-edge:main with commit 76b4c83 Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme:c8y Theme: Cumulocity related topics theme:configuration Theme: Configuration management

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants