From patchwork Wed Dec 9 01:59:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhou, JunX W" X-Patchwork-Id: 84839 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EFD78A09EA; Wed, 9 Dec 2020 02:56:58 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DAC63BE79; Wed, 9 Dec 2020 02:56:57 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 1FE802B8B for ; Wed, 9 Dec 2020 02:56:55 +0100 (CET) IronPort-SDR: n2luaslVeIstrK8IdNTPoH0y7DQSmkAYPqHnzxNJc+Z6uHQkidjEh19l/P39s9YPtEQpC7C9Is xUg2EsbARvVw== X-IronPort-AV: E=McAfee;i="6000,8403,9829"; a="238108419" X-IronPort-AV: E=Sophos;i="5.78,404,1599548400"; d="scan'208";a="238108419" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2020 17:56:53 -0800 IronPort-SDR: 5Ysv5g2OYQG55PRcHJYwsAYZVjKfOK6ayMy/fuj6kdSPeMLzh3GgeEQACLBB3erzdBSMNsH6jD c9ZDIry8+pHw== X-IronPort-AV: E=Sophos;i="5.78,404,1599548400"; d="scan'208";a="407870657" Received: from unknown (HELO localhost.localdomain) ([10.240.183.80]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2020 17:56:52 -0800 From: Zhou Jun To: dts@dpdk.org Cc: Zhou Jun Date: Wed, 9 Dec 2020 09:59:42 +0800 Message-Id: <20201209015944.12586-2-junx.w.zhou@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201209015944.12586-1-junx.w.zhou@intel.com> References: <20201209015944.12586-1-junx.w.zhou@intel.com> Subject: [dts] [dts 1/3] framework/packet.py:add interface for write raw pkt 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" Signed-off-by: Zhou Jun --- framework/packet.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/framework/packet.py b/framework/packet.py index 7d974db0..e13e74f2 100644 --- a/framework/packet.py +++ b/framework/packet.py @@ -119,6 +119,12 @@ PKTGEN_PIDS = {} # default filter for LLDP packet LLDP_FILTER = {'layer': 'ether', 'config': {'type': 'not lldp'}} +def write_raw_pkt(pkt_str, file_name): + tmp = eval(pkt_str) + tmp = bytearray(bytes(tmp)) + with open(file_name, 'wb') as w: + w.write(tmp) + w.close() class scapy(object): SCAPY_LAYERS = { From patchwork Wed Dec 9 01:59:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhou, JunX W" X-Patchwork-Id: 84840 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2587FA09E9; Wed, 9 Dec 2020 02:57:00 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 18AC4C930; Wed, 9 Dec 2020 02:56:59 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id C01EFBE75 for ; Wed, 9 Dec 2020 02:56:56 +0100 (CET) IronPort-SDR: hd6KNAuX/VXq5FLNz0mBmb+cPoCgQmWp7+9eLfRPEBBz+yV8wfB+6KXLLQbM8rAlTFc0rleNFR MuDb9nl2GiSg== X-IronPort-AV: E=McAfee;i="6000,8403,9829"; a="238108427" X-IronPort-AV: E=Sophos;i="5.78,404,1599548400"; d="scan'208";a="238108427" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2020 17:56:55 -0800 IronPort-SDR: jEh1D4FibarHRjnMu5oV4oUg0f2GBr7JeqGqmGUjlc4U8C3K7g+Lq3EBDeMcB/Gwq79sTV1zhr 6C0++8dmPG0w== X-IronPort-AV: E=Sophos;i="5.78,404,1599548400"; d="scan'208";a="407870680" Received: from unknown (HELO localhost.localdomain) ([10.240.183.80]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2020 17:56:53 -0800 From: Zhou Jun To: dts@dpdk.org Cc: Zhou Jun Date: Wed, 9 Dec 2020 09:59:43 +0800 Message-Id: <20201209015944.12586-3-junx.w.zhou@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201209015944.12586-1-junx.w.zhou@intel.com> References: <20201209015944.12586-1-junx.w.zhou@intel.com> Subject: [dts] [dts 2/3] tests/TestSuite_ddp_gtp_qregion:change send pkt mode and use framework interface to write raw pkt 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" Signed-off-by: Zhou Jun --- tests/TestSuite_ddp_gtp_qregion.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/tests/TestSuite_ddp_gtp_qregion.py b/tests/TestSuite_ddp_gtp_qregion.py index 443e1927..2c22756e 100644 --- a/tests/TestSuite_ddp_gtp_qregion.py +++ b/tests/TestSuite_ddp_gtp_qregion.py @@ -37,6 +37,7 @@ from scapy.all import * from test_case import TestCase from pmd_output import PmdOutput from settings import get_nic_name +import packet class TestDdpGtpQregion(TestCase): @@ -160,14 +161,11 @@ class TestDdpGtpQregion(TestCase): template file and packets sent to NIC. """ if flowtype == 23: - a = Ether()/IPv6()/UDP(dport=2152)/GTP_U_Header(teid=0xfe)/IPv6(dst="1001:0db8:85a3:0000:0000:8a2e:0370:0001", src="2001:0db8:85a3:0000:0000:8a2e:0370:0001")/UDP(dport=100, sport=200)/Raw("X"*20) + a = 'Ether()/IPv6()/UDP(dport=2152)/GTP_U_Header(teid=0xfe)/IPv6(dst="1001:0db8:85a3:0000:0000:8a2e:0370:0001", src="2001:0db8:85a3:0000:0000:8a2e:0370:0001")/UDP(dport=100, sport=200)/Raw("X"*20)' if flowtype == 26: - a = Ether()/IPv6()/UDP(dport=2152)/GTP_U_Header(teid=0xfe)/IP(dst="1.1.1.1", src="2.2.2.2")/UDP(dport=100, sport=200)/Raw("X"*20) - ba = bytearray(bytes(a)) + a = 'Ether()/IPv6()/UDP(dport=2152)/GTP_U_Header(teid=0xfe)/IP(dst="1.1.1.1", src="2.2.2.2")/UDP(dport=100, sport=200)/Raw("X"*20)' rawfile_src = '/tmp/test_gtp.raw' - File = open("%s" % rawfile_src, "wb") - File.write(ba) - File.close() + packet.write_test(a, rawfile_src) rawfile_dst = "/tmp/" self.dut.session.copy_file_to(rawfile_src, rawfile_dst) @@ -177,10 +175,8 @@ class TestDdpGtpQregion(TestCase): """ pkts = self.gtp_pkts(flowtype, keyword, opt) for packet_type in list(pkts.keys()): - self.tester.scapy_append( - 'sendp([%s], iface="%s")' - % (pkts[packet_type], self.tester_intf)) - self.tester.scapy_execute() + pkt = packet.Packet(pkts[packet_type]) + pkt.send_pkt(crb=self.tester, tx_port=self.tester_intf) out = self.dut.get_session_output(timeout=2) pattern = "port (\d)/queue (\d{1,2}): received (\d) packets" qnum = self.element_strip(out, pattern) @@ -239,10 +235,8 @@ class TestDdpGtpQregion(TestCase): keyword = 'src_ipv6' pkts = self.gtp_pkts(flowtype, keyword, opt) for packet_type in list(pkts.keys()): - self.tester.scapy_append( - 'sendp([%s], iface="%s")' - % (pkts[packet_type], self.tester_intf)) - self.tester.scapy_execute() + pkt = packet.Packet(pkts[packet_type]) + pkt.send_pkt(crb=self.tester, tx_port=self.tester_intf) out = self.dut.get_session_output(timeout=2) self.verify("PKT_RX_RSS_HASH" in out, "Failed to test RSS!!!") pattern = "port (\d)/queue (\d{1,2}): received (\d) packets" From patchwork Wed Dec 9 01:59:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhou, JunX W" X-Patchwork-Id: 84841 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3A337A09E9; Wed, 9 Dec 2020 02:57:01 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4ED0BC956; Wed, 9 Dec 2020 02:56:59 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 551A4BE79 for ; Wed, 9 Dec 2020 02:56:57 +0100 (CET) IronPort-SDR: 987odWfXyHcNcAWPn9dkqVAOIRxLId5Z4z9kB19koAfImj13UOM170AeN1qGRjEILtWsGd5Izm T1Sv04KMtlVQ== X-IronPort-AV: E=McAfee;i="6000,8403,9829"; a="238108431" X-IronPort-AV: E=Sophos;i="5.78,404,1599548400"; d="scan'208";a="238108431" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2020 17:56:56 -0800 IronPort-SDR: mt95F4TteF5h8hDw6eduV3+d5gDWWIhE2GcjJ0F+u9JbUqJGb5w48uN9xYdxr4zAwkd5wuF0H2 VCUbQB4fu2ZQ== X-IronPort-AV: E=Sophos;i="5.78,404,1599548400"; d="scan'208";a="407870700" Received: from unknown (HELO localhost.localdomain) ([10.240.183.80]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2020 17:56:55 -0800 From: Zhou Jun To: dts@dpdk.org Cc: Zhou Jun Date: Wed, 9 Dec 2020 09:59:44 +0800 Message-Id: <20201209015944.12586-4-junx.w.zhou@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201209015944.12586-1-junx.w.zhou@intel.com> References: <20201209015944.12586-1-junx.w.zhou@intel.com> Subject: [dts] [dts 3/3] tests/TestSuite_dynamic_flowtype:change send pkt mode 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" Signed-off-by: Zhou Jun --- tests/TestSuite_dynamic_flowtype.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/TestSuite_dynamic_flowtype.py b/tests/TestSuite_dynamic_flowtype.py index 99f28d8a..3f47d590 100644 --- a/tests/TestSuite_dynamic_flowtype.py +++ b/tests/TestSuite_dynamic_flowtype.py @@ -34,6 +34,7 @@ import re import utils from test_case import TestCase from pmd_output import PmdOutput +import packet VM_CORES_MASK = 'all' @@ -202,10 +203,8 @@ class TestDynamicFlowtype(TestCase): """ pkts = self.gtp_packets(flowtype, match_opt) for packet_type in list(pkts.keys()): - self.tester.scapy_append( - 'sendp([%s], iface="%s")' - % (pkts[packet_type], self.tester_intf)) - self.tester.scapy_execute() + pkt = packet.Packet(pkts[packet_type]) + pkt.send_pkt(crb=self.tester, tx_port=self.tester_intf) out = self.dut.get_session_output(timeout=2) if match_opt == 'matched': self.verify("PKT_RX_RSS_HASH" in out,