mirror of
https://github.com/espressif/openthread.git
synced 2026-08-04 01:47:47 +00:00
[routing-manager] stop PD if there is another prefix with higher preference in netdata (#10289)
This commit adds a new IDLE state to PdPrefixManager. PdPrefixManager enters idle state when PD is enabled and there is already a BR requesting PD prefix. When there are multiple BRs publishing PD prefix at the same time, the one with lexcial smaller prefix wins.
This commit is contained in:
@@ -2310,6 +2310,20 @@ class NodeImpl:
|
||||
self.send_command(cmd)
|
||||
return self._expect_command_output()[0]
|
||||
|
||||
def pd_get_prefix(self):
|
||||
cmd = 'br pd omrprefix'
|
||||
self.send_command(cmd)
|
||||
return self._expect_command_output()[0].split(" ")[0]
|
||||
|
||||
def pd_set_enabled(self, enable):
|
||||
self.send_command('br pd {}'.format("enable" if enable else "disable"))
|
||||
self._expect_done()
|
||||
|
||||
@property
|
||||
def pd_state(self):
|
||||
self.send_command('br pd state')
|
||||
return self._expect_command_output()[0].strip()
|
||||
|
||||
def get_netdata_non_nat64_routes(self):
|
||||
nat64_routes = []
|
||||
routes = self.get_routes()
|
||||
@@ -4097,6 +4111,33 @@ EOF
|
||||
self.bash('service radvd start')
|
||||
self.bash('service radvd status') # Make sure radvd service is running
|
||||
|
||||
def start_pd_radvd_service(self, prefix):
|
||||
self.bash("""cat >/etc/radvd.conf <<EOF
|
||||
interface wpan0
|
||||
{
|
||||
AdvSendAdvert on;
|
||||
|
||||
AdvReachableTime 20;
|
||||
AdvRetransTimer 20;
|
||||
AdvDefaultLifetime 180;
|
||||
MinRtrAdvInterval 120;
|
||||
MaxRtrAdvInterval 180;
|
||||
AdvDefaultPreference low;
|
||||
|
||||
prefix %s
|
||||
{
|
||||
AdvOnLink on;
|
||||
AdvAutonomous on;
|
||||
AdvRouterAddr off;
|
||||
AdvPreferredLifetime 180;
|
||||
AdvValidLifetime 180;
|
||||
};
|
||||
};
|
||||
EOF
|
||||
""" % (prefix,))
|
||||
self.bash('service radvd start')
|
||||
self.bash('service radvd status') # Make sure radvd service is running
|
||||
|
||||
def stop_radvd_service(self):
|
||||
self.bash('service radvd stop')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user