summaryrefslogtreecommitdiffstats
path: root/test/test_neighbor.py
diff options
context:
space:
mode:
authorNeale Ranns <neale@graphiant.com>2021-07-16 14:00:16 +0000
committerBeno�t Ganne <bganne@cisco.com>2022-08-09 14:17:46 +0000
commitfd2417b2a42e34062e3d07875e5c4e11922513d5 (patch)
treeeec1ea914c259f685e2bca897e5853faec9339c1 /test/test_neighbor.py
parent896b184b781a09ce5cefb94c471029c6a8d025aa (diff)
ip-neighbor: ARP and ND stats per-interface.
Type: feature stats of the like from: https://datatracker.ietf.org/doc/html/draft-ietf-rtgwg-arp-yang-model-03#section-4 Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: Icb1bf4f6f7e6ccc2f44b0008d4774b61cae96184
Diffstat (limited to 'test/test_neighbor.py')
-rw-r--r--test/test_neighbor.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/test_neighbor.py b/test/test_neighbor.py
index e1b37a0a124..64be36d739a 100644
--- a/test/test_neighbor.py
+++ b/test/test_neighbor.py
@@ -160,6 +160,30 @@ class ARPTestCase(VppTestCase):
self.assertEqual(ip.src, sip)
self.assertEqual(ip.dst, dip)
+ def get_arp_rx_requests(self, itf):
+ """Get ARP RX request stats for and interface"""
+ return self.statistics["/net/arp/rx/requests"][:, itf.sw_if_index].sum()
+
+ def get_arp_tx_requests(self, itf):
+ """Get ARP TX request stats for and interface"""
+ return self.statistics["/net/arp/tx/requests"][:, itf.sw_if_index].sum()
+
+ def get_arp_rx_replies(self, itf):
+ """Get ARP RX replies stats for and interface"""
+ return self.statistics["/net/arp/rx/replies"][:, itf.sw_if_index].sum()
+
+ def get_arp_tx_replies(self, itf):
+ """Get ARP TX replies stats for and interface"""
+ return self.statistics["/net/arp/tx/replies"][:, itf.sw_if_index].sum()
+
+ def get_arp_rx_garp(self, itf):
+ """Get ARP RX grat stats for and interface"""
+ return self.statistics["/net/arp/rx/gratuitous"][:, itf.sw_if_index].sum()
+
+ def get_arp_tx_garp(self, itf):
+ """Get ARP RX grat stats for and interface"""
+ return self.statistics["/net/arp/tx/gratuitous"][:, itf.sw_if_index].sum()
+
def test_arp(self):
"""ARP"""
@@ -208,6 +232,10 @@ class ARPTestCase(VppTestCase):
rx[0], self.pg1.local_mac, self.pg1.local_ip4, self.pg1._remote_hosts[1].ip4
)
+ self.logger.info(self.vapi.cli("sh ip neighbor-stats"))
+ self.logger.info(self.vapi.cli("sh ip neighbor-stats pg1"))
+ self.assert_equal(self.get_arp_tx_requests(self.pg1), 1)
+
#
# And a dynamic ARP entry for host 1
#
@@ -328,6 +356,7 @@ class ARPTestCase(VppTestCase):
self.verify_arp_req(
rx[0], self.pg1.local_mac, self.pg1.local_ip4, self.pg1._remote_hosts[1].ip4
)
+ self.assert_equal(self.get_arp_tx_requests(self.pg1), 2)
self.assertFalse(dyn_arp.query_vpp_config())
self.assertTrue(static_arp.query_vpp_config())
@@ -353,6 +382,9 @@ class ARPTestCase(VppTestCase):
self.pg1.local_ip4,
self.pg1._remote_hosts[3].ip4,
)
+ self.logger.info(self.vapi.cli("sh ip neighbor-stats pg1"))
+ self.assert_equal(self.get_arp_rx_requests(self.pg1), 1)
+ self.assert_equal(self.get_arp_tx_replies(self.pg1), 1)
#
# VPP should have learned the mapping for the remote host
@@ -1662,6 +1694,7 @@ class ARPTestCase(VppTestCase):
mac=self.pg1.remote_hosts[2].mac,
)
)
+ self.assert_equal(self.get_arp_rx_garp(self.pg1), 1)
#
# Send a GARP (reply) to swap the host 1's address to that of host 3
@@ -1686,6 +1719,7 @@ class ARPTestCase(VppTestCase):
mac=self.pg1.remote_hosts[3].mac,
)
)
+ self.assert_equal(self.get_arp_rx_garp(self.pg1), 2)
#
# GARPs (request nor replies) for host we don't know yet