From 2bf3086cc301446df9bcc933cf4ae8e0c706d338 Mon Sep 17 00:00:00 2001 From: Jing Ma Date: Wed, 2 Sep 2020 13:45:02 +0800 Subject: [PATCH] [thread-cert] refactor case 6.1.3, 6.1.5, 6.1.7 and 6.1.9 using pktverify (#5352) --- .../Cert_6_1_03_RouterAttachConnectivity.py | 40 +++++ .../Cert_6_1_04_REEDAttachConnectivity.py | 100 ------------ .../Cert_6_1_05_REEDAttachConnectivity.py | 147 ++++++++++++++++++ ...=> Cert_6_1_07_RouterAttachLinkQuality.py} | 43 ++++- ...on.py => Cert_6_1_09_EDSynchronization.py} | 32 +++- tests/scripts/thread-cert/Makefile.am | 12 +- 6 files changed, 264 insertions(+), 110 deletions(-) delete mode 100755 tests/scripts/thread-cert/Cert_6_1_04_REEDAttachConnectivity.py create mode 100755 tests/scripts/thread-cert/Cert_6_1_05_REEDAttachConnectivity.py rename tests/scripts/thread-cert/{Cert_6_1_05_RouterAttachLinkQuality.py => Cert_6_1_07_RouterAttachLinkQuality.py} (56%) rename tests/scripts/thread-cert/{Cert_6_1_07_EDSynchronization.py => Cert_6_1_09_EDSynchronization.py} (69%) diff --git a/tests/scripts/thread-cert/Cert_6_1_03_RouterAttachConnectivity.py b/tests/scripts/thread-cert/Cert_6_1_03_RouterAttachConnectivity.py index 678b3f94c..5b10c00a0 100755 --- a/tests/scripts/thread-cert/Cert_6_1_03_RouterAttachConnectivity.py +++ b/tests/scripts/thread-cert/Cert_6_1_03_RouterAttachConnectivity.py @@ -31,6 +31,8 @@ import unittest import config import thread_cert +from pktverify.consts import MLE_CHILD_ID_REQUEST, MLE_PARENT_REQUEST, MODE_TLV, CHALLENGE_TLV, SCAN_MASK_TLV, VERSION_TLV, RESPONSE_TLV, LINK_LAYER_FRAME_COUNTER_TLV, MLE_FRAME_COUNTER_TLV, TIMEOUT_TLV, ADDRESS_REGISTRATION_TLV, TLV_REQUEST_TLV, LINK_LOCAL_ALL_ROUTERS_MULTICAST_ADDRESS +from pktverify.packet_verifier import PacketVerifier LEADER = 1 ROUTER1 = 2 @@ -42,29 +44,34 @@ ED = 5 class Cert_6_1_3_RouterAttachConnectivity(thread_cert.TestCase): TOPOLOGY = { LEADER: { + 'name': 'LEADER', 'mode': 'rsdn', 'panid': 0xface, 'whitelist': [ROUTER1, ROUTER2, ROUTER3] }, ROUTER1: { + 'name': 'ROUTER_1', 'mode': 'rsdn', 'panid': 0xface, 'router_selection_jitter': 1, 'whitelist': [LEADER, ROUTER3] }, ROUTER2: { + 'name': 'ROUTER_2', 'mode': 'rsdn', 'panid': 0xface, 'router_selection_jitter': 1, 'whitelist': [LEADER, ED] }, ROUTER3: { + 'name': 'ROUTER_3', 'mode': 'rsdn', 'panid': 0xface, 'router_selection_jitter': 1, 'whitelist': [LEADER, ROUTER1, ED] }, ED: { + 'name': 'ED', 'is_mtd': True, 'mode': 'rsn', 'panid': 0xface, @@ -91,10 +98,43 @@ class Cert_6_1_3_RouterAttachConnectivity(thread_cert.TestCase): self.simulator.go(5) self.assertEqual(self.nodes[ED].get_state(), 'child') + self.collect_ipaddrs() addrs = self.nodes[ED].get_addrs() for addr in addrs: self.assertTrue(self.nodes[ROUTER3].ping(addr)) + def verify(self, pv): + pkts = pv.pkts + pv.summary.show() + + ROUTER_3 = pv.vars['ROUTER_3'] + ED = pv.vars['ED'] + _router3_pkts = pkts.filter_wpan_src64(ROUTER_3) + _ed_pkts = pkts.filter_wpan_src64(ED) + + # Step 2: The DUT MUST send a MLE Parent Request to the + # All-Routers multicast address + _ed_pkts.filter_mle_cmd(MLE_PARENT_REQUEST).filter_ipv6_dst( + LINK_LOCAL_ALL_ROUTERS_MULTICAST_ADDRESS).must_next().must_verify( + lambda p: {MODE_TLV, CHALLENGE_TLV, SCAN_MASK_TLV, VERSION_TLV} == set(p.mle.tlv.type + ) and p.mle.tlv.scan_mask.r == 1) + + # Step 3: Router_2, Router_3 Respond with MLE Parent Response + # Step 4: DUT Send a Child ID Request to Router_3 due to better connectivity + _ed_pkts.filter_mle_cmd(MLE_CHILD_ID_REQUEST).must_next().must_verify( + lambda p: { + RESPONSE_TLV, LINK_LAYER_FRAME_COUNTER_TLV, MLE_FRAME_COUNTER_TLV, MODE_TLV, TIMEOUT_TLV, VERSION_TLV, + ADDRESS_REGISTRATION_TLV, TLV_REQUEST_TLV + } <= set(p.mle.tlv.type)) + + # Step 5: The DUT MUST respond with ICMPv6 Echo Reply + ed_mleid = pv.vars['ED_MLEID'] + router3_mleid = pv.vars['ROUTER_3_MLEID'] + _pkt = _router3_pkts.filter( + lambda p: p.ipv6.src == router3_mleid and p.ipv6.dst == ed_mleid).filter_ping_request().must_next() + _ed_pkts.filter(lambda p: p.ipv6.src == ed_mleid and p.ipv6.dst == router3_mleid).filter_ping_reply( + identifier=_pkt.icmpv6.echo.identifier).must_next() + if __name__ == '__main__': unittest.main() diff --git a/tests/scripts/thread-cert/Cert_6_1_04_REEDAttachConnectivity.py b/tests/scripts/thread-cert/Cert_6_1_04_REEDAttachConnectivity.py deleted file mode 100755 index e1d729495..000000000 --- a/tests/scripts/thread-cert/Cert_6_1_04_REEDAttachConnectivity.py +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (c) 2016, 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 unittest - -import thread_cert - -LEADER = 1 -ROUTER1 = 2 -REED0 = 3 -REED1 = 4 -ED = 5 - - -class Cert_6_1_4_REEDAttachConnectivity(thread_cert.TestCase): - TOPOLOGY = { - LEADER: { - 'mode': 'rsdn', - 'panid': 0xface, - 'whitelist': [ROUTER1, REED0, REED1] - }, - ROUTER1: { - 'mode': 'rsdn', - 'panid': 0xface, - 'router_selection_jitter': 1, - 'whitelist': [LEADER, REED1] - }, - REED0: { - 'mode': 'rsdn', - 'panid': 0xface, - 'router_upgrade_threshold': 0, - 'whitelist': [LEADER, ED] - }, - REED1: { - 'mode': 'rsdn', - 'panid': 0xface, - 'router_upgrade_threshold': 0, - 'whitelist': [LEADER, ROUTER1, ED] - }, - ED: { - 'is_mtd': True, - 'mode': 'rsn', - 'panid': 0xface, - 'whitelist': [REED0, REED1] - }, - } - - def test(self): - self.nodes[LEADER].start() - self.simulator.go(5) - self.assertEqual(self.nodes[LEADER].get_state(), 'leader') - - self.nodes[ROUTER1].start() - self.simulator.go(5) - self.assertEqual(self.nodes[ROUTER1].get_state(), 'router') - - self.nodes[REED0].start() - self.simulator.go(5) - self.assertEqual(self.nodes[REED0].get_state(), 'child') - - self.nodes[REED1].start() - self.simulator.go(5) - self.assertEqual(self.nodes[REED1].get_state(), 'child') - - self.simulator.go(10) - - self.nodes[ED].start() - self.simulator.go(10) - self.assertEqual(self.nodes[ED].get_state(), 'child') - self.assertEqual(self.nodes[REED1].get_state(), 'router') - - -if __name__ == '__main__': - unittest.main() diff --git a/tests/scripts/thread-cert/Cert_6_1_05_REEDAttachConnectivity.py b/tests/scripts/thread-cert/Cert_6_1_05_REEDAttachConnectivity.py new file mode 100755 index 000000000..37f34c565 --- /dev/null +++ b/tests/scripts/thread-cert/Cert_6_1_05_REEDAttachConnectivity.py @@ -0,0 +1,147 @@ +#!/usr/bin/env python3 +# +# Copyright (c) 2016, 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 unittest + +import thread_cert +from pktverify.consts import MLE_CHILD_ID_REQUEST, MLE_PARENT_REQUEST, MODE_TLV, CHALLENGE_TLV, SCAN_MASK_TLV, VERSION_TLV, RESPONSE_TLV, LINK_LAYER_FRAME_COUNTER_TLV, MLE_FRAME_COUNTER_TLV, TIMEOUT_TLV, ADDRESS_REGISTRATION_TLV, TLV_REQUEST_TLV, LINK_LOCAL_ALL_ROUTERS_MULTICAST_ADDRESS +from pktverify.packet_verifier import PacketVerifier + +LEADER = 1 +ROUTER1 = 2 +REED1 = 3 +REED2 = 4 +ED = 5 + + +class Cert_6_1_5_REEDAttachConnectivity(thread_cert.TestCase): + TOPOLOGY = { + LEADER: { + 'name': 'LEADER', + 'mode': 'rsdn', + 'panid': 0xface, + 'whitelist': [ROUTER1, REED1, REED2] + }, + ROUTER1: { + 'name': 'ROUTER_1', + 'mode': 'rsdn', + 'panid': 0xface, + 'router_selection_jitter': 1, + 'whitelist': [LEADER, REED2] + }, + REED1: { + 'name': 'REED_1', + 'mode': 'rsdn', + 'panid': 0xface, + 'router_upgrade_threshold': 0, + 'whitelist': [LEADER, ROUTER1, ED] + }, + REED2: { + 'name': 'REED_2', + 'mode': 'rsdn', + 'panid': 0xface, + 'router_upgrade_threshold': 0, + 'whitelist': [LEADER, (ED, -85)] + }, + ED: { + 'name': 'ED', + 'is_mtd': True, + 'mode': 'rsn', + 'panid': 0xface, + 'whitelist': [REED1, REED2] + }, + } + + def test(self): + self.nodes[LEADER].start() + self.simulator.go(5) + self.assertEqual(self.nodes[LEADER].get_state(), 'leader') + + self.nodes[ROUTER1].start() + self.simulator.go(5) + self.assertEqual(self.nodes[ROUTER1].get_state(), 'router') + + self.nodes[REED1].start() + self.simulator.go(5) + self.assertEqual(self.nodes[REED1].get_state(), 'child') + + self.nodes[REED2].start() + self.simulator.go(5) + self.assertEqual(self.nodes[REED2].get_state(), 'child') + + self.nodes[ED].start() + self.simulator.go(10) + self.assertEqual(self.nodes[ED].get_state(), 'child') + self.assertEqual(self.nodes[REED1].get_state(), 'router') + + self.collect_ipaddrs() + addrs = self.nodes[ED].get_addrs() + for addr in addrs: + self.assertTrue(self.nodes[REED1].ping(addr)) + + def verify(self, pv): + pkts = pv.pkts + pv.summary.show() + + REED_1 = pv.vars['REED_1'] + ED = pv.vars['ED'] + _reed1_pkts = pkts.filter_wpan_src64(REED_1) + _ed_pkts = pkts.filter_wpan_src64(ED) + + # Step 2: The DUT MUST send a MLE Parent Request to the + # All-Routers multicast address + _ed_pkts.filter_mle_cmd(MLE_PARENT_REQUEST).filter_ipv6_dst( + LINK_LOCAL_ALL_ROUTERS_MULTICAST_ADDRESS).must_next().must_verify( + lambda p: {MODE_TLV, CHALLENGE_TLV, SCAN_MASK_TLV, VERSION_TLV} == set(p.mle.tlv.type + ) and p.mle.tlv.scan_mask.r == 1) + + # Step 3: REED_1 and REED_2 No response to Parent Request + # Step 4: DUT Send MLE Parent Request with Scan Mask set to Routers AND REEDs + _ed_pkts.filter_mle_cmd(MLE_PARENT_REQUEST).must_next().must_verify( + lambda p: {MODE_TLV, CHALLENGE_TLV, SCAN_MASK_TLV, VERSION_TLV} == set( + p.mle.tlv.type) and p.mle.tlv.scan_mask.r == 1 and p.mle.tlv.scan_mask.e == 1) + + # Step 5: The DUT MUST send a MLE Child ID Request + _ed_pkts.filter_wpan_dst64(REED_1).filter_mle_cmd(MLE_CHILD_ID_REQUEST).must_next().must_verify( + lambda p: { + RESPONSE_TLV, LINK_LAYER_FRAME_COUNTER_TLV, MLE_FRAME_COUNTER_TLV, MODE_TLV, TIMEOUT_TLV, VERSION_TLV, + ADDRESS_REGISTRATION_TLV, TLV_REQUEST_TLV + } <= set(p.mle.tlv.type)) + + # Step 8: The DUT MUST respond with ICMPv6 Echo Reply + ed_mleid = pv.vars['ED_MLEID'] + reed1_mleid = pv.vars['REED_1_MLEID'] + _pkt = _reed1_pkts.filter( + lambda p: p.ipv6.src == reed1_mleid and p.ipv6.dst == ed_mleid).filter_ping_request().must_next() + _ed_pkts.filter(lambda p: p.ipv6.src == ed_mleid and p.ipv6.dst == reed1_mleid).filter_ping_reply( + identifier=_pkt.icmpv6.echo.identifier).must_next() + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/scripts/thread-cert/Cert_6_1_05_RouterAttachLinkQuality.py b/tests/scripts/thread-cert/Cert_6_1_07_RouterAttachLinkQuality.py similarity index 56% rename from tests/scripts/thread-cert/Cert_6_1_05_RouterAttachLinkQuality.py rename to tests/scripts/thread-cert/Cert_6_1_07_RouterAttachLinkQuality.py index 778a39b91..43f11d72a 100755 --- a/tests/scripts/thread-cert/Cert_6_1_05_RouterAttachLinkQuality.py +++ b/tests/scripts/thread-cert/Cert_6_1_07_RouterAttachLinkQuality.py @@ -30,6 +30,8 @@ import unittest import thread_cert +from pktverify.consts import MLE_CHILD_ID_REQUEST, MLE_PARENT_REQUEST, MODE_TLV, CHALLENGE_TLV, SCAN_MASK_TLV, VERSION_TLV, RESPONSE_TLV, LINK_LAYER_FRAME_COUNTER_TLV, MLE_FRAME_COUNTER_TLV, TIMEOUT_TLV, ADDRESS_REGISTRATION_TLV, TLV_REQUEST_TLV, LINK_LOCAL_ALL_ROUTERS_MULTICAST_ADDRESS +from pktverify.packet_verifier import PacketVerifier LEADER = 1 ROUTER1 = 2 @@ -37,26 +39,30 @@ ROUTER2 = 3 ED = 4 -class Cert_6_1_5_RouterAttachLinkQuality(thread_cert.TestCase): +class Cert_6_1_7_RouterAttachLinkQuality(thread_cert.TestCase): TOPOLOGY = { LEADER: { + 'name': 'LEADER', 'mode': 'rsdn', 'panid': 0xface, 'whitelist': [ROUTER1, ROUTER2] }, ROUTER1: { + 'name': 'ROUTER_1', 'mode': 'rsdn', 'panid': 0xface, 'router_selection_jitter': 1, 'whitelist': [LEADER, ED] }, ROUTER2: { + 'name': 'ROUTER_2', 'mode': 'rsdn', 'panid': 0xface, 'router_selection_jitter': 1, 'whitelist': [LEADER, (ED, -85)] }, ED: { + 'name': 'ED', 'is_mtd': True, 'mode': 'rsn', 'panid': 0xface, @@ -81,6 +87,41 @@ class Cert_6_1_5_RouterAttachLinkQuality(thread_cert.TestCase): self.simulator.go(5) self.assertEqual(self.nodes[ED].get_state(), 'child') + self.collect_ipaddrs() + addrs = self.nodes[ED].get_addrs() + for addr in addrs: + self.assertTrue(self.nodes[ROUTER1].ping(addr)) + + def verify(self, pv): + pkts = pv.pkts + pv.summary.show() + + ROUTER_1 = pv.vars['ROUTER_1'] + ED = pv.vars['ED'] + _ed_pkts = pkts.filter_wpan_src64(ED) + + # Step 3: The DUT MUST send a MLE Parent Request to the + # All-Routers multicast address + _ed_pkts.filter_mle_cmd(MLE_PARENT_REQUEST).filter_ipv6_dst( + LINK_LOCAL_ALL_ROUTERS_MULTICAST_ADDRESS).must_next().must_verify( + lambda p: {MODE_TLV, CHALLENGE_TLV, SCAN_MASK_TLV, VERSION_TLV} == set( + p.mle.tlv.type) and p.mle.tlv.scan_mask.r == 1 and p.mle.tlv.scan_mask.e == 0) + + # Step 5: The DUT MUST send a MLE Child ID Request to Router_1 + _ed_pkts.filter_wpan_dst64(ROUTER_1).filter_mle_cmd(MLE_CHILD_ID_REQUEST).must_next().must_verify( + lambda p: { + RESPONSE_TLV, LINK_LAYER_FRAME_COUNTER_TLV, MLE_FRAME_COUNTER_TLV, MODE_TLV, TIMEOUT_TLV, VERSION_TLV, + ADDRESS_REGISTRATION_TLV, TLV_REQUEST_TLV + } <= set(p.mle.tlv.type)) + + # Step 6: The DUT MUST respond with ICMPv6 Echo Reply + ed_mleid = pv.vars['ED_MLEID'] + router1_mleid = pv.vars['ROUTER_1_MLEID'] + _pkt = pkts.range(_ed_pkts.index).filter_ipv6_src_dst(router1_mleid, + ed_mleid).filter_ping_request().must_next() + _ed_pkts.filter_ipv6_src_dst( + ed_mleid, router1_mleid).filter_ping_reply(identifier=_pkt.icmpv6.echo.identifier).must_next() + if __name__ == '__main__': unittest.main() diff --git a/tests/scripts/thread-cert/Cert_6_1_07_EDSynchronization.py b/tests/scripts/thread-cert/Cert_6_1_09_EDSynchronization.py similarity index 69% rename from tests/scripts/thread-cert/Cert_6_1_07_EDSynchronization.py rename to tests/scripts/thread-cert/Cert_6_1_09_EDSynchronization.py index e99ced24b..32966d52e 100755 --- a/tests/scripts/thread-cert/Cert_6_1_07_EDSynchronization.py +++ b/tests/scripts/thread-cert/Cert_6_1_09_EDSynchronization.py @@ -30,6 +30,8 @@ import unittest import thread_cert +from pktverify.consts import MLE_CHILD_ID_RESPONSE, MLE_LINK_REQUEST, MLE_LINK_ACCEPT, CHALLENGE_TLV, LEADER_DATA_TLV, SOURCE_ADDRESS_TLV, VERSION_TLV +from pktverify.packet_verifier import PacketVerifier LEADER = 1 ROUTER1 = 2 @@ -38,32 +40,35 @@ ROUTER2 = 4 ROUTER3 = 5 -class Cert_6_1_7_EDSynchronization(thread_cert.TestCase): +class Cert_6_1_9_EDSynchronization(thread_cert.TestCase): TOPOLOGY = { LEADER: { + 'name': 'LEADER', 'mode': 'rsdn', 'panid': 0xface, 'whitelist': [ROUTER1, ED, ROUTER2] }, ROUTER1: { + 'name': 'ROUTER_1', 'mode': 'rsdn', 'panid': 0xface, 'router_selection_jitter': 1, 'whitelist': [LEADER, ED, ROUTER3] }, ED: { - 'is_mtd': True, - 'mode': 'rsn', + 'name': 'ED', 'panid': 0xface, 'whitelist': [LEADER, ROUTER1, ROUTER2, ROUTER3] }, ROUTER2: { + 'name': 'ROUTER_2', 'mode': 'rsdn', 'panid': 0xface, 'router_selection_jitter': 1, 'whitelist': [LEADER, ED, ROUTER3] }, ROUTER3: { + 'name': 'ROUTER_3', 'mode': 'rsdn', 'panid': 0xface, 'router_selection_jitter': 1, @@ -92,6 +97,27 @@ class Cert_6_1_7_EDSynchronization(thread_cert.TestCase): self.simulator.go(5) self.assertEqual(self.nodes[ROUTER3].get_state(), 'router') + def verify(self, pv): + pkts = pv.pkts + pv.summary.show() + + LEADER = pv.vars['LEADER'] + ED = pv.vars['ED'] + + # Step 3: The DUT MUST send a unicast Link Request + # to Router 1, Router 2 & Router 3 + pkts.filter_wpan_src64(LEADER).filter_wpan_dst64(ED).filter_mle_cmd(MLE_CHILD_ID_RESPONSE).must_next() + for i in range(1, 3): + _pkts = pkts.copy() + _pkts.filter_wpan_src64(ED).filter_wpan_dst64( + pv.vars['ROUTER_%d' % i]).filter_mle_cmd(MLE_LINK_REQUEST).must_next().must_verify( + lambda p: {CHALLENGE_TLV, LEADER_DATA_TLV, SOURCE_ADDRESS_TLV, VERSION_TLV} <= set(p.mle.tlv.type)) + + # Step 4: Router_1, Router_2 & Router_3 MUST all send a + # Link Accept message to the DUT + _pkts.filter_wpan_src64(pv.vars['ROUTER_%d' % + i]).filter_wpan_dst64(ED).filter_mle_cmd(MLE_LINK_ACCEPT).must_next() + if __name__ == '__main__': unittest.main() diff --git a/tests/scripts/thread-cert/Makefile.am b/tests/scripts/thread-cert/Makefile.am index e5c2ed678..46294f542 100644 --- a/tests/scripts/thread-cert/Makefile.am +++ b/tests/scripts/thread-cert/Makefile.am @@ -83,11 +83,11 @@ EXTRA_DIST = \ Cert_6_1_02_REEDAttach_MED.py \ Cert_6_1_02_REEDAttach_SED.py \ Cert_6_1_03_RouterAttachConnectivity.py \ - Cert_6_1_04_REEDAttachConnectivity.py \ - Cert_6_1_05_RouterAttachLinkQuality.py \ + Cert_6_1_05_REEDAttachConnectivity.py \ + Cert_6_1_07_RouterAttachLinkQuality.py \ Cert_6_1_06_REEDAttachLinkQuality_ED.py \ Cert_6_1_06_REEDAttachLinkQuality_SED.py \ - Cert_6_1_07_EDSynchronization.py \ + Cert_6_1_09_EDSynchronization.py \ Cert_6_2_01_NewPartition.py \ Cert_6_2_02_NewPartition.py \ Cert_6_3_01_OrphanReattach.py \ @@ -258,11 +258,11 @@ check_SCRIPTS = \ Cert_6_1_02_REEDAttach_MED.py \ Cert_6_1_02_REEDAttach_SED.py \ Cert_6_1_03_RouterAttachConnectivity.py \ - Cert_6_1_04_REEDAttachConnectivity.py \ - Cert_6_1_05_RouterAttachLinkQuality.py \ + Cert_6_1_05_REEDAttachConnectivity.py \ + Cert_6_1_07_RouterAttachLinkQuality.py \ Cert_6_1_06_REEDAttachLinkQuality_ED.py \ Cert_6_1_06_REEDAttachLinkQuality_SED.py \ - Cert_6_1_07_EDSynchronization.py \ + Cert_6_1_09_EDSynchronization.py \ Cert_6_2_01_NewPartition.py \ Cert_6_2_02_NewPartition.py \ Cert_6_3_01_OrphanReattach.py \