aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_ip6.py
diff options
context:
space:
mode:
authorBrian Russell <brian@graphiant.com>2021-02-10 13:56:06 +0000
committerNeale Ranns <neale@graphiant.com>2021-02-15 12:15:41 +0000
commitbb9831403bbedf8a058fd5aa4add449b4b09bbdd (patch)
tree694108ac1126e2c8107b55fd482556a0c2a9d67b /test/test_ip6.py
parent48e26367cfe731d31472e18c1e0f6fe94bc4e9c3 (diff)
tests: test punt policer bound to worker thread
Add to the IP[46] punt policer handoff tests by binding the policer to a particular worker and checking all packets are policed on that thread. Type: test Signed-off-by: Brian Russell <brian@graphiant.com> Change-Id: I7fab28659ccb65f13f841cec65a3f808281b3f90
Diffstat (limited to 'test/test_ip6.py')
-rw-r--r--test/test_ip6.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/test_ip6.py b/test/test_ip6.py
index a3da6650d8b..8a2b332d167 100644
--- a/test/test_ip6.py
+++ b/test/test_ip6.py
@@ -2377,6 +2377,50 @@ class TestIP6PuntHandoff(IP6PuntSetup, VppTestCase):
self.assertEqual(stats1['exceed_packets'], 0)
self.assertEqual(stats1['violate_packets'], 0)
+ # Bind the policer to worker 1 and repeat
+ policer.bind_vpp_config(1, True)
+ for worker in [0, 1]:
+ self.send_and_expect(self.pg0, pkts, self.pg1, worker=worker)
+ self.logger.debug(self.vapi.cli("show trace max 100"))
+
+ # The 2 workers should now have policed the same amount
+ stats = policer.get_stats()
+ stats0 = policer.get_stats(worker=0)
+ stats1 = policer.get_stats(worker=1)
+
+ self.assertGreater(stats0['conform_packets'], 0)
+ self.assertEqual(stats0['exceed_packets'], 0)
+ self.assertGreater(stats0['violate_packets'], 0)
+
+ self.assertGreater(stats1['conform_packets'], 0)
+ self.assertEqual(stats1['exceed_packets'], 0)
+ self.assertGreater(stats1['violate_packets'], 0)
+
+ self.assertEqual(stats0['conform_packets'] + stats1['conform_packets'],
+ stats['conform_packets'])
+
+ self.assertEqual(stats0['violate_packets'] + stats1['violate_packets'],
+ stats['violate_packets'])
+
+ # Unbind the policer and repeat
+ policer.bind_vpp_config(1, False)
+ for worker in [0, 1]:
+ self.send_and_expect(self.pg0, pkts, self.pg1, worker=worker)
+ self.logger.debug(self.vapi.cli("show trace max 100"))
+
+ # The policer should auto-bind to worker 0 when packets arrive
+ stats = policer.get_stats()
+ stats0new = policer.get_stats(worker=0)
+ stats1new = policer.get_stats(worker=1)
+
+ self.assertGreater(stats0new['conform_packets'],
+ stats0['conform_packets'])
+ self.assertEqual(stats0new['exceed_packets'], 0)
+ self.assertGreater(stats0new['violate_packets'],
+ stats0['violate_packets'])
+
+ self.assertEqual(stats1, stats1new)
+
#
# Clean up
#