From c5ee31350008ed6784d3be023093f62e9f761600 Mon Sep 17 00:00:00 2001 From: whd <7058128+superwhd@users.noreply.github.com> Date: Tue, 13 Dec 2022 08:18:13 +0800 Subject: [PATCH] [tests] verify the RA/RS fields in border routing counters (#8494) --- .../border_router/test_multi_thread_networks.py | 3 +++ tests/scripts/thread-cert/node.py | 14 +++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/scripts/thread-cert/border_router/test_multi_thread_networks.py b/tests/scripts/thread-cert/border_router/test_multi_thread_networks.py index 63992ae6570..d7ebc80665a 100755 --- a/tests/scripts/thread-cert/border_router/test_multi_thread_networks.py +++ b/tests/scripts/thread-cert/border_router/test_multi_thread_networks.py @@ -151,6 +151,9 @@ def test(self): self.assertTrue(router2.ping(router1.get_ip6_address(config.ADDRESS_TYPE.OMR)[0])) self.verify_border_routing_counters(br1, {'inbound_unicast': 1, 'outbound_unicast': 1}) self.verify_border_routing_counters(br2, {'inbound_unicast': 1, 'outbound_unicast': 1}) + self.assertGreater(br1.get_border_routing_counters()['ra_rx'], 0) + self.assertGreater(br1.get_border_routing_counters()['ra_tx_success'], 0) + self.assertGreater(br1.get_border_routing_counters()['rs_tx_success'], 0) def verify_border_routing_counters(self, br, expect_delta): delta_counters = br.read_border_routing_counters_delta() diff --git a/tests/scripts/thread-cert/node.py b/tests/scripts/thread-cert/node.py index 8b6ae87d5af..1904c7199e4 100755 --- a/tests/scripts/thread-cert/node.py +++ b/tests/scripts/thread-cert/node.py @@ -382,9 +382,15 @@ def get_border_routing_counters(self): 'inbound_unicast': counters[0], 'inbound_multicast': counters[1], 'outbound_unicast': counters[2], - 'outbound_multicast': counters[3] + 'outbound_multicast': counters[3], + 'ra_rx': counters[4], + 'ra_tx_success': counters[5], + 'ra_tx_failure': counters[6], + 'rs_rx': counters[7], + 'rs_tx_success': counters[8], + 'rs_tx_failure': counters[9], } - logging.info(f'counters = {counters} ') + logging.info(f'border routing counters: {counters}') return counters def _process_traffic_counters(self, counter): @@ -469,7 +475,9 @@ def read_border_routing_counters_delta(self): assert (key in new_counters) value = [new_counters[key][0] - old_counters[key][0], new_counters[key][1] - old_counters[key][1]] delta_counters[key] = value - delta_counters = {key: value for key, value in delta_counters.items() if value[0] and value[1]} + delta_counters = { + key: value for key, value in delta_counters.items() if not isinstance(value, int) and value[0] and value[1] + } return delta_counters