test suite reviews and discussions
 help / color / mirror / Atom feed
From: "xu,gang" <gangx.xu@intel.com>
To: dts@dpdk.org
Cc: "xu,gang" <gangx.xu@intel.com>
Subject: [dts] [PATCH V1] add send a specified number of packages function
Date: Wed, 23 Nov 2016 11:11:02 +0800	[thread overview]
Message-ID: <1479870662-10369-1-git-send-email-gangx.xu@intel.com> (raw)

Signed-off-by: xu,gang <gangx.xu@intel.com>
---
 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):
         """
-- 
1.9.3

             reply	other threads:[~2016-11-23  3:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-23  3:11 xu,gang [this message]
2016-12-14  7:58 ` Liu, Yong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1479870662-10369-1-git-send-email-gangx.xu@intel.com \
    --to=gangx.xu@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).