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/test_flowperpkt.py | 2 +- test/vpp_pg_interface.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/test_flowperpkt.py b/test/test_flowperpkt.py index 16fe2a3e259..29b3353b199 100644 --- a/test/test_flowperpkt.py +++ b/test/test_flowperpkt.py @@ -164,7 +164,7 @@ class TestFlowperpkt(VppTestCase): # Flush the ipfix collector, so we don't need any # asinine time.sleep(5) action - self.vapi.cli("ipfix flush") # FIXME this should be an API call + self.vapi.cli("ipfix flush") # Make sure the 4 pkts we expect actually showed up self.verify_ipfix(self.pg2) diff --git a/test/vpp_pg_interface.py b/test/vpp_pg_interface.py index d3db8d208a3..a79af037098 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