mirror of
https://github.com/espressif/openthread.git
synced 2026-08-04 01:47:47 +00:00
[tests] add tests for Border Routing Counters (#8341)
This commit adds tests for verifying the functionality of the D-BUS API `GetBorderRoutingCounters`.
This commit is contained in:
@@ -146,10 +146,14 @@ class TestMlr(thread_cert.TestCase):
|
||||
# ping MA1 from Host could generate a reply from R1 and R2
|
||||
self.assertTrue(self.nodes[HOST].ping(MA1, backbone=True, ttl=5))
|
||||
self.simulator.go(WAIT_REDUNDANCE)
|
||||
self.verify_border_routing_counters(self.nodes[PBBR1], {'inbound_multicast': 1, 'outbound_unicast': 1})
|
||||
self.verify_border_routing_counters(self.nodes[PBBR2], {'inbound_multicast': 1, 'outbound_unicast': 1})
|
||||
|
||||
# ping MA2 from R1 could generate a reply from Host and R2
|
||||
self.assertTrue(self.nodes[ROUTER1].ping(MA2))
|
||||
self.simulator.go(WAIT_REDUNDANCE)
|
||||
self.verify_border_routing_counters(self.nodes[PBBR1], {'inbound_unicast': 2, 'outbound_multicast': 1})
|
||||
self.verify_border_routing_counters(self.nodes[PBBR2], {'inbound_multicast': 1, 'outbound_unicast': 1})
|
||||
|
||||
# ping MA2 from R1's MLE-ID shouldn't generate a reply from Host or R2
|
||||
self.assertFalse(self.nodes[ROUTER1].ping(MA2, interface=self.nodes[ROUTER1].get_mleid()))
|
||||
@@ -241,6 +245,13 @@ class TestMlr(thread_cert.TestCase):
|
||||
# PBBR1 shouldn't forward the multicast ping request to the Backbone link
|
||||
pkts.filter_eth_src(PBBR1_ETH).filter_ping_request(ping_ma2_3.icmpv6.echo.identifier).must_not_next()
|
||||
|
||||
def verify_border_routing_counters(self, br, expect_delta):
|
||||
delta_counters = br.read_border_routing_counters_delta()
|
||||
self.assertEqual(set(delta_counters.keys()), set(expect_delta.keys()))
|
||||
for key in delta_counters:
|
||||
self.assertGreaterEqual(delta_counters[key][0], expect_delta[key])
|
||||
self.assertGreater(delta_counters[key][1], 0)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user