[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)