From 8642f998ccff6ee2bf5d73c692f8d38198a0c566 Mon Sep 17 00:00:00 2001 From: Simon Lin Date: Mon, 12 Oct 2020 14:02:29 +0800 Subject: [PATCH] [thread-cert] set node addr64 to EXTENDED_ADDRESS_BASE + nodeid (#5601) This commit sets nodes' extaddrs to 0x166e0a0000000000 + nodeid, which does not change node behavior but makes it easier for us to analyze pcaps. --- tests/scripts/thread-cert/node.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/scripts/thread-cert/node.py b/tests/scripts/thread-cert/node.py index 833a76765..5f1353726 100755 --- a/tests/scripts/thread-cert/node.py +++ b/tests/scripts/thread-cert/node.py @@ -45,6 +45,7 @@ import pexpect.popen_spawn import config import simulator +import thread_cert PORT_OFFSET = int(os.getenv('PORT_OFFSET', "0")) @@ -412,6 +413,7 @@ class NodeImpl: super().__init__(nodeid, **kwargs) self.set_extpanid(config.EXTENDED_PANID) + self.set_addr64('%016x' % (thread_cert.EXTENDED_ADDRESS_BASE + nodeid)) def _expect(self, pattern, timeout=-1, *args, **kwargs): """ Process simulator events until expected the pattern. """ @@ -831,7 +833,10 @@ class NodeImpl: self.send_command('extaddr') return self._expect_result('[0-9a-fA-F]{16}') - def set_addr64(self, addr64): + def set_addr64(self, addr64: str): + # Make sure `addr64` is a hex string of length 16 + assert len(addr64) == 16 + int(addr64, 16) self.send_command('extaddr %s' % addr64) self._expect('Done')