summaryrefslogtreecommitdiffstats
path: root/test/framework.py
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2019-02-20 09:01:14 -0800
committerNeale Ranns <nranns@cisco.com>2019-02-20 19:05:46 +0000
commiteb414435a188ea9b36ada69b8ccc12fafbb04eca (patch)
treec99b4b657d5eb7eddff4d2f47d17d8d9cea43a8c /test/framework.py
parenta052b78da508e180fd92ccdb294909e7a076e669 (diff)
TESTS: refactor framework send_and_expect.
Create a common pg_send method for cases when results are just discarded. Change-Id: I786960d2d7bbb96dcb407f6e59aa96951b7b19e7 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'test/framework.py')
-rw-r--r--test/framework.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/test/framework.py b/test/framework.py
index 5b29ac47cf4..13f94d66354 100644
--- a/test/framework.py
+++ b/test/framework.py
@@ -954,11 +954,14 @@ class VppTestCase(unittest.TestCase):
"Finished sleep (%s) - slept %es (wanted %es)",
remark, after - before, timeout)
- def send_and_assert_no_replies(self, intf, pkts, remark="", timeout=None):
+ def pg_send(self, intf, pkts):
self.vapi.cli("clear trace")
intf.add_stream(pkts)
self.pg_enable_capture(self.pg_interfaces)
self.pg_start()
+
+ def send_and_assert_no_replies(self, intf, pkts, remark="", timeout=None):
+ self.pg_send(intf, pkts)
if not timeout:
timeout = 1
for i in self.pg_interfaces:
@@ -966,19 +969,13 @@ class VppTestCase(unittest.TestCase):
i.assert_nothing_captured(remark=remark)
timeout = 0.1
- def send_and_expect(self, input, pkts, output):
- self.vapi.cli("clear trace")
- input.add_stream(pkts)
- self.pg_enable_capture(self.pg_interfaces)
- self.pg_start()
+ def send_and_expect(self, intf, pkts, output):
+ self.pg_send(intf, pkts)
rx = output.get_capture(len(pkts))
return rx
- def send_and_expect_only(self, input, pkts, output, timeout=None):
- self.vapi.cli("clear trace")
- input.add_stream(pkts)
- self.pg_enable_capture(self.pg_interfaces)
- self.pg_start()
+ def send_and_expect_only(self, intf, pkts, output, timeout=None):
+ self.pg_send(intf, pkts)
rx = output.get_capture(len(pkts))
outputs = [output]
if not timeout: