test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [[patch v1]] framework/etgen.py: add in a function for ixia to send fixed number of packets
@ 2017-09-08 12:07 wang fei
  2017-09-11  1:21 ` Liu, Yong
  0 siblings, 1 reply; 2+ messages in thread
From: wang fei @ 2017-09-08 12:07 UTC (permalink / raw)
  To: dts; +Cc: wang fei

Signed-off-by: wang fei <feix.y.wang@intel.com>
---
 framework/etgen.py | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/framework/etgen.py b/framework/etgen.py
index f45a96e..7ee24ac 100644
--- a/framework/etgen.py
+++ b/framework/etgen.py
@@ -141,7 +141,6 @@ class IxiaPacketGenerator(SSHConnection):
         self.logger = getLogger(self.NAME)
         super(IxiaPacketGenerator, self).__init__(self.get_ip_address(),
                                                   self.NAME,
-                                                  self.get_username(),
                                                   self.get_password())
         super(IxiaPacketGenerator, self).init_log(self.logger)
 
@@ -869,3 +868,35 @@ class IxiaPacketGenerator(SSHConnection):
         retrieved capture buffer. Call packetGroupStats get before.
         """
         return self._packetgroup_cget_value('averageLatency')
+    
+    def send_packets(self,portList,ratePercent,packetNum,delay=5,runTime=60):
+        """
+        configure ixia to send fixed number of packets for each tx port
+        and returns the throughput for rx ports
+        """
+        rxPortlist, txPortlist = self._configure_everything(portList, ratePercent)
+        time.sleep(delay)
+        self.send_expect("ixStopTransmit portList","%",5)
+        
+        self.send_expect("stream config -numFrames %s" % packetNum,"%",5)
+        self.send_expect("stream config -dma stopStream","%",5)
+        for txPort in txPortlist:
+            port = self.pci_to_port(self.tester.get_pci(txPort))
+            self.send_expect("stream set %d %d %d 1" % (self.chasId, port['card'], port['port']),"%",5)
+
+        self.send_expect("ixWritePortsToHardware portList","%",5)
+        self.send_expect("ixClearStats portList","%",5)
+        self.send_expect("ixStartTransmit portList","%",5)
+        time.sleep(runTime)
+        time.sleep(3)
+		
+        txPackets = 0
+        rxPackets = 0
+        for port in txPortlist:
+            self.stat_get_stat_all_stats(port)
+            txPackets += self.get_frames_sent()
+            rxPackets += self.get_frames_received()
+        self.logger.info("Transmitted packets :%s" % txPackets)
+        self.logger.info("Received packets :%s" % rxPackets)
+		
+        return txPackets,rxPackets
-- 
2.7.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dts] [[patch v1]] framework/etgen.py: add in a function for ixia to send fixed number of packets
  2017-09-08 12:07 [dts] [[patch v1]] framework/etgen.py: add in a function for ixia to send fixed number of packets wang fei
@ 2017-09-11  1:21 ` Liu, Yong
  0 siblings, 0 replies; 2+ messages in thread
From: Liu, Yong @ 2017-09-11  1:21 UTC (permalink / raw)
  To: Wang, FeiX Y, dts; +Cc: Wang, FeiX Y

Fei, some comments below.

Thanks,
Marvin

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of wang fei
> Sent: Friday, September 08, 2017 8:07 PM
> To: dts@dpdk.org
> Cc: Wang, FeiX Y <feix.y.wang@intel.com>
> Subject: [dts] [[patch v1]] framework/etgen.py: add in a function for ixia
> to send fixed number of packets
> 
> Signed-off-by: wang fei <feix.y.wang@intel.com>
> ---
>  framework/etgen.py | 33 ++++++++++++++++++++++++++++++++-
>  1 file changed, 32 insertions(+), 1 deletion(-)
> 
> diff --git a/framework/etgen.py b/framework/etgen.py
> index f45a96e..7ee24ac 100644
> --- a/framework/etgen.py
> +++ b/framework/etgen.py
> @@ -141,7 +141,6 @@ class IxiaPacketGenerator(SSHConnection):
>          self.logger = getLogger(self.NAME)
>          super(IxiaPacketGenerator, self).__init__(self.get_ip_address(),
>                                                    self.NAME,
> -                                                  self.get_username(),
>                                                    self.get_password())
>          super(IxiaPacketGenerator, self).init_log(self.logger)
> 
> @@ -869,3 +868,35 @@ class IxiaPacketGenerator(SSHConnection):
>          retrieved capture buffer. Call packetGroupStats get before.
>          """
>          return self._packetgroup_cget_value('averageLatency')
> +
> +    def
> send_packets(self,portList,ratePercent,packetNum,delay=5,runTime=60):

Please add space after each parameter for PEP alignment.

> +        """
> +        configure ixia to send fixed number of packets for each tx port
> +        and returns the throughput for rx ports
> +        """
> +        rxPortlist, txPortlist = self._configure_everything(portList,
> ratePercent)
> +        time.sleep(delay)
> +        self.send_expect("ixStopTransmit portList","%",5)
> +
> +        self.send_expect("stream config -numFrames %s" % packetNum,"%",5)
> +        self.send_expect("stream config -dma stopStream","%",5)

Look like it will not work for multiple streams, is this function support that? If not, please add check or rename the function.

> +        for txPort in txPortlist:
> +            port = self.pci_to_port(self.tester.get_pci(txPort))
> +            self.send_expect("stream set %d %d %d 1" % (self.chasId,
> port['card'], port['port']),"%",5)
> +
> +        self.send_expect("ixWritePortsToHardware portList","%",5)
> +        self.send_expect("ixClearStats portList","%",5)
> +        self.send_expect("ixStartTransmit portList","%",5)
> +        time.sleep(runTime)
> +        time.sleep(3)

Sleep 60 seconds cannot assure that all packets transmitted. And most of cases will waste time for waiting.
You can add one while loop here and break the loop when transmitted packets equal to "packetNum". 


> +
> +        txPackets = 0
> +        rxPackets = 0
> +        for port in txPortlist:
> +            self.stat_get_stat_all_stats(port)
> +            txPackets += self.get_frames_sent()
> +            rxPackets += self.get_frames_received()
> +        self.logger.info("Transmitted packets :%s" % txPackets)
> +        self.logger.info("Received packets :%s" % rxPackets)
> +
> +        return txPackets,rxPackets
> --
> 2.7.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-11  1:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-08 12:07 [dts] [[patch v1]] framework/etgen.py: add in a function for ixia to send fixed number of packets wang fei
2017-09-11  1:21 ` Liu, Yong

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).