From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id DEC5D2BF5 for ; Tue, 11 Dec 2018 02:40:29 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Dec 2018 17:40:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,340,1539673200"; d="scan'208";a="301067305" Received: from ubuntu.sh.intel.com ([10.67.119.125]) by fmsmga006.fm.intel.com with ESMTP; 10 Dec 2018 17:40:28 -0800 From: lihong To: dts@dpdk.org Cc: lihong Date: Tue, 11 Dec 2018 02:24:19 +0800 Message-Id: <1544466259-26531-1-git-send-email-lihongx.ma@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dts] [PATCH V2] Use tcpdump_sniff_packets instead of sniff method X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Dec 2018 01:40:30 -0000 The sniff method may not work well when add filter ether arguments, so use tcpdump_sniff_packets instead of it. Signed-off-by: lihong --- tests/TestSuite_short_live.py | 9 ++++----- tests/TestSuite_vxlan.py | 8 +++----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/tests/TestSuite_short_live.py b/tests/TestSuite_short_live.py index ca3643f..b3ec131 100644 --- a/tests/TestSuite_short_live.py +++ b/tests/TestSuite_short_live.py @@ -102,10 +102,7 @@ class TestShortLiveApp(TestCase): if (txPort == rxPort): count = 2 - self.tester.scapy_append('p=sniff(iface="%s", filter="ether[12:2]!=0x88cc", count=%d, timeout=5)' % (rxitf, count)) - self.tester.scapy_append('RESULT=str(p[%d].show)' % (count-1)) - - self.tester.scapy_foreground() + inst = self.tester.tcpdump_sniff_packets(rxitf, count=count, timeout=5) pktlen = pktSize - 14 padding = pktlen - 20 @@ -114,7 +111,9 @@ class TestShortLiveApp(TestCase): self.tester.scapy_execute() time.sleep(3) - out = self.tester.scapy_get_result() + pkts = self.tester.load_tcpdump_sniff_packets(inst) + out = str(pkts[0].pktgen.pkt.show) + self.logger.info('SCAPY Result:\n' + out + '\n\n\n') if received: self.verify(('PPP' in out) and 'src=%s'% Dut_tx_mac in out, "Receive test failed") else: diff --git a/tests/TestSuite_vxlan.py b/tests/TestSuite_vxlan.py index d5a9d77..8de8384 100644 --- a/tests/TestSuite_vxlan.py +++ b/tests/TestSuite_vxlan.py @@ -447,16 +447,14 @@ class TestVxlan(TestCase, IxiaPacketGenerator): config.create_pcap() # remove tempory files + config.capture_file = "/tmp/sniff_%s.pcap" % self.recv_iface self.tester.send_expect("rm -rf %s" % config.capture_file, "# ") # save the capture packet into pcap format self.tester.scapy_background() - self.tester.scapy_append( - 'p=sniff(iface="%s",filter="ether[12:2]!=0x88cc",count=1,timeout=5)' % self.recv_iface) - self.tester.scapy_append( - 'wrpcap(\"%s\", p)' % config.capture_file) - self.tester.scapy_foreground() + inst = self.tester.tcpdump_sniff_packets(self.recv_iface, timeout=5) config.send_pcap(self.tester_iface) + self.tester.load_tcpdump_sniff_packets(inst) time.sleep(5) # extract the checksum offload from saved pcap file -- 2.7.4