mirror of
https://github.com/espressif/openthread.git
synced 2026-09-16 06:00:13 +00:00
[tests] fix key_id_mode handling and add exception handle (#4927)
This commit fixes key_id_mode handling and added exception handling
when key_id_mode is 0.
According to IEEE Std 802.15.4-2015, when Key Id Mode is 0x00:
Key is determined implicitly from the originator and recipient(s)
of the frame, as indicated in the frame header.
Our test scripts cannot handle such packets. If we leave key_id_mode =
0 case unhandled, we would get some exceptions that may cause
developers to think that something is wrong. However dropping packets
in this case is a normal behavior.
This commit is contained in:
@@ -175,14 +175,18 @@ class VirtualTime(BaseSimulator):
|
||||
self.sock.close()
|
||||
self.sock = None
|
||||
|
||||
def _add_message(self, nodeid, message):
|
||||
def _add_message(self, nodeid, message_obj):
|
||||
addr = ('127.0.0.1', self.port + nodeid)
|
||||
|
||||
# Ignore any exceptions
|
||||
try:
|
||||
messages = self._message_factory.create(io.BytesIO(message))
|
||||
messages = self._message_factory.create(io.BytesIO(message_obj))
|
||||
self.devices[addr]['msgs'] += messages
|
||||
|
||||
except message.DropPacketException:
|
||||
print(
|
||||
'Drop current packet because it cannot be handled in test scripts'
|
||||
)
|
||||
except Exception as e:
|
||||
# Just print the exception to the console
|
||||
print("EXCEPTION: %s" % e)
|
||||
|
||||
Reference in New Issue
Block a user