aboutsummaryrefslogtreecommitdiffstats
path: root/test/framework.py
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2021-03-31 13:36:38 +0200
committerAndrew Yourtchenko <ayourtch@gmail.com>2021-04-01 15:29:42 +0000
commit7ba9fae5540f3490cea8258cc7830138b58d2740 (patch)
tree8f61463d3502d85f809567d02c65368ed491da67 /test/framework.py
parent87d81ae60c45d422e9b29343ad7cec881c3eb470 (diff)
tests: support injecting multiple worker pcaps on one PG
This change allows one to inject multiple streams for different workers on the same PG interface at the same time. Type: improvement Change-Id: I29d80369aabada261eda466e5a5d8d3518bb8bc8 Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'test/framework.py')
-rw-r--r--test/framework.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/test/framework.py b/test/framework.py
index f3c74ceec3e..5e39854ac42 100644
--- a/test/framework.py
+++ b/test/framework.py
@@ -581,6 +581,7 @@ class VppTestCase(unittest.TestCase):
cls.setUpConstants()
cls.reset_packet_infos()
cls._captures = []
+ cls._old_captures = []
cls.verbose = 0
cls.vpp_dead = False
cls.registry = VppObjectRegistry()
@@ -814,10 +815,10 @@ class VppTestCase(unittest.TestCase):
i.enable_capture()
@classmethod
- def register_capture(cls, cap_name):
+ def register_capture(cls, intf, worker):
""" Register a capture in the testclass """
# add to the list of captures with current timestamp
- cls._captures.append((time.time(), cap_name))
+ cls._captures.append((intf, worker))
@classmethod
def get_vpp_time(cls):
@@ -841,6 +842,10 @@ class VppTestCase(unittest.TestCase):
@classmethod
def pg_start(cls, trace=True):
""" Enable the PG, wait till it is done, then clean up """
+ for (intf, worker) in cls._old_captures:
+ intf.rename_previous_capture_file(intf.get_in_path(worker),
+ intf.in_history_counter)
+ cls._old_captures = []
if trace:
cls.vapi.cli("clear trace")
cls.vapi.cli("trace add pg-input 1000")
@@ -855,8 +860,10 @@ class VppTestCase(unittest.TestCase):
if time.time() > deadline:
cls.logger.error("Timeout waiting for pg to stop")
break
- for stamp, cap_name in cls._captures:
- cls.vapi.cli('packet-generator delete %s' % cap_name)
+ for intf, worker in cls._captures:
+ cls.vapi.cli('packet-generator delete %s' %
+ intf.get_cap_name(worker))
+ cls._old_captures = cls._captures
cls._captures = []
@classmethod