[bbr] implement new Sequence Number increase rules (#7342)

"BBR Sequence Number Updating" section in Thread Specification
requires special wraps when increasing BBR Dataset Sequence Number.
This commit is contained in:
Eduardo Montoya
2022-01-25 18:20:36 -08:00
committed by GitHub
parent 3ef867602e
commit d4e041096f
3 changed files with 34 additions and 6 deletions
+7 -2
View File
@@ -1607,7 +1607,7 @@ class OpenThreadTHCI(object):
self.stopListeningToAddrAll()
# BBR dataset
self.bbrSeqNum = random.randint(0, 254) # random seqnum except 255, so that BBR-TC-02 never need re-run
self.bbrSeqNum = random.randint(0, 126) # 5.21.4.2
self.bbrMlrTimeout = 3600
self.bbrReRegDelay = 5
@@ -3182,7 +3182,12 @@ class OpenThreadTHCI(object):
"""
assert not (SeqNumInc and SeqNum is not None), "Must not specify both SeqNumInc and SeqNum"
if SeqNumInc:
SeqNum = (self.bbrSeqNum + 1) % 256
if self.bbrSeqNum in (126, 127):
self.bbrSeqNum = 0
elif self.bbrSeqNum in (254, 255):
self.bbrSeqNum = 128
else:
self.bbrSeqNum = (self.bbrSeqNum + 1) % 256
return self.__configBbrDataset(SeqNum=SeqNum, MlrTimeout=MlrTimeout, ReRegDelay=ReRegDelay)