From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B8B98A04DC; Tue, 20 Oct 2020 04:06:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B222ABBF0; Tue, 20 Oct 2020 04:06:40 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id D9213BBE4 for ; Tue, 20 Oct 2020 04:06:38 +0200 (CEST) IronPort-SDR: ihHI7bHPJA1rMQN6oviiCCciosIntwWxxsRsOLidRIxQnlf/lW3RKsNQtIp+Atr9w/A72BQoa4 39Oh5BuOua0Q== X-IronPort-AV: E=McAfee;i="6000,8403,9779"; a="154924000" X-IronPort-AV: E=Sophos;i="5.77,395,1596524400"; d="scan'208";a="154924000" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2020 19:06:38 -0700 IronPort-SDR: 5YaHAF3ZwIYiZZwKfztucRsu6tmFIvcK9u6CihzuDsY6RObbQeK3bG0CiVnWGFqFp8KusX5C16 bw6HTHJcvs+Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,395,1596524400"; d="scan'208";a="465751318" Received: from dpdk-lihong-ub1604.sh.intel.com ([10.67.118.174]) by orsmga004.jf.intel.com with ESMTP; 19 Oct 2020 19:06:37 -0700 From: LihongX Ma To: dts@dpdk.org Cc: LihongX Ma Date: Tue, 20 Oct 2020 02:31:55 +0800 Message-Id: <1603132315-19498-5-git-send-email-lihongx.ma@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1603132315-19498-1-git-send-email-lihongx.ma@intel.com> References: <1603132315-19498-1-git-send-email-lihongx.ma@intel.com> Subject: [dts] [PATCH V1 4/4] tests: use scapy modules gre instead of local modules nvgre X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" - remove the import of nvgre - use GRE instead of nvgre in some suite that send pkt by self Signed-off-by: LihongX Ma --- 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