Skip to content

Commit

Permalink
[net-diag] handle MleCounterTlv in AppendDiagTlv() (openthread#9777)
Browse files Browse the repository at this point in the history
Adds support for responding to `MleCounterTlv` in `AppendDiagTlv()`
Processing the TLV is a received response is already implemented
and supported. Updates `test-020-net-diag` to check query of MLE
counters TLV.
  • Loading branch information
abtink committed Jan 17, 2024
1 parent 4a6ebf0 commit f75e2bb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/core/thread/network_diagnostic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,15 @@ Error Server::AppendDiagTlv(uint8_t aTlvType, Message &aMessage)
error = AppendMacCounters(aMessage);
break;

case Tlv::kMleCounters:
{
MleCountersTlv tlv;

tlv.Init(Get<Mle::Mle>().GetCounters());
error = tlv.AppendTo(aMessage);
break;
}

case Tlv::kVendorName:
error = Tlv::Append<VendorNameTlv>(aMessage, GetVendorName());
break;
Expand Down
5 changes: 5 additions & 0 deletions tests/toranj/cli/test-020-net-diag-vendor-info.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
VENDOR_MODEL_TLV = 26
VENDOR_SW_VERSION_TLV = 27
THREAD_STACK_VERSION_TLV = 28
MLE_COUNTERS_TLV = 34

#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Check setting vendor name, model, ans sw version
Expand Down Expand Up @@ -176,6 +177,10 @@
else:
verify(False)

result = r2.cli('networkdiagnostic get', r1_rloc, MLE_COUNTERS_TLV)
print(len(result) >= 1)
verify(result[1].startswith("MLE Counters:"))

# -----------------------------------------------------------------------------------------------------------------------
# Test finished

Expand Down

0 comments on commit f75e2bb

Please sign in to comment.