-
Notifications
You must be signed in to change notification settings - Fork 56
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
Initial follow up tasks for built-in bridge #2810
Merged
jarhodes314
merged 5 commits into
thin-edge:main
from
jarhodes314:2794-follow-up-tasks-for-built-in-bridge
Apr 8, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
393e54b
Add logging for bridge status detection
jarhodes314 51f8c14
Correctly filter out bridge health topic
jarhodes314 e1d6b18
Use standard tedge health format for built-in bridge
jarhodes314 27d3a92
Move configuration from `c8y.bridge.built_in` to `mqtt.bridge.built_in`
jarhodes314 2ada77d
Correctly handle connecting built-in bridge for new devices
jarhodes314 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -390,6 +390,12 @@ impl EntityTopicId { | |
pub fn as_str(&self) -> &str { | ||
self.0.as_str() | ||
} | ||
|
||
// FIXME: can also match "device/bridge//" or "/device/main/service/my_custom_bridge" | ||
// should match ONLY the single mapper bridge | ||
pub fn is_bridge_health_topic(&self) -> bool { | ||
self.as_str().contains("bridge") | ||
} | ||
Comment on lines
+394
to
+398
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This PR might be the opportunity to resolve this FIXME. |
||
} | ||
|
||
/// Contains a topic id of the service itself and the associated device. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
[minor] I would move into
tedge_api
this logic to accept0
|1
|status = up
|status = down
.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.
If I'm removing the check for bridge health, then this more complicated logic isn't required, so unless we need it for some other reason you know of, I'll undo this change
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.
Checking that the bridge has been initialized before sending registration messages to c8y is required for a very new thin-edge device. If the c8y mapper starts before the bridge and even before the c8y.url is provided (as this is the case for a generic image of thin-edge), then the mapper must wait for the bridge to be initialized - otherwise all the registration messages are lost.
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.
So this logic is required - but can be simplified by simply checking that at least one message has been received on this topic - whatever the payload.
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 just saw 4ef0fcd and I'm okay with it.