From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9AB1E44161 for ; Wed, 5 Jun 2024 19:54:56 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7C99240DDA; Wed, 5 Jun 2024 19:54:56 +0200 (CEST) Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by mails.dpdk.org (Postfix) with ESMTP id 73B34402C9 for ; Wed, 5 Jun 2024 19:54:53 +0200 (CEST) Received: from loongson.cn (unknown [192.168.100.1]) by gateway (Coremail) with SMTP id _____8BxLutqpmBmAecDAA--.16530S3; Thu, 06 Jun 2024 01:54:51 +0800 (CST) Received: from localhost.localdomain (unknown [192.168.100.1]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxmsZqpmBmAfcVAA--.54729S3; Thu, 06 Jun 2024 01:54:50 +0800 (CST) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.15.2/8.15.2) with ESMTPS id 455HQG0I699019 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 6 Jun 2024 01:26:17 +0800 Received: (from root@localhost) by localhost.localdomain (8.15.2/8.15.2/Submit) id 455HQGBF699018; Thu, 6 Jun 2024 01:26:16 +0800 Date: Thu, 6 Jun 2024 01:26:16 +0800 From: qemudev@loongson.cn Message-Id: <202406051726.455HQGBF699018@localhost.localdomain> Content-Type: text/plain; charset="utf-8" Subject: |WARNING| pw140765-140766 [RFC PATCH v1 1/2] dts: Add interactive shell for managing Scapy In-Reply-To: <20240605175227.7003-2-jspewock@iol.unh.edu> References: <20240605175227.7003-2-jspewock@iol.unh.edu> To: test-report@dpdk.org Cc: jspewock@iol.unh.edu, zhoumin@loongson.cn X-CM-TRANSID: AQAAf8BxmsZqpmBmAfcVAA--.54729S3 Authentication-Results: localhost.localdomain; spf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UJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14 v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07Uu89NUUUUU= X-BeenThere: test-report@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: automatic DPDK test reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: test-report-bounces@dpdk.org Test-Label: loongarch-compilation Test-Status: WARNING http://dpdk.org/patch/140765 _apply patch failure_ Submitter: Jeremy Spewock Date: Wed, 5 Jun 2024 13:52:26 -0400 DPDK git baseline: Repo:dpdk Branch: main CommitID: 76cef1af8bdaeaf67a5c4ca5df3f221df994dc46 Apply patch set 140765-140766 failed: Checking patch dts/framework/testbed_model/traffic_generator/scapy.py... error: while searching for: _get_default_capture_name, ) """ ========= BEGIN RPC FUNCTIONS ========= All of the functions in this section are intended to be exported to a python shell which runs a scapy RPC server. These functions are made available via that RPC server to the packet generator. To add a new function to the RPC server, first write the function in this section. Then, if you need any imports, make sure to add them to SCAPY_RPC_SERVER_IMPORTS as well. After that, add the function to the list in EXPORTED_FUNCTIONS. Note that kwargs (keyword arguments) do not work via xmlrpc, so you may need to construct wrapper functions around many scapy types. """ """ Add the line needed to import something in a normal python environment as an entry to this array. It will be imported before any functions are sent to the server. """ SCAPY_RPC_SERVER_IMPORTS = [ "from scapy.all import *", "import xmlrpc", "import sys", "from xmlrpc.server import SimpleXMLRPCServer", "import marshal", "import pickle", "import types", "import time", ] def scapy_send_packets_and_capture( xmlrpc_packets: list[xmlrpc.client.Binary], send_iface: str, recv_iface: str, duration: float, sniff_filter: str, ) -> list[bytes]: """The RPC function to send and capture packets. This function is meant to be executed on the remote TG node via the server proxy. Args: xmlrpc_packets: The packets to send. These need to be converted to :class:`~xmlrpc.client.Binary` objects before sending to the remote server. send_iface: The logical name of the egress interface. recv_iface: The logical name of the ingress interface. duration: Capture for this amount of time, in seconds. Returns: A list of bytes. Each item in the list represents one packet, which needs to be converted back upon transfer from the remote node. """ scapy_packets = [scapy.all.Packet(packet.data) for packet in xmlrpc_packets] sniffer = scapy.all.AsyncSniffer( iface=recv_iface, store=True, started_callback=lambda *args: scapy.all.sendp(scapy_packets, iface=send_iface), filter=sniff_filter, ) sniffer.start() time.sleep(duration) return [scapy_packet.build() for scapy_packet in sniffer.stop(join=True)] def scapy_send_packets(xmlrpc_packets: list[xmlrpc.client.Binary], send_iface: str) -> None: """The RPC function to send packets. This function is meant to be executed on the remote TG node via the server proxy. It only sends `xmlrpc_packets`, without capturing them. Args: xmlrpc_packets: The packets to send. These need to be converted to :class:`~xmlrpc.client.Binary` objects before sending to the remote server. send_iface: The logical name of the egress interface. """ scapy_packets = [scapy.all.Packet(packet.data) for packet in xmlrpc_packets] scapy.all.sendp(scapy_packets, iface=send_iface, realtime=True, verbose=True) """ Functions to be exposed by the scapy RPC server. """ RPC_FUNCTIONS = [ scapy_send_packets, scapy_send_packets_and_capture, ] """ ========= END RPC FUNCTIONS ========= """ class QuittableXMLRPCServer(SimpleXMLRPCServer): r"""Basic XML-RPC server. The server may be augmented by functions serializable by the :mod:`marshal` module. Example: :: def hello_world(): # to be sent to the XML-RPC server print("Hello World!") # start the XML-RPC server on the remote node # the example assumes you're already connect to a tg_node # this is done by starting a Python shell on the remote node from framework.remote_session import PythonShell session = tg_node.create_interactive_shell(PythonShell, timeout=5, privileged=True) # then importing the modules needed to run the server # and the modules for any functions later added to the server session.send_command("import xmlrpc" error: patch failed: dts/framework/testbed_model/traffic_generator/scapy.py:36 error: dts/framework/testbed_model/traffic_generator/scapy.py: patch does not apply