[cli] router table command to output Link (#5997)

This commit enhance OT CLI command router table to output whether Link
Established in Link field.
This commit is contained in:
Simon Lin
2020-12-22 22:52:14 -08:00
committed by GitHub
parent b306cb0bbe
commit 24ed1ffd37
3 changed files with 10 additions and 8 deletions
+4 -4
View File
@@ -1806,10 +1806,10 @@ Print table of routers.
```bash
> router table
| ID | RLOC16 | Next Hop | Path Cost | LQ In | LQ Out | Age | Extended MAC |
+----+--------+----------+-----------+-------+--------+-----+------------------+
| 21 | 0x5400 | 21 | 0 | 3 | 3 | 5 | d28d7f875888fccb |
| 56 | 0xe000 | 56 | 0 | 0 | 0 | 182 | f2d92a82c8d8fe43 |
| ID | RLOC16 | Next Hop | Path Cost | LQ In | LQ Out | Age | Extended MAC | Link |
+----+--------+----------+-----------+-------+--------+-----+------------------+------+
| 22 | 0x5800 | 63 | 0 | 0 | 0 | 0 | 0aeb8196c9f61658 | 0 |
| 49 | 0xc400 | 63 | 0 | 3 | 3 | 0 | faa1c03908e2dbf2 | 1 |
Done
```
+3 -3
View File
@@ -3492,8 +3492,8 @@ otError Interpreter::ProcessRouter(uint8_t aArgsLength, char *aArgs[])
if (isTable)
{
OutputLine("| ID | RLOC16 | Next Hop | Path Cost | LQ In | LQ Out | Age | Extended MAC |");
OutputLine("+----+--------+----------+-----------+-------+--------+-----+------------------+");
OutputLine("| ID | RLOC16 | Next Hop | Path Cost | LQ In | LQ Out | Age | Extended MAC | Link |");
OutputLine("+----+--------+----------+-----------+-------+--------+-----+------------------+------+");
}
maxRouterId = otThreadGetMaxRouterId(mInstance);
@@ -3516,7 +3516,7 @@ otError Interpreter::ProcessRouter(uint8_t aArgsLength, char *aArgs[])
OutputFormat("| %3d ", routerInfo.mAge);
OutputFormat("| ");
OutputExtAddress(routerInfo.mExtAddress);
OutputLine(" |");
OutputLine(" | %4d |", routerInfo.mLinkEstablished);
}
else
{
+3 -1
View File
@@ -1908,7 +1908,7 @@ class NodeImpl:
line = line[1:][:-1]
line = [x.strip() for x in line.split('|')]
if len(line) != 8:
if len(line) < 9:
print("unexpected line %d: %s" % (i, line))
continue
@@ -1927,6 +1927,7 @@ class NodeImpl:
lqout = int(line[5])
age = int(line[6])
emac = str(line[7])
link = int(line[8])
router_table[id] = {
'rloc16': rloc16,
@@ -1936,6 +1937,7 @@ class NodeImpl:
'lqout': lqout,
'age': age,
'emac': emac,
'link': link,
}
return router_table