-
Notifications
You must be signed in to change notification settings - Fork 199
Add route table to network backup #1686
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
Conversation
Switch format around Switch to a simple dict Fix route table unit tests Add `tx_power` Fix Z2M backup test
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.
Pull Request Overview
Adds route table functionality to network backup and restore operations. This change extends the network info JSON structure to include next-hop routing information, which is essential for fully restoring network state.
- Adds a
route_tablefield to theNetworkInfodataclass as a dictionary mapping destination nodes to next-hop nodes - Updates backup format version from 1 to 2 to accommodate the new route table field
- Implements serialization/deserialization logic for route tables in both internal format and Open Coordinator backup format
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| zigpy/state.py | Adds route_table field to NetworkInfo and implements serialization/deserialization |
| zigpy/backups.py | Updates backup format version and adds route table handling in backup conversions |
| tests/test_backups.py | Updates test fixtures to include route table data |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1686 +/- ##
=======================================
Coverage 99.31% 99.31%
=======================================
Files 62 62
Lines 12048 12055 +7
=======================================
+ Hits 11965 11972 +7
Misses 83 83 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Looks good to me, one small note about tx_power still being in a comment:
| obj["node_info"]["version"] = None | ||
| version = 1 | ||
|
|
||
| # Version 2 introduced the `route_table` and `tx_power` fields |
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.
The tx_power field doesn't seem to be included in this PR yet:
| # Version 2 introduced the `route_table` and `tx_power` fields | |
| # Version 2 introduced the `route_table` field |
If you merge the other PR shortly after this, feel free to leave it in.
In preparation for NabuCasa/silabs-firmware-builder#118, I'm extending the network info JSON with a next-hop route table. While the EmberZNet structures reference route status, route age, cost, and so on, we do not actually need any of this information to restore the route table: we just need the destination node and the next-hop node.