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 8530CA04DC; Tue, 20 Oct 2020 04:06:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7E91ABC6C; Tue, 20 Oct 2020 04:06:38 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id EF441BC6A for ; Tue, 20 Oct 2020 04:06:36 +0200 (CEST) IronPort-SDR: iQShK6qrfJAY4eEPtTxfNtpXTAUt/AXX4bxRkBApYU41OhHg3VCWmyRPquviTk3J7Q5C6tP3FD 8aEAEADp2glQ== X-IronPort-AV: E=McAfee;i="6000,8403,9779"; a="154923995" X-IronPort-AV: E=Sophos;i="5.77,395,1596524400"; d="scan'208";a="154923995" 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:36 -0700 IronPort-SDR: qd68xHmixRmQFFXJAiv2MgJA8Buwx5XRekSx6Ymafk6mnS7nZQPVvTn6NzAmsSaqbgPvTujUaA SskVuKmpIZpA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,395,1596524400"; d="scan'208";a="465751299" Received: from dpdk-lihong-ub1604.sh.intel.com ([10.67.118.174]) by orsmga004.jf.intel.com with ESMTP; 19 Oct 2020 19:06:35 -0700 From: LihongX Ma To: dts@dpdk.org Cc: LihongX Ma Date: Tue, 20 Oct 2020 02:31:54 +0800 Message-Id: <1603132315-19498-4-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 3/4] tests: use scapy modules vxlan instead of local modules 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" - modify the import path of vxlan layers Signed-off-by: LihongX Ma --- tests/TestSuite_cloud_filter.py | 5 ++--- tests/TestSuite_generic_flow_api.py | 27 --------------------------- tests/TestSuite_vxlan.py | 2 +- tests/TestSuite_vxlan_sample.py | 2 +- 4 files changed, 4 insertions(+), 32 deletions(-) diff --git a/tests/TestSuite_cloud_filter.py b/tests/TestSuite_cloud_filter.py index 3723e57..abc474f 100644 --- a/tests/TestSuite_cloud_filter.py +++ b/tests/TestSuite_cloud_filter.py @@ -46,11 +46,10 @@ from settings import HEADER_SIZE from packet import Packet from scapy.layers.inet import UDP, IP +from scapy.layers.vxlan import VXLAN from scapy.packet import split_layers, bind_layers -from vxlan import VXLAN -from vxlan import VXLAN_PORT - +VXLAN_PORT = 4789 CLOUD_PORT = 8472 split_layers(UDP, VXLAN, dport=VXLAN_PORT) bind_layers(UDP, VXLAN, dport=CLOUD_PORT) diff --git a/tests/TestSuite_generic_flow_api.py b/tests/TestSuite_generic_flow_api.py index da061fe..1660669 100644 --- a/tests/TestSuite_generic_flow_api.py +++ b/tests/TestSuite_generic_flow_api.py @@ -148,19 +148,6 @@ class TestGeneric_flow_api(TestCase): time.sleep(2) self.vf_flag = 0 - def load_module(self, module=""): - """ - Load vxlan or nvgre module to scapy. - """ - # load vxlan module to scapy - cwd = os.getcwd() - dir_module = cwd + r'/' + 'dep' - self.tester.scapy_append('sys.path.append("%s")' % dir_module) - if module == "vxlan": - self.tester.scapy_append("from vxlan import VXLAN") - elif module == "nvgre": - self.tester.scapy_append('from nvgre import NVGRE') - def verify_result(self, pf_vf, expect_rxpkts, expect_queue, verify_mac): """ verify the packet to the expected queue or be dropped @@ -322,12 +309,6 @@ class TestGeneric_flow_api(TestCase): self.dut.send_expect(flow_cmd, "created") rule_created = 1 - # Enable vxlan packet sending - if "VXLAN" in flow_pkt: - self.load_module("vxlan") - elif "NVGRE" in flow_pkt: - self.load_module("nvgre") - # The rule is created successfully, so send the consistent packet. self.sendpkt(pktstr=flow_pkt) cur_mac = re.search("dst='(\S\S:\S\S:\S\S:\S\S:\S\S:\S\S)'", flow_pkt) @@ -2290,21 +2271,17 @@ class TestGeneric_flow_api(TestCase): extrapkt_rulenum = self.all_flows_process(basic_flow_actions) extra_packet = extrapkt_rulenum['extrapacket'] - self.load_module("vxlan") self.sendpkt('Ether(dst="%s")/IP()/UDP()/VXLAN()/Ether(dst="%s")/Dot1Q(vlan=11)/IP()/TCP()/Raw("x" * 20)' % (self.outer_mac, self.inner_mac)) self.verify_result("pf", expect_rxpkts="1", expect_queue=extrapkt_rulenum['queue'][0], verify_mac=self.outer_mac) - self.load_module("vxlan") self.sendpkt('Ether(dst="%s")/IP()/UDP()/VXLAN(vni=5)/Ether(dst="%s")/IP()/TCP()/Raw("x" * 20)' % (self.outer_mac, self.wrong_mac)) self.verify_result("pf", expect_rxpkts="1", expect_queue="0", verify_mac=self.outer_mac) - self.load_module("vxlan") self.sendpkt('Ether(dst="%s")/IP()/UDP()/VXLAN(vni=%s)/Ether(dst="%s")/Dot1Q(vlan=%s)/IP()/TCP()/Raw("x" * 20)' % ( self.outer_mac, extra_packet[5]['vni'], self.wrong_mac, extra_packet[5]['invlan'])) self.verify_result("vf0", expect_rxpkts="1", expect_queue="0", verify_mac=self.outer_mac) - self.load_module("vxlan") self.sendpkt('Ether(dst="%s")/IP()/UDP()/VXLAN(vni=%s)/Ether(dst="%s")/IP()/TCP()/Raw("x" * 20)' % ( self.wrong_mac, extra_packet[6]['vni'], self.inner_mac)) self.verify_result("vf1", expect_rxpkts="0", expect_queue="NULL", verify_mac=self.wrong_mac) @@ -2356,22 +2333,18 @@ class TestGeneric_flow_api(TestCase): extrapkt_rulenum = self.all_flows_process(basic_flow_actions) extra_packet = extrapkt_rulenum['extrapacket'] - self.load_module("nvgre") self.sendpkt('Ether(dst="%s")/IP()/NVGRE()/Ether(dst="%s")/Dot1Q(vlan=1)/IP()/TCP()/Raw("x" * 20)' % (self.outer_mac, self.inner_mac)) self.verify_result("pf", expect_rxpkts="1", expect_queue=extrapkt_rulenum['queue'][0], verify_mac=self.outer_mac) - self.load_module("nvgre") self.sendpkt('Ether(dst="%s")/IP()/NVGRE(TNI=%s)/Ether(dst="%s")/IP()/TCP()/Raw("x" * 20)' % ( self.outer_mac, extra_packet[4]['tni'], self.wrong_mac)) self.verify_result("pf", expect_rxpkts="1", expect_queue="0", verify_mac=self.outer_mac) - self.load_module("nvgre") self.sendpkt('Ether(dst="%s")/IP()/NVGRE(TNI=%s)/Ether(dst="%s")/Dot1Q(vlan=%s)/IP()/TCP()/Raw("x" * 20)' % ( self.outer_mac, extra_packet[5]['tni'], self.wrong_mac, extra_packet[5]['invlan'])) self.verify_result("vf0", expect_rxpkts="1", expect_queue="0", verify_mac=self.outer_mac) - self.load_module("nvgre") self.sendpkt('Ether(dst="%s")/IP()/NVGRE(TNI=%s)/Ether(dst="%s")/IP()/TCP()/Raw("x" * 20)' % ( self.wrong_mac, extra_packet[6]['tni'], self.inner_mac)) self.verify_result("vf1", expect_rxpkts="0", expect_queue="NULL", verify_mac=self.wrong_mac) diff --git a/tests/TestSuite_vxlan.py b/tests/TestSuite_vxlan.py index 2db3549..eb324fb 100644 --- a/tests/TestSuite_vxlan.py +++ b/tests/TestSuite_vxlan.py @@ -48,7 +48,7 @@ from scapy.utils import wrpcap, rdpcap from scapy.layers.inet import Ether, IP, TCP, UDP from scapy.layers.inet6 import IPv6 from scapy.layers.l2 import Dot1Q -from vxlan import VXLAN +from scapy.layers.vxlan import VXLAN from scapy.layers.sctp import SCTP, SCTPChunkData from scapy.sendrecv import sniff from scapy.config import conf diff --git a/tests/TestSuite_vxlan_sample.py b/tests/TestSuite_vxlan_sample.py index feaad14..92253bb 100644 --- a/tests/TestSuite_vxlan_sample.py +++ b/tests/TestSuite_vxlan_sample.py @@ -54,7 +54,7 @@ from scapy.utils import wrpcap, rdpcap from scapy.layers.inet import Ether, IP, TCP, UDP from scapy.layers.inet6 import IPv6 from scapy.layers.l2 import Dot1Q -from vxlan import VXLAN +from scapy.layers.vxlan import VXLAN from scapy.layers.sctp import SCTP, SCTPChunkData from scapy.sendrecv import sniff from scapy.config import conf -- 2.7.4