Skip to content

Commit

Permalink
[tests] verify the RA/RS fields in border routing counters (openthrea…
Browse files Browse the repository at this point in the history
  • Loading branch information
superwhd authored Dec 13, 2022
1 parent 98e644d commit c5ee313
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
14 changes: 11 additions & 3 deletions tests/scripts/thread-cert/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit c5ee313

Please sign in to comment.