make test: rotate capture files after consuming arp/ndp 13/4513/2
authorKlement Sekera <ksekera@cisco.com>
Mon, 2 Jan 2017 09:18:34 +0000 (10:18 +0100)
committerDamjan Marion <dmarion.lists@gmail.com>
Mon, 2 Jan 2017 22:55:09 +0000 (22:55 +0000)
Change-Id: I512dc07638b4539d4a75e2ac40d3acee77f0bba6
Signed-off-by: Klement Sekera <ksekera@cisco.com>
test/test_flowperpkt.py
test/vpp_pg_interface.py

index 16fe2a3..29b3353 100644 (file)
@@ -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)
index d3db8d2..a79af03 100644 (file)
@@ -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")