[child-supervision] mechanism to inform interval from child to parent (#7993)

This commit contains changes to child supervision feature. It adds a
new mechanism for a child to inform its desired supervision interval
to its parent. A new optional MLE TLV is added with type 27 and value
of `uint16_t` indicating the supervision interval in seconds. This
TLV is included in MLE Child ID Request and MLE Child Update Request
(sent from the child). The parent echoes back this TLV in the
corresponding responses to indicate that it supports supervision. This
commit changes the parent implementation to track the supervision
interval per child.

This commit also updates the OT public APIs along with the related
CLI commands:
- API now allows the supervision interval to be set on a child.
- New field in `otChildInfo` to indicate the child's supervision
  interval.
- New counter is added to track the number of supervision check
  timeouts failures on a child (intended for testing and debugging).

This commit adds a test `test_child_supervision` to cover behavior of
child supervision and its new behaviors.

This change allows backward compatibility: If the parent does not
support child supervision, it ignores the new TLV in the MLE messages
and the child would fall back to periodically exchanging MLE Child
Update Request with parent. If the child does not support supervision
and/or does not indicate its desired child supervision interval, the
parent will fall back to use the configured default interval.
This commit is contained in:
Abtin Keshavarzian
2023-02-28 23:01:43 -08:00
committed by GitHub
parent 0491c8ff2c
commit 091f68ed70
53 changed files with 541 additions and 425 deletions
+29 -4
View File
@@ -1721,6 +1721,30 @@ class NodeImpl:
self.send_command('pollperiod %d' % pollperiod)
self._expect_done()
def get_child_supervision_interval(self):
self.send_command('childsupervision interval')
return self._expect_result(r'\d+')
def set_child_supervision_interval(self, interval):
self.send_command('childsupervision interval %d' % interval)
self._expect_done()
def get_child_supervision_check_timeout(self):
self.send_command('childsupervision checktimeout')
return self._expect_result(r'\d+')
def set_child_supervision_check_timeout(self, timeout):
self.send_command('childsupervision checktimeout %d' % timeout)
self._expect_done()
def get_child_supervision_check_failure_counter(self):
self.send_command('childsupervision failcounter')
return self._expect_result(r'\d+')
def reset_child_supervision_check_failure_counter(self):
self.send_command('childsupervision failcounter reset')
self._expect_done()
def get_csl_info(self):
self.send_command('csl')
self._expect_done()
@@ -1928,10 +1952,10 @@ class NodeImpl:
#
# Example output:
# | ID | RLOC16 | Timeout | Age | LQ In | C_VN |R|D|N|Ver|CSL|QMsgCnt| Extended MAC |
# +-----+--------+------------+------------+-------+------+-+-+-+---+---+-------+------------------+
# | 1 | 0xc801 | 240 | 24 | 3 | 131 |1|0|0| 3| 0 | 0 | 4ecede68435358ac |
# | 2 | 0xc802 | 240 | 2 | 3 | 131 |0|0|0| 3| 1 | 0 | a672a601d2ce37d8 |
# | ID | RLOC16 | Timeout | Age | LQ In | C_VN |R|D|N|Ver|CSL|QMsgCnt|Suprvsn| Extended MAC |
# +-----+--------+------------+------------+-------+------+-+-+-+---+---+-------+-------+------------------+
# | 1 | 0xc801 | 240 | 24 | 3 | 131 |1|0|0| 3| 0 | 0 | 129 | 4ecede68435358ac |
# | 2 | 0xc802 | 240 | 2 | 3 | 131 |0|0|0| 3| 1 | 0 | 0 | a672a601d2ce37d8 |
# Done
#
@@ -1962,6 +1986,7 @@ class NodeImpl:
'ver': int(col('Ver')),
'csl': bool(int(col('CSL'))),
'qmsgcnt': int(col('QMsgCnt')),
'suprvsn': int(col('Suprvsn'))
}
return table