From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw0-f172.google.com (mail-yw0-f172.google.com [209.85.161.172]) by dpdk.org (Postfix) with ESMTP id AA53158C8 for ; Fri, 2 Dec 2016 04:45:30 +0100 (CET) Received: by mail-yw0-f172.google.com with SMTP id a10so211284993ywa.3 for ; Thu, 01 Dec 2016 19:45:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=2MerM7LG1ODV7LzdYqSxjUuuaO0imxaBqpB8XWM+1QI=; b=R5oKVC5T/kryj6VUpTvM+SDX9XezpWonRs59L6tox7SWW+mCynUyzU1bcm+PHqznCL ihk31wV5PF4hgv6IYtKelxQ3PoVzYY/fa55kqNv/6ZDUelllYiMWkOut6yPGMSxkcTSY qZfMD5E/eZn5O2dZ7IAzhd8jg+VdmrLsCcq9s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=2MerM7LG1ODV7LzdYqSxjUuuaO0imxaBqpB8XWM+1QI=; b=W6cXoNvQFxPFp08ZpMmUX3E8fSLVEd+F+5ZokNjM/UMtWtQIRs54cWnDulYqQnl1fT XyFihvXYwKgJ5vzMcFzAr/vIPHJ9s1sAvM7nKDagasRYlgpdVRUgEAWmxM7BWhoKC5Rr 9nFe+9YWCUn7yVKXDo1r7f3hcC97LkwdIOtAzJUp1NsCNKzja9zSnkTV4aCDO/3qVDqM sJkgLxFR3yg6hw5V0CoN4iL75TBb8BBQPzwEKuuf1Ou545gPVqYsvH8W6wHD/zWJ6wBe qMx0fDBMaR2oeObKeQHx+Dv25MQbdCtSfZkL71Am/GPKqV64McKkPuBzU5nRt0o0gfBT yr0g== X-Gm-Message-State: AKaTC00UkHjTL+2H5T/N8sfWtN2VLE8hH7Imrij7VqUXLBLEUsYS1NgTfinAmJFWXcPAvjuazq9/XoYYX+zUQufX X-Received: by 10.13.255.5 with SMTP id p5mr48337262ywf.60.1480650330092; Thu, 01 Dec 2016 19:45:30 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.193.131 with HTTP; Thu, 1 Dec 2016 19:45:29 -0800 (PST) In-Reply-To: <86228AFD5BCD8E4EBFD2B90117B5E81E6033532C@SHSMSX103.ccr.corp.intel.com> References: <1480646757-13829-1-git-send-email-jianbo.liu@linaro.org> <86228AFD5BCD8E4EBFD2B90117B5E81E6033532C@SHSMSX103.ccr.corp.intel.com> From: Jianbo Liu Date: Fri, 2 Dec 2016 11:45:29 +0800 Message-ID: To: "Liu, Yong" Cc: "dts@dpdk.org" Content-Type: text/plain; charset=UTF-8 Subject: Re: [dts] [PATCH] tests mac_filter: use scapy to send packets 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: Fri, 02 Dec 2016 03:45:31 -0000 Hi Marvin, On 2 December 2016 at 11:27, Liu, Yong wrote: > Hi Jianbo, > Packet module is one abstract layer based on scapy. We abstracted this layer for monitoring scapy process and integrating sniff/configuration function. > It should work the same as scapy command. I'm interesting in why your intended to use scapy replace of Packet module. > I assume dts can be run on a different machine from tester. Am I right? But I got the following error, as the module sends packets through its local port, not the tester's port, but they are different if dts is not run on tester machine. ERROR: Test Case test_add_remove_mac_address Result ERROR: Traceback (most recent call last): File "/home/liujb/work/src/dts/framework/test_case.py", line 282, in _execute_test_case case_obj() File "/home/liujb/work/src/dts/tests/TestSuite_mac_filter.py", line 109, in test_add_remove_mac_address self.whitelist_send_packet(portid, self.dest) File "/home/liujb/work/src/dts/tests/TestSuite_mac_filter.py", line 91, in whitelist_send_packet pkt.send_pkt(tx_port=itf) File "/home/liujb/work/src/dts/framework/packet.py", line 464, in send_pkt self.pktgen.send_pkt(intf=self.tx_port) File "/home/liujb/work/src/dts/framework/packet.py", line 348, in send_pkt self.pkt.getlayer(0).src = get_if_hwaddr(intf) File "/usr/lib/python2.7/dist-packages/scapy/arch/__init__.py", line 39, in get_if_hwaddr addrfamily, mac = get_if_raw_hwaddr(iff) File "/usr/lib/python2.7/dist-packages/scapy/arch/linux.py", line 82, in get_if_raw_hwaddr return struct.unpack("16xh6s8x",get_if(iff,SIOCGIFHWADDR)) File "/usr/lib/python2.7/dist-packages/scapy/arch/linux.py", line 269, in get_if ifreq = ioctl(s, cmd, struct.pack("16s16x",iff)) IOError: [Errno 19] No such device > Thanks, > Marvin > >> -----Original Message----- >> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Jianbo Liu >> Sent: Friday, December 02, 2016 10:46 AM >> To: dts@dpdk.org >> Cc: Jianbo Liu >> Subject: [dts] [PATCH] tests mac_filter: use scapy to send packets >> >> Signed-off-by: Jianbo Liu >> --- >> tests/TestSuite_mac_filter.py | 7 ++++--- >> 1 file changed, 4 insertions(+), 3 deletions(-) >> >> diff --git a/tests/TestSuite_mac_filter.py b/tests/TestSuite_mac_filter.py >> index 1c58b87..a06b812 100644 >> --- a/tests/TestSuite_mac_filter.py >> +++ b/tests/TestSuite_mac_filter.py >> @@ -86,9 +86,10 @@ class TestWhitelist(TestCase): >> Send 1 packet to portid. >> """ >> itf = >> self.tester.get_interface(self.tester.get_local_port(portid)) >> - pkt = Packet(pkt_type='UDP') >> - pkt.config_layer('ether', {'src': '52:00:00:00:00:00', 'dst': >> destMac}) >> - pkt.send_pkt(tx_port=itf) >> + pkt = 'Ether(dst="%s", >> src="52:00:00:00:00:00")/IP()/UDP()/("X"*46)' % destMac >> + self.tester.send_expect("scapy", ">>> ") >> + self.tester.scapy_append('sendp([%s], iface="%s")' % (pkt, itf)) >> + self.tester.scapy_execute() >> >> def test_add_remove_mac_address(self): >> """ >> -- >> 1.9.1 >