[netdiag] rename namespace NetworkDiagnostic to NetDiag (#13154)

This commit renames the `NetworkDiagnostic` namespace in `src/core/thread/`
and its related types to `NetDiag` for brevity. It updates the
corresponding filenames and header guards as well.
This commit is contained in:
Abtin Keshavarzian
2026-05-26 20:19:48 -07:00
committed by GitHub
parent 337d424d4f
commit 3ce616d835
26 changed files with 159 additions and 173 deletions
+7 -7
View File
@@ -733,6 +733,12 @@ openthread_core_files = [
"thread/neighbor.hpp",
"thread/neighbor_table.cpp",
"thread/neighbor_table.hpp",
"thread/net_diag.cpp",
"thread/net_diag.hpp",
"thread/net_diag_tlvs.cpp",
"thread/net_diag_tlvs.hpp",
"thread/net_diag_types.cpp",
"thread/net_diag_types.hpp",
"thread/network_data.cpp",
"thread/network_data.hpp",
"thread/network_data_leader.cpp",
@@ -750,12 +756,6 @@ openthread_core_files = [
"thread/network_data_tlvs.hpp",
"thread/network_data_types.cpp",
"thread/network_data_types.hpp",
"thread/network_diagnostic.cpp",
"thread/network_diagnostic.hpp",
"thread/network_diagnostic_tlvs.cpp",
"thread/network_diagnostic_tlvs.hpp",
"thread/network_diagnostic_types.cpp",
"thread/network_diagnostic_types.hpp",
"thread/panid_query_server.cpp",
"thread/panid_query_server.hpp",
"thread/peer.cpp",
@@ -908,8 +908,8 @@ source_set("libopenthread_core_config") {
"config/misc.h",
"config/mle.h",
"config/nat64.h",
"config/net_diag.h",
"config/netdata_publisher.h",
"config/network_diagnostic.h",
"config/openthread-core-config-check.h",
"config/p2p.h",
"config/parent_search.h",
+3 -3
View File
@@ -257,6 +257,9 @@ set(COMMON_SOURCES
thread/mlr_types.cpp
thread/neighbor.cpp
thread/neighbor_table.cpp
thread/net_diag.cpp
thread/net_diag_tlvs.cpp
thread/net_diag_types.cpp
thread/network_data.cpp
thread/network_data_leader.cpp
thread/network_data_leader_ftd.cpp
@@ -266,9 +269,6 @@ set(COMMON_SOURCES
thread/network_data_service.cpp
thread/network_data_tlvs.cpp
thread/network_data_types.cpp
thread/network_diagnostic.cpp
thread/network_diagnostic_tlvs.cpp
thread/network_diagnostic_types.cpp
thread/panid_query_server.cpp
thread/peer.cpp
thread/peer_table.cpp
+8 -8
View File
@@ -46,7 +46,7 @@ otError otThreadGetNextDiagnosticTlv(const otMessage *aMessage,
AssertPointerIsNotNull(aIterator);
AssertPointerIsNotNull(aNetworkDiagTlv);
return NetworkDiagnostic::Client::GetNextDiagTlv(AsCoapMessage(aMessage), *aIterator, *aNetworkDiagTlv);
return NetDiag::Client::GetNextDiagTlv(AsCoapMessage(aMessage), *aIterator, *aNetworkDiagTlv);
}
otError otThreadSendDiagnosticGet(otInstance *aInstance,
@@ -56,8 +56,8 @@ otError otThreadSendDiagnosticGet(otInstance *aInstance,
otReceiveDiagnosticGetCallback aCallback,
void *aCallbackContext)
{
return AsCoreType(aInstance).Get<NetworkDiagnostic::Client>().SendDiagnosticGet(
AsCoreType(aDestination), aTlvTypes, aCount, aCallback, aCallbackContext);
return AsCoreType(aInstance).Get<NetDiag::Client>().SendDiagnosticGet(AsCoreType(aDestination), aTlvTypes, aCount,
aCallback, aCallbackContext);
}
otError otThreadSendDiagnosticReset(otInstance *aInstance,
@@ -65,8 +65,8 @@ otError otThreadSendDiagnosticReset(otInstance *aInstance,
const uint8_t aTlvTypes[],
uint8_t aCount)
{
return AsCoreType(aInstance).Get<NetworkDiagnostic::Client>().SendDiagnosticReset(AsCoreType(aDestination),
aTlvTypes, aCount);
return AsCoreType(aInstance).Get<NetDiag::Client>().SendDiagnosticReset(AsCoreType(aDestination), aTlvTypes,
aCount);
}
#endif // OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE
@@ -118,17 +118,17 @@ otError otThreadSetVendorOui(otInstance *aInstance, uint32_t aVendorOui)
void otThreadSetNonPreferredChannels(otInstance *aInstance, otChannelMask aChannelMask)
{
return AsCoreType(aInstance).Get<NetworkDiagnostic::Server>().SetNonPreferredChannels(aChannelMask);
return AsCoreType(aInstance).Get<NetDiag::Server>().SetNonPreferredChannels(aChannelMask);
}
otChannelMask otThreadGetNonPreferredChannels(otInstance *aInstance)
{
return AsCoreType(aInstance).Get<NetworkDiagnostic::Server>().GetNonPreferredChannels();
return AsCoreType(aInstance).Get<NetDiag::Server>().GetNonPreferredChannels();
}
void otThreadSetNonPreferredChannelsResetCallback(otInstance *aInstance,
otThreadNonPreferredChannelsResetCallback aCallback,
void *aContext)
{
AsCoreType(aInstance).Get<NetworkDiagnostic::Server>().SetNonPreferredChannelsResetCallback(aCallback, aContext);
AsCoreType(aInstance).Get<NetDiag::Server>().SetNonPreferredChannelsResetCallback(aCallback, aContext);
}
@@ -31,8 +31,8 @@
* This file includes compile-time configurations for the Network Diagnostics.
*/
#ifndef OT_CORE_CONFIG_NETWORK_DIAGNOSTIC_H_
#define OT_CORE_CONFIG_NETWORK_DIAGNOSTIC_H_
#ifndef OT_CORE_CONFIG_NET_DIAG_H_
#define OT_CORE_CONFIG_NET_DIAG_H_
/**
* @addtogroup config-network-diagnostic
@@ -122,4 +122,4 @@
* @}
*/
#endif // OT_CORE_CONFIG_NETWORK_DIAGNOSTIC_H_
#endif // OT_CORE_CONFIG_NET_DIAG_H_
+2 -2
View File
@@ -170,9 +170,9 @@ Instance::Instance(void)
#endif
, mNetworkDataServiceManager(*this)
, mVendorInfo(*this)
, mNetworkDiagnosticServer(*this)
, mNetDiagServer(*this)
#if OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE
, mNetworkDiagnosticClient(*this)
, mNetDiagClient(*this)
#endif
#if OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE
, mBorderAgentTxtData(*this)
+5 -5
View File
@@ -137,11 +137,11 @@
#include "thread/message_framer.hpp"
#include "thread/mle.hpp"
#include "thread/mlr_manager.hpp"
#include "thread/net_diag.hpp"
#include "thread/network_data_local.hpp"
#include "thread/network_data_notifier.hpp"
#include "thread/network_data_publisher.hpp"
#include "thread/network_data_service.hpp"
#include "thread/network_diagnostic.hpp"
#include "thread/panid_query_server.hpp"
#include "thread/radio_selector.hpp"
#include "thread/thread_netif.hpp"
@@ -711,9 +711,9 @@ private:
VendorInfo mVendorInfo;
NetworkDiagnostic::Server mNetworkDiagnosticServer;
NetDiag::Server mNetDiagServer;
#if OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE
NetworkDiagnostic::Client mNetworkDiagnosticClient;
NetDiag::Client mNetDiagClient;
#endif
#if OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE
@@ -1128,10 +1128,10 @@ template <> inline Dns::Multicast::Core &Instance::Get(void) { return mMdnsCore;
template <> inline VendorInfo &Instance::Get(void) { return mVendorInfo; }
template <> inline NetworkDiagnostic::Server &Instance::Get(void) { return mNetworkDiagnosticServer; }
template <> inline NetDiag::Server &Instance::Get(void) { return mNetDiagServer; }
#if OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE
template <> inline NetworkDiagnostic::Client &Instance::Get(void) { return mNetworkDiagnosticClient; }
template <> inline NetDiag::Client &Instance::Get(void) { return mNetDiagClient; }
#endif
#if OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
+2 -3
View File
@@ -39,7 +39,7 @@
#include "common/error.hpp"
#include "crypto/storage.hpp"
#include "instance/instance.hpp"
#include "thread/network_diagnostic.hpp"
#include "thread/net_diag.hpp"
namespace ot {
namespace MeshCoP {
@@ -626,8 +626,7 @@ Error TcatAgent::HandleGetDiagnosticTlvs(const Message &aIncomingMessage,
extTlv.SetLength(0);
SuccessOrExit(error = aOutgoingMessage.Append(extTlv));
error =
Get<NetworkDiagnostic::Server>().AppendRequestedTlvsForTcat(aIncomingMessage, aOutgoingMessage, aOffsetRange);
error = Get<NetDiag::Server>().AppendRequestedTlvsForTcat(aIncomingMessage, aOutgoingMessage, aOffsetRange);
// Ensure enough message buffers are left for transmission of the result. Report error otherwise.
if (Get<MessagePool>().GetFreeBufferCount() < kBufferReserve)
+1 -1
View File
@@ -97,8 +97,8 @@
#include "config/misc.h"
#include "config/mle.h"
#include "config/nat64.h"
#include "config/net_diag.h"
#include "config/netdata_publisher.h"
#include "config/network_diagnostic.h"
#include "config/p2p.h"
#include "config/parent_search.h"
#include "config/ping_sender.h"
@@ -31,7 +31,7 @@
* This file implements Thread's Network Diagnostic processing.
*/
#include "network_diagnostic.hpp"
#include "net_diag.hpp"
#include "instance/instance.hpp"
@@ -39,7 +39,7 @@ namespace ot {
RegisterLogModule("NetDiag");
namespace NetworkDiagnostic {
namespace NetDiag {
//---------------------------------------------------------------------------------------------------------------------
// Server
@@ -1338,6 +1338,6 @@ const char *Client::UriToString(Uri aUri)
#endif // OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE
} // namespace NetworkDiagnostic
} // namespace NetDiag
} // namespace ot
@@ -31,8 +31,8 @@
* This file includes definitions for handle network diagnostic.
*/
#ifndef OT_CORE_THREAD_NETWORK_DIAGNOSTIC_HPP_
#define OT_CORE_THREAD_NETWORK_DIAGNOSTIC_HPP_
#ifndef OT_CORE_THREAD_NET_DIAG_HPP_
#define OT_CORE_THREAD_NET_DIAG_HPP_
#include "openthread-core-config.h"
@@ -44,8 +44,8 @@
#include "common/non_copyable.hpp"
#include "common/numeric_limits.hpp"
#include "net/udp6.hpp"
#include "thread/network_diagnostic_tlvs.hpp"
#include "thread/network_diagnostic_types.hpp"
#include "thread/net_diag_tlvs.hpp"
#include "thread/net_diag_types.hpp"
#include "thread/tmf.hpp"
#include "thread/uri_paths.hpp"
@@ -59,7 +59,7 @@ namespace MeshCoP {
class TcatAgent;
}
namespace NetworkDiagnostic {
namespace NetDiag {
/**
* @addtogroup core-netdiag
@@ -303,8 +303,8 @@ DeclareTmfHandler(Client, kUriDiagnosticReset);
/**
* @}
*/
} // namespace NetworkDiagnostic
} // namespace NetDiag
} // namespace ot
#endif // OT_CORE_THREAD_NETWORK_DIAGNOSTIC_HPP_
#endif // OT_CORE_THREAD_NET_DIAG_HPP_
@@ -31,12 +31,12 @@
* This file implements methods for generating and processing Network Diagnostics TLVs.
*/
#include "network_diagnostic_tlvs.hpp"
#include "net_diag_tlvs.hpp"
#include "common/time.hpp"
namespace ot {
namespace NetworkDiagnostic {
namespace NetDiag {
//---------------------------------------------------------------------------------------------------------------------
// ChildTableTlvEntry
@@ -292,5 +292,5 @@ void MleCountersTlv::Read(MleCounters &aDiagMleCounters) const
aDiagMleCounters.mLeaderTime = BigEndian::HostSwap64(mLeaderTime);
}
} // namespace NetworkDiagnostic
} // namespace NetDiag
} // namespace ot
@@ -31,8 +31,8 @@
* This file includes definitions for generating and processing Network Diagnostics TLVs.
*/
#ifndef OT_CORE_THREAD_NETWORK_DIAGNOSTIC_TLVS_HPP_
#define OT_CORE_THREAD_NETWORK_DIAGNOSTIC_TLVS_HPP_
#ifndef OT_CORE_THREAD_NET_DIAG_TLVS_HPP_
#define OT_CORE_THREAD_NET_DIAG_TLVS_HPP_
#include "openthread-core-config.h"
@@ -54,7 +54,7 @@
#include "thread/router.hpp"
namespace ot {
namespace NetworkDiagnostic {
namespace NetDiag {
/**
* Implements Network Diagnostic TLV generation and parsing.
@@ -299,7 +299,7 @@ typedef TlvInfo<Tlv::kConnectivity> ConnectivityTlv;
class RouteTlv : public Mle::RouteTlv
{
public:
static constexpr uint8_t kType = ot::NetworkDiagnostic::Tlv::kRoute; ///< The TLV Type value.
static constexpr uint8_t kType = ot::NetDiag::Tlv::kRoute; ///< The TLV Type value.
/**
* Finds and parses a Route TLV in a given message.
@@ -354,7 +354,7 @@ public:
/**
* Reads the counters from TLV.
*
* @param[out] aDiagMacCounters A reference to `NetworkDiagnostic::MacCounters` to populate.
* @param[out] aDiagMacCounters A reference to `NetDiag::MacCounters` to populate.
*/
void Read(MacCounters &aDiagMacCounters) const;
@@ -895,7 +895,7 @@ public:
*
* Reads the counters from TLV.
*
* @param[out] aDiagMleCounters A reference to `NetworkDiagnostic::MleCounters` to populate.
* @param[out] aDiagMleCounters A reference to `NetDiag::MleCounters` to populate.
*/
void Read(MleCounters &aDiagMleCounters) const;
@@ -917,10 +917,10 @@ private:
uint64_t mLeaderTime; // Milliseconds device has been in leader role.
} OT_TOOL_PACKED_END;
} // namespace NetworkDiagnostic
} // namespace NetDiag
DefineCoreType(otNetworkDiagConnectivity, NetworkDiagnostic::Connectivity);
DefineCoreType(otNetworkDiagConnectivity, NetDiag::Connectivity);
} // namespace ot
#endif // OT_CORE_THREAD_NETWORK_DIAGNOSTIC_TLVS_HPP_
#endif // OT_CORE_THREAD_NET_DIAG_TLVS_HPP_
@@ -31,12 +31,12 @@
* This file implements methods for Network Diagnostics helper types and classes.
*/
#include "network_diagnostic_types.hpp"
#include "net_diag_types.hpp"
#include "instance/instance.hpp"
namespace ot {
namespace NetworkDiagnostic {
namespace NetDiag {
AnswerBuilder::AnswerBuilder(Instance &aInstance)
: InstanceLocator(aInstance)
@@ -104,5 +104,5 @@ exit:
return error;
}
} // namespace NetworkDiagnostic
} // namespace NetDiag
} // namespace ot
@@ -31,12 +31,12 @@
* This file includes definitions for Network Diagnostics helper types and classes.
*/
#ifndef OT_CORE_THREAD_NETWORK_DIAGNOSTIC_TYPES_HPP_
#define OT_CORE_THREAD_NETWORK_DIAGNOSTIC_TYPES_HPP_
#ifndef OT_CORE_THREAD_NET_DIAG_TYPES_HPP_
#define OT_CORE_THREAD_NET_DIAG_TYPES_HPP_
#include "openthread-core-config.h"
#include "network_diagnostic_tlvs.hpp"
#include "net_diag_tlvs.hpp"
#include "coap/coap_message.hpp"
#include "common/error.hpp"
#include "common/locator.hpp"
@@ -44,7 +44,7 @@
#include "thread/uri_paths.hpp"
namespace ot {
namespace NetworkDiagnostic {
namespace NetDiag {
/**
* Represents an object for tracking and managing Network Diagnostic answer messages.
@@ -133,7 +133,7 @@ private:
Message::Priority mPriority;
};
} // namespace NetworkDiagnostic
} // namespace NetDiag
} // namespace ot
#endif // OT_CORE_THREAD_NETWORK_DIAGNOSTIC_TYPES_HPP_
#endif // OT_CORE_THREAD_NET_DIAG_TYPES_HPP_
+4 -4
View File
@@ -131,12 +131,12 @@ bool Agent::HandleResource(const char *aUriPath, Msg &aMsg)
Case(kUriAnycastLocate, AnycastLocator);
#endif
Case(kUriDiagnosticGetRequest, NetworkDiagnostic::Server);
Case(kUriDiagnosticGetQuery, NetworkDiagnostic::Server);
Case(kUriDiagnosticReset, NetworkDiagnostic::Server);
Case(kUriDiagnosticGetRequest, NetDiag::Server);
Case(kUriDiagnosticGetQuery, NetDiag::Server);
Case(kUriDiagnosticReset, NetDiag::Server);
#if OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE
Case(kUriDiagnosticGetAnswer, NetworkDiagnostic::Client);
Case(kUriDiagnosticGetAnswer, NetDiag::Client);
#endif
#if OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE && OPENTHREAD_CONFIG_HISTORY_TRACKER_SERVER_ENABLE
+5 -5
View File
@@ -41,7 +41,7 @@
#include "common/error.hpp"
#include "common/locator.hpp"
#include "common/non_copyable.hpp"
#include "thread/network_diagnostic_tlvs.hpp"
#include "thread/net_diag_tlvs.hpp"
namespace ot {
@@ -177,10 +177,10 @@ private:
static constexpr uint32_t kOuiMask = 0xffffff;
// String buffer types (max size specified by corresponding TLV)
typedef NetworkDiagnostic::VendorNameTlv::StringType NameStringType;
typedef NetworkDiagnostic::VendorModelTlv::StringType ModelStringType;
typedef NetworkDiagnostic::VendorSwVersionTlv::StringType SwVersionStringType;
typedef NetworkDiagnostic::VendorAppUrlTlv::StringType AppUrlStringType;
typedef NetDiag::VendorNameTlv::StringType NameStringType;
typedef NetDiag::VendorModelTlv::StringType ModelStringType;
typedef NetDiag::VendorSwVersionTlv::StringType SwVersionStringType;
typedef NetDiag::VendorAppUrlTlv::StringType AppUrlStringType;
static const char kName[];
static const char kModel[];
+2 -2
View File
@@ -42,7 +42,7 @@
#include "common/encoding.hpp"
#include "common/tlvs.hpp"
#include "thread/network_diagnostic_tlvs.hpp"
#include "thread/net_diag_tlvs.hpp"
#include "utils/history_tracker.hpp"
namespace ot {
@@ -75,7 +75,7 @@ typedef UintTlvInfo<Tlv::kQueryId, uint16_t> QueryIdTlv;
/**
* Represents an Answer TLV value.
*/
typedef NetworkDiagnostic::AnswerTlvValue AnswerTlvValue;
typedef NetDiag::AnswerTlvValue AnswerTlvValue;
/**
* Defines Answer TLV constants and types.
+1 -1
View File
@@ -40,7 +40,7 @@
namespace ot {
namespace Utils {
using namespace NetworkDiagnostic;
using namespace NetDiag;
RegisterLogModule("MeshDiag");
+6 -6
View File
@@ -49,8 +49,8 @@
#include "common/message.hpp"
#include "common/timer.hpp"
#include "net/ip6_address.hpp"
#include "thread/network_diagnostic.hpp"
#include "thread/network_diagnostic_tlvs.hpp"
#include "thread/net_diag.hpp"
#include "thread/net_diag_tlvs.hpp"
#include "thread/tmf.hpp"
struct otMeshDiagIp6AddrIterator
@@ -69,7 +69,7 @@ namespace Utils {
*/
class MeshDiag : public InstanceLocator
{
friend class ot::NetworkDiagnostic::Client;
friend class ot::NetDiag::Client;
public:
static constexpr uint16_t kVersionUnknown = OT_MESH_DIAG_VERSION_UNKNOWN; ///< Unknown version.
@@ -242,7 +242,7 @@ public:
void Cancel(void);
private:
typedef ot::NetworkDiagnostic::Tlv Tlv;
typedef ot::NetDiag::Tlv Tlv;
static constexpr uint32_t kResponseTimeout = OPENTHREAD_CONFIG_MESH_DIAG_RESPONSE_TIMEOUT;
static constexpr uint32_t kMinResponseTimeout = 50;
@@ -286,7 +286,7 @@ private:
friend class MeshDiag;
private:
void SetFrom(const NetworkDiagnostic::ChildTlvValue &aChildTlvValue);
void SetFrom(const NetDiag::ChildTlvValue &aChildTlvValue);
};
class RouterNeighborEntry : public otMeshDiagRouterNeighborEntry
@@ -294,7 +294,7 @@ private:
friend class MeshDiag;
private:
void SetFrom(const NetworkDiagnostic::RouterNeighborTlvValue &aTlvValue);
void SetFrom(const NetDiag::RouterNeighborTlvValue &aTlvValue);
};
Error SendQuery(uint16_t aRloc16, const uint8_t *aTlvs, uint8_t aTlvsLength);
+23 -25
View File
@@ -30,7 +30,7 @@
#include "platform/nexus_core.hpp"
#include "platform/nexus_node.hpp"
#include "thread/network_diagnostic.hpp"
#include "thread/net_diag.hpp"
namespace ot {
namespace Nexus {
@@ -155,15 +155,13 @@ void Test5_7_1(void)
Log("Step 2: Leader");
uint8_t tlvTypes2[] = {
NetworkDiagnostic::Tlv::kExtMacAddress, NetworkDiagnostic::Tlv::kAddress16,
NetworkDiagnostic::Tlv::kMode, NetworkDiagnostic::Tlv::kConnectivity,
NetworkDiagnostic::Tlv::kRoute, NetworkDiagnostic::Tlv::kLeaderData,
NetworkDiagnostic::Tlv::kNetworkData, NetworkDiagnostic::Tlv::kIp6AddressList,
NetworkDiagnostic::Tlv::kChannelPages,
NetDiag::Tlv::kExtMacAddress, NetDiag::Tlv::kAddress16, NetDiag::Tlv::kMode,
NetDiag::Tlv::kConnectivity, NetDiag::Tlv::kRoute, NetDiag::Tlv::kLeaderData,
NetDiag::Tlv::kNetworkData, NetDiag::Tlv::kIp6AddressList, NetDiag::Tlv::kChannelPages,
};
SuccessOrQuit(leader.Get<NetworkDiagnostic::Client>().SendDiagnosticGet(dutRloc, tlvTypes2, sizeof(tlvTypes2),
nullptr, nullptr));
SuccessOrQuit(
leader.Get<NetDiag::Client>().SendDiagnosticGet(dutRloc, tlvTypes2, sizeof(tlvTypes2), nullptr, nullptr));
nexus.AdvanceTime(kDiagResponseTime);
/**
@@ -180,10 +178,10 @@ void Test5_7_1(void)
*/
Log("Step 3: Leader");
uint8_t tlvTypes3[] = {NetworkDiagnostic::Tlv::kMacCounters};
uint8_t tlvTypes3[] = {NetDiag::Tlv::kMacCounters};
SuccessOrQuit(leader.Get<NetworkDiagnostic::Client>().SendDiagnosticGet(dutRloc, tlvTypes3, sizeof(tlvTypes3),
nullptr, nullptr));
SuccessOrQuit(
leader.Get<NetDiag::Client>().SendDiagnosticGet(dutRloc, tlvTypes3, sizeof(tlvTypes3), nullptr, nullptr));
nexus.AdvanceTime(kDiagResponseTime);
/**
@@ -199,10 +197,10 @@ void Test5_7_1(void)
*/
Log("Step 4: Leader");
uint8_t tlvTypes4[] = {NetworkDiagnostic::Tlv::kTimeout};
uint8_t tlvTypes4[] = {NetDiag::Tlv::kTimeout};
SuccessOrQuit(leader.Get<NetworkDiagnostic::Client>().SendDiagnosticGet(dutRloc, tlvTypes4, sizeof(tlvTypes4),
nullptr, nullptr));
SuccessOrQuit(
leader.Get<NetDiag::Client>().SendDiagnosticGet(dutRloc, tlvTypes4, sizeof(tlvTypes4), nullptr, nullptr));
nexus.AdvanceTime(kDiagResponseTime);
/**
@@ -220,10 +218,10 @@ void Test5_7_1(void)
*/
Log("Step 5: Leader");
uint8_t tlvTypes5[] = {NetworkDiagnostic::Tlv::kBatteryLevel, NetworkDiagnostic::Tlv::kSupplyVoltage};
uint8_t tlvTypes5[] = {NetDiag::Tlv::kBatteryLevel, NetDiag::Tlv::kSupplyVoltage};
SuccessOrQuit(leader.Get<NetworkDiagnostic::Client>().SendDiagnosticGet(dutRloc, tlvTypes5, sizeof(tlvTypes5),
nullptr, nullptr));
SuccessOrQuit(
leader.Get<NetDiag::Client>().SendDiagnosticGet(dutRloc, tlvTypes5, sizeof(tlvTypes5), nullptr, nullptr));
nexus.AdvanceTime(kDiagResponseTime);
/**
@@ -241,10 +239,10 @@ void Test5_7_1(void)
*/
Log("Step 6: Leader");
uint8_t tlvTypes6[] = {NetworkDiagnostic::Tlv::kChildTable};
uint8_t tlvTypes6[] = {NetDiag::Tlv::kChildTable};
SuccessOrQuit(leader.Get<NetworkDiagnostic::Client>().SendDiagnosticGet(dutRloc, tlvTypes6, sizeof(tlvTypes6),
nullptr, nullptr));
SuccessOrQuit(
leader.Get<NetDiag::Client>().SendDiagnosticGet(dutRloc, tlvTypes6, sizeof(tlvTypes6), nullptr, nullptr));
nexus.AdvanceTime(kDiagResponseTime);
/**
@@ -258,9 +256,9 @@ void Test5_7_1(void)
*/
Log("Step 7: Leader");
uint8_t tlvTypes7[] = {NetworkDiagnostic::Tlv::kMacCounters};
uint8_t tlvTypes7[] = {NetDiag::Tlv::kMacCounters};
SuccessOrQuit(leader.Get<NetworkDiagnostic::Client>().SendDiagnosticReset(dutRloc, tlvTypes7, sizeof(tlvTypes7)));
SuccessOrQuit(leader.Get<NetDiag::Client>().SendDiagnosticReset(dutRloc, tlvTypes7, sizeof(tlvTypes7)));
nexus.AdvanceTime(kDiagResponseTime);
/**
@@ -278,10 +276,10 @@ void Test5_7_1(void)
*/
Log("Step 8: Leader");
uint8_t tlvTypes8[] = {NetworkDiagnostic::Tlv::kMacCounters};
uint8_t tlvTypes8[] = {NetDiag::Tlv::kMacCounters};
SuccessOrQuit(leader.Get<NetworkDiagnostic::Client>().SendDiagnosticGet(dutRloc, tlvTypes8, sizeof(tlvTypes8),
nullptr, nullptr));
SuccessOrQuit(
leader.Get<NetDiag::Client>().SendDiagnosticGet(dutRloc, tlvTypes8, sizeof(tlvTypes8), nullptr, nullptr));
nexus.AdvanceTime(kDiagResponseTime);
nexus.SaveTestInfo("test_1_1_5_7_1.json");
+20 -22
View File
@@ -30,7 +30,7 @@
#include "platform/nexus_core.hpp"
#include "platform/nexus_node.hpp"
#include "thread/network_diagnostic.hpp"
#include "thread/net_diag.hpp"
namespace ot {
namespace Nexus {
@@ -74,17 +74,15 @@ static constexpr uint8_t kNumRouters = 15;
* Base diagnostic TLV types used in Steps 2 and 8.
*/
static constexpr uint8_t kBaseDiagGetTlvs[] = {
NetworkDiagnostic::Tlv::kExtMacAddress, NetworkDiagnostic::Tlv::kAddress16,
NetworkDiagnostic::Tlv::kMode, NetworkDiagnostic::Tlv::kConnectivity,
NetworkDiagnostic::Tlv::kRoute, NetworkDiagnostic::Tlv::kLeaderData,
NetworkDiagnostic::Tlv::kNetworkData, NetworkDiagnostic::Tlv::kIp6AddressList,
NetworkDiagnostic::Tlv::kChannelPages,
NetDiag::Tlv::kExtMacAddress, NetDiag::Tlv::kAddress16, NetDiag::Tlv::kMode,
NetDiag::Tlv::kConnectivity, NetDiag::Tlv::kRoute, NetDiag::Tlv::kLeaderData,
NetDiag::Tlv::kNetworkData, NetDiag::Tlv::kIp6AddressList, NetDiag::Tlv::kChannelPages,
};
/**
* MAC Counters diagnostic TLV type used in Steps 3, 6, and 7.
*/
static constexpr uint8_t kMacCountersTlv[] = {NetworkDiagnostic::Tlv::kMacCounters};
static constexpr uint8_t kMacCountersTlv[] = {NetDiag::Tlv::kMacCounters};
void Test5_7_2(void)
{
@@ -196,8 +194,8 @@ void Test5_7_2(void)
* - The presence of each TLV MUST be validated. Where possible, the value of the TLVs MUST be validated.
*/
SuccessOrQuit(leader.Get<NetworkDiagnostic::Client>().SendDiagnosticGet(
reedRloc, kBaseDiagGetTlvs, sizeof(kBaseDiagGetTlvs), nullptr, nullptr));
SuccessOrQuit(leader.Get<NetDiag::Client>().SendDiagnosticGet(reedRloc, kBaseDiagGetTlvs, sizeof(kBaseDiagGetTlvs),
nullptr, nullptr));
nexus.AdvanceTime(kDiagResponseTime);
Log("---------------------------------------------------------------------------------------");
@@ -216,8 +214,8 @@ void Test5_7_2(void)
* - TLV Type 9 - MAC Counters MUST contain a list of MAC Counters.
*/
SuccessOrQuit(leader.Get<NetworkDiagnostic::Client>().SendDiagnosticGet(reedRloc, kMacCountersTlv,
sizeof(kMacCountersTlv), nullptr, nullptr));
SuccessOrQuit(leader.Get<NetDiag::Client>().SendDiagnosticGet(reedRloc, kMacCountersTlv, sizeof(kMacCountersTlv),
nullptr, nullptr));
nexus.AdvanceTime(kDiagResponseTime);
Log("---------------------------------------------------------------------------------------");
@@ -236,10 +234,10 @@ void Test5_7_2(void)
* - The Timeout TLV MUST NOT be present.
*/
uint8_t tlvTypes4[] = {NetworkDiagnostic::Tlv::kTimeout, NetworkDiagnostic::Tlv::kChildTable};
uint8_t tlvTypes4[] = {NetDiag::Tlv::kTimeout, NetDiag::Tlv::kChildTable};
SuccessOrQuit(leader.Get<NetworkDiagnostic::Client>().SendDiagnosticGet(reedRloc, tlvTypes4, sizeof(tlvTypes4),
nullptr, nullptr));
SuccessOrQuit(
leader.Get<NetDiag::Client>().SendDiagnosticGet(reedRloc, tlvTypes4, sizeof(tlvTypes4), nullptr, nullptr));
nexus.AdvanceTime(kDiagResponseTime);
Log("---------------------------------------------------------------------------------------");
@@ -259,10 +257,10 @@ void Test5_7_2(void)
* - TLV Type 15 Supply Voltage (optional)
*/
uint8_t tlvTypes5[] = {NetworkDiagnostic::Tlv::kBatteryLevel, NetworkDiagnostic::Tlv::kSupplyVoltage};
uint8_t tlvTypes5[] = {NetDiag::Tlv::kBatteryLevel, NetDiag::Tlv::kSupplyVoltage};
SuccessOrQuit(leader.Get<NetworkDiagnostic::Client>().SendDiagnosticGet(reedRloc, tlvTypes5, sizeof(tlvTypes5),
nullptr, nullptr));
SuccessOrQuit(
leader.Get<NetDiag::Client>().SendDiagnosticGet(reedRloc, tlvTypes5, sizeof(tlvTypes5), nullptr, nullptr));
nexus.AdvanceTime(kDiagResponseTime);
Log("---------------------------------------------------------------------------------------");
@@ -289,8 +287,8 @@ void Test5_7_2(void)
* - CoAP Response Code: 2.04 Changed
*/
SuccessOrQuit(leader.Get<NetworkDiagnostic::Client>().SendDiagnosticReset(reedRloc, kMacCountersTlv,
sizeof(kMacCountersTlv)));
SuccessOrQuit(
leader.Get<NetDiag::Client>().SendDiagnosticReset(reedRloc, kMacCountersTlv, sizeof(kMacCountersTlv)));
nexus.AdvanceTime(kDiagResponseTime);
Log("---------------------------------------------------------------------------------------");
@@ -321,8 +319,8 @@ void Test5_7_2(void)
* step 3.
*/
SuccessOrQuit(leader.Get<NetworkDiagnostic::Client>().SendDiagnosticGet(reedRloc, kMacCountersTlv,
sizeof(kMacCountersTlv), nullptr, nullptr));
SuccessOrQuit(leader.Get<NetDiag::Client>().SendDiagnosticGet(reedRloc, kMacCountersTlv, sizeof(kMacCountersTlv),
nullptr, nullptr));
nexus.AdvanceTime(kDiagResponseTime);
Log("---------------------------------------------------------------------------------------");
@@ -356,7 +354,7 @@ void Test5_7_2(void)
* - The presence of each TLV MUST be validated. Where possible, the value of the TLVs MUST be validated.
*/
SuccessOrQuit(leader.Get<NetworkDiagnostic::Client>().SendDiagnosticGet(
SuccessOrQuit(leader.Get<NetDiag::Client>().SendDiagnosticGet(
Ip6::Address::GetRealmLocalAllNodesMulticast(), kBaseDiagGetTlvs, sizeof(kBaseDiagGetTlvs), nullptr, nullptr));
nexus.AdvanceTime(kDiagResponseTime);
+9 -10
View File
@@ -31,7 +31,7 @@
#include "mac/data_poll_sender.hpp"
#include "platform/nexus_core.hpp"
#include "platform/nexus_node.hpp"
#include "thread/network_diagnostic.hpp"
#include "thread/net_diag.hpp"
namespace ot {
namespace Nexus {
@@ -65,11 +65,10 @@ static constexpr uint32_t kPollPeriod = 500;
* Diagnostic TLV types used in the query.
*/
static constexpr uint8_t kDiagGetTlvs[] = {
NetworkDiagnostic::Tlv::kExtMacAddress, NetworkDiagnostic::Tlv::kAddress16,
NetworkDiagnostic::Tlv::kMode, NetworkDiagnostic::Tlv::kConnectivity,
NetworkDiagnostic::Tlv::kRoute, NetworkDiagnostic::Tlv::kLeaderData,
NetworkDiagnostic::Tlv::kNetworkData, NetworkDiagnostic::Tlv::kIp6AddressList,
NetworkDiagnostic::Tlv::kChildTable, NetworkDiagnostic::Tlv::kChannelPages,
NetDiag::Tlv::kExtMacAddress, NetDiag::Tlv::kAddress16, NetDiag::Tlv::kMode,
NetDiag::Tlv::kConnectivity, NetDiag::Tlv::kRoute, NetDiag::Tlv::kLeaderData,
NetDiag::Tlv::kNetworkData, NetDiag::Tlv::kIp6AddressList, NetDiag::Tlv::kChildTable,
NetDiag::Tlv::kChannelPages,
};
struct DiagGetContext
@@ -100,9 +99,9 @@ static void HandleDiagnosticGetAnswer(otError aError,
Log("Diagnostic Answer from %s", AsCoreType(&aMessageInfo->mPeerAddr).ToString().AsCString());
SuccessOrQuit(Tlv::Find<NetworkDiagnostic::ExtMacAddressTlv>(*message, extAddress));
SuccessOrQuit(Tlv::Find<NetworkDiagnostic::Address16Tlv>(*message, shortAddress));
SuccessOrQuit(Tlv::Find<NetworkDiagnostic::ModeTlv>(*message, mode));
SuccessOrQuit(Tlv::Find<NetDiag::ExtMacAddressTlv>(*message, extAddress));
SuccessOrQuit(Tlv::Find<NetDiag::Address16Tlv>(*message, shortAddress));
SuccessOrQuit(Tlv::Find<NetDiag::ModeTlv>(*message, mode));
}
void Test5_7_3(void)
@@ -205,7 +204,7 @@ void Test5_7_3(void)
* - Pass Criteria: N/A.
*/
SuccessOrQuit(leader.Get<NetworkDiagnostic::Client>().SendDiagnosticGet(
SuccessOrQuit(leader.Get<NetDiag::Client>().SendDiagnosticGet(
leader.Get<Mle::Mle>().GetRealmLocalAllThreadNodesAddress(), kDiagGetTlvs, sizeof(kDiagGetTlvs),
HandleDiagnosticGetAnswer, &context));
+9 -13
View File
@@ -30,7 +30,7 @@
#include "platform/nexus_core.hpp"
#include "platform/nexus_node.hpp"
#include "thread/network_diagnostic.hpp"
#include "thread/net_diag.hpp"
#include "utils/mesh_diag.hpp"
namespace ot {
@@ -165,16 +165,12 @@ void TestDiagTc1(const char *aJsonFileName)
dutRloc.SetToRoutingLocator(leader.Get<Mle::Mle>().GetMeshLocalPrefix(), router1.Get<Mle::Mle>().GetRloc16());
uint8_t tlvTypesStep2[] = {
NetworkDiagnostic::Tlv::kMaxChildTimeout,
NetworkDiagnostic::Tlv::kEui64,
NetworkDiagnostic::Tlv::kVersion,
NetworkDiagnostic::Tlv::kVendorName,
NetworkDiagnostic::Tlv::kVendorModel,
NetworkDiagnostic::Tlv::kVendorSwVersion,
NetworkDiagnostic::Tlv::kThreadStackVersion,
NetDiag::Tlv::kMaxChildTimeout, NetDiag::Tlv::kEui64, NetDiag::Tlv::kVersion,
NetDiag::Tlv::kVendorName, NetDiag::Tlv::kVendorModel, NetDiag::Tlv::kVendorSwVersion,
NetDiag::Tlv::kThreadStackVersion,
};
SuccessOrQuit(leader.Get<NetworkDiagnostic::Client>().SendDiagnosticGet(dutRloc, tlvTypesStep2,
sizeof(tlvTypesStep2), nullptr, nullptr));
SuccessOrQuit(leader.Get<NetDiag::Client>().SendDiagnosticGet(dutRloc, tlvTypesStep2, sizeof(tlvTypesStep2),
nullptr, nullptr));
/**
* Step 3
@@ -242,9 +238,9 @@ void TestDiagTc1(const char *aJsonFileName)
* - Pass Criteria:
* - N/A
*/
uint8_t tlvTypesStep5[] = {NetworkDiagnostic::Tlv::kMaxChildTimeout, NetworkDiagnostic::Tlv::kMleCounters};
SuccessOrQuit(leader.Get<NetworkDiagnostic::Client>().SendDiagnosticGet(dutRloc, tlvTypesStep5,
sizeof(tlvTypesStep5), nullptr, nullptr));
uint8_t tlvTypesStep5[] = {NetDiag::Tlv::kMaxChildTimeout, NetDiag::Tlv::kMleCounters};
SuccessOrQuit(leader.Get<NetDiag::Client>().SendDiagnosticGet(dutRloc, tlvTypesStep5, sizeof(tlvTypesStep5),
nullptr, nullptr));
/**
* Step 6
+9 -13
View File
@@ -31,7 +31,7 @@
#include "platform/nexus_core.hpp"
#include "platform/nexus_node.hpp"
#include "thread/network_diagnostic.hpp"
#include "thread/net_diag.hpp"
namespace ot {
namespace Nexus {
@@ -153,16 +153,12 @@ void TestDiagTc2(const char *aJsonFile)
td1Rloc.SetToRoutingLocator(leader1.Get<Mle::Mle>().GetMeshLocalPrefix(), td1.Get<Mle::Mle>().GetRloc16());
uint8_t tlvTypesStep2[] = {
NetworkDiagnostic::Tlv::kMaxChildTimeout,
NetworkDiagnostic::Tlv::kEui64,
NetworkDiagnostic::Tlv::kVersion,
NetworkDiagnostic::Tlv::kVendorName,
NetworkDiagnostic::Tlv::kVendorModel,
NetworkDiagnostic::Tlv::kVendorSwVersion,
NetworkDiagnostic::Tlv::kThreadStackVersion,
NetDiag::Tlv::kMaxChildTimeout, NetDiag::Tlv::kEui64, NetDiag::Tlv::kVersion,
NetDiag::Tlv::kVendorName, NetDiag::Tlv::kVendorModel, NetDiag::Tlv::kVendorSwVersion,
NetDiag::Tlv::kThreadStackVersion,
};
SuccessOrQuit(leader1.Get<NetworkDiagnostic::Client>().SendDiagnosticGet(td1Rloc, tlvTypesStep2,
sizeof(tlvTypesStep2), nullptr, nullptr));
SuccessOrQuit(leader1.Get<NetDiag::Client>().SendDiagnosticGet(td1Rloc, tlvTypesStep2, sizeof(tlvTypesStep2),
nullptr, nullptr));
Log("---------------------------------------------------------------------------------------");
Log("Step 3: TD_1 (DUT) Automatically responds either with 1. DIAG_GET.rsp or 2. CoAP response 4.04.");
@@ -213,9 +209,9 @@ void TestDiagTc2(const char *aJsonFile)
* - Pass Criteria:
* - N/A
*/
uint8_t tlvTypesStep4[] = {NetworkDiagnostic::Tlv::kMleCounters};
SuccessOrQuit(leader1.Get<NetworkDiagnostic::Client>().SendDiagnosticGet(td1Rloc, tlvTypesStep4,
sizeof(tlvTypesStep4), nullptr, nullptr));
uint8_t tlvTypesStep4[] = {NetDiag::Tlv::kMleCounters};
SuccessOrQuit(leader1.Get<NetDiag::Client>().SendDiagnosticGet(td1Rloc, tlvTypesStep4, sizeof(tlvTypesStep4),
nullptr, nullptr));
Log("---------------------------------------------------------------------------------------");
Log("Step 5: TD_1 (DUT) Automatically responds with DIAG_GET.rsp containing the requested Diagnostic TLVs.");
+7 -7
View File
@@ -281,9 +281,9 @@ void Test_1_3_GEN_TC_1(Topology aTopology, const char *aJsonFileName)
*/
Ip6::Address br1Rloc;
br1Rloc.SetToRoutingLocator(router1.Get<Mle::Mle>().GetMeshLocalPrefix(), br1.Get<Mle::Mle>().GetRloc16());
uint8_t tlvTypes[] = {NetworkDiagnostic::Tlv::kVersion};
SuccessOrQuit(router1.Get<NetworkDiagnostic::Client>().SendDiagnosticGet(br1Rloc, tlvTypes, sizeof(tlvTypes),
nullptr, nullptr));
uint8_t tlvTypes[] = {NetDiag::Tlv::kVersion};
SuccessOrQuit(
router1.Get<NetDiag::Client>().SendDiagnosticGet(br1Rloc, tlvTypes, sizeof(tlvTypes), nullptr, nullptr));
Log("---------------------------------------------------------------------------------------");
Log("Step 14: BR_1 Automatically responds with Get Diagnostic Response unicast to Router_1.");
@@ -313,8 +313,8 @@ void Test_1_3_GEN_TC_1(Topology aTopology, const char *aJsonFileName)
*/
Ip6::Address router1Rloc;
router1Rloc.SetToRoutingLocator(br1.Get<Mle::Mle>().GetMeshLocalPrefix(), router1.Get<Mle::Mle>().GetRloc16());
SuccessOrQuit(br1.Get<NetworkDiagnostic::Client>().SendDiagnosticGet(router1Rloc, tlvTypes, sizeof(tlvTypes),
nullptr, nullptr));
SuccessOrQuit(
br1.Get<NetDiag::Client>().SendDiagnosticGet(router1Rloc, tlvTypes, sizeof(tlvTypes), nullptr, nullptr));
Log("---------------------------------------------------------------------------------------");
Log("Step 16: Router_1 Automatically responds with Get Diagnostic Response unicast to the DUT.");
@@ -344,8 +344,8 @@ void Test_1_3_GEN_TC_1(Topology aTopology, const char *aJsonFileName)
*/
Ip6::Address ed1Rloc;
ed1Rloc.SetToRoutingLocator(router1.Get<Mle::Mle>().GetMeshLocalPrefix(), ed1.Get<Mle::Mle>().GetRloc16());
SuccessOrQuit(router1.Get<NetworkDiagnostic::Client>().SendDiagnosticGet(ed1Rloc, tlvTypes, sizeof(tlvTypes),
nullptr, nullptr));
SuccessOrQuit(
router1.Get<NetDiag::Client>().SendDiagnosticGet(ed1Rloc, tlvTypes, sizeof(tlvTypes), nullptr, nullptr));
Log("---------------------------------------------------------------------------------------");
Log("Step 18: ED_1 Optionally responds with Get Diagnostic Response unicast to Router_1.");
+2 -2
View File
@@ -3175,7 +3175,7 @@ void TestBorderAdmitterForwardingUdpProxy(void)
static const char *kEnrollerIds[kNumEnrollers] = {"1", "2", "3", "4"};
static const uint8_t kDiagTlvs[] = {NetworkDiagnostic::Tlv::kExtMacAddress, NetworkDiagnostic::Tlv::kVersion};
static const uint8_t kDiagTlvs[] = {NetDiag::Tlv::kExtMacAddress, NetDiag::Tlv::kVersion};
Core nexus;
Node &admitter = nexus.CreateNode();
@@ -3347,7 +3347,7 @@ void TestBorderAdmitterForwardingUdpProxy(void)
diagMessage = enrollers[0]->Get<Tmf::Agent>().AllocateAndInitNonConfirmablePostMessage(kUriDiagnosticGetQuery);
VerifyOrQuit(diagMessage != nullptr);
SuccessOrQuit(Tlv::Append<NetworkDiagnostic::TypeListTlv>(*diagMessage, kDiagTlvs, sizeof(kDiagTlvs)));
SuccessOrQuit(Tlv::Append<NetDiag::TypeListTlv>(*diagMessage, kDiagTlvs, sizeof(kDiagTlvs)));
diagMessage->WriteMessageId(0);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -