[mle] let the command partitionid return the current partition id (#5872)

If user doesn't set the Partition Id using the command
'leaderpartitionid xxx', the current cli command 'leaderpartitionid'
always return 0. This commit renames the command 'leaderpartitionid'
to partitionid and let the command partitionid returns the current
leader Partition Id and add command partitionid preferred to set or
get preferred Partition Id.
This commit is contained in:
Zhanglong Xia
2020-11-30 21:15:18 -08:00
committed by GitHub
parent 24bc5c87ad
commit 0d14e85439
16 changed files with 160 additions and 62 deletions
+4 -4
View File
@@ -939,12 +939,12 @@ class NodeImpl:
self.send_command(cmd)
self._expect('Done')
def get_partition_id(self):
self.send_command('leaderpartitionid')
def get_preferred_partition_id(self):
self.send_command('partitionid preferred')
return self._expect_result(r'\d+')
def set_partition_id(self, partition_id):
cmd = 'leaderpartitionid %d' % partition_id
def set_preferred_partition_id(self, partition_id):
cmd = 'partitionid preferred %d' % partition_id
self.send_command(cmd)
self._expect('Done')