mirror of
https://github.com/espressif/openthread.git
synced 2026-08-15 07:07:46 +00:00
[thread-cert] add more info and tlv checks in case 5.1.7 (#5740)
This commit is contained in:
@@ -31,15 +31,41 @@ import unittest
|
||||
|
||||
import config
|
||||
import thread_cert
|
||||
from pktverify.consts import MLE_PARENT_RESPONSE, MLE_CHILD_ID_RESPONSE
|
||||
from pktverify.consts import MLE_PARENT_RESPONSE, MLE_CHILD_ID_RESPONSE, SOURCE_ADDRESS_TLV, CHALLENGE_TLV, RESPONSE_TLV, LINK_LAYER_FRAME_COUNTER_TLV, ADDRESS16_TLV, LEADER_DATA_TLV, NETWORK_DATA_TLV, CONNECTIVITY_TLV, LINK_MARGIN_TLV, VERSION_TLV, ADDRESS_REGISTRATION_TLV
|
||||
from pktverify.packet_verifier import PacketVerifier
|
||||
from pktverify.null_field import nullField
|
||||
|
||||
LEADER = 1
|
||||
ROUTER = 2
|
||||
SED1 = 7
|
||||
|
||||
# Test Purpose and 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.
|
||||
#
|
||||
# Test Topology:
|
||||
# -------------
|
||||
#
|
||||
# Leader
|
||||
# |
|
||||
# Router[DUT]
|
||||
# / \
|
||||
# MED1 - MED4 SED1 - SED6
|
||||
#
|
||||
# DUT Types:
|
||||
# ----------
|
||||
# Router
|
||||
|
||||
|
||||
class Cert_5_1_07_MaxChildCount(thread_cert.TestCase):
|
||||
USE_MESSAGE_FACTORY = False
|
||||
|
||||
TOPOLOGY = {
|
||||
LEADER: {
|
||||
'name': 'LEADER',
|
||||
@@ -178,13 +204,61 @@ class Cert_5_1_07_MaxChildCount(thread_cert.TestCase):
|
||||
# and MLE Child ID Response to each child.
|
||||
for i in range(1, 7):
|
||||
_pkts = router_pkts.copy().filter_wpan_dst64(pv.vars['SED%d' % i])
|
||||
_pkts.filter_mle_cmd(MLE_PARENT_RESPONSE).must_next()
|
||||
_pkts.filter_mle_cmd(MLE_CHILD_ID_RESPONSE).must_next()
|
||||
_pkts.filter_mle_cmd(MLE_PARENT_RESPONSE).\
|
||||
filter(lambda p: {
|
||||
CHALLENGE_TLV,
|
||||
CONNECTIVITY_TLV,
|
||||
LEADER_DATA_TLV,
|
||||
LINK_LAYER_FRAME_COUNTER_TLV,
|
||||
LINK_MARGIN_TLV,
|
||||
RESPONSE_TLV,
|
||||
SOURCE_ADDRESS_TLV,
|
||||
VERSION_TLV
|
||||
} <= set(p.mle.tlv.type)
|
||||
).\
|
||||
must_next()
|
||||
_pkts.filter_mle_cmd(MLE_CHILD_ID_RESPONSE).\
|
||||
filter(lambda p: {
|
||||
SOURCE_ADDRESS_TLV,
|
||||
LEADER_DATA_TLV,
|
||||
ADDRESS16_TLV,
|
||||
NETWORK_DATA_TLV,
|
||||
ADDRESS_REGISTRATION_TLV
|
||||
} <= set(p.mle.tlv.type) and\
|
||||
p.mle.tlv.addr16 is not nullField and\
|
||||
p.thread_nwd.tlv.type is not None and\
|
||||
p.thread_meshcop.tlv.type is not None
|
||||
).\
|
||||
must_next()
|
||||
|
||||
for i in range(1, 5):
|
||||
_pkts = router_pkts.copy().filter_wpan_dst64(pv.vars['MED%d' % i])
|
||||
_pkts.filter_mle_cmd(MLE_PARENT_RESPONSE).must_next()
|
||||
_pkts.filter_mle_cmd(MLE_CHILD_ID_RESPONSE).must_next()
|
||||
_pkts.filter_mle_cmd(MLE_PARENT_RESPONSE).\
|
||||
filter(lambda p: {
|
||||
CHALLENGE_TLV,
|
||||
CONNECTIVITY_TLV,
|
||||
LEADER_DATA_TLV,
|
||||
LINK_LAYER_FRAME_COUNTER_TLV,
|
||||
LINK_MARGIN_TLV,
|
||||
RESPONSE_TLV,
|
||||
SOURCE_ADDRESS_TLV,
|
||||
VERSION_TLV
|
||||
} <= set(p.mle.tlv.type)
|
||||
).\
|
||||
must_next()
|
||||
|
||||
_pkts.filter_mle_cmd(MLE_CHILD_ID_RESPONSE).\
|
||||
filter(lambda p: {
|
||||
SOURCE_ADDRESS_TLV,
|
||||
LEADER_DATA_TLV,
|
||||
ADDRESS16_TLV,
|
||||
NETWORK_DATA_TLV,
|
||||
ADDRESS_REGISTRATION_TLV
|
||||
} <= set(p.mle.tlv.type) and\
|
||||
p.mle.tlv.addr16 is not nullField and\
|
||||
p.thread_meshcop.tlv.type is not None
|
||||
).\
|
||||
must_next()
|
||||
|
||||
# Step 2: The DUT MUST properly forward ICMPv6 Echo Requests to all MED children
|
||||
# The DUT MUST properly forward ICMPv6 Echo Replies to the Leader
|
||||
@@ -192,18 +266,26 @@ class Cert_5_1_07_MaxChildCount(thread_cert.TestCase):
|
||||
for i in range(1, 5):
|
||||
rloc16 = pv.vars['MED%d_RLOC16' % i]
|
||||
_pkts = router_pkts.copy()
|
||||
p = _pkts.filter('wpan.dst16 == {rloc16}', rloc16=rloc16).filter_ping_request().must_next()
|
||||
p = _pkts.filter('wpan.dst16 == {rloc16}', rloc16=rloc16).\
|
||||
filter_ping_request().\
|
||||
must_next()
|
||||
_pkts.filter('wpan.dst16 == {rloc16}',
|
||||
rloc16=leader_rloc16).filter_ping_reply(identifier=p.icmpv6.echo.identifier).must_next()
|
||||
rloc16=leader_rloc16).\
|
||||
filter_ping_reply(identifier=p.icmpv6.echo.identifier).\
|
||||
must_next()
|
||||
|
||||
# Step 3: The DUT MUST properly forward ICMPv6 Echo Requests to all SED children
|
||||
# The DUT MUST properly forward ICMPv6 Echo Replies to the Leader
|
||||
for i in range(1, 7):
|
||||
rloc16 = pv.vars['SED%d_RLOC16' % i]
|
||||
_pkts = router_pkts.copy()
|
||||
p = _pkts.filter('wpan.dst16 == {rloc16}', rloc16=rloc16).filter_ping_request().must_next()
|
||||
p = _pkts.filter('wpan.dst16 == {rloc16}', rloc16=rloc16).\
|
||||
filter_ping_request().\
|
||||
must_next()
|
||||
_pkts.filter('wpan.dst16 == {rloc16}',
|
||||
rloc16=leader_rloc16).filter_ping_reply(identifier=p.icmpv6.echo.identifier).must_next()
|
||||
rloc16=leader_rloc16).\
|
||||
filter_ping_reply(identifier=p.icmpv6.echo.identifier).\
|
||||
must_next()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user