[low-power] resync SSED with its parent after retransmission (#6342)

Per 15.4 spec, transmitter cannot modify frame content in
retransmission which will leads to out-of-date CSL IE being sent to
CSL transmitter. This commit fixes this issue by,
1. Send a follow up data poll with CSL IE to resync the CSL
   transmitter.
2. Send periodic data poll with CSL IE to keep SSED's parent in sync.
3. Move PrepareDataRequest to data_poll_sender.
4. Add test cases to cover.
This commit is contained in:
Jintao Lin
2021-04-13 13:02:00 -07:00
committed by GitHub
parent 07eb021679
commit d514373832
12 changed files with 268 additions and 189 deletions
@@ -101,6 +101,31 @@ class SSED_CslTransmission(thread_cert.TestCase):
self.nodes[SSED_1].set_pollperiod(0)
self.simulator.go(5)
# Check if data poll is not sent if data packet with CSL IE is sent to parent
self.nodes[SSED_1].set_csl_period(consts.CSL_DEFAULT_PERIOD)
self.simulator.go(consts.CSL_DEFAULT_TIMEOUT / 2)
self.assertTrue(self.nodes[LEADER].ping(self.nodes[SSED_1].get_rloc(), timeout=timeout))
self.flush_all()
self.simulator.go(consts.CSL_DEFAULT_TIMEOUT / 2)
ssed_messages = self.simulator.get_messages_sent_by(SSED_1)
self.assertIsNone(ssed_messages.next_data_poll())
# Check if data poll is used to sync SSED's parent before CSL timeout
self.assertTrue(self.nodes[LEADER].ping(self.nodes[SSED_1].get_rloc(), timeout=timeout))
self.flush_all()
self.simulator.go(consts.CSL_DEFAULT_TIMEOUT)
ssed_messages = self.simulator.get_messages_sent_by(SSED_1)
self.assertIsNotNone(ssed_messages.next_data_poll())
# Check if data poll is used to resync SSED's parent after retransmission
leader_rloc = self.nodes[LEADER].get_rloc()
self.nodes[LEADER].stop()
self.flush_all()
self.assertFalse(self.nodes[SSED_1].ping(leader_rloc, timeout=timeout))
self.simulator.go(2)
ssed_messages = self.simulator.get_messages_sent_by(SSED_1)
self.assertIsNotNone(ssed_messages.next_data_poll())
if __name__ == '__main__':
unittest.main()