-
Notifications
You must be signed in to change notification settings - Fork 55
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
c8y-mapper sends software list to advanced software management endpoint #2771
c8y-mapper sends software list to advanced software management endpoint #2771
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files
|
Robot Results
|
a764643
to
6ede9d3
Compare
6ede9d3
to
7e81021
Compare
7e81021
to
ee8f32f
Compare
a70e8dc
to
30741ee
Compare
30741ee
to
d2655fa
Compare
d2655fa
to
c96de86
Compare
c96de86
to
d2655fa
Compare
fa391cb
to
cb75ce0
Compare
tests/RobotFramework/tests/cumulocity/software_management/software.robot
Show resolved
Hide resolved
tests/RobotFramework/tests/cumulocity/software_management/software.robot
Show resolved
Hide resolved
crates/common/tedge_config/src/tedge_config_cli/models/c8y_software_management.rs
Outdated
Show resolved
Hide resolved
crates/common/tedge_config/src/tedge_config_cli/models/c8y_software_management.rs
Show resolved
Hide resolved
crates/common/tedge_config/src/tedge_config_cli/models/c8y_software_management.rs
Outdated
Show resolved
Hide resolved
// Send c8y_SupportedSoftwareTypes, which is introduced in c8y >= 10.14 | ||
let data = SoftwareCommandMetadata::from_json(message.payload_str()?)?; | ||
let payload = json!({"c8y_SupportedSoftwareTypes": data.types}).to_string(); | ||
let topic = self.get_inventory_update_topic(target)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is not the right place to improve on this, but we will have to find a better pattern before being overwhelmed by this kind of artificial and error-prone complexity.
- Artificial, because we only need to translate a tedge MQTT message into a c8y one. This is not obvious from these lines.
- Error-prone, because the message must be partially parsed before calling this method (to extract the target and message topic from the message.topic).
- I agree this is not so easy, as we need to access the inventory to translate the tedge entity id into a c8y external id.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we can work to improve, however, I'm not sure how much I should do in this PR...
By the way, since this action updates the device's c8y inventory, should the mapper publish to our twin
topic, instead of directly publishing to the JSON over MQTT topic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how much I should do in this PR...
Definitely not in this PR as this would impact all the messages received by the c8y converter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the mapper publish to our twin topic, instead of directly publishing to the JSON over MQTT topic?
No, the twin
topic is where child devices publish their metadata. The c8y mapper should react on these messages, not push data there.
c594fc3
to
be43806
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved
Since Cumulocity 10.14, it is recommended to send software list to the advanced software management endpoint. By default, the mapper publishes its software list via SmartREST. If `c8y.software_management.api` is set to 'true', the mapper also sends c8y_SupportedSoftwareTypes to inventory via JSON over MQTT. To keep backwards compatibility, if `c8y.software_management.api` is set to "legacy", the mapper posts to c8y_SoftwareList fragment to the inventory API via HTTP. Signed-off-by: Rina Fujino <[email protected]>
Signed-off-by: Rina Fujino <[email protected]>
5546a35
to
667652a
Compare
Proposed changes
Since c8y 10.14, advanced software management feature is supported together with the microservice "Advanced-software-mgmt". This PR enables users to use the feature. For more details about the feature, please read the c8y user doc.
Introduced two tedge configs:
To switch legacy software management (= sending list via HTTP) and advanced one (= sending list via SmartREST).
By default, it is set to
legacy
. To enhance the detection, the ticket Cumulocity software api configuration options #2778 is created.If mapper publishes
c8y_SupportedSoftwareTypes
to the inventory or not. If the type is set in its managed object, c8y stop usingc8y_SoftwareList
fragment to look up the installed software list. By default, it is set tofalse
so that we can still usec8y_SoftwareList
fragment for testing and so on.Types of changes
Paste Link to the issue
#2654
Checklist
cargo fmt
as mentioned in CODING_GUIDELINEScargo clippy
as mentioned in CODING_GUIDELINESFurther comments