[nexus] use two host nodes in BBR_TC_3 for robust verification (#12766)

This commit updates the `BBR_TC_3` Nexus test to use two separate host
nodes, `HOST_1` and `HOST_2`, for sending mDNS queries.

By using distinct host nodes, the packet verification script can now
unambiguously identify and track queries from different test steps
based on their source Ethernet MAC address. This improves the
robustness of the test by reducing reliance on packet sequence
numbers for isolation which can be fragile due to possible multiple
transmission of mDNS query message.

Specifically, `HOST_1` is used for queries in steps 1, 5, and 12,
while `HOST_2` is dedicated to the query in step 9. Both the C++ test
logic in `test_1_2_BBR_TC_3.cpp` and the Python verification script in
`verify_1_2_BBR_TC_3.py` are updated to reflect this change.
This commit is contained in:
Abtin Keshavarzian
2026-03-25 21:22:17 -05:00
committed by GitHub
parent 9ca942c313
commit 1f218fd056
2 changed files with 42 additions and 31 deletions
+35 -26
View File
@@ -74,7 +74,9 @@ void TestBbrTc3(void)
* 5.11.3.1 Topology
* - BR_1: BR device initially operating as the Primary BBR and Leader.
* - BR_2: BR device initially operating as a Secondary BBR.
* - Host: Test bed BR device operating as a non-Thread IPv6 host. It is used to send out the mDNS queries.
* - Host_1 and Host_2 : Test bed devices operating as a non-Thread IPv6 hosts. They are used to send out the
* mDNS queries. Two hosts are used to be able to track their queries more easily during pkt
* verification.
*
* 5.11.3.2 Purpose & Description
* The purpose of this test case is to verify that a BBR Function (both Primary and Secondary) can be discovered
@@ -88,13 +90,15 @@ void TestBbrTc3(void)
*/
Core nexus;
Node &br1 = nexus.CreateNode();
Node &br2 = nexus.CreateNode();
Node &host = nexus.CreateNode();
Node &br1 = nexus.CreateNode();
Node &br2 = nexus.CreateNode();
Node &host1 = nexus.CreateNode();
Node &host2 = nexus.CreateNode();
br1.SetName("BR_1");
br2.SetName("BR_2");
host.SetName("HOST");
host1.SetName("HOST_1");
host2.SetName("HOST_2");
br1.Form();
@@ -154,10 +158,15 @@ void TestBbrTc3(void)
nexus.AdvanceTime(kAttachToRouterTime);
VerifyOrQuit(br2.Get<Mle::Mle>().IsRouter());
host.Get<BorderRouter::InfraIf>().Init(kInfraIfIndex, true);
SuccessOrQuit(host.Get<BorderRouter::RoutingManager>().SetEnabled(false));
host.Get<Dns::Multicast::Core>().SetAutoEnableMode(false);
SuccessOrQuit(host.Get<Dns::Multicast::Core>().SetEnabled(true, kInfraIfIndex));
host1.Get<BorderRouter::InfraIf>().Init(kInfraIfIndex, true);
SuccessOrQuit(host1.Get<BorderRouter::RoutingManager>().SetEnabled(false));
host1.Get<Dns::Multicast::Core>().SetAutoEnableMode(false);
SuccessOrQuit(host1.Get<Dns::Multicast::Core>().SetEnabled(true, kInfraIfIndex));
host2.Get<BorderRouter::InfraIf>().Init(kInfraIfIndex, true);
SuccessOrQuit(host2.Get<BorderRouter::RoutingManager>().SetEnabled(false));
host2.Get<Dns::Multicast::Core>().SetAutoEnableMode(false);
SuccessOrQuit(host2.Get<Dns::Multicast::Core>().SetEnabled(true, kInfraIfIndex));
nexus.AdvanceTime(kBbrSelectionTime);
nexus.AdvanceTime(kStabilizationTime);
@@ -170,7 +179,7 @@ void TestBbrTc3(void)
/**
* Step 1
* - Device: Host
* - Device: Host_1
* - Description: Harness instructs the device to send an mDNS query (per P2).
* - Pass Criteria:
* - N/A
@@ -178,16 +187,16 @@ void TestBbrTc3(void)
{
Dns::Multicast::Core::Browser browser;
SuccessOrQuit(host.Get<Dns::Multicast::Core>().SetEnabled(true, kInfraIfIndex));
VerifyOrQuit(host.Get<Dns::Multicast::Core>().IsEnabled());
SuccessOrQuit(host1.Get<Dns::Multicast::Core>().SetEnabled(true, kInfraIfIndex));
VerifyOrQuit(host1.Get<Dns::Multicast::Core>().IsEnabled());
ClearAllBytes(browser);
browser.mServiceType = "_meshcop._udp";
browser.mInfraIfIndex = kInfraIfIndex;
browser.mCallback = HandleMdnsBrowse;
SuccessOrQuit(host.Get<Dns::Multicast::Core>().StartBrowser(browser));
SuccessOrQuit(host1.Get<Dns::Multicast::Core>().StartBrowser(browser));
nexus.AdvanceTime(kStabilizationTime);
SuccessOrQuit(host.Get<Dns::Multicast::Core>().StopBrowser(browser));
SuccessOrQuit(host1.Get<Dns::Multicast::Core>().StopBrowser(browser));
}
nexus.AddOmrPrefixTestVar("OMR_PREFIX_STEP_0", br1);
@@ -298,7 +307,7 @@ void TestBbrTc3(void)
/**
* Step 5
* - Device: Host
* - Device: Host_1
* - Description: Harness instructs the device to send an mDNS query.
* - Pass Criteria:
* - N/A
@@ -306,15 +315,15 @@ void TestBbrTc3(void)
{
Dns::Multicast::Core::Browser browser;
SuccessOrQuit(host.Get<Dns::Multicast::Core>().SetEnabled(true, kInfraIfIndex));
SuccessOrQuit(host1.Get<Dns::Multicast::Core>().SetEnabled(true, kInfraIfIndex));
ClearAllBytes(browser);
browser.mServiceType = "_meshcop._udp";
browser.mInfraIfIndex = kInfraIfIndex;
browser.mCallback = HandleMdnsBrowse;
SuccessOrQuit(host.Get<Dns::Multicast::Core>().StartBrowser(browser));
SuccessOrQuit(host1.Get<Dns::Multicast::Core>().StartBrowser(browser));
nexus.AdvanceTime(kStabilizationTime);
SuccessOrQuit(host.Get<Dns::Multicast::Core>().StopBrowser(browser));
SuccessOrQuit(host1.Get<Dns::Multicast::Core>().StopBrowser(browser));
}
nexus.AddOmrPrefixTestVar("OMR_PREFIX_STEP_4", br1);
@@ -371,7 +380,7 @@ void TestBbrTc3(void)
/**
* Step 9
* - Device: Host
* - Device: Host_2
* - Description: Harness instructs the device to send an mDNS query.
* - Pass Criteria:
* - N/A
@@ -379,15 +388,15 @@ void TestBbrTc3(void)
{
Dns::Multicast::Core::Browser browser;
SuccessOrQuit(host.Get<Dns::Multicast::Core>().SetEnabled(true, kInfraIfIndex));
SuccessOrQuit(host2.Get<Dns::Multicast::Core>().SetEnabled(true, kInfraIfIndex));
ClearAllBytes(browser);
browser.mServiceType = "_meshcop._udp";
browser.mInfraIfIndex = kInfraIfIndex;
browser.mCallback = HandleMdnsBrowse;
SuccessOrQuit(host.Get<Dns::Multicast::Core>().StartBrowser(browser));
SuccessOrQuit(host2.Get<Dns::Multicast::Core>().StartBrowser(browser));
nexus.AdvanceTime(kStabilizationTime);
SuccessOrQuit(host.Get<Dns::Multicast::Core>().StopBrowser(browser));
SuccessOrQuit(host2.Get<Dns::Multicast::Core>().StopBrowser(browser));
}
nexus.AddOmrPrefixTestVar("OMR_PREFIX_STEP_10", br2);
@@ -467,7 +476,7 @@ void TestBbrTc3(void)
/**
* Step 12
* - Device: Host
* - Device: Host_1
* - Description: Harness instructs the device to send an mDNS query.
* - Pass Criteria:
* - N/A
@@ -475,15 +484,15 @@ void TestBbrTc3(void)
{
Dns::Multicast::Core::Browser browser;
SuccessOrQuit(host.Get<Dns::Multicast::Core>().SetEnabled(true, kInfraIfIndex));
SuccessOrQuit(host1.Get<Dns::Multicast::Core>().SetEnabled(true, kInfraIfIndex));
ClearAllBytes(browser);
browser.mServiceType = "_meshcop._udp";
browser.mInfraIfIndex = kInfraIfIndex;
browser.mCallback = HandleMdnsBrowse;
SuccessOrQuit(host.Get<Dns::Multicast::Core>().StartBrowser(browser));
SuccessOrQuit(host1.Get<Dns::Multicast::Core>().StartBrowser(browser));
nexus.AdvanceTime(kStabilizationTime);
SuccessOrQuit(host.Get<Dns::Multicast::Core>().StopBrowser(browser));
SuccessOrQuit(host1.Get<Dns::Multicast::Core>().StopBrowser(browser));
}
nexus.AddOmrPrefixTestVar("OMR_PREFIX_STEP_11", br1);
+7 -5
View File
@@ -73,7 +73,8 @@ def verify(pv):
# In Nexus, Ethernet MAC addresses are 02:00:00:00:00:<node_id>
BR_1_ETH = '02:00:00:00:00:00'
BR_2_ETH = '02:00:00:00:00:01'
HOST_ETH = '02:00:00:00:00:02'
HOST_1_ETH = '02:00:00:00:00:02'
HOST_2_ETH = '02:00:00:00:00:03'
def is_mdns_response(p):
return p.udp.srcport == MDNS_UDP_PORT
@@ -235,7 +236,7 @@ def verify(pv):
# Step 1: Host sends an mDNS query (per P2).
print("Step 1: Host sends an mDNS query.")
pkts.filter_eth_src(HOST_ETH).\
pkts.filter_eth_src(HOST_1_ETH).\
filter_ipv6_dst(MDNS_IPV6_ADDR).\
filter(lambda p: p.udp.dstport == MDNS_UDP_PORT).\
must_next()
@@ -266,7 +267,7 @@ def verify(pv):
# Step 5: Harness instructs the device to send an mDNS query.
print("Step 5: Host sends an mDNS query.")
# Skip all packets until the next query which should be around Step 5
pkts.filter_eth_src(HOST_ETH).\
pkts.filter_eth_src(HOST_1_ETH).\
filter_ipv6_dst(MDNS_IPV6_ADDR).\
filter(lambda p: p.udp.dstport == MDNS_UDP_PORT).\
filter(lambda p: p.number > max(p1.number, p2.number)).\
@@ -302,7 +303,7 @@ def verify(pv):
# Step 9: Harness instructs the device to send an mDNS query.
print("Step 9: Host sends an mDNS query.")
pkts.filter_eth_src(HOST_ETH).\
pkts.filter_eth_src(HOST_2_ETH).\
filter_ipv6_dst(MDNS_IPV6_ADDR).\
filter(lambda p: p.udp.dstport == MDNS_UDP_PORT).\
filter(lambda p: p.number > max(p1.number, p2.number)).\
@@ -339,6 +340,7 @@ def verify(pv):
filter(lambda p: p.number > q_number).\
filter(lambda p: has_sb_bit(p, 8)).\
must_next()
verify_mdns_response(p2, {'ifstate': 2, 'active': 1, 'primary': 1}, expected_omr_var='OMR_PREFIX_STEP_10')
# Step 11: The device must be powered up; BR_1 joins BR_2.
@@ -346,7 +348,7 @@ def verify(pv):
# Step 12: Harness instructs the device to send an mDNS query.
print("Step 12: Host sends an mDNS query.")
pkts.filter_eth_src(HOST_ETH).\
pkts.filter_eth_src(HOST_1_ETH).\
filter_ipv6_dst(MDNS_IPV6_ADDR).\
filter(lambda p: p.udp.dstport == MDNS_UDP_PORT).\
filter(lambda p: p.number > p2.number).\