mirror of
https://github.com/espressif/openthread.git
synced 2026-08-21 01:49:52 +00:00
[netdata-publisher] remove SRP unicast on anycast entry added by a BR (#9807)
This commit updates how the `NetworkData::Publisher` handles "DNS/SRP Service Unicast Address" entries. Specifically, when a "DNS/SRP Service Anycast" entry is added by another BR, the publisher will set the desired count of unicast entries to zero. This effectively removes any previously added unicast entry. This new behavior is only applied when the address and port are included in the Server TLV data in a "DNS/SRP Service Unicast Address" entry. The `test_netdata_publisher` has been updated to verify this new behavior.
This commit is contained in:
@@ -304,6 +304,37 @@ class NetDataPublisher(thread_cert.TestCase):
|
||||
node.srp_server_set_enabled(False)
|
||||
self.assertEqual(node.srp_server_get_state(), 'disabled')
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# DNS/SRP unicast and anycast entry
|
||||
|
||||
# Verify that publishing an anycast entry will update the limit
|
||||
# for the unicast MLE-EID address entry and all are removed.
|
||||
|
||||
num = 0
|
||||
for node in routers:
|
||||
node.netdata_publish_dnssrp_unicast_mleid(DNSSRP_PORT)
|
||||
self.simulator.go(WAIT_TIME)
|
||||
num += 1
|
||||
services = leader.get_services()
|
||||
self.assertEqual(len(services), min(num, DESIRED_NUM_DNSSRP_UNCIAST))
|
||||
self.verify_unicast_services(services)
|
||||
|
||||
leader.netdata_publish_dnssrp_anycast(ANYCAST_SEQ_NUM)
|
||||
self.simulator.go(WAIT_TIME)
|
||||
services = leader.get_services()
|
||||
self.assertEqual(len(services), 1)
|
||||
self.verify_anycast_services(services)
|
||||
|
||||
leader.netdata_unpublish_dnssrp()
|
||||
self.simulator.go(WAIT_TIME)
|
||||
|
||||
services = leader.get_services()
|
||||
self.assertEqual(len(services), min(num, DESIRED_NUM_DNSSRP_UNCIAST))
|
||||
self.verify_unicast_services(services)
|
||||
|
||||
for node in routers:
|
||||
node.netdata_unpublish_dnssrp()
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# DNS/SRP entries: Verify publisher preference when removing
|
||||
# entries.
|
||||
|
||||
Reference in New Issue
Block a user