ip: rate-limit the sending of ICMP error messages
[vpp.git] / test / framework.py
index 1c81e8a..257c85e 100644 (file)
@@ -1310,8 +1310,7 @@ class VppTestCase(CPUInterface, unittest.TestCase):
             if not timeout:
                 timeout = 1
             for i in self.pg_interfaces:
-                i.get_capture(0, timeout=timeout)
-                i.assert_nothing_captured(remark=remark)
+                i.assert_nothing_captured(timeout=timeout, remark=remark)
                 timeout = 0.1
         finally:
             if trace:
@@ -1353,6 +1352,17 @@ class VppTestCase(CPUInterface, unittest.TestCase):
             self.logger.debug(self.vapi.cli("show trace"))
         return rxs
 
+    def send_and_expect_some(self, intf, pkts, output,
+                             worker=None,
+                             trace=True):
+        self.pg_send(intf, pkts, worker=worker, trace=trace)
+        rx = output._get_capture(1)
+        if trace:
+            self.logger.debug(self.vapi.cli("show trace"))
+        self.assertTrue(len(rx) > 0)
+        self.assertTrue(len(rx) < len(pkts))
+        return rx
+
     def send_and_expect_only(self, intf, pkts, output, timeout=None,
                              stats_diff=None):
         if stats_diff:
@@ -1365,8 +1375,7 @@ class VppTestCase(CPUInterface, unittest.TestCase):
             timeout = 1
         for i in self.pg_interfaces:
             if i not in outputs:
-                i.get_capture(0, timeout=timeout)
-                i.assert_nothing_captured()
+                i.assert_nothing_captured(timeout=timeout)
                 timeout = 0.1
 
         if stats_diff: