summaryrefslogtreecommitdiffstats
path: root/test/test_ip6.py
diff options
context:
space:
mode:
authorBrian Russell <brian@graphiant.com>2021-01-27 14:45:22 +0000
committerNeale Ranns <neale@graphiant.com>2021-02-02 15:05:44 +0000
commite988726cbfb1b1f618c4034aa16e41364f9c48a2 (patch)
treed1e2846e60281d0e06b2dfa666c0aa5b2e213d3c /test/test_ip6.py
parenta71ed7869fa59884a61356a997cea81344c19dde (diff)
tests: verify policer stats in punt tests
Add verification of policer stats in the IP[46] punt paths. Type: test Signed-off-by: Brian Russell <brian@graphiant.com> Change-Id: I8b1035afc2d3abe4e98bdb3a76e87a0dd131ef4b
Diffstat (limited to 'test/test_ip6.py')
-rw-r--r--test/test_ip6.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/test_ip6.py b/test/test_ip6.py
index 2aab4defa64..a3da6650d8b 100644
--- a/test/test_ip6.py
+++ b/test/test_ip6.py
@@ -2248,6 +2248,13 @@ class TestIP6Punt(IP6PuntSetup, VppTestCase):
# but not equal to the number sent, since some were policed
#
rx = self.pg1._get_capture(1)
+ stats = policer.get_stats()
+
+ # Single rate policer - expect conform, violate but no exceed
+ self.assertGreater(stats['conform_packets'], 0)
+ self.assertEqual(stats['exceed_packets'], 0)
+ self.assertGreater(stats['violate_packets'], 0)
+
self.assertGreater(len(rx), 0)
self.assertLess(len(rx), len(pkts))
@@ -2352,6 +2359,24 @@ class TestIP6PuntHandoff(IP6PuntSetup, VppTestCase):
if worker == 0:
self.logger.debug(self.vapi.cli("show trace max 100"))
+ # Combined stats, all threads
+ stats = policer.get_stats()
+
+ # Single rate policer - expect conform, violate but no exceed
+ self.assertGreater(stats['conform_packets'], 0)
+ self.assertEqual(stats['exceed_packets'], 0)
+ self.assertGreater(stats['violate_packets'], 0)
+
+ # Worker 0, should have done all the policing
+ stats0 = policer.get_stats(worker=0)
+ self.assertEqual(stats, stats0)
+
+ # Worker 1, should have handed everything off
+ stats1 = policer.get_stats(worker=1)
+ self.assertEqual(stats1['conform_packets'], 0)
+ self.assertEqual(stats1['exceed_packets'], 0)
+ self.assertEqual(stats1['violate_packets'], 0)
+
#
# Clean up
#