From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 7F0A7370 for ; Wed, 14 Dec 2016 09:00:39 +0100 (CET) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP; 14 Dec 2016 00:00:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,345,1477983600"; d="scan'208";a="42328543" Received: from stv-crb-56.sh.intel.com (HELO [10.239.128.116]) ([10.239.128.116]) by fmsmga005.fm.intel.com with ESMTP; 14 Dec 2016 00:00:37 -0800 Message-ID: <5850FB94.60701@intel.com> Date: Wed, 14 Dec 2016 15:58:12 +0800 From: "Liu, Yong" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: "xu,gang" , dts@dpdk.org References: <1479870662-10369-1-git-send-email-gangx.xu@intel.com> In-Reply-To: <1479870662-10369-1-git-send-email-gangx.xu@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dts] [PATCH V1] add send a specified number of packages function 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: Wed, 14 Dec 2016 08:00:39 -0000 Applied, sorry for miss the mail. On 11/23/2016 11:11 AM, xu,gang wrote: > Signed-off-by: xu,gang > --- > framework/packet.py | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/framework/packet.py b/framework/packet.py > index 05a3d1f..f19a638 100755 > --- a/framework/packet.py > +++ b/framework/packet.py > @@ -327,12 +327,12 @@ class scapy(object): > except: > pass > > - def send_pcap_pkt(self, crb=None, file='', intf=''): > + def send_pcap_pkt(self, crb=None, file='', intf='', count=1): > if intf == '' or file == '' or crb is None: > print "Invalid option for send packet by scapy" > return > > - content = 'pkts=rdpcap(\"%s\");sendp(pkts, iface=\"%s\");exit()' % (file, intf) > + content = 'pkts=rdpcap(\"%s\");sendp(pkts, iface=\"%s\", count=\"%s\" );exit()' % (file, intf, count) > cmd_file = '/tmp/scapy_%s.cmd' % intf > > crb.create_file(content, cmd_file) > @@ -341,12 +341,12 @@ class scapy(object): > def print_summary(self): > print "Send out pkt %s" % self.pkt.summary() > > - def send_pkt(self, intf=''): > + def send_pkt(self, intf='', count=1): > self.print_summary() > if intf != '': > # fix fortville can't receive packets with 00:00:00:00:00:00 > self.pkt.getlayer(0).src = get_if_hwaddr(intf) > - sendp(self.pkt, iface=intf) > + sendp(self.pkt, iface=intf, count=count) > > > class Packet(object): > @@ -443,7 +443,7 @@ class Packet(object): > raw_confs['payload'] = payload > self.config_layer('raw', raw_confs) > > - def send_pkt(self, crb=None, tx_port='', auto_cfg=True): > + def send_pkt(self, crb=None, tx_port='', auto_cfg=True, count=1): > if tx_port == '': > print "Invalid Tx interface" > return > @@ -459,9 +459,9 @@ class Packet(object): > crb.session.copy_file_to(self.uni_name) > pcap_file = self.uni_name.split('/')[2] > self.pktgen.send_pcap_pkt( > - crb=crb, file=pcap_file, intf=self.tx_port) > + crb=crb, file=pcap_file, intf=self.tx_port, count=count) > else: > - self.pktgen.send_pkt(intf=self.tx_port) > + self.pktgen.send_pkt(intf=self.tx_port, count=count) > > def check_layer_config(self, layer, config): > """