Commissioner joiner list. (#729)

This commit is contained in:
Jonathan Hui
2016-10-03 08:54:54 -07:00
committed by GitHub
parent 95d2e8cdec
commit cb04fe8391
12 changed files with 343 additions and 40 deletions
@@ -59,7 +59,8 @@ class Cert_8_1_01_Commissioning(unittest.TestCase):
self.nodes[COMMISSIONER].thread_start()
time.sleep(5)
self.assertEqual(self.nodes[COMMISSIONER].get_state(), 'leader')
self.nodes[COMMISSIONER].commissioner_start('openthread')
self.nodes[COMMISSIONER].commissioner_start()
self.nodes[COMMISSIONER].commissioner_add_joiner('*', 'openthread')
self.nodes[JOINER].interface_up()
self.nodes[JOINER].joiner_start('openthread')
@@ -59,7 +59,8 @@ class Cert_8_1_02_Commissioning(unittest.TestCase):
self.nodes[COMMISSIONER].thread_start()
time.sleep(5)
self.assertEqual(self.nodes[COMMISSIONER].get_state(), 'leader')
self.nodes[COMMISSIONER].commissioner_start('openthread')
self.nodes[COMMISSIONER].commissioner_start()
self.nodes[COMMISSIONER].commissioner_add_joiner(self.nodes[JOINER].get_hashmacaddr(), 'openthread')
self.nodes[JOINER].interface_up()
self.nodes[JOINER].joiner_start('daerhtnepo')
+15 -2
View File
@@ -144,8 +144,13 @@ class Node:
self.send_command('thread stop')
self.pexpect.expect('Done')
def commissioner_start(self, pskd='', provisioning_url=''):
cmd = 'commissioner start ' + pskd + ' ' + provisioning_url
def commissioner_start(self):
cmd = 'commissioner start'
self.send_command(cmd)
self.pexpect.expect('Done')
def commissioner_add_joiner(self, addr, psk):
cmd = 'commissioner joiner add ' + addr + ' ' + psk
self.send_command(cmd)
self.pexpect.expect('Done')
@@ -202,6 +207,14 @@ class Node:
self.pexpect.expect('Done')
return addr64
def get_hashmacaddr(self):
self.send_command('hashmacaddr')
i = self.pexpect.expect('([0-9a-fA-F]{16})')
if i == 0:
addr = self.pexpect.match.groups()[0].decode("utf-8")
self.pexpect.expect('Done')
return addr
def set_channel(self, channel):
cmd = 'channel %d' % channel
self.send_command(cmd)