From a913534837441c59e3f7717089f57fdbcda476b9 Mon Sep 17 00:00:00 2001 From: Klement Sekera Date: Mon, 2 Jan 2017 10:18:34 +0100 Subject: make test: rotate capture files after consuming arp/ndp Change-Id: I512dc07638b4539d4a75e2ac40d3acee77f0bba6 Signed-off-by: Klement Sekera --- test/vpp_pg_interface.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'test/vpp_pg_interface.py') diff --git a/test/vpp_pg_interface.py b/test/vpp_pg_interface.py index d3db8d20..a79af037 100644 --- a/test/vpp_pg_interface.py +++ b/test/vpp_pg_interface.py @@ -91,8 +91,7 @@ class VppPGInterface(VppInterface): self._input_cli = "packet-generator new pcap %s source pg%u name %s" % ( self.in_path, self.pg_index, self.cap_name) - def enable_capture(self): - """ Enable capture on this packet-generator interface""" + def rotate_out_file(self): try: if os.path.isfile(self.out_path): os.rename(self.out_path, @@ -104,6 +103,10 @@ class VppPGInterface(VppInterface): self._out_file)) except: pass + + def enable_capture(self): + """ Enable capture on this packet-generator interface""" + self.rotate_out_file() # FIXME this should be an API, but no such exists atm self.test.vapi.cli(self.capture_cli) self._pcap_reader = None @@ -328,6 +331,7 @@ class VppPGInterface(VppInterface): self.test.logger.info("No ARP received on port %s" % pg_interface.name) return + self.rotate_out_file() arp_reply = captured_packet.copy() # keep original for exception # Make Dot1AD packet content recognizable to scapy if arp_reply.type == 0x88a8: @@ -387,6 +391,7 @@ class VppPGInterface(VppInterface): self._local_mac = opt.lladdr self.test.logger.debug(self.test.vapi.cli("show trace")) # we now have the MAC we've been after + self.rotate_out_file() return except: self.test.logger.info( @@ -394,4 +399,5 @@ class VppPGInterface(VppInterface): now = time.time() self.test.logger.debug(self.test.vapi.cli("show trace")) + self.rotate_out_file() raise Exception("Timeout while waiting for NDP response") -- cgit 1.2.3-korg