diff --git a/include/openthread/instance.h b/include/openthread/instance.h index 7db5df0df..6bdfdcdd0 100644 --- a/include/openthread/instance.h +++ b/include/openthread/instance.h @@ -53,7 +53,7 @@ extern "C" { * @note This number versions both OpenThread platform and user APIs. * */ -#define OPENTHREAD_API_VERSION (264) +#define OPENTHREAD_API_VERSION (265) /** * @addtogroup api-instance diff --git a/include/openthread/thread.h b/include/openthread/thread.h index 15ae8377c..244a21fb5 100644 --- a/include/openthread/thread.h +++ b/include/openthread/thread.h @@ -99,6 +99,7 @@ typedef struct int8_t mLastRssi; ///< Last observed RSSI uint16_t mFrameErrorRate; ///< Frame error rate (0xffff->100%). Requires error tracking feature. uint16_t mMessageErrorRate; ///< (IPv6) msg error rate (0xffff->100%). Requires error tracking feature. + uint16_t mVersion; ///< Thread version of the neighbor bool mRxOnWhenIdle : 1; ///< rx-on-when-idle bool mFullThreadDevice : 1; ///< Full Thread Device bool mFullNetworkData : 1; ///< Full Network Data diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 9a670f4a3..44e2b738e 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -4960,11 +4960,11 @@ template <> otError Interpreter::Process(Arg aArgs[]) if (isTable) { static const char *const kNeighborTableTitles[] = { - "Role", "RLOC16", "Age", "Avg RSSI", "Last RSSI", "R", "D", "N", "Extended MAC", + "Role", "RLOC16", "Age", "Avg RSSI", "Last RSSI", "R", "D", "N", "Extended MAC", "Version", }; static const uint8_t kNeighborTableColumnWidths[] = { - 6, 8, 5, 10, 11, 1, 1, 1, 18, + 6, 8, 5, 10, 11, 1, 1, 1, 18, 9, }; OutputTableHeader(kNeighborTableTitles, kNeighborTableColumnWidths); @@ -4984,7 +4984,7 @@ template <> otError Interpreter::Process(Arg aArgs[]) OutputFormat("|%1d", neighborInfo.mFullNetworkData); OutputFormat("| "); OutputExtAddress(neighborInfo.mExtAddress); - OutputLine(" |"); + OutputLine(" | %7d |", neighborInfo.mVersion); } else { diff --git a/src/core/thread/topology.cpp b/src/core/thread/topology.cpp index 5eac7761e..be309a9f0 100644 --- a/src/core/thread/topology.cpp +++ b/src/core/thread/topology.cpp @@ -81,6 +81,7 @@ void Neighbor::Info::SetFrom(const Neighbor &aNeighbor) mRxOnWhenIdle = aNeighbor.IsRxOnWhenIdle(); mFullThreadDevice = aNeighbor.IsFullThreadDevice(); mFullNetworkData = (aNeighbor.GetNetworkDataType() == NetworkData::kFullSet); + mVersion = aNeighbor.GetVersion(); } void Neighbor::Init(Instance &aInstance) diff --git a/tests/scripts/expect/cli-neighbor.exp b/tests/scripts/expect/cli-neighbor.exp index 9f5dd9e5f..1b5a9de85 100755 --- a/tests/scripts/expect/cli-neighbor.exp +++ b/tests/scripts/expect/cli-neighbor.exp @@ -38,9 +38,9 @@ set extaddr [get_extaddr] switch_node 1 send "neighbor table\n" -expect "| Role | RLOC16 | Age | Avg RSSI | Last RSSI |R|D|N| Extended MAC |" -expect "+------+--------+-----+----------+-----------+-+-+-+------------------+" -expect -re "\\| +C +\\| 0x$rloc \\| +\\d+ \\| +-?\\d+ \\| +-?\\d+ \\|1\\|0\\|0\\| $extaddr \\|" +expect "| Role | RLOC16 | Age | Avg RSSI | Last RSSI |R|D|N| Extended MAC | Version |" +expect "+------+--------+-----+----------+-----------+-+-+-+------------------+---------+" +expect -re "\\| +C +\\| 0x$rloc \\| +\\d+ \\| +-?\\d+ \\| +-?\\d+ \\|1\\|0\\|0\\| $extaddr \\| +\\d+ \\|" expect_line "Done" send "neighbor list\n" expect "0x$rloc"