aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2021-04-01 18:19:29 +0200
committerKlement Sekera <ksekera@cisco.com>2021-04-09 21:12:46 +0000
commit3ff6ffce032544b4ffc3e42b5e069243681ae751 (patch)
tree013a5e436e4d167395bb759f0119cdddfc1caf7e
parente4db945e1cd960f94f3e3f3d1049fd98cfadbeb1 (diff)
tests: improve naming
Change capture to pcap to remove confusion in framework.py Type: improvement Signed-off-by: Klement Sekera <ksekera@cisco.com> Change-Id: Idf8bd61f174b8b2df3bbd13908e54d597da4a83b
-rw-r--r--test/framework.py24
-rwxr-xr-xtest/vpp_pg_interface.py8
2 files changed, 15 insertions, 17 deletions
diff --git a/test/framework.py b/test/framework.py
index 5e39854ac42..8e50a467834 100644
--- a/test/framework.py
+++ b/test/framework.py
@@ -580,8 +580,8 @@ class VppTestCase(unittest.TestCase):
cls.logger.debug("Random seed is %s" % seed)
cls.setUpConstants()
cls.reset_packet_infos()
- cls._captures = []
- cls._old_captures = []
+ cls._pcaps = []
+ cls._old_pcaps = []
cls.verbose = 0
cls.vpp_dead = False
cls.registry = VppObjectRegistry()
@@ -815,10 +815,10 @@ class VppTestCase(unittest.TestCase):
i.enable_capture()
@classmethod
- def register_capture(cls, intf, worker):
- """ Register a capture in the testclass """
+ def register_pcap(cls, intf, worker):
+ """ Register a pcap in the testclass """
# add to the list of captures with current timestamp
- cls._captures.append((intf, worker))
+ cls._pcaps.append((intf, worker))
@classmethod
def get_vpp_time(cls):
@@ -842,10 +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 = []
+ for (intf, worker) in cls._old_pcaps:
+ intf.rename_old_pcap_file(intf.get_in_path(worker),
+ intf.in_history_counter)
+ cls._old_pcaps = []
if trace:
cls.vapi.cli("clear trace")
cls.vapi.cli("trace add pg-input 1000")
@@ -860,11 +860,11 @@ class VppTestCase(unittest.TestCase):
if time.time() > deadline:
cls.logger.error("Timeout waiting for pg to stop")
break
- for intf, worker in cls._captures:
+ for intf, worker in cls._pcaps:
cls.vapi.cli('packet-generator delete %s' %
intf.get_cap_name(worker))
- cls._old_captures = cls._captures
- cls._captures = []
+ cls._old_pcaps = cls._pcaps
+ cls._pcaps = []
@classmethod
def create_pg_interfaces(cls, interfaces, gso=0, gso_size=0):
diff --git a/test/vpp_pg_interface.py b/test/vpp_pg_interface.py
index c8debff0301..3bcde9319a8 100755
--- a/test/vpp_pg_interface.py
+++ b/test/vpp_pg_interface.py
@@ -132,8 +132,7 @@ class VppPGInterface(VppInterface):
self._cap_name = "pcap%u-sw_if_index-%s" % (
self.pg_index, self.sw_if_index)
- def rename_previous_capture_file(self, path, counter):
- # if a file from a previous capture exists, rename it.
+ def rename_old_pcap_file(self, path, counter):
filename = os.path.basename(path)
try:
if os.path.isfile(path):
@@ -157,8 +156,7 @@ class VppPGInterface(VppInterface):
"""
# disable the capture to flush the capture
self.disable_capture()
- self.rename_previous_capture_file(self.out_path,
- self.out_history_counter)
+ self.rename_old_pcap_file(self.out_path, self.out_history_counter)
# FIXME this should be an API, but no such exists atm
self.test.vapi.cli(self.capture_cli)
self._pcap_reader = None
@@ -186,7 +184,7 @@ class VppPGInterface(VppInterface):
"""
wrpcap(self.get_in_path(worker), pkts)
- self.test.register_capture(self, worker)
+ self.test.register_pcap(self, worker)
# FIXME this should be an API, but no such exists atm
self.test.vapi.cli(self.get_input_cli(nb_replays, worker))