hs-test: improve get stats
[vpp.git] / test / test_neighbor.py
index 503b1f1..b600a97 100644 (file)
@@ -4,7 +4,7 @@ import unittest
 import os
 from socket import AF_INET, AF_INET6, inet_pton
 
-from framework import tag_fixme_vpp_workers
+from framework import tag_fixme_vpp_workers, tag_fixme_ubuntu2204, tag_fixme_debian11
 from framework import VppTestCase, VppTestRunner
 from vpp_neighbor import VppNeighbor, find_nbr
 from vpp_ip_route import (
@@ -1762,6 +1762,10 @@ class ARPTestCase(VppTestCase):
         #
         self.pg2.configure_ipv4_neighbors()
 
+        cntr = self.statistics.get_err_counter(
+            "/err/arp-reply/l3_dst_address_not_local"
+        )
+
         for op in ["is-at", "who-has"]:
             p1 = [
                 (
@@ -1793,7 +1797,7 @@ class ARPTestCase(VppTestCase):
 
         # they are all dropped because the subnet's don't match
         self.assertEqual(
-            4,
+            cntr + 4,
             self.statistics.get_err_counter("/err/arp-reply/l3_dst_address_not_local"),
         )
 
@@ -2192,6 +2196,7 @@ class NeighborStatsTestCase(VppTestCase):
         self.assertEqual(NUM_PKTS + 16, nd1.get_stats()["packets"])
 
 
+@tag_fixme_ubuntu2204
 class NeighborAgeTestCase(VppTestCase):
     """ARP/ND Aging"""
 
@@ -2242,6 +2247,14 @@ class NeighborAgeTestCase(VppTestCase):
         self.assertEqual(arp.psrc, sip)
         self.assertEqual(arp.pdst, dip)
 
+    def verify_ip_neighbor_config(self, af, max_number, max_age, recycle):
+        config = self.vapi.ip_neighbor_config_get(af)
+
+        self.assertEqual(config.af, af)
+        self.assertEqual(config.max_number, max_number)
+        self.assertEqual(config.max_age, max_age)
+        self.assertEqual(config.recycle, recycle)
+
     def test_age(self):
         """Aging/Recycle"""
 
@@ -2257,6 +2270,13 @@ class NeighborAgeTestCase(VppTestCase):
         #
         self.pg_enable_capture(self.pg_interfaces)
 
+        #
+        # Verify neighbor configuration defaults
+        #
+        self.verify_ip_neighbor_config(
+            af=vaf.ADDRESS_IP4, max_number=50000, max_age=0, recycle=False
+        )
+
         #
         # Set the neighbor configuration:
         #   limi = 200
@@ -2266,6 +2286,9 @@ class NeighborAgeTestCase(VppTestCase):
         self.vapi.ip_neighbor_config(
             af=vaf.ADDRESS_IP4, max_number=200, max_age=0, recycle=False
         )
+        self.verify_ip_neighbor_config(
+            af=vaf.ADDRESS_IP4, max_number=200, max_age=0, recycle=False
+        )
 
         self.vapi.cli("sh ip neighbor-config")
 
@@ -2293,6 +2316,9 @@ class NeighborAgeTestCase(VppTestCase):
         self.vapi.ip_neighbor_config(
             af=vaf.ADDRESS_IP4, max_number=200, max_age=0, recycle=True
         )
+        self.verify_ip_neighbor_config(
+            af=vaf.ADDRESS_IP4, max_number=200, max_age=0, recycle=True
+        )
 
         # now new additions are allowed
         VppNeighbor(
@@ -2316,6 +2342,9 @@ class NeighborAgeTestCase(VppTestCase):
         self.vapi.ip_neighbor_config(
             af=vaf.ADDRESS_IP4, max_number=200, max_age=2, recycle=True
         )
+        self.verify_ip_neighbor_config(
+            af=vaf.ADDRESS_IP4, max_number=200, max_age=2, recycle=True
+        )
 
         self.vapi.cli("sh ip4 neighbor-sorted")
 
@@ -2394,6 +2423,9 @@ class NeighborAgeTestCase(VppTestCase):
         self.vapi.ip_neighbor_config(
             af=vaf.ADDRESS_IP4, max_number=200, max_age=1000, recycle=True
         )
+        self.verify_ip_neighbor_config(
+            af=vaf.ADDRESS_IP4, max_number=200, max_age=1000, recycle=True
+        )
 
         #
         # load up some neighbours again, then disable the aging
@@ -2409,6 +2441,9 @@ class NeighborAgeTestCase(VppTestCase):
         self.vapi.ip_neighbor_config(
             af=vaf.ADDRESS_IP4, max_number=200, max_age=0, recycle=False
         )
+        self.verify_ip_neighbor_config(
+            af=vaf.ADDRESS_IP4, max_number=200, max_age=0, recycle=False
+        )
 
         self.virtual_sleep(10)
         self.assertTrue(