Skip to content

[netdata] move service ALOC management from MLE module - #11815

Merged
jwhui merged 1 commit into
openthread:mainfrom
abtink:mle/move-service-aloc-to-nd
Aug 14, 2025
Merged

[netdata] move service ALOC management from MLE module#11815
jwhui merged 1 commit into
openthread:mainfrom
abtink:mle/move-service-aloc-to-nd

Conversation

@abtink

@abtink abtink commented Aug 13, 2025

Copy link
Copy Markdown
Member

This change moves the service ALOC management logic from the Mle module to NetworkData::Service::Manager.

This change simplifies the code by consolidating responsibilities. Since the NetworkData::Service module manages service entries in the Network Data, it is the logical owner for managing the associated service ALOCs.

@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.

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 refactors the management of Service ALOCs (Address Locators) within the network data handling. It moves the logic responsible for updating and finding Service ALOCs from the Mle (Mesh Link Establishment) module to the NetworkData::Service::Manager module. This change aims to improve code organization and adhere to the principle of single responsibility, as NetworkData::Service::Manager is the more logical owner for managing service-related entries.

Highlights

  • Responsibility Transfer: The core logic for managing Service ALOCs, including their creation, removal, and lookup, has been relocated from the Mle class to the NetworkData::Service::Manager class.
  • Notifier Integration: The system's event notification mechanism (Notifier) now directly informs NetworkData::Service::Manager about relevant network data changes, enabling it to manage Service ALOCs independently.
  • Code Decoupling: This refactoring reduces the Mle module's responsibilities, making it leaner and more focused on its primary role, while centralizing service-related network data management in a dedicated module.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 refactors the service ALOC management by moving the logic from the Mle module to NetworkData::Service::Manager. This is a good change that improves code organization by consolidating related responsibilities. The implementation looks correct and the move has been done cleanly. I have one minor suggestion to fix a comment.

Comment thread src/core/thread/network_data_service.cpp Outdated
@github-actions

github-actions Bot commented Aug 13, 2025

Copy link
Copy Markdown

Merging #11815 into main

name branch text data bss total
ot-cli-ftd 562a3d8 479000 860 66548 546408
7a74f8a 479112 860 66548 546520
+/- +112 +0 +0 +112
ot-ncp-ftd 562a3d8 444716 764 61792 507272
7a74f8a 444812 764 61792 507368
+/- +96 +0 +0 +96
ot-cli-mtd 562a3d8 371920 764 51028 423712
7a74f8a 371920 764 51028 423712
+/- +0 +0 +0 +0
ot-ncp-mtd 562a3d8 353052 764 46296 400112
7a74f8a 353052 764 46296 400112
+/- +0 +0 +0 +0
ot-cli-ftd-br 562a3d8 578480 868 135372 714720
7a74f8a 578560 868 135364 714792
+/- +80 +0 -8 +72
ot-rcp 562a3d8 63136 568 20804 84508
7a74f8a 63136 568 20804 84508
+/- +0 +0 +0 +0
Library files
name branch text data bss total
libopenthread-ftd.a 562a3d8 246188 95 40326 286609
7a74f8a 246294 95 40326 286715
+/- +106 +0 +0 +106
libopenthread-cli-ftd.a 562a3d8 60843 0 8083 68926
7a74f8a 60843 0 8083 68926
+/- +0 +0 +0 +0
libopenthread-ncp-ftd.a 562a3d8 33257 0 5948 39205
7a74f8a 33257 0 5948 39205
+/- +0 +0 +0 +0
libopenthread-mtd.a 562a3d8 164783 0 24830 189613
7a74f8a 164783 0 24830 189613
+/- +0 +0 +0 +0
libopenthread-cli-mtd.a 562a3d8 41134 0 8059 49193
7a74f8a 41134 0 8059 49193
+/- +0 +0 +0 +0
libopenthread-ncp-mtd.a 562a3d8 25785 0 5948 31733
7a74f8a 25785 0 5948 31733
+/- +0 +0 +0 +0
libopenthread-ftd-br.a 562a3d8 348831 100 109118 458049
7a74f8a 348917 100 109110 458127
+/- +86 +0 -8 +78
libopenthread-cli-ftd-br.a 562a3d8 76979 0 8115 85094
7a74f8a 76979 0 8115 85094
+/- +0 +0 +0 +0
libopenthread-rcp.a 562a3d8 9932 0 5060 14992
7a74f8a 9932 0 5060 14992
+/- +0 +0 +0 +0
libopenthread-radio.a 562a3d8 19423 0 238 19661
7a74f8a 19423 0 238 19661
+/- +0 +0 +0 +0

@abtink
abtink force-pushed the mle/move-service-aloc-to-nd branch from 5532902 to 2fddc10 Compare August 13, 2025 17:53
@codecov

codecov Bot commented Aug 13, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.66%. Comparing base (a1ad5d2) to head (b8b8b31).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11815      +/-   ##
==========================================
+ Coverage   74.55%   74.66%   +0.10%     
==========================================
  Files         640      641       +1     
  Lines       93476    99343    +5867     
==========================================
+ Hits        69693    74172    +4479     
- Misses      23783    25171    +1388     
Files with missing lines Coverage Δ
src/core/common/notifier.cpp 92.30% <100.00%> (+0.64%) ⬆️
src/core/thread/mle.cpp 70.48% <ø> (-17.13%) ⬇️
src/core/thread/mle.hpp 89.23% <ø> (+2.42%) ⬆️
src/core/thread/network_data_service.cpp 96.69% <100.00%> (+1.10%) ⬆️
src/core/thread/network_data_service.hpp 98.63% <100.00%> (-1.37%) ⬇️

... and 352 files with indirect coverage changes

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

@abtink
abtink marked this pull request as ready for review August 13, 2025 19:03
@jwhui
jwhui requested a review from Copilot August 13, 2025 20:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR moves service ALOC (Anycast Locator) management from the MLE (Mesh Link Establishment) module to the NetworkData::Service::Manager module, consolidating service-related responsibilities.

Key changes:

  • Transfers ServiceAloc class definition and related methods from Mle to NetworkData::Service::Manager
  • Moves service ALOC update logic from MLE's event handler to the Service Manager
  • Updates the notifier to call the Service Manager's event handler for network data changes

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/core/thread/network_data_service.hpp Adds ServiceAloc class, event handling method, and member variables for ALOC management
src/core/thread/network_data_service.cpp Implements moved ALOC management logic including HandleNotifierEvents and FindInServiceAlocs methods
src/core/thread/mle.hpp Removes ServiceAloc-related declarations and member variables
src/core/thread/mle.cpp Removes ServiceAloc implementation and event handling code
src/core/common/notifier.cpp Adds call to Service Manager's HandleNotifierEvents method

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/core/thread/network_data_service.hpp
Comment thread src/core/thread/network_data_service.cpp
static constexpr uint8_t kMaxServiceAlocs = OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_MAX_ALOCS;
#endif

class ServiceAloc : public Ip6::Netif::UnicastAddress

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this a duplicate from the one in mle.hpp? Can we remove the other one?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes. We should remove this from Mle. Thanks for noticing.
Updated in new push.

This change moves the service ALOC management logic from the `Mle`
module to `NetworkData::Service::Manager`.

This change simplifies the code by consolidating responsibilities.
Since the `NetworkData::Service` module manages service entries in
the Network Data, it is the logical owner for managing the associated
service ALOCs.
@abtink
abtink force-pushed the mle/move-service-aloc-to-nd branch from 2fddc10 to b8b8b31 Compare August 13, 2025 23:44
@abtink

abtink commented Aug 13, 2025

Copy link
Copy Markdown
Member Author

/gemini review

@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 moves the service ALOC management logic from the Mle module to NetworkData::Service::Manager. The changes are well-structured and effectively consolidate responsibilities, making the NetworkData::Service module the logical owner for managing service ALOCs. The refactoring is clean and the implementation appears correct. I have no further comments.

@jwhui
jwhui merged commit a3cd859 into openthread:main Aug 14, 2025
101 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.

3 participants