test suite reviews and discussions
 help / color / Atom feed
* [dts] [PATCH V2] tests/tso:Verify the chksum value.
@ 2019-09-23  8:58 zhu,shuai
  2019-09-29  5:45 ` Chen, Zhaoyan
  0 siblings, 1 reply; 2+ messages in thread
From: zhu,shuai @ 2019-09-23  8:58 UTC (permalink / raw)
  To: dts; +Cc: zhu,shuai

 Add a new verification method.

Signed-off-by: zhu,shuai <shuaix.zhu@intel.com>
---
 tests/TestSuite_tso.py | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/tests/TestSuite_tso.py b/tests/TestSuite_tso.py
index 36e00fe..cf81068 100644
--- a/tests/TestSuite_tso.py
+++ b/tests/TestSuite_tso.py
@@ -44,6 +44,7 @@ import os
 from test_case import TestCase
 from settings import HEADER_SIZE
 from pktgen import PacketGeneratorHelper
+from packet import load_pcapfile, save_packets
 
 DEFAULT_MUT = 1500
 TSO_MTU = 9000
@@ -164,6 +165,32 @@ class TestTSO(TestCase):
         scanner = ('tcpdump  -vv -r tcpdump_{iface}.pcap 2>/dev/null | grep "seq"  | grep "length"')
         return self.tcpdump_scanner(scanner.format(**locals()))
 
+    def get_chksum_value_and_verify(self, dump_pcap, save_file, Nic_list):
+        self.pks = load_pcapfile(dump_pcap)
+        for i in range(len(self.pks)):
+            self.pks = load_pcapfile(dump_pcap)
+            pks = self.pks[i]
+            out = pks.pktgen.pkt.show
+            chksum_list = re.findall(r'chksum=(0x\w+)', str(out))
+            pks.pktgen.pkt['IP'].chksum=None
+            if "VXLAN" in str(out):
+                pks.pktgen.pkt['UDP'].chksum=None
+                pks.pktgen.pkt['VXLAN']['IP'].chksum=None
+                pks.pktgen.pkt['VXLAN']['TCP'].chksum=None
+            elif "GRE" in str(out):
+                pks.pktgen.pkt['GRE']['IP'].chksum=None
+                pks.pktgen.pkt['GRE']['TCP'].chksum=None
+            save_packets(self.pks, save_file
+            self.pks1 = load_pcapfile(save_file)
+            out1 = self.pks1[i].pktgen.pkt.show
+            chksum_list1 = re.findall(r'chksum=(0x\w+)', str(out1))
+            self.tester.send_expect("rm -rf %s" % save_file, "#")
+            if self.nic in Nic_list and "VXLAN" in str(out):
+                self.verify(chksum_list[0] == chksum_list1[0] and chksum_list[2] == chksum_list1[2] and chksum_list[3] == chksum_list1[3], \
+                            "The obtained chksum value is incorrect.")
+            else:
+                self.verify(chksum_list == chksum_list1, "The obtained chksum value is incorrect.")
+
     def test_tso(self):
         """
         TSO IPv4 TCP, IPv6 TCP, VXLan testing
@@ -257,6 +284,10 @@ class TestTSO(TestCase):
         """
         tx_interface = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0]))
         rx_interface = self.tester.get_interface(self.tester.get_local_port(self.dut_ports[1]))
+
+        Nic_list = ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortville_25g"]
+        save_file = "save.pcap"
+        dump_pcap = "/root/tcpdump_%s.pcap" % rx_interface
 
         mac = self.dut.get_mac_address(self.dut_ports[0])
 
@@ -276,6 +307,10 @@ class TestTSO(TestCase):
         self.dut.send_expect("csum set tcp hw %d" % self.dut_ports[0], "testpmd> ", 120)
         self.dut.send_expect("csum set sctp hw %d" % self.dut_ports[0], "testpmd> ", 120)
         self.dut.send_expect("csum set outer-ip hw %d" % self.dut_ports[0], "testpmd> ", 120)
+        if self.nic in Nic_list:
+            self.logger.warning("Warning: fvl serise not support outer udp.")
+        else:
+            self.dut.send_expect("csum set outer-udp hw %d" % self.dut_ports[0], "testpmd> ", 120)
         self.dut.send_expect("csum parse-tunnel on %d" % self.dut_ports[0], "testpmd> ", 120)
 
         self.dut.send_expect("csum set ip hw %d" % self.dut_ports[1], "testpmd> ", 120)
@@ -283,6 +318,10 @@ class TestTSO(TestCase):
         self.dut.send_expect("csum set tcp hw %d" % self.dut_ports[1], "testpmd> ", 120)
         self.dut.send_expect("csum set sctp hw %d" % self.dut_ports[1], "testpmd> ", 120)
         self.dut.send_expect("csum set outer-ip hw %d" % self.dut_ports[1], "testpmd> ", 120)
+        if self.nic in Nic_list:
+            self.logger.warning("Warning: fvl serise not support outer udp.")
+        else:
+            self.dut.send_expect("csum set outer-udp hw %d" % self.dut_ports[1], "testpmd> ", 120)
         self.dut.send_expect("csum parse-tunnel on %d" % self.dut_ports[1], "testpmd> ", 120)
 
         self.dut.send_expect("tunnel_tso set 800 %d" % self.dut_ports[1], "testpmd> ", 120)
@@ -317,6 +356,7 @@ class TestTSO(TestCase):
                     self.verify(int(tx_outlist[i]) == 800, "the packet segmentation incorrect, %s" % tx_outlist)
                 if loading_size% 800 != 0:
                     self.verify(int(tx_outlist[num]) == loading_size% 800, "the packet segmentation incorrect, %s" % tx_outlist)
+            self.get_chksum_value_and_verify(dump_pcap, save_file, Nic_list)
 
         for loading_size in self.loading_sizes:
             # Nvgre test
@@ -340,6 +380,7 @@ class TestTSO(TestCase):
                     self.verify(int(tx_outlist[i]) == 800, "the packet segmentation incorrect, %s" % tx_outlist)
                 if loading_size% 800 != 0:
                     self.verify(int(tx_outlist[num]) == loading_size% 800, "the packet segmentation incorrect, %s" % tx_outlist)
+            self.get_chksum_value_and_verify(dump_pcap, save_file, Nic_list)
 
     def test_perf_TSO_2ports(self):
         """
-- 
2.17.2


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

* Re: [dts] [PATCH V2] tests/tso:Verify the chksum value.
  2019-09-23  8:58 [dts] [PATCH V2] tests/tso:Verify the chksum value zhu,shuai
@ 2019-09-29  5:45 ` Chen, Zhaoyan
  0 siblings, 0 replies; 2+ messages in thread
From: Chen, Zhaoyan @ 2019-09-29  5:45 UTC (permalink / raw)
  To: Zhu, ShuaiX, dts; +Cc: Zhu, ShuaiX, Chen, Zhaoyan


Shuai, could you replace absolute folder "/root" with temporary file? 


Regards,
Zhaoyan Chen

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of zhu,shuai
> Sent: Monday, September 23, 2019 4:59 PM
> To: dts@dpdk.org
> Cc: Zhu, ShuaiX <shuaix.zhu@intel.com>
> Subject: [dts] [PATCH V2] tests/tso:Verify the chksum value.
> 
>  Add a new verification method.
> 
> Signed-off-by: zhu,shuai <shuaix.zhu@intel.com>
> ---
>  tests/TestSuite_tso.py | 41 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
> 
> diff --git a/tests/TestSuite_tso.py b/tests/TestSuite_tso.py index 36e00fe..cf81068
> 100644
> --- a/tests/TestSuite_tso.py
> +++ b/tests/TestSuite_tso.py
> @@ -44,6 +44,7 @@ import os
>  from test_case import TestCase
>  from settings import HEADER_SIZE
>  from pktgen import PacketGeneratorHelper
> +from packet import load_pcapfile, save_packets
> 
>  DEFAULT_MUT = 1500
>  TSO_MTU = 9000
> @@ -164,6 +165,32 @@ class TestTSO(TestCase):
>          scanner = ('tcpdump  -vv -r tcpdump_{iface}.pcap 2>/dev/null | grep "seq"  |
> grep "length"')
>          return self.tcpdump_scanner(scanner.format(**locals()))
> 
> +    def get_chksum_value_and_verify(self, dump_pcap, save_file, Nic_list):
> +        self.pks = load_pcapfile(dump_pcap)
> +        for i in range(len(self.pks)):
> +            self.pks = load_pcapfile(dump_pcap)
> +            pks = self.pks[i]
> +            out = pks.pktgen.pkt.show
> +            chksum_list = re.findall(r'chksum=(0x\w+)', str(out))
> +            pks.pktgen.pkt['IP'].chksum=None
> +            if "VXLAN" in str(out):
> +                pks.pktgen.pkt['UDP'].chksum=None
> +                pks.pktgen.pkt['VXLAN']['IP'].chksum=None
> +                pks.pktgen.pkt['VXLAN']['TCP'].chksum=None
> +            elif "GRE" in str(out):
> +                pks.pktgen.pkt['GRE']['IP'].chksum=None
> +                pks.pktgen.pkt['GRE']['TCP'].chksum=None
> +            save_packets(self.pks, save_file
> +            self.pks1 = load_pcapfile(save_file)
> +            out1 = self.pks1[i].pktgen.pkt.show
> +            chksum_list1 = re.findall(r'chksum=(0x\w+)', str(out1))
> +            self.tester.send_expect("rm -rf %s" % save_file, "#")
> +            if self.nic in Nic_list and "VXLAN" in str(out):
> +                self.verify(chksum_list[0] == chksum_list1[0] and chksum_list[2] ==
> chksum_list1[2] and chksum_list[3] == chksum_list1[3], \
> +                            "The obtained chksum value is incorrect.")
> +            else:
> +                self.verify(chksum_list == chksum_list1, "The obtained
> + chksum value is incorrect.")
> +
>      def test_tso(self):
>          """
>          TSO IPv4 TCP, IPv6 TCP, VXLan testing @@ -257,6 +284,10 @@ class
> TestTSO(TestCase):
>          """
>          tx_interface =
> self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0]))
>          rx_interface =
> self.tester.get_interface(self.tester.get_local_port(self.dut_ports[1]))
> +
> +        Nic_list = ["fortville_eagle", "fortville_spirit", "fortville_spirit_single",
> "fortville_25g"]
> +        save_file = "save.pcap"
> +        dump_pcap = "/root/tcpdump_%s.pcap" % rx_interface
> 
>          mac = self.dut.get_mac_address(self.dut_ports[0])
> 
> @@ -276,6 +307,10 @@ class TestTSO(TestCase):
>          self.dut.send_expect("csum set tcp hw %d" % self.dut_ports[0], "testpmd> ",
> 120)
>          self.dut.send_expect("csum set sctp hw %d" % self.dut_ports[0], "testpmd> ",
> 120)
>          self.dut.send_expect("csum set outer-ip hw %d" % self.dut_ports[0], "testpmd>
> ", 120)
> +        if self.nic in Nic_list:
> +            self.logger.warning("Warning: fvl serise not support outer udp.")
> +        else:
> +            self.dut.send_expect("csum set outer-udp hw %d" %
> + self.dut_ports[0], "testpmd> ", 120)
>          self.dut.send_expect("csum parse-tunnel on %d" % self.dut_ports[0], "testpmd>
> ", 120)
> 
>          self.dut.send_expect("csum set ip hw %d" % self.dut_ports[1], "testpmd> ", 120)
> @@ -283,6 +318,10 @@ class TestTSO(TestCase):
>          self.dut.send_expect("csum set tcp hw %d" % self.dut_ports[1], "testpmd> ",
> 120)
>          self.dut.send_expect("csum set sctp hw %d" % self.dut_ports[1], "testpmd> ",
> 120)
>          self.dut.send_expect("csum set outer-ip hw %d" % self.dut_ports[1], "testpmd>
> ", 120)
> +        if self.nic in Nic_list:
> +            self.logger.warning("Warning: fvl serise not support outer udp.")
> +        else:
> +            self.dut.send_expect("csum set outer-udp hw %d" %
> + self.dut_ports[1], "testpmd> ", 120)
>          self.dut.send_expect("csum parse-tunnel on %d" % self.dut_ports[1], "testpmd>
> ", 120)
> 
>          self.dut.send_expect("tunnel_tso set 800 %d" % self.dut_ports[1], "testpmd> ",
> 120) @@ -317,6 +356,7 @@ class TestTSO(TestCase):
>                      self.verify(int(tx_outlist[i]) == 800, "the packet segmentation
> incorrect, %s" % tx_outlist)
>                  if loading_size% 800 != 0:
>                      self.verify(int(tx_outlist[num]) == loading_size% 800, "the packet
> segmentation incorrect, %s" % tx_outlist)
> +            self.get_chksum_value_and_verify(dump_pcap, save_file,
> + Nic_list)
> 
>          for loading_size in self.loading_sizes:
>              # Nvgre test
> @@ -340,6 +380,7 @@ class TestTSO(TestCase):
>                      self.verify(int(tx_outlist[i]) == 800, "the packet segmentation
> incorrect, %s" % tx_outlist)
>                  if loading_size% 800 != 0:
>                      self.verify(int(tx_outlist[num]) == loading_size% 800, "the packet
> segmentation incorrect, %s" % tx_outlist)
> +            self.get_chksum_value_and_verify(dump_pcap, save_file,
> + Nic_list)
> 
>      def test_perf_TSO_2ports(self):
>          """
> --
> 2.17.2


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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-23  8:58 [dts] [PATCH V2] tests/tso:Verify the chksum value zhu,shuai
2019-09-29  5:45 ` Chen, Zhaoyan

test suite reviews and discussions

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/dts/0 dts/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dts dts/ http://inbox.dpdk.org/dts \
		dts@dpdk.org
	public-inbox-index dts


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dts


AGPL code for this site: git clone https://public-inbox.org/ public-inbox