test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [DTS][PATCH V1 1/2] update packet checking case, send 2000 random packets, check dut not loss packet
@ 2016-02-04  3:22 xu,huilong
  2016-02-04  3:22 ` [dts] [DTS][PATCH V1 2/2] creat a pcap file include 2000 random packet, used scapy send the pcap, and " xu,huilong
  2016-02-24  1:42 ` [dts] [DTS][PATCH V1 1/2] update packet checking case, send 2000 random packets, " Tang, HaifengX
  0 siblings, 2 replies; 5+ messages in thread
From: xu,huilong @ 2016-02-04  3:22 UTC (permalink / raw)
  To: dts

Signed-off-by: xu,huilong <huilongx.xu@intel.com>
---
 test_plans/pmd_test_plan.rst | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/test_plans/pmd_test_plan.rst b/test_plans/pmd_test_plan.rst
index 1073149..c5e346e 100644
--- a/test_plans/pmd_test_plan.rst
+++ b/test_plans/pmd_test_plan.rst
@@ -82,10 +82,8 @@ The linuxapp is started with the following parameters:
   --rxpt=4 --rxht=4 --rxwt=16 --txpt=36 --txht=0 --txwt=0 --txrst=32
 
 
-The tester sends packets with different sizes (64, 65, 128, 256, 512, 1024,
-1280 and 1518 bytes), using scapy, which will be forwarded by the DUT.
-The test checks if the packets are correctly forwarded and if both RX and TX
-packet sizes match.
+The tester sends 2000 packets with different type, using scapy, which will be forwarded by the DUT.
+The test checks if the packets are correctly forwarded and if both RX and TX packet number is 2000
 
 Test Case: Descriptors Checking
 ===============================
-- 
1.9.3

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

* [dts] [DTS][PATCH V1 2/2] creat a pcap file include 2000 random packet, used scapy send the pcap, and check dut not loss packet
  2016-02-04  3:22 [dts] [DTS][PATCH V1 1/2] update packet checking case, send 2000 random packets, check dut not loss packet xu,huilong
@ 2016-02-04  3:22 ` xu,huilong
  2016-02-15  1:55   ` Xu, HuilongX
  2016-02-24  1:42 ` [dts] [DTS][PATCH V1 1/2] update packet checking case, send 2000 random packets, " Tang, HaifengX
  1 sibling, 1 reply; 5+ messages in thread
From: xu,huilong @ 2016-02-04  3:22 UTC (permalink / raw)
  To: dts

Signed-off-by: xu,huilong <huilongx.xu@intel.com>
---
 tests/TestSuite_pmd.py | 55 +++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 50 insertions(+), 5 deletions(-)

diff --git a/tests/TestSuite_pmd.py b/tests/TestSuite_pmd.py
index eeec53f..7a8df89 100644
--- a/tests/TestSuite_pmd.py
+++ b/tests/TestSuite_pmd.py
@@ -1,6 +1,6 @@
 # BSD LICENSE
 #
-# Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+# Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -37,12 +37,14 @@ Test userland 10Gb PMD
 import dts
 import re
 import time
+import random
 from test_case import TestCase
 from plotting import Plotting
 from time import sleep
 from settings import HEADER_SIZE
 from pmd_output import PmdOutput
 from etgen import IxiaPacketGenerator
+from scapy.all import *
 
 class TestPmd(TestCase,IxiaPacketGenerator):
 
@@ -81,6 +83,8 @@ class TestPmd(TestCase,IxiaPacketGenerator):
         self.frame_sizes = [64, 65, 128, 256, 512, 1024, 1280, 1518]
 
         self.rxfreet_values = [0, 8, 16, 32, 64, 128]
+        
+        self.total_packets = 2000
 
         self.test_cycles = [{'cores': '1S/1C/1T', 'Mpps': {}, 'pct': {}},
                             {'cores': '1S/2C/1T', 'Mpps': {}, 'pct': {}},
@@ -113,7 +117,37 @@ class TestPmd(TestCase,IxiaPacketGenerator):
         Run before each test case.
         """
         pass
-
+    def random_ip(self, iptype):
+        tmp = []
+        if 'ipv4' == iptype:
+            for i in range(4):
+                tmp.append(str(random.randint(10, 254)))
+            return '.'.join(tmp)
+        if 'ipv6' == iptype:
+            for i in range(8):
+                tmp.append(str(hex(random.randint(0, 65535)))[2:])
+            return ':'.join(tmp)
+        else:
+            self.logger.warning("invalid ip type: %s" % iptype)    
+    def creat_pcap(self, filename, dst_mac, tx_intf):
+        packets = []
+        packet_type = [Ether(dst="%s" % dst_mac, src=get_if_hwaddr(tx_intf))/IP(src="%s" % self.random_ip("ipv4"), dst="%s" % self.random_ip("ipv4"))/("X"), #ipv4 packet
+                       Ether(dst="%s" % dst_mac, src=get_if_hwaddr(tx_intf))/IP(src="%s" % self.random_ip("ipv4"), dst="%s" % self.random_ip("ipv4"))/TCP()/("X"), #ipv4 tcp packet
+                       Ether(dst="%s" % dst_mac, src=get_if_hwaddr(tx_intf))/IP(src="%s" % self.random_ip("ipv4"), dst="%s" % self.random_ip("ipv4"))/UDP()/("X"), #ipv4 udp packet
+                       Ether(dst="%s" % dst_mac, src=get_if_hwaddr(tx_intf))/IP(src="%s" % self.random_ip("ipv4"), dst="%s" % self.random_ip("ipv4"))/SCTP(tag=1)/("X"),#ipv4 sctp packet
+                       Ether(dst="%s" % dst_mac, src=get_if_hwaddr(tx_intf))/("X"), # l2 packet
+                       Ether(dst="%s" % dst_mac, src=get_if_hwaddr(tx_intf))/IPv6(src="%s" % self.random_ip("ipv6"), dst="%s" % self.random_ip("ipv6"))/("X"), # ipv6 packet
+                       Ether(dst="%s" % dst_mac, src=get_if_hwaddr(tx_intf))/IPv6(src="%s" % self.random_ip("ipv6"), dst="%s" % self.random_ip("ipv6"))/UDP()/("X"), #ipv6 udp packet
+                       Ether(dst="%s" % dst_mac, src=get_if_hwaddr(tx_intf))/IPv6(src="%s" % self.random_ip("ipv6"), dst="%s" % self.random_ip("ipv6"))/TCP()/("X"), # ipv6 tcp packet
+                       Ether(dst="%s" % dst_mac, src=get_if_hwaddr(tx_intf))/IPv6(src="%s" % self.random_ip("ipv6"), dst="%s" % self.random_ip("ipv6"))/SCTP(tag=1)/("X"), # ipv6 sctp packet
+                      ]
+        for packet in packet_type:
+            for i in range(self.total_packets / len(packet_type)): 
+                packets.append(packet)
+        for i in range(self.total_packets % len(packet_type)):
+            packets.append(packet_type[random.randint(0, len(packet_type) - 1)])
+        wrpcap(filename, packets)
+        self.tester.session.copy_file_to(filename)
     def test_perf_pmd_performance_4ports(self):
         """
         PMD Performance Benchmarking with 4 ports.
@@ -322,11 +356,22 @@ class TestPmd(TestCase,IxiaPacketGenerator):
         port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]])
 
         self.pmdout.start_testpmd("1S/2C/1T", "--portmask=%s" % port_mask, socket=self.ports_socket)
+       
+        self.dut.send_expect("set fwd mac", "testpmd> ")
         self.dut.send_expect("start", "testpmd> ")
-        for size in self.frame_sizes:
-            self.send_packet(size)
+        interface = self.tester.get_interface(
+            self.tester.get_local_port(self.dut_ports[0]))
+        mac = self.dut.get_mac_address(self.dut_ports[0])
+        self.creat_pcap("random_packet.pcap", mac, interface)
+        self.tester.scapy_append('pcap = rdpcap("random_packet.pcap")')
+        self.tester.scapy_append('sendp(pcap, iface="%s")' % interface)
+        self.tester.scapy_execute(120)
+
+        #self.dut.send_expect("stop", "testpmd> ")
+        dut_rxpackets = self.get_stats(self.dut_ports[0])['RX-packets']
+        dut_txpackets = self.get_stats(self.dut_ports[1])['TX-packets']
+        self.verify(dut_txpackets == self.total_packets and dut_rxpackets == dut_txpackets, "loss packets,tester send %d packets, dut rx packets %s, dut tx packets %s" %(self.total_packets, dut_rxpackets, dut_txpackets) )
 
-        self.dut.send_expect("stop", "testpmd> ")
         self.dut.send_expect("quit", "# ", 30)
         sleep(5)
 
-- 
1.9.3

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

* Re: [dts] [DTS][PATCH V1 2/2] creat a pcap file include 2000 random packet, used scapy send the pcap, and check dut not loss packet
  2016-02-04  3:22 ` [dts] [DTS][PATCH V1 2/2] creat a pcap file include 2000 random packet, used scapy send the pcap, and " xu,huilong
@ 2016-02-15  1:55   ` Xu, HuilongX
  2016-03-02  5:21     ` Liu, Yong
  0 siblings, 1 reply; 5+ messages in thread
From: Xu, HuilongX @ 2016-02-15  1:55 UTC (permalink / raw)
  To: Xu, HuilongX, dts

Hi all,
Could you have time, review this patch and give me some comments.
Thanks  a lot

> -----Original Message-----
> From: Xu, HuilongX
> Sent: Thursday, February 04, 2016 11:22 AM
> To: dts@dpdk.org
> Cc: Xu, HuilongX
> Subject: [DTS][PATCH V1 2/2] creat a pcap file include 2000 random packet,
> used scapy send the pcap, and check dut not loss packet
> 
> Signed-off-by: xu,huilong <huilongx.xu@intel.com>
> ---
>  tests/TestSuite_pmd.py | 55
> +++++++++++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 50 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/TestSuite_pmd.py b/tests/TestSuite_pmd.py
> index eeec53f..7a8df89 100644
> --- a/tests/TestSuite_pmd.py
> +++ b/tests/TestSuite_pmd.py
> @@ -1,6 +1,6 @@
>  # BSD LICENSE
>  #
> -# Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> +# Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
>  # All rights reserved.
>  #
>  # Redistribution and use in source and binary forms, with or without
> @@ -37,12 +37,14 @@ Test userland 10Gb PMD
>  import dts
>  import re
>  import time
> +import random
>  from test_case import TestCase
>  from plotting import Plotting
>  from time import sleep
>  from settings import HEADER_SIZE
>  from pmd_output import PmdOutput
>  from etgen import IxiaPacketGenerator
> +from scapy.all import *
> 
>  class TestPmd(TestCase,IxiaPacketGenerator):
> 
> @@ -81,6 +83,8 @@ class TestPmd(TestCase,IxiaPacketGenerator):
>          self.frame_sizes = [64, 65, 128, 256, 512, 1024, 1280, 1518]
> 
>          self.rxfreet_values = [0, 8, 16, 32, 64, 128]
> +
> +        self.total_packets = 2000
> 
>          self.test_cycles = [{'cores': '1S/1C/1T', 'Mpps': {}, 'pct': {}},
>                              {'cores': '1S/2C/1T', 'Mpps': {}, 'pct': {}},
> @@ -113,7 +117,37 @@ class TestPmd(TestCase,IxiaPacketGenerator):
>          Run before each test case.
>          """
>          pass
> -
> +    def random_ip(self, iptype):
> +        tmp = []
> +        if 'ipv4' == iptype:
> +            for i in range(4):
> +                tmp.append(str(random.randint(10, 254)))
> +            return '.'.join(tmp)
> +        if 'ipv6' == iptype:
> +            for i in range(8):
> +                tmp.append(str(hex(random.randint(0, 65535)))[2:])
> +            return ':'.join(tmp)
> +        else:
> +            self.logger.warning("invalid ip type: %s" % iptype)
> +    def creat_pcap(self, filename, dst_mac, tx_intf):
> +        packets = []
> +        packet_type = [Ether(dst="%s" % dst_mac,
> src=get_if_hwaddr(tx_intf))/IP(src="%s" % self.random_ip("ipv4"),
> dst="%s" % self.random_ip("ipv4"))/("X"), #ipv4 packet
> +                       Ether(dst="%s" % dst_mac,
> src=get_if_hwaddr(tx_intf))/IP(src="%s" % self.random_ip("ipv4"),
> dst="%s" % self.random_ip("ipv4"))/TCP()/("X"), #ipv4 tcp packet
> +                       Ether(dst="%s" % dst_mac,
> src=get_if_hwaddr(tx_intf))/IP(src="%s" % self.random_ip("ipv4"),
> dst="%s" % self.random_ip("ipv4"))/UDP()/("X"), #ipv4 udp packet
> +                       Ether(dst="%s" % dst_mac,
> src=get_if_hwaddr(tx_intf))/IP(src="%s" % self.random_ip("ipv4"),
> dst="%s" % self.random_ip("ipv4"))/SCTP(tag=1)/("X"),#ipv4 sctp packet
> +                       Ether(dst="%s" % dst_mac,
> src=get_if_hwaddr(tx_intf))/("X"), # l2 packet
> +                       Ether(dst="%s" % dst_mac,
> src=get_if_hwaddr(tx_intf))/IPv6(src="%s" % self.random_ip("ipv6"),
> dst="%s" % self.random_ip("ipv6"))/("X"), # ipv6 packet
> +                       Ether(dst="%s" % dst_mac,
> src=get_if_hwaddr(tx_intf))/IPv6(src="%s" % self.random_ip("ipv6"),
> dst="%s" % self.random_ip("ipv6"))/UDP()/("X"), #ipv6 udp packet
> +                       Ether(dst="%s" % dst_mac,
> src=get_if_hwaddr(tx_intf))/IPv6(src="%s" % self.random_ip("ipv6"),
> dst="%s" % self.random_ip("ipv6"))/TCP()/("X"), # ipv6 tcp packet
> +                       Ether(dst="%s" % dst_mac,
> src=get_if_hwaddr(tx_intf))/IPv6(src="%s" % self.random_ip("ipv6"),
> dst="%s" % self.random_ip("ipv6"))/SCTP(tag=1)/("X"), # ipv6 sctp packet
> +                      ]
> +        for packet in packet_type:
> +            for i in range(self.total_packets / len(packet_type)):
> +                packets.append(packet)
> +        for i in range(self.total_packets % len(packet_type)):
> +            packets.append(packet_type[random.randint(0, len(packet_type)
> - 1)])
> +        wrpcap(filename, packets)
> +        self.tester.session.copy_file_to(filename)
>      def test_perf_pmd_performance_4ports(self):
>          """
>          PMD Performance Benchmarking with 4 ports.
> @@ -322,11 +356,22 @@ class TestPmd(TestCase,IxiaPacketGenerator):
>          port_mask = dts.create_mask([self.dut_ports[0],
> self.dut_ports[1]])
> 
>          self.pmdout.start_testpmd("1S/2C/1T", "--portmask=%s" % port_mask,
> socket=self.ports_socket)
> +
> +        self.dut.send_expect("set fwd mac", "testpmd> ")
>          self.dut.send_expect("start", "testpmd> ")
> -        for size in self.frame_sizes:
> -            self.send_packet(size)
> +        interface = self.tester.get_interface(
> +            self.tester.get_local_port(self.dut_ports[0]))
> +        mac = self.dut.get_mac_address(self.dut_ports[0])
> +        self.creat_pcap("random_packet.pcap", mac, interface)
> +        self.tester.scapy_append('pcap = rdpcap("random_packet.pcap")')
> +        self.tester.scapy_append('sendp(pcap, iface="%s")' % interface)
> +        self.tester.scapy_execute(120)
> +
> +        #self.dut.send_expect("stop", "testpmd> ")
> +        dut_rxpackets = self.get_stats(self.dut_ports[0])['RX-packets']
> +        dut_txpackets = self.get_stats(self.dut_ports[1])['TX-packets']
> +        self.verify(dut_txpackets == self.total_packets and dut_rxpackets
> == dut_txpackets, "loss packets,tester send %d packets, dut rx packets %s,
> dut tx packets %s" %(self.total_packets, dut_rxpackets, dut_txpackets) )
> 
> -        self.dut.send_expect("stop", "testpmd> ")
>          self.dut.send_expect("quit", "# ", 30)
>          sleep(5)
> 
> --
> 1.9.3

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

* Re: [dts] [DTS][PATCH V1 1/2] update packet checking case, send 2000 random packets, check dut not loss packet
  2016-02-04  3:22 [dts] [DTS][PATCH V1 1/2] update packet checking case, send 2000 random packets, check dut not loss packet xu,huilong
  2016-02-04  3:22 ` [dts] [DTS][PATCH V1 2/2] creat a pcap file include 2000 random packet, used scapy send the pcap, and " xu,huilong
@ 2016-02-24  1:42 ` Tang, HaifengX
  1 sibling, 0 replies; 5+ messages in thread
From: Tang, HaifengX @ 2016-02-24  1:42 UTC (permalink / raw)
  To: Xu, HuilongX, dts

Acked-by:Tang,Haifeng <haifengx.tang@intel.com>
>-----Original Message-----
>From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of xu,huilong
>Sent: Thursday, February 04, 2016 11:22 AM
>To: dts@dpdk.org
>Subject: [dts] [DTS][PATCH V1 1/2] update packet checking case, send 2000 random packets, check dut not loss packet
>
>Signed-off-by: xu,huilong <huilongx.xu@intel.com>
>---
> test_plans/pmd_test_plan.rst | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
>diff --git a/test_plans/pmd_test_plan.rst b/test_plans/pmd_test_plan.rst index 1073149..c5e346e 100644
>--- a/test_plans/pmd_test_plan.rst
>+++ b/test_plans/pmd_test_plan.rst
>@@ -82,10 +82,8 @@ The linuxapp is started with the following parameters:
>   --rxpt=4 --rxht=4 --rxwt=16 --txpt=36 --txht=0 --txwt=0 --txrst=32
> 
> 
>-The tester sends packets with different sizes (64, 65, 128, 256, 512, 1024,
>-1280 and 1518 bytes), using scapy, which will be forwarded by the DUT.
>-The test checks if the packets are correctly forwarded and if both RX and TX -packet sizes match.
>+The tester sends 2000 packets with different type, using scapy, which will be forwarded by the DUT.
>+The test checks if the packets are correctly forwarded and if both RX 
>+and TX packet number is 2000
> 
> Test Case: Descriptors Checking
> ===============================
>--
>1.9.3
>

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

* Re: [dts] [DTS][PATCH V1 2/2] creat a pcap file include 2000 random packet, used scapy send the pcap, and check dut not loss packet
  2016-02-15  1:55   ` Xu, HuilongX
@ 2016-03-02  5:21     ` Liu, Yong
  0 siblings, 0 replies; 5+ messages in thread
From: Liu, Yong @ 2016-03-02  5:21 UTC (permalink / raw)
  To: Xu, HuilongX, dts

Hi Huilong,
In tester module , there has been one function named as 
"check_random_pkts" which do the same validation task.
We do not need to re-invent the wheel, you can use this function for 
packet integration check.

BTW, scapy 2.2.0 has issue in packet analysis, please use latest scapy 
release.

On 02/15/2016 09:55 AM, Xu, HuilongX wrote:
> Hi all,
> Could you have time, review this patch and give me some comments.
> Thanks  a lot
>
>> -----Original Message-----
>> From: Xu, HuilongX
>> Sent: Thursday, February 04, 2016 11:22 AM
>> To: dts@dpdk.org
>> Cc: Xu, HuilongX
>> Subject: [DTS][PATCH V1 2/2] creat a pcap file include 2000 random packet,
>> used scapy send the pcap, and check dut not loss packet
>>
>> Signed-off-by: xu,huilong <huilongx.xu@intel.com>
>> ---
>>   tests/TestSuite_pmd.py | 55
>> +++++++++++++++++++++++++++++++++++++++++++++-----
>>   1 file changed, 50 insertions(+), 5 deletions(-)
>>
>> diff --git a/tests/TestSuite_pmd.py b/tests/TestSuite_pmd.py
>> index eeec53f..7a8df89 100644
>> --- a/tests/TestSuite_pmd.py
>> +++ b/tests/TestSuite_pmd.py
>> @@ -1,6 +1,6 @@
>>   # BSD LICENSE
>>   #
>> -# Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
>> +# Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
>>   # All rights reserved.
>>   #
>>   # Redistribution and use in source and binary forms, with or without
>> @@ -37,12 +37,14 @@ Test userland 10Gb PMD
>>   import dts
>>   import re
>>   import time
>> +import random
>>   from test_case import TestCase
>>   from plotting import Plotting
>>   from time import sleep
>>   from settings import HEADER_SIZE
>>   from pmd_output import PmdOutput
>>   from etgen import IxiaPacketGenerator
>> +from scapy.all import *
>>
>>   class TestPmd(TestCase,IxiaPacketGenerator):
>>
>> @@ -81,6 +83,8 @@ class TestPmd(TestCase,IxiaPacketGenerator):
>>           self.frame_sizes = [64, 65, 128, 256, 512, 1024, 1280, 1518]
>>
>>           self.rxfreet_values = [0, 8, 16, 32, 64, 128]
>> +
>> +        self.total_packets = 2000
>>
>>           self.test_cycles = [{'cores': '1S/1C/1T', 'Mpps': {}, 'pct': {}},
>>                               {'cores': '1S/2C/1T', 'Mpps': {}, 'pct': {}},
>> @@ -113,7 +117,37 @@ class TestPmd(TestCase,IxiaPacketGenerator):
>>           Run before each test case.
>>           """
>>           pass
>> -
>> +    def random_ip(self, iptype):
>> +        tmp = []
>> +        if 'ipv4' == iptype:
>> +            for i in range(4):
>> +                tmp.append(str(random.randint(10, 254)))
>> +            return '.'.join(tmp)
>> +        if 'ipv6' == iptype:
>> +            for i in range(8):
>> +                tmp.append(str(hex(random.randint(0, 65535)))[2:])
>> +            return ':'.join(tmp)
>> +        else:
>> +            self.logger.warning("invalid ip type: %s" % iptype)
>> +    def creat_pcap(self, filename, dst_mac, tx_intf):
>> +        packets = []
>> +        packet_type = [Ether(dst="%s" % dst_mac,
>> src=get_if_hwaddr(tx_intf))/IP(src="%s" % self.random_ip("ipv4"),
>> dst="%s" % self.random_ip("ipv4"))/("X"), #ipv4 packet
>> +                       Ether(dst="%s" % dst_mac,
>> src=get_if_hwaddr(tx_intf))/IP(src="%s" % self.random_ip("ipv4"),
>> dst="%s" % self.random_ip("ipv4"))/TCP()/("X"), #ipv4 tcp packet
>> +                       Ether(dst="%s" % dst_mac,
>> src=get_if_hwaddr(tx_intf))/IP(src="%s" % self.random_ip("ipv4"),
>> dst="%s" % self.random_ip("ipv4"))/UDP()/("X"), #ipv4 udp packet
>> +                       Ether(dst="%s" % dst_mac,
>> src=get_if_hwaddr(tx_intf))/IP(src="%s" % self.random_ip("ipv4"),
>> dst="%s" % self.random_ip("ipv4"))/SCTP(tag=1)/("X"),#ipv4 sctp packet
>> +                       Ether(dst="%s" % dst_mac,
>> src=get_if_hwaddr(tx_intf))/("X"), # l2 packet
>> +                       Ether(dst="%s" % dst_mac,
>> src=get_if_hwaddr(tx_intf))/IPv6(src="%s" % self.random_ip("ipv6"),
>> dst="%s" % self.random_ip("ipv6"))/("X"), # ipv6 packet
>> +                       Ether(dst="%s" % dst_mac,
>> src=get_if_hwaddr(tx_intf))/IPv6(src="%s" % self.random_ip("ipv6"),
>> dst="%s" % self.random_ip("ipv6"))/UDP()/("X"), #ipv6 udp packet
>> +                       Ether(dst="%s" % dst_mac,
>> src=get_if_hwaddr(tx_intf))/IPv6(src="%s" % self.random_ip("ipv6"),
>> dst="%s" % self.random_ip("ipv6"))/TCP()/("X"), # ipv6 tcp packet
>> +                       Ether(dst="%s" % dst_mac,
>> src=get_if_hwaddr(tx_intf))/IPv6(src="%s" % self.random_ip("ipv6"),
>> dst="%s" % self.random_ip("ipv6"))/SCTP(tag=1)/("X"), # ipv6 sctp packet
>> +                      ]
>> +        for packet in packet_type:
>> +            for i in range(self.total_packets / len(packet_type)):
>> +                packets.append(packet)
>> +        for i in range(self.total_packets % len(packet_type)):
>> +            packets.append(packet_type[random.randint(0, len(packet_type)
>> - 1)])
>> +        wrpcap(filename, packets)
>> +        self.tester.session.copy_file_to(filename)
>>       def test_perf_pmd_performance_4ports(self):
>>           """
>>           PMD Performance Benchmarking with 4 ports.
>> @@ -322,11 +356,22 @@ class TestPmd(TestCase,IxiaPacketGenerator):
>>           port_mask = dts.create_mask([self.dut_ports[0],
>> self.dut_ports[1]])
>>
>>           self.pmdout.start_testpmd("1S/2C/1T", "--portmask=%s" % port_mask,
>> socket=self.ports_socket)
>> +
>> +        self.dut.send_expect("set fwd mac", "testpmd> ")
>>           self.dut.send_expect("start", "testpmd> ")
>> -        for size in self.frame_sizes:
>> -            self.send_packet(size)
>> +        interface = self.tester.get_interface(
>> +            self.tester.get_local_port(self.dut_ports[0]))
>> +        mac = self.dut.get_mac_address(self.dut_ports[0])
>> +        self.creat_pcap("random_packet.pcap", mac, interface)
>> +        self.tester.scapy_append('pcap = rdpcap("random_packet.pcap")')
>> +        self.tester.scapy_append('sendp(pcap, iface="%s")' % interface)
>> +        self.tester.scapy_execute(120)
>> +
>> +        #self.dut.send_expect("stop", "testpmd> ")
>> +        dut_rxpackets = self.get_stats(self.dut_ports[0])['RX-packets']
>> +        dut_txpackets = self.get_stats(self.dut_ports[1])['TX-packets']
>> +        self.verify(dut_txpackets == self.total_packets and dut_rxpackets
>> == dut_txpackets, "loss packets,tester send %d packets, dut rx packets %s,
>> dut tx packets %s" %(self.total_packets, dut_rxpackets, dut_txpackets) )
>>
>> -        self.dut.send_expect("stop", "testpmd> ")
>>           self.dut.send_expect("quit", "# ", 30)
>>           sleep(5)
>>
>> --
>> 1.9.3

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

end of thread, other threads:[~2016-03-02  5:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-04  3:22 [dts] [DTS][PATCH V1 1/2] update packet checking case, send 2000 random packets, check dut not loss packet xu,huilong
2016-02-04  3:22 ` [dts] [DTS][PATCH V1 2/2] creat a pcap file include 2000 random packet, used scapy send the pcap, and " xu,huilong
2016-02-15  1:55   ` Xu, HuilongX
2016-03-02  5:21     ` Liu, Yong
2016-02-24  1:42 ` [dts] [DTS][PATCH V1 1/2] update packet checking case, send 2000 random packets, " Tang, HaifengX

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