mirror of
https://github.com/espressif/openthread.git
synced 2026-08-17 16:09:51 +00:00
[nexus] add test 5.1.7 Minimum Supported Children – IPv6 Datagram Buffering (#12375)
Adds a new Nexus test case for 'Minimum Supported Children – IPv6 Datagram
Buffering' (5.1.7) as specified in the test specification.
Summary of changes:
- Implemented Nexus test 5.1.7:
- Added test_5_1_7.cpp: Sets up a Leader, Router_1 (DUT), 4 MEDs, and 6
SEDs. Verifies the DUT can handle the minimum required number of
children and buffers multiple concurrent IPv6 datagrams (including
a 1280-octet MTU packet) destined for SEDs.
- Added verify_5_1_7.py: PCAP verification script for test 5.1.7,
ensuring proper MLE attachment, correct forwarding of ICMPv6 Echo
Requests/Replies, and verification of buffered traffic to SEDs.
- Updated build and execution scripts:
- Modified CMakeLists.txt to build the new 5.1.7 test executable.
- Updated run_nexus_tests.sh to include 5.1.7 in the default test list.
This commit is contained in:
@@ -119,6 +119,7 @@ ot_nexus_test(5_1_3)
|
||||
ot_nexus_test(5_1_4)
|
||||
ot_nexus_test(5_1_5)
|
||||
ot_nexus_test(5_1_6)
|
||||
ot_nexus_test(5_1_7)
|
||||
ot_nexus_test(border_agent)
|
||||
ot_nexus_test(border_agent_tracker)
|
||||
ot_nexus_test(discover_scan)
|
||||
|
||||
@@ -54,6 +54,7 @@ DEFAULT_TESTS=(
|
||||
"5_1_4"
|
||||
"5_1_5"
|
||||
"5_1_6"
|
||||
"5_1_7"
|
||||
)
|
||||
|
||||
# Use provided arguments or the default test list
|
||||
|
||||
@@ -0,0 +1,287 @@
|
||||
/*
|
||||
* Copyright (c) 2026, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "common/string.hpp"
|
||||
#include "mac/data_poll_sender.hpp"
|
||||
|
||||
#include "platform/nexus_core.hpp"
|
||||
#include "platform/nexus_node.hpp"
|
||||
|
||||
namespace ot {
|
||||
namespace Nexus {
|
||||
|
||||
/**
|
||||
* Time to advance for a node to form a network and become leader.
|
||||
*/
|
||||
static constexpr uint32_t kFormNetworkTime = 13 * 1000;
|
||||
|
||||
/**
|
||||
* Time to advance for a node to join as a child and upgrade to a router.
|
||||
*/
|
||||
static constexpr uint32_t kAttachToRouterTime = 200 * 1000;
|
||||
|
||||
/**
|
||||
* Time to advance for a node to join as a child.
|
||||
*/
|
||||
static constexpr uint32_t kAttachAsChildTime = 5 * 1000;
|
||||
|
||||
/**
|
||||
* Number of MED children.
|
||||
*/
|
||||
static constexpr uint16_t kNumMeds = 4;
|
||||
|
||||
/**
|
||||
* Number of SED children.
|
||||
*/
|
||||
static constexpr uint16_t kNumSeds = 6;
|
||||
|
||||
/**
|
||||
* IPv6 header size in octets.
|
||||
*/
|
||||
static constexpr uint16_t kIp6HeaderSize = 40;
|
||||
|
||||
/**
|
||||
* ICMPv6 header size in octets.
|
||||
*/
|
||||
static constexpr uint16_t kIcmp6HeaderSize = 8;
|
||||
|
||||
/**
|
||||
* Small ICMPv6 Echo Request datagram size in octets.
|
||||
*/
|
||||
static constexpr uint16_t kSmallDatagramSize = 106;
|
||||
|
||||
/**
|
||||
* Large ICMPv6 Echo Request datagram size in octets.
|
||||
*/
|
||||
static constexpr uint16_t kLargeDatagramSize = 1280;
|
||||
|
||||
/**
|
||||
* Time to wait for ICMPv6 Echo replies.
|
||||
*/
|
||||
static constexpr uint32_t kEchoResponseWaitTime = 5 * 1000;
|
||||
|
||||
/**
|
||||
* ICMPv6 Echo Request identifier for MED children.
|
||||
*/
|
||||
static constexpr uint16_t kMedEchoId = 1001;
|
||||
|
||||
/**
|
||||
* ICMPv6 Echo Request identifier for SED children.
|
||||
*/
|
||||
static constexpr uint16_t kSedEchoId = 2001;
|
||||
|
||||
static void SendEchoRequest(Node &aSender, const Ip6::Address &aPeerAddr, uint16_t aDatagramSize, uint16_t aIdentifier)
|
||||
{
|
||||
Error error = kErrorNone;
|
||||
Message *message = aSender.Get<Ip6::Icmp>().NewMessage();
|
||||
Ip6::MessageInfo messageInfo;
|
||||
uint16_t payloadLength;
|
||||
|
||||
VerifyOrQuit(message != nullptr);
|
||||
|
||||
VerifyOrExit(aDatagramSize >= kIp6HeaderSize + kIcmp6HeaderSize, error = kErrorInvalidArgs);
|
||||
payloadLength = aDatagramSize - kIp6HeaderSize - kIcmp6HeaderSize;
|
||||
|
||||
error = message->SetLength(payloadLength);
|
||||
SuccessOrExit(error);
|
||||
|
||||
messageInfo.SetPeerAddr(aPeerAddr);
|
||||
messageInfo.SetHopLimit(64);
|
||||
|
||||
error = aSender.Get<Ip6::Icmp>().SendEchoRequest(*message, messageInfo, aIdentifier);
|
||||
SuccessOrExit(error);
|
||||
|
||||
message = nullptr;
|
||||
|
||||
exit:
|
||||
if (message != nullptr)
|
||||
{
|
||||
message->Free();
|
||||
}
|
||||
|
||||
SuccessOrQuit(error);
|
||||
}
|
||||
|
||||
static void CreateNodes(Core &aNexus, Node *aNodes[], uint16_t aCount, const char *aNamePrefix)
|
||||
{
|
||||
for (uint16_t i = 0; i < aCount; i++)
|
||||
{
|
||||
aNodes[i] = &aNexus.CreateNode();
|
||||
|
||||
String<16> name;
|
||||
|
||||
name.Append("%s_%u", aNamePrefix, i + 1);
|
||||
aNodes[i]->SetName(name.AsCString());
|
||||
}
|
||||
}
|
||||
|
||||
static void AllowListNodes(Node &aRouter, Node *aNodes[], uint16_t aCount)
|
||||
{
|
||||
for (uint16_t i = 0; i < aCount; i++)
|
||||
{
|
||||
aRouter.AllowList(*aNodes[i]);
|
||||
aNodes[i]->AllowList(aRouter);
|
||||
}
|
||||
}
|
||||
|
||||
static void VerifyChildren(Node *aNodes[], uint16_t aCount)
|
||||
{
|
||||
for (uint16_t i = 0; i < aCount; i++)
|
||||
{
|
||||
VerifyOrQuit(aNodes[i]->Get<Mle::Mle>().IsChild());
|
||||
}
|
||||
}
|
||||
|
||||
void Test5_1_7(void)
|
||||
{
|
||||
/**
|
||||
* 5.1.7 Minimum Supported Children – IPv6 Datagram Buffering
|
||||
*
|
||||
* 5.1.7.1 Topology
|
||||
* - Leader
|
||||
* - Router_1 (DUT)
|
||||
* - MED_1 through MED_4
|
||||
* - SED_1 through SED_6
|
||||
*
|
||||
* 5.1.7.2 Purpose & Description
|
||||
* The purpose of this test case is to validate the minimum conformance requirements for router-capable devices:
|
||||
* - a) Minimum number of supported children.
|
||||
* - b) Minimum MTU requirement when sending/forwarding an IPv6 datagram to a SED.
|
||||
* - c) Minimum number of sent/forwarded IPv6 datagrams to SED children.
|
||||
*
|
||||
* Spec Reference | V1.1 Section | V1.3.0 Section
|
||||
* ---------------------|--------------|---------------
|
||||
* Conformance Document | 2.2 | 2.2
|
||||
*/
|
||||
|
||||
Core nexus;
|
||||
|
||||
Node &leader = nexus.CreateNode();
|
||||
Node &router = nexus.CreateNode();
|
||||
Node *meds[kNumMeds];
|
||||
Node *seds[kNumSeds];
|
||||
|
||||
leader.SetName("LEADER");
|
||||
router.SetName("ROUTER_1");
|
||||
|
||||
CreateNodes(nexus, meds, kNumMeds, "MED");
|
||||
CreateNodes(nexus, seds, kNumSeds, "SED");
|
||||
|
||||
nexus.AdvanceTime(0);
|
||||
|
||||
// Use AllowList feature to restrict the topology.
|
||||
leader.AllowList(router);
|
||||
router.AllowList(leader);
|
||||
|
||||
AllowListNodes(router, meds, kNumMeds);
|
||||
AllowListNodes(router, seds, kNumSeds);
|
||||
|
||||
Log("---------------------------------------------------------------------------------------");
|
||||
Log("Step 1: Leader, Router_1 (DUT), Children");
|
||||
|
||||
/**
|
||||
* Step 1: Leader, Router_1 (DUT), Children
|
||||
* - Description: Create topology and attach MED_1, MED_2…MED_4, SED_1, SED_2…SED_6 children to the Router.
|
||||
* - Pass Criteria:
|
||||
* - The DUT MUST send properly formatted MLE Parent Response and MLE Child ID Response to each child.
|
||||
*/
|
||||
leader.Form();
|
||||
nexus.AdvanceTime(kFormNetworkTime);
|
||||
VerifyOrQuit(leader.Get<Mle::Mle>().IsLeader());
|
||||
|
||||
router.Join(leader);
|
||||
nexus.AdvanceTime(kAttachToRouterTime);
|
||||
VerifyOrQuit(router.Get<Mle::Mle>().IsRouter());
|
||||
|
||||
for (uint16_t i = 0; i < kNumMeds; i++)
|
||||
{
|
||||
meds[i]->Join(router, Node::kAsMed);
|
||||
}
|
||||
nexus.AdvanceTime(kAttachAsChildTime);
|
||||
|
||||
for (uint16_t i = 0; i < kNumSeds; i++)
|
||||
{
|
||||
seds[i]->Join(router, Node::kAsSed);
|
||||
SuccessOrQuit(seds[i]->Get<DataPollSender>().SetExternalPollPeriod(1000));
|
||||
}
|
||||
nexus.AdvanceTime(kAttachAsChildTime);
|
||||
|
||||
VerifyChildren(meds, kNumMeds);
|
||||
VerifyChildren(seds, kNumSeds);
|
||||
|
||||
Log("---------------------------------------------------------------------------------------");
|
||||
Log("Step 2: Leader");
|
||||
|
||||
/**
|
||||
* Step 2: Leader
|
||||
* - Description: Harness instructs the Leader to send an ICMPv6 Echo Request with IPv6 datagram size of 106 octets
|
||||
* to each MED.
|
||||
* - Pass Criteria:
|
||||
* - The DUT MUST properly forward ICMPv6 Echo Requests to all MED children.
|
||||
* - The DUT MUST properly forward ICMPv6 Echo Replies to the Leader.
|
||||
*/
|
||||
for (uint16_t i = 0; i < kNumMeds; i++)
|
||||
{
|
||||
SendEchoRequest(leader, meds[i]->Get<Mle::Mle>().GetMeshLocalEid(), kSmallDatagramSize, kMedEchoId + i);
|
||||
}
|
||||
nexus.AdvanceTime(kEchoResponseWaitTime);
|
||||
|
||||
Log("---------------------------------------------------------------------------------------");
|
||||
Log("Step 3: Leader");
|
||||
|
||||
/**
|
||||
* Step 3: Leader
|
||||
* - Description: Harness instructs the Leader to send an ICMPv6 Echo Request with IPv6 datagram size of 1280 octets
|
||||
* to SED_1 and ICMPv6 Echo Requests with IPv6 datagram size of 106 octets to SED_2, SED_3, SED_4, SED_5 and SED_6
|
||||
* without waiting for ICMPv6 Echo Replies.
|
||||
* - Pass Criteria:
|
||||
* - The DUT MUST buffer all IPv6 datagrams.
|
||||
* - The DUT MUST properly forward ICMPv6 Echo Requests to all SED children.
|
||||
* - The DUT MUST properly forward ICMPv6 Echo Replies to the Leader.
|
||||
*/
|
||||
SendEchoRequest(leader, seds[0]->Get<Mle::Mle>().GetMeshLocalEid(), kLargeDatagramSize, kSedEchoId);
|
||||
for (uint16_t i = 1; i < kNumSeds; i++)
|
||||
{
|
||||
SendEchoRequest(leader, seds[i]->Get<Mle::Mle>().GetMeshLocalEid(), kSmallDatagramSize, kSedEchoId + i);
|
||||
}
|
||||
nexus.AdvanceTime(kEchoResponseWaitTime);
|
||||
|
||||
nexus.SaveTestInfo("test_5_1_7.json");
|
||||
}
|
||||
|
||||
} // namespace Nexus
|
||||
} // namespace ot
|
||||
|
||||
int main(void)
|
||||
{
|
||||
ot::Nexus::Test5_1_7();
|
||||
printf("All tests passed\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (c) 2026, The OpenThread Authors.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the copyright holder nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Add the current directory to sys.path to find verify_utils
|
||||
CUR_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
sys.path.append(CUR_DIR)
|
||||
|
||||
import verify_utils
|
||||
from pktverify import consts
|
||||
|
||||
# IPv6 header size in octets.
|
||||
IPV6_HEADER_SIZE = 40
|
||||
|
||||
# Small ICMPv6 Echo Request datagram size in octets.
|
||||
SMALL_DATAGRAM_SIZE = 106
|
||||
|
||||
# Large ICMPv6 Echo Request datagram size in octets.
|
||||
LARGE_DATAGRAM_SIZE = 1280
|
||||
|
||||
# Number of MED children.
|
||||
NUM_MEDS = 4
|
||||
|
||||
# Number of SED children.
|
||||
NUM_SEDS = 6
|
||||
|
||||
# ICMPv6 Echo Request identifier for MED children.
|
||||
MED_ECHO_ID = 1001
|
||||
|
||||
# ICMPv6 Echo Request identifier for SED children.
|
||||
SED_ECHO_ID = 2001
|
||||
|
||||
|
||||
def verify_ping_forwarding(pv, start_idx, children_rloc16, children_mleid, base_echo_id):
|
||||
"""Verify that the Router (DUT) properly forwards ICMPv6 Echo Requests and Replies.
|
||||
"""
|
||||
pkts = pv.pkts
|
||||
LEADER_RLOC16 = pv.vars['LEADER_RLOC16']
|
||||
ROUTER_1_RLOC16 = pv.vars['ROUTER_1_RLOC16']
|
||||
|
||||
max_idx = pkts.index
|
||||
|
||||
for i, (child_rloc16, child_mleid) in enumerate(zip(children_rloc16, children_mleid)):
|
||||
f = pkts.range(start_idx).copy()
|
||||
|
||||
# Router to child
|
||||
f.filter_ping_request(identifier=base_echo_id + i).\
|
||||
filter_wpan_src16(ROUTER_1_RLOC16).\
|
||||
filter_wpan_dst16(child_rloc16).\
|
||||
filter_ipv6_dst(child_mleid).\
|
||||
must_next()
|
||||
|
||||
# Child to Router
|
||||
f.filter_ping_reply(identifier=base_echo_id + i).\
|
||||
filter_wpan_src16(child_rloc16).\
|
||||
filter_wpan_dst16(ROUTER_1_RLOC16).\
|
||||
must_next()
|
||||
|
||||
# Router to Leader
|
||||
f.filter_ping_reply(identifier=base_echo_id + i).\
|
||||
filter_wpan_src16(ROUTER_1_RLOC16).\
|
||||
filter_wpan_dst16(LEADER_RLOC16).\
|
||||
must_next()
|
||||
|
||||
max_idx = max(max_idx, f.index)
|
||||
|
||||
return max_idx
|
||||
|
||||
|
||||
def verify(pv):
|
||||
# 5.1.7 Minimum Supported Children – IPv6 Datagram Buffering
|
||||
#
|
||||
# 5.1.7.1 Topology
|
||||
# - Leader
|
||||
# - Router_1 (DUT)
|
||||
# - MED_1 through MED_4
|
||||
# - SED_1 through SED_6
|
||||
#
|
||||
# 5.1.7.2 Purpose & Description
|
||||
# The purpose of this test case is to validate the minimum conformance requirements for router-capable devices:
|
||||
# - a) Minimum number of supported children.
|
||||
# - b) Minimum MTU requirement when sending/forwarding an IPv6 datagram to a SED.
|
||||
# - c) Minimum number of sent/forwarded IPv6 datagrams to SED children.
|
||||
#
|
||||
# Spec Reference | V1.1 Section | V1.3.0 Section
|
||||
# ---------------------|--------------|---------------
|
||||
# Conformance Document | 2.2 | 2.2
|
||||
|
||||
pkts = pv.pkts
|
||||
pv.summary.show()
|
||||
|
||||
LEADER = pv.vars['LEADER']
|
||||
LEADER_RLOC16 = pv.vars['LEADER_RLOC16']
|
||||
ROUTER_1 = pv.vars['ROUTER_1']
|
||||
ROUTER_1_RLOC16 = pv.vars['ROUTER_1_RLOC16']
|
||||
MEDS_RLOC16 = verify_utils.get_vars(pv, 'MED', NUM_MEDS, '_RLOC16')
|
||||
MEDS_MLEID = verify_utils.get_vars(pv, 'MED', NUM_MEDS, '_MLEID')
|
||||
SEDS_RLOC16 = verify_utils.get_vars(pv, 'SED', NUM_SEDS, '_RLOC16')
|
||||
SEDS_MLEID = verify_utils.get_vars(pv, 'SED', NUM_SEDS, '_MLEID')
|
||||
|
||||
# Step 1: Leader, Router_1 (DUT), Children
|
||||
# - Description: Create topology and attach MED_1, MED_2…MED_4, SED_1, SED_2…SED_6 children to the Router.
|
||||
# - Pass Criteria:
|
||||
# - The DUT MUST send properly formatted MLE Parent Response and MLE Child ID Response to each child.
|
||||
print("Step 1: Leader, Router_1 (DUT), Children")
|
||||
|
||||
# Use copy to allow interleaving between different children
|
||||
start_pkts = pkts.copy()
|
||||
max_idx = pkts.index
|
||||
|
||||
children = verify_utils.get_vars(pv, 'MED', NUM_MEDS) + verify_utils.get_vars(pv, 'SED', NUM_SEDS)
|
||||
|
||||
for child in children:
|
||||
# Parent Response
|
||||
f = start_pkts.copy().\
|
||||
filter_wpan_src64(ROUTER_1).\
|
||||
filter_wpan_dst64(child).\
|
||||
filter_mle_cmd(consts.MLE_PARENT_RESPONSE)
|
||||
f.must_next()
|
||||
max_idx = max(max_idx, f.index)
|
||||
|
||||
# Child ID Response
|
||||
f = start_pkts.copy().\
|
||||
filter_wpan_src64(ROUTER_1).\
|
||||
filter_wpan_dst64(child).\
|
||||
filter_mle_cmd(consts.MLE_CHILD_ID_RESPONSE)
|
||||
f.must_next()
|
||||
max_idx = max(max_idx, f.index)
|
||||
|
||||
pkts.index = max_idx
|
||||
|
||||
# Step 2: Leader
|
||||
# - Description: Harness instructs the Leader to send an ICMPv6 Echo Request with IPv6 datagram size of 106 octets
|
||||
# to each MED.
|
||||
# - Pass Criteria:
|
||||
# - The DUT MUST properly forward ICMPv6 Echo Requests to all MED children.
|
||||
# - The DUT MUST properly forward ICMPv6 Echo Replies to the Leader.
|
||||
print("Step 2: Leader")
|
||||
|
||||
step2_start_idx = pkts.index
|
||||
|
||||
# Leader sends all requests to Router first (identifiers 1001..1004)
|
||||
for i, med_mleid in enumerate(MEDS_MLEID):
|
||||
pkts.filter_ping_request(identifier=MED_ECHO_ID + i).\
|
||||
filter_wpan_src16(LEADER_RLOC16).\
|
||||
filter_wpan_dst16(ROUTER_1_RLOC16).\
|
||||
filter_ipv6_dst(med_mleid).\
|
||||
filter(lambda p: p.ipv6.plen == SMALL_DATAGRAM_SIZE - IPV6_HEADER_SIZE).\
|
||||
must_next()
|
||||
|
||||
# Verify Router forwards to MEDs and receives replies (allow interleaving with requests)
|
||||
pkts.index = verify_ping_forwarding(pv, step2_start_idx, MEDS_RLOC16, MEDS_MLEID, MED_ECHO_ID)
|
||||
|
||||
# Step 3: Leader
|
||||
# - Description: Harness instructs the Leader to send an ICMPv6 Echo Request with IPv6 datagram size of 1280 octets
|
||||
# to SED_1 and ICMPv6 Echo Requests with IPv6 datagram size of 106 octets to SED_2, SED_3, SED_4, SED_5 and SED_6
|
||||
# without waiting for ICMPv6 Echo Replies.
|
||||
# - Pass Criteria:
|
||||
# - The DUT MUST buffer all IPv6 datagrams.
|
||||
# - The DUT MUST properly forward ICMPv6 Echo Requests to all SED children.
|
||||
# - The DUT MUST properly forward ICMPv6 Echo Replies to the Leader.
|
||||
print("Step 3: Leader")
|
||||
|
||||
step3_start_idx = pkts.index
|
||||
|
||||
# Leader sends all requests to Router first (identifiers 2001..2006)
|
||||
# SED_1 (1280 octets)
|
||||
pkts.filter_ping_request(identifier=SED_ECHO_ID).\
|
||||
filter_wpan_src16(LEADER_RLOC16).\
|
||||
filter_wpan_dst16(ROUTER_1_RLOC16).\
|
||||
filter_ipv6_dst(SEDS_MLEID[0]).\
|
||||
filter(lambda p: p.ipv6.plen == LARGE_DATAGRAM_SIZE - IPV6_HEADER_SIZE).\
|
||||
must_next()
|
||||
|
||||
# SED_2..6 (106 octets)
|
||||
for i in range(1, NUM_SEDS):
|
||||
pkts.filter_ping_request(identifier=SED_ECHO_ID + i).\
|
||||
filter_wpan_src16(LEADER_RLOC16).\
|
||||
filter_wpan_dst16(ROUTER_1_RLOC16).\
|
||||
filter_ipv6_dst(SEDS_MLEID[i]).\
|
||||
filter(lambda p: p.ipv6.plen == SMALL_DATAGRAM_SIZE - IPV6_HEADER_SIZE).\
|
||||
must_next()
|
||||
|
||||
# Verify Router forwards to SEDs and receives replies (allow interleaving)
|
||||
pkts.index = verify_ping_forwarding(pv, step3_start_idx, SEDS_RLOC16, SEDS_MLEID, SED_ECHO_ID)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
verify_utils.run_main(verify)
|
||||
@@ -76,6 +76,10 @@ def apply_patches():
|
||||
pvutils.which_tshark = which_tshark_patch
|
||||
|
||||
|
||||
def get_vars(pv, prefix, count, suffix=''):
|
||||
return [pv.vars[f'{prefix}_{i}{suffix}'] for i in range(1, count + 1)]
|
||||
|
||||
|
||||
def run_main(verify_func):
|
||||
if len(sys.argv) < 2:
|
||||
print(f"Usage: python3 {sys.argv[0]} <json_file>")
|
||||
|
||||
Reference in New Issue
Block a user