test suite reviews and discussions
 help / color / mirror / Atom feed
From: LihongX Ma <lihongx.ma@intel.com>
To: dts@dpdk.org
Cc: LihongX Ma <lihongx.ma@intel.com>
Subject: [dts] [PATCH V1 4/4] tests: use scapy modules gre instead of local modules nvgre
Date: Tue, 20 Oct 2020 02:31:55 +0800	[thread overview]
Message-ID: <1603132315-19498-5-git-send-email-lihongx.ma@intel.com> (raw)
In-Reply-To: <1603132315-19498-1-git-send-email-lihongx.ma@intel.com>

 - remove the import of nvgre
 - use GRE instead of nvgre in some suite that send pkt by self

Signed-off-by: LihongX Ma <lihongx.ma@intel.com>
---
 tests/TestSuite_ipgre.py |  7 +------
 tests/TestSuite_nvgre.py |  9 ++++-----
 tests/TestSuite_tso.py   | 14 +-------------
 3 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/tests/TestSuite_ipgre.py b/tests/TestSuite_ipgre.py
index 743c7ab..5e7750c 100644
--- a/tests/TestSuite_ipgre.py
+++ b/tests/TestSuite_ipgre.py
@@ -44,7 +44,7 @@ import re
 import time
 import os
 
-from packet import Packet, NVGRE, IPPROTO_NVGRE
+from packet import Packet
 
 from scapy.utils import wrpcap, rdpcap
 from scapy.packet import split_layers,bind_layers
@@ -80,7 +80,6 @@ class TestIpgre(TestCase):
         self.tester_iface = self.tester.get_interface(tester_port)
         self.tester_iface_mac =  self.tester.get_mac(tester_port)
         self.initialize_port_config()
-        self.re_bind_nvgre_to_gre()
 
     def initialize_port_config(self):
         self.outer_mac_src = '00:00:10:00:00:00'
@@ -142,10 +141,6 @@ class TestIpgre(TestCase):
             wrpcap("/tmp/ref_pkt.pcap", pkt.pktgen.pkt)
             time.sleep(1)
 
-    def re_bind_nvgre_to_gre(self):
-        split_layers(IP, NVGRE, frag=0, proto=IPPROTO_NVGRE)
-        bind_layers(IP, GRE, frag=0, proto=IPPROTO_NVGRE)
-
     def get_chksums(self, pcap=None):
         """
         get chksum values of Outer and Inner packet L3&L4
diff --git a/tests/TestSuite_nvgre.py b/tests/TestSuite_nvgre.py
index 306a89d..ce02a85 100644
--- a/tests/TestSuite_nvgre.py
+++ b/tests/TestSuite_nvgre.py
@@ -48,9 +48,8 @@ from socket import AF_INET6
 from scapy.utils import struct, socket, wrpcap, rdpcap
 from scapy.layers.inet import Ether, IP, TCP, UDP
 from scapy.layers.inet6 import IPv6
-from scapy.layers.l2 import Dot1Q
+from scapy.layers.l2 import Dot1Q, GRE
 from scapy.layers.sctp import SCTP, SCTPChunkData
-from nvgre import NVGRE
 from scapy.sendrecv import sniff
 from scapy.config import conf
 from scapy.route import *
@@ -307,7 +306,7 @@ class NvgreTestConfig(object):
         GRE package: outer/GRE header/inner
         """
         if self.outer_ip_proto == 47:
-            self.pkt = outer / NVGRE() / inner
+            self.pkt = outer / GRE(key_present=1,proto=0x6558,key=0x00000100) / inner
         else:
             self.pkt = outer / ("X" * self.payload_size)
 
@@ -332,8 +331,8 @@ class NvgreTestConfig(object):
         if payload.guess_payload_class(payload).name == "IP":
             chk_sums['outer_ip'] = hex(payload[IP].chksum)
 
-        if pkts[0].haslayer(NVGRE) == 1:
-            inner = pkts[0][NVGRE]
+        if pkts[0].haslayer(GRE) == 1:
+            inner = pkts[0][GRE]
             if inner.haslayer(IP) == 1:
                 chk_sums['inner_ip'] = hex(inner[IP].chksum)
                 if inner[IP].proto == 6:
diff --git a/tests/TestSuite_tso.py b/tests/TestSuite_tso.py
index e7b4a8c..d0c67d4 100644
--- a/tests/TestSuite_tso.py
+++ b/tests/TestSuite_tso.py
@@ -101,16 +101,6 @@ class TestTSO(TestCase):
         """
         pass
 
-    def load_module(self):
-        """
-        Load vxlan or nvgre module to scapy.
-        """
-        cwd = os.getcwd()
-        dir_module = cwd + r'/' + 'dep' + '/scapy_modules'
-        self.tester.scapy_append('sys.path.append("%s")' % dir_module)
-        self.tester.scapy_append("from vxlan import VXLAN")
-        self.tester.scapy_append('from nvgre import NVGRE')
-
     def tcpdump_start_sniffing(self, ifaces=[]):
         """
         Starts tcpdump in the background to sniff the tester interface where
@@ -347,7 +337,6 @@ class TestTSO(TestCase):
         for loading_size in self.loading_sizes:
             # Vxlan test
             self.tcpdump_start_sniffing([tx_interface, rx_interface])
-            self.load_module()
             out = self.dut.send_expect("clear port stats all", "testpmd> ", 120)
             self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/UDP(sport=1021,dport=4789)/VXLAN()/Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, mac, loading_size, tx_interface))
             out = self.tester.scapy_execute()
@@ -371,9 +360,8 @@ class TestTSO(TestCase):
         for loading_size in self.loading_sizes:
             # Nvgre test
             self.tcpdump_start_sniffing([tx_interface, rx_interface])
-            self.load_module()
             out = self.dut.send_expect("clear port stats all", "testpmd> ", 120)
-            self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2",proto=47)/NVGRE()/Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, mac, loading_size, tx_interface))
+            self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2",proto=47)/GRE(key_present=1,proto=0x6558,key=0x00001000)/Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, mac, loading_size, tx_interface))
             out = self.tester.scapy_execute()
             out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
             print(out)
-- 
2.7.4


  parent reply	other threads:[~2020-10-20  2:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19 18:31 [dts] [PATCH V1 0/4] use scapy modules instead of local modules LihongX Ma
2020-10-19 18:31 ` [dts] [PATCH V1 1/4] dep: remove the scapy modules in dep LihongX Ma
2020-10-19 18:31 ` [dts] [PATCH V1 2/4] framework/packet: use scapy modules instead of local modules LihongX Ma
2020-10-19 18:31 ` [dts] [PATCH V1 3/4] tests: use scapy modules vxlan " LihongX Ma
2020-10-19 18:31 ` LihongX Ma [this message]
2020-10-28  6:35 ` [dts] [PATCH V1 0/4] use scapy modules " Tu, Lijuan

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=1603132315-19498-5-git-send-email-lihongx.ma@intel.com \
    --to=lihongx.ma@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).