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 579B8A09EA; Wed, 9 Dec 2020 03:47:28 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 38178C8F8; Wed, 9 Dec 2020 03:47:27 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 060972B8B for ; Wed, 9 Dec 2020 03:47:24 +0100 (CET) IronPort-SDR: WB4NSe1XQ4saG3QI4FTNpxDFPHQ7HBHalqEsKd7SXuYOTOMGLPZtPUP0f+5rbK8C4H8YeZp7cI Ih8cOJ/cLjqA== X-IronPort-AV: E=McAfee;i="6000,8403,9829"; a="153818754" X-IronPort-AV: E=Sophos;i="5.78,404,1599548400"; d="scan'208";a="153818754" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2020 18:47:21 -0800 IronPort-SDR: sTMHDP35Xd26CKRY/tUtT1lGdbAbf9EsbU+mmhtnCR5auD/dsHy+yxUj0YuNvVg/9/QslpOQSx JOYoml/rCYLA== X-IronPort-AV: E=Sophos;i="5.78,404,1599548400"; d="scan'208";a="363942576" Received: from unknown (HELO localhost.localdomain) ([10.240.183.80]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2020 18:47:20 -0800 From: Zhou Jun To: dts@dpdk.org Cc: Zhou Jun Date: Wed, 9 Dec 2020 10:50:10 +0800 Message-Id: <20201209025012.13017-2-junx.w.zhou@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201209025012.13017-1-junx.w.zhou@intel.com> References: <20201209025012.13017-1-junx.w.zhou@intel.com> Subject: [dts] [PATCH V3 1/3] framework/packet:add new 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" framework/packet:add new interface for write raw pkt 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 = { -- 2.17.1