[dua] handle coap error code for DUA.rsp (#5523)

- Configure next response to 5.00 for Reference Device
- Handle 5.00 (and other COAP error codes) in DUA.rsp (required by 1.2
  Test Spec)
- Update DUA test to handle COAP code 5.00
This commit is contained in:
Simon Lin
2020-09-27 22:30:15 -07:00
committed by GitHub
parent 6c6d5f6179
commit 81996b0f3b
10 changed files with 66 additions and 25 deletions
+7 -1
View File
@@ -723,7 +723,13 @@ class NodeImpl:
self.remove_prefix(prefix)
self.register_netdata()
def set_next_dua_response(self, status, iid=None):
def set_next_dua_response(self, status: Union[str, int], iid=None):
# Convert 5.00 to COAP CODE 160
if isinstance(status, str):
assert '.' in status
status = status.split('.')
status = (int(status[0]) << 5) + int(status[1])
cmd = 'bbr mgmt dua {}'.format(status)
if iid is not None:
cmd += ' ' + str(iid)
@@ -281,8 +281,8 @@ class TestDomainUnicastAddressRegistration(thread_cert.TestCase):
# - increase BBR seqno to trigger reregistration
# - ROUTER_1_2 should re-register within BBR_REREGISTRATION_DELAY. For the not fatal errors, ROUTER_1_2
# should re-register within another BBR_REREGISTRATION_DELAY (with least delay if ST_DUA_REREGISTER)
for status in [ST_DUA_REREGISTER, ST_DUA_NO_RESOURCES, ST_DUA_BBR_NOT_PRIMARY, ST_DUA_GENERAL_FAILURE]:
print('Testing Status %d...'.format(status))
for status in ['5.00', ST_DUA_REREGISTER, ST_DUA_NO_RESOURCES, ST_DUA_BBR_NOT_PRIMARY, ST_DUA_GENERAL_FAILURE]:
print(f'Testing Status {status}...')
# Flush relative message queues.
self.flush_nodes([ROUTER_1_2])
seq_num = seq_num + 1