Skip to content

[mle] introduce Connectivity and ConnectivityTlvValue types - #12300

Merged
jwhui merged 1 commit into
openthread:mainfrom
abtink:tlv/connectivity
Jan 15, 2026
Merged

[mle] introduce Connectivity and ConnectivityTlvValue types#12300
jwhui merged 1 commit into
openthread:mainfrom
abtink:tlv/connectivity

Conversation

@abtink

@abtink abtink commented Jan 14, 2026

Copy link
Copy Markdown
Member

This change separates the Connectivity TLV value format from its logical structure by introducing ConnectivityTlvValue (raw format) and Connectivity (parsed info). This replaces the ConnectivityTlv class and enables value format sharing between MLE and Network Diagnostics (without improper TLV inheritance).

It also updates ParentCandidate to use the new Connectivity class for better field encapsulation. It also updates ConnectivityTlvValue parsing to handle optional fields and enforce spec-defined minimums for these fields.

This change separates the Connectivity TLV value format from its
logical structure by introducing `ConnectivityTlvValue` (raw format)
and `Connectivity` (parsed info). This replaces the `ConnectivityTlv`
class and enables value format sharing between MLE and Network
Diagnostics (without improper TLV inheritance).

It also updates `ParentCandidate` to use the new `Connectivity` class
for better field encapsulation. It also updates `ConnectivityTlvValue`
parsing to handle optional fields and enforce spec-defined minimums
for these fields.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @abtink, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant architectural improvement by decoupling the logical representation of connectivity data from its on-wire TLV format. This separation enhances code clarity, improves data encapsulation within key structures like ParentCandidate, and ensures a consistent approach to handling connectivity information across different modules such as MLE and Network Diagnostics. The update also brings more robust parsing capabilities for the Connectivity TLV, accommodating optional fields as per specification.

Highlights

  • Separation of Concerns for Connectivity TLV: The Connectivity TLV data has been refactored into two distinct types: Connectivity to represent the logical structure of the connectivity information, and ConnectivityTlvValue to handle the raw, on-wire format of the TLV.
  • Improved Data Encapsulation: The ParentCandidate structure now directly embeds the new Connectivity object, leading to better encapsulation of parent-related connectivity attributes and simplifying access to these fields.
  • Shared TLV Format: This change enables the ConnectivityTlvValue format to be shared consistently between the MLE (Mesh Link Establishment) and Network Diagnostics modules, avoiding previous issues with improper TLV inheritance.
  • Robust TLV Parsing: The parsing logic for ConnectivityTlvValue has been enhanced to correctly handle optional fields within the TLV and to enforce spec-defined minimum values for these fields when they are not explicitly present.
  • Refactored Connectivity TLV Handling: The previous ConnectivityTlv class has been replaced by the new Connectivity and ConnectivityTlvValue types across the codebase, including message appending and reading functions.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request is a well-executed refactoring that separates the Connectivity TLV's raw format from its logical structure. The introduction of ConnectivityTlvValue for the raw format and Connectivity for the parsed information is a clean design choice that effectively replaces the old ConnectivityTlv class. This change successfully enables the sharing of the value format between MLE and Network Diagnostics, which reduces code duplication. Additionally, updating ParentCandidate to use the new Connectivity class improves encapsulation. The parsing logic for ConnectivityTlvValue has also been enhanced to handle optional fields, making it more robust. The changes are consistently applied across all relevant files, resulting in cleaner and more maintainable code. I have no specific comments as the implementation is solid.

@github-actions

Copy link
Copy Markdown

Merging #12300 into main

name branch text data bss total
ot-cli-ftd 0d1cca3 482080 860 66548 549488
72bdbc0 482080 860 66556 549496
+/- +0 +0 +8 +8
ot-ncp-ftd 0d1cca3 447700 764 61784 510248
72bdbc0 447796 764 61792 510352
+/- +96 +0 +8 +104
ot-cli-mtd 0d1cca3 373488 764 50980 425232
72bdbc0 373520 764 50980 425264
+/- +32 +0 +0 +32
ot-ncp-mtd 0d1cca3 354644 764 46248 401656
72bdbc0 354676 764 46248 401688
+/- +32 +0 +0 +32
ot-cli-ftd-br 0d1cca3 589216 868 136460 726544
72bdbc0 589200 868 136468 726536
+/- -16 +0 +8 -8
ot-rcp 0d1cca3 63264 568 20804 84636
72bdbc0 63264 568 20804 84636
+/- +0 +0 +0 +0
Library files
name branch text data bss total
libopenthread-ftd.a 0d1cca3 248964 95 40327 289386
72bdbc0 248942 95 40335 289372
+/- -22 +0 +8 -14
libopenthread-cli-ftd.a 0d1cca3 61989 0 8091 70080
72bdbc0 61989 0 8091 70080
+/- +0 +0 +0 +0
libopenthread-ncp-ftd.a 0d1cca3 33581 0 5948 39529
72bdbc0 33581 0 5948 39529
+/- +0 +0 +0 +0
libopenthread-mtd.a 0d1cca3 166636 0 24791 191427
72bdbc0 166718 0 24791 191509
+/- +82 +0 +0 +82
libopenthread-cli-mtd.a 0d1cca3 41426 0 8059 49485
72bdbc0 41426 0 8059 49485
+/- +0 +0 +0 +0
libopenthread-ncp-mtd.a 0d1cca3 25805 0 5948 31753
72bdbc0 25805 0 5948 31753
+/- +0 +0 +0 +0
libopenthread-ftd-br.a 0d1cca3 357718 100 110199 468017
72bdbc0 357728 100 110207 468035
+/- +10 +0 +8 +18
libopenthread-cli-ftd-br.a 0d1cca3 80402 0 8131 88533
72bdbc0 80402 0 8131 88533
+/- +0 +0 +0 +0
libopenthread-rcp.a 0d1cca3 9944 0 5060 15004
72bdbc0 9944 0 5060 15004
+/- +0 +0 +0 +0
libopenthread-radio.a 0d1cca3 19547 0 238 19785
72bdbc0 19547 0 238 19785
+/- +0 +0 +0 +0

@codecov

codecov Bot commented Jan 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.26923% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.59%. Comparing base (0d1cca3) to head (501f7dd).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/core/thread/mle.cpp 86.20% 4 Missing ⚠️
src/core/thread/mle_tlvs.cpp 90.62% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12300      +/-   ##
==========================================
+ Coverage   76.09%   76.59%   +0.50%     
==========================================
  Files         680      677       -3     
  Lines       92485    93932    +1447     
==========================================
+ Hits        70378    71949    +1571     
+ Misses      22107    21983     -124     
Files with missing lines Coverage Δ
src/core/thread/mle.hpp 93.47% <ø> (-1.53%) ⬇️
src/core/thread/mle_ftd.cpp 87.61% <100.00%> (+0.19%) ⬆️
src/core/thread/mle_tlvs.hpp 87.90% <ø> (-12.10%) ⬇️
src/core/thread/mle_types.cpp 100.00% <100.00%> (ø)
src/core/thread/mle_types.hpp 98.50% <100.00%> (-1.50%) ⬇️
src/core/thread/network_diagnostic.cpp 81.01% <100.00%> (+0.09%) ⬆️
src/core/thread/network_diagnostic_tlvs.hpp 100.00% <ø> (ø)
src/core/thread/mle_tlvs.cpp 95.65% <90.62%> (-4.35%) ⬇️
src/core/thread/mle.cpp 90.84% <86.20%> (+0.31%) ⬆️

... and 212 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jwhui
jwhui merged commit 0e72f56 into openthread:main Jan 15, 2026
104 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants