-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[network-data] add leader override feature #9106
Conversation
Size Report of OpenThread
|
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #9106 +/- ##
==========================================
+ Coverage 82.34% 85.41% +3.06%
==========================================
Files 527 544 +17
Lines 69940 71612 +1672
==========================================
+ Hits 57592 61164 +3572
+ Misses 12348 10448 -1900
|
* | ||
*/ | ||
#ifndef OPENTHREAD_CONFIG_BORDER_ROUTER_LEADER_OVERRIDE_ENABLE | ||
#define OPENTHREAD_CONFIG_BORDER_ROUTER_LEADER_OVERRIDE_ENABLE OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE |
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.
Also to include the condition here that Thread Version >= 1.3.1
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.
Since it is only added behavior and requires feature to be explicitly enabled (through API call otBorderRouterSetLeaderOverrideEnabled()
and by default it is disabled), I think we can skip version check (we usually avoid version check for new additive feature, e.g. SRP clinet/sever also don't have version check).
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.
Ok, if the feature is available and by default disabled then it's fine to include for the standard build. A BR vendor can anyway overrule the setting if wanted, e.g. to reduce some code if needed.
|
||
void Leader::CheckForNetDataGettingFull(const NetworkData &aNetworkData, uint16_t aOldRloc16) | ||
{ | ||
// Determines whether there is still room in Network Data to register |
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.
with a check method, some result of the check needs to be provided either a boolean or an object whose size can be verified. It's not clear from the comments how the result is delivered?
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.
Added new text in comment to clarify this. We use callback by invoking Get<Notifier>().SignalNetworkDataFull()
(which then may call user callback and inform any other module that may be intrested).
The reason went for this model (callback) is that it can be triggered from different paths in the code (e.g. local netdata getting full, etc).
This commit adds a new mechanism to detect when Network Data (local or leader) becomes full. When this happens, a callback function is invoked. This callback function can be set using a newly added OT API. The callback is invoked whenever: - The device is acting as the leader and receives a Network Data registration from a Border Router (BR) that it cannot add to Network Data (running out of space). - The device is acting as a BR and new entries cannot be added to its local Network Data. - The device is acting as a BR and tries to register its local Network Data entries with the leader, but determines that its local entries will not fit. The `OPENTHREAD_CONFIG_BORDER_ROUTER_SIGNAL_NETWORK_DATA_FULL` config controls the new mechanism and its API. It is enabled by default when `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` is enabled. This commit also adds CLI support for the new mechanism and adds a test case to validate its behavior.
This commit implements the leader override mechanism. When enabled, a border router (BR) monitors the following trigger conditions to start leader override: - The BR's leader weight is higher than the current partition's weight (as indicated in the current Leader Data). - The BR has pending local Network Data entries and has tried to register them with the leader at least 3 times, but failed each time. - Each attempt consisted of sending a SRV_DATA.ntf message to the leader, which was acknowledged but not integrated into the Thread Network Data within `DATA_RESUBMIT_DELAY` seconds (300 seconds). - The maximum size of the Thread Network Data has been such that the local Network Data entries would fit over the past period. If all of these conditions are met, the BR starts the leader override procedure by selecting a random delay between 1 and 30 seconds. If the trigger conditions still hold after the random delay, the BR starts a new partition as the leader. The `OPENTHREAD_CONFIG_BORDER_ROUTER_LEADER_OVERRIDE_ENABLE` configuration option or the `OT_LEADER_OVERRIDE` CMake option control whether this feature is included. This commit also adds the `test_leader_override.py` script, which validates the behavior of the newly added leader override mechanism under different scenarios.
e8fe35f
to
4dde33a
Compare
Closing this PR for now. |
This commit implements the leader override mechanism. When enabled, a border router (BR) monitors the following trigger conditions to start leader override:
DATA_RESUBMIT_DELAY
seconds (300 seconds).If all of these conditions are met, the BR starts the leader override procedure by selecting a random delay between 1 and 30 seconds. If the trigger conditions still hold after the random delay, the BR starts a new partition as the leader.
The
OPENTHREAD_CONFIG_BORDER_ROUTER_LEADER_OVERRIDE_ENABLE
configuration option or theOT_LEADER_OVERRIDE
CMake option control whether this feature is included.This commit also adds the
test_leader_override.py
script, which validates the behavior of the newly added leader override mechanism under different scenarios.