From edce936b1c8529d140ff131b84718d2d702f5a8a Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Mon, 3 Apr 2023 10:37:47 -0700 Subject: [PATCH] [network-data] change 6LoWPAN context ID reuse delay to 5 minutes (#8896) This commit changes the context ID reuse delay from 48 hours to 5 minutes. It also updates `test-019-netdata-context-id.py` to check the default value. --- src/core/thread/network_data_leader_ftd.hpp | 2 +- tests/toranj/cli/cli.py | 6 ++++++ tests/toranj/cli/test-019-netdata-context-id.py | 10 +++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/core/thread/network_data_leader_ftd.hpp b/src/core/thread/network_data_leader_ftd.hpp index c7a3cd152..85096c33c 100644 --- a/src/core/thread/network_data_leader_ftd.hpp +++ b/src/core/thread/network_data_leader_ftd.hpp @@ -234,7 +234,7 @@ private: void HandleTimer(void); private: - static constexpr uint32_t kReuseDelay = 48 * 60 * 60; // in seconds + static constexpr uint32_t kReuseDelay = 5 * 60; // 5 minutes (in seconds). static constexpr uint8_t kMinId = 1; static constexpr uint8_t kMaxId = 15; diff --git a/tests/toranj/cli/cli.py b/tests/toranj/cli/cli.py index db0a40bc6..b8a8b02c4 100644 --- a/tests/toranj/cli/cli.py +++ b/tests/toranj/cli/cli.py @@ -274,6 +274,12 @@ class Node(object): def set_router_eligible(self, enable): self._cli_no_output('routereligible', enable) + def get_context_reuse_delay(self): + return self._cli_single_output('contextreusedelay') + + def set_context_reuse_delay(self, delay): + self._cli_no_output('contextreusedelay', delay) + def interface_up(self): self._cli_no_output('ifconfig up') diff --git a/tests/toranj/cli/test-019-netdata-context-id.py b/tests/toranj/cli/test-019-netdata-context-id.py index dd60cd6b6..68029da21 100755 --- a/tests/toranj/cli/test-019-netdata-context-id.py +++ b/tests/toranj/cli/test-019-netdata-context-id.py @@ -74,10 +74,14 @@ verify(r3.get_state() == 'router') # ----------------------------------------------------------------------------------------------------------------------- # Test Implementation -# Change the reuse delay on `r1 (leader) to 5 seconds. +# Check the default reuse delay on `r1` to be 5 minutes. -r1.cli('contextreusedelay 5') -verify(int(r1.cli('contextreusedelay')[0]) == 5) +verify(int(r1.get_context_reuse_delay()) == 5 * 60) + +# Change the reuse delay on `r1` (leader) to 5 seconds. + +r1.set_context_reuse_delay(5) +verify(int(r1.get_context_reuse_delay()) == 5) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Add an on-mesh prefix from each router `r1`, r2`, and `r3`.