test suite reviews and discussions
 help / color / mirror / Atom feed
From: Lijuan Tu <lijuanx.a.tu@intel.com>
To: dts@dpdk.org
Cc: Lijuan Tu <lijuanx.a.tu@intel.com>
Subject: [dts] [PATCH 8/8] tests/vxlan_sample: adjust to dpdk1705
Date: Fri, 12 May 2017 16:18:15 +0800	[thread overview]
Message-ID: <1494577095-45103-9-git-send-email-lijuanx.a.tu@intel.com> (raw)
In-Reply-To: <1494577095-45103-1-git-send-email-lijuanx.a.tu@intel.com>

Signed-off-by: Lijuan Tu <lijuanx.a.tu@intel.com>
---
 tests/TestSuite_vxlan.py        |  7 +++++-
 tests/TestSuite_vxlan_sample.py | 52 ++++++++++++++++++++++++-----------------
 2 files changed, 36 insertions(+), 23 deletions(-)

diff --git a/tests/TestSuite_vxlan.py b/tests/TestSuite_vxlan.py
index 5fef9d9..73ed3e8 100644
--- a/tests/TestSuite_vxlan.py
+++ b/tests/TestSuite_vxlan.py
@@ -24,7 +24,7 @@ from scapy.config import conf
 from scapy.route import *
 
 from test_case import TestCase
-from settings import HEADER_SIZE
+from settings import HEADER_SIZE, FOLDERS
 from etgen import IxiaPacketGenerator
 
 #
@@ -236,6 +236,11 @@ class VxlanTestConfig(object):
         """
         Send vxlan pcap file by iface
         """
+        # load vxlan module to scapy
+        cwd = os.getcwd()
+        dir_vxlan_module = cwd + r'/' + FOLDERS['Depends']
+        self.test_case.tester.scapy_append("sys.path.append('%s')" % dir_vxlan_module)
+        self.test_case.tester.scapy_append("from vxlan import Vxlan")
         self.test_case.tester.scapy_append(
             'pcap = rdpcap("%s")' % self.pcap_file)
         self.test_case.tester.scapy_append(
diff --git a/tests/TestSuite_vxlan_sample.py b/tests/TestSuite_vxlan_sample.py
index 1dbb727..aacdd4f 100644
--- a/tests/TestSuite_vxlan_sample.py
+++ b/tests/TestSuite_vxlan_sample.py
@@ -75,15 +75,6 @@ class TestVxlanSample(TestCase):
         """
         Run before each test suite.
         """
-        # Change the config file to support vhost and recompile the package.
-        self.dut.send_expect("sed -i -e 's/RTE_LIBRTE_VHOST=n$/"
-                             + "RTE_LIBRTE_VHOST=y/' config/"
-                             + "common_base", "# ", 30)
-        # temporary disable skip_setup
-        skip_setup = self.dut.skip_setup
-        self.dut.skip_setup = False
-        self.dut.build_install_dpdk(self.target)
-        self.dut.skip_setup = skip_setup
 
         # this feature only enable in FVL now
         self.verify(self.nic in ["fortville_eagle", "fortville_spirit",
@@ -106,15 +97,6 @@ class TestVxlanSample(TestCase):
         self.verify("Error" not in out, "compilation error 1")
         self.verify("No such file" not in out, "compilation error 2")
 
-        # build for vhost user environment
-        self.dut.send_expect("cd lib/librte_vhost/eventfd_link", "# ")
-        self.dut.send_expect("make", "# ")
-        self.dut.send_expect("insmod ./eventfd_link.ko", "# ")
-        self.dut.send_expect("cd ../../..", "# ")
-        out = self.dut.send_expect("lsmod |grep eventfd_link", "# ")
-        self.verify("eventfd_link" in out,
-                    "Failed to insmod eventfd_link driver")
-
         self.def_mac = "00:00:20:00:00:20"
         self.vm_dut = None
         self.tep_app = "./examples/tep_termination/build/tep_termination"
@@ -163,10 +145,11 @@ class TestVxlanSample(TestCase):
 
         encap = self.FEAT_ENABLE
         decap = self.FEAT_ENABLE
-        chksum = self.FEAT_DISABLE
+        chksum = self.FEAT_ENABLE
         if self.running_case == "test_vxlan_sample_encap":
             encap = self.FEAT_ENABLE
             decap = self.FEAT_DISABLE
+            chksum = self.FEAT_ENABLE
         elif self.running_case == "test_vxlan_sample_decap":
             encap = self.FEAT_DISABLE
             decap = self.FEAT_ENABLE
@@ -201,7 +184,7 @@ class TestVxlanSample(TestCase):
         self.dut.send_expect("rm -rf vhost-net", "# ")
 
         # start tep_termination first
-        self.dut.send_expect(tep_cmd, "VHOST_CONFIG: bind to vhost-net")
+        self.dut.send_expect(tep_cmd, "EAL")
 
         # start one vm
         self.vm = QEMUKvm(self.dut, 'vm0', 'vxlan_sample')
@@ -237,6 +220,8 @@ class TestVxlanSample(TestCase):
             self.vm.stop()
             self.vm = None
 
+        self.dut.virt_exit()
+
     def mac_address_add(self, number):
         if number > 15:
             return ''
@@ -302,6 +287,7 @@ class TestVxlanSample(TestCase):
         self.tester.session.copy_file_from(self.capture_file)
 
         if os.path.isfile('vxlan_cap.pcap'):
+            self.verify(os.path.getsize('vxlan_cap.pcap') != 0, "Packets receive error")
             pkts = rdpcap('vxlan_cap.pcap')
         else:
             pkts = []
@@ -312,12 +298,13 @@ class TestVxlanSample(TestCase):
         case_pass = True
         tester_recv_port = self.tester.get_local_port(self.pf)
         tester_iface = self.tester.get_interface(tester_recv_port)
+        tester_smac = self.tester.get_mac(tester_recv_port)
 
         if pkt_type == "normal_udp":
             self.start_capture(tester_iface, pkt_smac=self.pf_mac)
             self.tester.scapy_append(
-                'sendp([Ether(dst="%s")/IP()/UDP()/Raw("X"*18)], iface="%s")'
-                % (self.pf_mac, tester_iface))
+                'sendp([Ether(dst="%s",src="%s")/IP()/UDP()/Raw("X"*18)], iface="%s")'
+                % (self.pf_mac, tester_smac, tester_iface))
             self.tester.scapy_execute()
             time.sleep(5)
 
@@ -390,6 +377,7 @@ class TestVxlanSample(TestCase):
 
             # transfer capture pcap to server
             pkts = self.transfer_capture_file()
+
             # check packet number and payload
             self.verify(len(pkts) >= 1, "Failed to capture packets")
             self.verify(pkts[0].haslayer(Vxlan) == 1,
@@ -461,6 +449,7 @@ class TestVxlanSample(TestCase):
             mac_incr = 2 * vm_id + vf_id
             params['inner_mac_dst'] = self.mac_address_add(mac_incr)
             params['payload_size'] = 892  # 256 + 256 + 256 + 124
+
             # extract reference chksum value
             vxlan_pkt = VxlanTestConfig(self, **params)
             vxlan_pkt.create_pcap()
@@ -474,6 +463,25 @@ class TestVxlanSample(TestCase):
             pkts = self.transfer_capture_file()
             # check packet number and payload
             self.verify(len(pkts) == 4, "Failed to capture tso packets")
+
+            # calculation  checksum, and checkt it
+            for pkt in pkts:
+                inner = pkt[Vxlan]
+                inner_ip_chksum = inner[IP].chksum
+                del inner.chksum
+                inner[IP] = inner[IP].__class__(str(inner[IP]))
+                inner_ip_chksum_ref = inner[IP].chksum
+                print utils.GREEN("inner ip checksum reference: %x" % inner_ip_chksum_ref)
+                print utils.GREEN("inner ip checksum: %x" % inner_ip_chksum)
+                self.verify(inner_ip_chksum == inner_ip_chksum_ref, "inner ip checksum error")
+                inner_l4_chksum = inner[params['inner_l4_type']].chksum
+                del inner[params['inner_l4_type']].chksum
+                inner[params['inner_l4_type']] = inner[params['inner_l4_type']].__class__(str(inner[params['inner_l4_type']]))
+                inner_l4_chksum_ref =  inner[params['inner_l4_type']].chksum
+                print utils.GREEN("inner l4 checksum reference: %x" % inner_l4_chksum_ref)
+                print utils.GREEN("inner l4 checksum: %x" % inner_l4_chksum)
+                self.verify(inner_l4_chksum == inner_l4_chksum_ref, "inner %s checksum error" % params['inner_l4_type'])
+
             length = 0
             for pkt in pkts:
                 self.verify(pkt.haslayer(Vxlan) == 1,
-- 
1.9.3

  parent reply	other threads:[~2017-05-12  8:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-12  8:18 [dts] [PATCH V1 0/8] sync virtual tests " Lijuan Tu
2017-05-12  8:18 ` [dts] [PATCH V1 1/8] tests/vf_packet_rxtx: remove crc-strip parameter Lijuan Tu
2017-05-15  1:56   ` Liu, Yong
2017-05-12  8:18 ` [dts] [PATCH V1 2/8] tests/vf_macfilter: " Lijuan Tu
2017-05-15  1:57   ` Liu, Yong
2017-05-12  8:18 ` [dts] [PATCH V1 3/8] tests/vf_offload: fix variable name typo and " Lijuan Tu
2017-05-15  1:57   ` Liu, Yong
2017-05-12  8:18 ` [dts] [PATCH V1 4/8] tests/vf_port_start_stop: make adjustment to dpdk1705 Lijuan Tu
2017-05-15  2:00   ` Liu, Yong
2017-05-12  8:18 ` [dts] [PATCH V1 5/8] test/vf_rss: remove crc-strip parameter, and check RSS config command Lijuan Tu
2017-05-15  2:01   ` Liu, Yong
2017-05-12  8:18 ` [dts] [PATCH V1 6/8] test/vf_to_vf_nic_bridge: remove crc-strip parameter and filter misc packets Lijuan Tu
2017-05-15  2:03   ` Liu, Yong
2017-05-12  8:18 ` [dts] [PATCH V1 7/8] tests/vm_power_manager: adjust to dpdk1705 Lijuan Tu
2017-05-15  2:05   ` Liu, Yong
2017-05-12  8:18 ` Lijuan Tu [this message]
2017-05-15  2:06   ` [dts] [PATCH 8/8] tests/vxlan_sample: " 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=1494577095-45103-9-git-send-email-lijuanx.a.tu@intel.com \
    --to=lijuanx.a.tu@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).