[dts] [PATCH v2 04/17] tests/ipfrag: Replace sniff_packet to tester.tcpdump_sniff_packet

Phil Yang phil.yang at arm.com
Fri Mar 30 12:40:56 CEST 2018


Make sniff_packet running on the tester. Create a ssh connection to the
tester then call tcpdump.

Signed-off-by: Phil Yang <phil.yang at arm.com>
---
 tests/TestSuite_ipfrag.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tests/TestSuite_ipfrag.py b/tests/TestSuite_ipfrag.py
index f23dbe1..d5e8e5f 100644
--- a/tests/TestSuite_ipfrag.py
+++ b/tests/TestSuite_ipfrag.py
@@ -39,7 +39,6 @@ import string
 import re
 import time
 from settings import HEADER_SIZE
-from packet import Packet, sniff_packets, load_sniff_packets
 
 lpm_table_ipv4 = [
     "{IPv4(100,10,0,0), 16, P1}",
@@ -159,7 +158,7 @@ l3fwd_ipv4_route_array[] = {\\\n"
                 expPkts = 1
                 val = 2
 
-            inst = sniff_packets(intf=self.rxItf, timeout=5)
+            inst = self.tester.tcpdump_sniff_packets(intf=self.rxItf, timeout=5)
             # send packet
             for times in range(burst):
                 pkt_size = pkt_sizes[pkt_sizes.index(size) + times]
@@ -169,7 +168,8 @@ l3fwd_ipv4_route_array[] = {\\\n"
                 pkt.send_pkt(tx_port=self.txItf)
 
             # verify normal packet just by number, verify fragment packet by all elements
-            pkts = load_sniff_packets(inst)
+            self.tester.session.copy_file_from("/tmp/sniff_%s.pcap" % self.rxItf, "/tmp/")
+            pkts = self.tester.load_tcpdump_sniff_packets(inst)
             self.verify(len(pkts) == expPkts, "Failed on forward packet size " + str(size))
             if flag == 'frag':
                 idx = 1
@@ -209,7 +209,7 @@ l3fwd_ipv4_route_array[] = {\\\n"
                 expPkts = 1
                 val = 2
 
-            inst = sniff_packets(intf=self.rxItf, timeout=5)
+            inst = self.tester.tcpdump_sniff_packets(intf=self.rxItf, timeout=5)
             # send packet
             for times in range(burst):
                 pkt_size = pkt_sizes[pkt_sizes.index(size) + times]
@@ -219,7 +219,8 @@ l3fwd_ipv4_route_array[] = {\\\n"
                 pkt.send_pkt(tx_port=self.txItf)
 
             # verify normal packet just by number, verify fragment packet by all elements
-            pkts = load_sniff_packets(inst)
+            self.tester.session.copy_file_from("/tmp/sniff_%s.pcap" % self.rxItf, "/tmp/")
+            pkts = self.tester.load_tcpdump_sniff_packets(inst)
             self.verify(len(pkts) == expPkts, "Failed on forward packet size " + str(size))
             if flag == 'frag':
                 idx = 1
-- 
2.7.4



More information about the dts mailing list