Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/134397/?format=api
http://patches.dpdk.org/api/patches/134397/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20231115130959.39420-21-juraj.linkes@pantheon.tech/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20231115130959.39420-21-juraj.linkes@pantheon.tech>", "list_archive_url": "https://inbox.dpdk.org/dev/20231115130959.39420-21-juraj.linkes@pantheon.tech", "date": "2023-11-15T13:09:58", "name": "[v7,20/21] dts: scapy tg docstring update", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "9876414c541bf45be330cc848a1cfc00ae09c1dc", "submitter": { "id": 1626, "url": "http://patches.dpdk.org/api/people/1626/?format=api", "name": "Juraj Linkeš", "email": "juraj.linkes@pantheon.tech" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20231115130959.39420-21-juraj.linkes@pantheon.tech/mbox/", "series": [ { "id": 30302, "url": "http://patches.dpdk.org/api/series/30302/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=30302", "date": "2023-11-15T13:09:38", "name": "dts: docstrings update", "version": 7, "mbox": "http://patches.dpdk.org/series/30302/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/134397/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/134397/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id A3C6F43339;\n\tWed, 15 Nov 2023 14:14:28 +0100 (CET)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 60B54427E0;\n\tWed, 15 Nov 2023 14:12:24 +0100 (CET)", "from mail-ej1-f46.google.com (mail-ej1-f46.google.com\n [209.85.218.46]) by mails.dpdk.org (Postfix) with ESMTP id D966B410F6\n for <dev@dpdk.org>; Wed, 15 Nov 2023 14:12:17 +0100 (CET)", "by mail-ej1-f46.google.com with SMTP id\n a640c23a62f3a-9f26ee4a6e5so119105866b.2\n for <dev@dpdk.org>; Wed, 15 Nov 2023 05:12:17 -0800 (PST)", "from jlinkes-PT-Latitude-5530.pantheon.local\n (81.89.53.154.host.vnet.sk. [81.89.53.154])\n by smtp.gmail.com with ESMTPSA id\n tb16-20020a1709078b9000b009f2b7282387sm1011914ejc.46.2023.11.15.05.12.16\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 15 Nov 2023 05:12:16 -0800 (PST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=pantheon.tech; s=google; t=1700053937; x=1700658737; darn=dpdk.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=l+YRs3S0yhFtTSeinZqTtWuwCfuutnSDZBMU3VA9kyM=;\n b=IJ1EpIc1C28/DnBEdhdAPK+D5b+nCpCpZTUyRTG8lg1Qlbn7eFDhdVdzY5nFusXPma\n /DUnbgNGhx6JPFSlJIvUKVzKhpXbJONoncGeklWJQgRNDTkaAgIhlVj8vrn1puwd32IF\n dlFZNhhGerQrJveI9lzYgw4E0dt+TctxMmDuwTS7ManwFyBd4E1YC1ow78YE3sf5oK5U\n 8eB4iskJD7ZjXrQWpn6bISOBNmF+D/984Mky+LA+e0B3rgs4bC3Cpo6GZHQKSjuq6tBk\n q5J3r1F+mrFItXWXXYWERGdGV6Ds7irIC4G7kGYfhRuZ5s/okWXVPChdfmqUj2vJ/1e6\n iqZA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1700053937; x=1700658737;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=l+YRs3S0yhFtTSeinZqTtWuwCfuutnSDZBMU3VA9kyM=;\n b=OqU5lIWi1AcxB1NOpx9exUckyECddOtEybkKa3gOIIGPXexfvkRMHkln++sgOTFwb/\n g/Uy0XZ9c6CBNwO2iBMHrQrrk22R8Po33GPR+OPPql4X3pbTmyJNc3GLELoJLBOWbAAi\n Yt0bhKkp7IgA+5AZcr1TK4+GtGJS+SBXlI9BBmcnSFVz90/1xLX2L9WHgWE1NoA9hGeE\n O+0N7c0MWQ9SWSF66xC3g6J+cRo82ytNQ2KN3KKIGb5NWshPE5O8XkqWEjOL4QSeaPkk\n Ad0pz8g8IlQJwjatJrl+umgGcZX8NPaVOwVMBclc6SYx+zw10ovkO9c+O57XrlVePW7d\n 9Emw==", "X-Gm-Message-State": "AOJu0YyV2QEfRYZI+XrsEdW9K1iEj+KYSoBaFgr2Q5PdJ3vJ1RDWj2kg\n gYm89L7sH54i2DFN8zs09jOrRg==", "X-Google-Smtp-Source": "\n AGHT+IFbq2GpKNqHoASLWbj06Lfr7P9IgSIlSrn3dxBxfy0ALEegNGaJ71p5JKL/whozMM1mH/IQaw==", "X-Received": "by 2002:a17:906:f2c3:b0:9bd:a738:2bfe with SMTP id\n gz3-20020a170906f2c300b009bda7382bfemr9420755ejb.38.1700053937562;\n Wed, 15 Nov 2023 05:12:17 -0800 (PST)", "From": "=?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>", "To": "thomas@monjalon.net, Honnappa.Nagarahalli@arm.com, jspewock@iol.unh.edu,\n probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com", "Cc": "dev@dpdk.org, =?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>", "Subject": "[PATCH v7 20/21] dts: scapy tg docstring update", "Date": "Wed, 15 Nov 2023 14:09:58 +0100", "Message-Id": "<20231115130959.39420-21-juraj.linkes@pantheon.tech>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20231115130959.39420-1-juraj.linkes@pantheon.tech>", "References": "<20231108125324.191005-23-juraj.linkes@pantheon.tech>\n <20231115130959.39420-1-juraj.linkes@pantheon.tech>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org" }, "content": "Format according to the Google format and PEP257, with slight\ndeviations.\n\nSigned-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>\n---\n .../testbed_model/traffic_generator/scapy.py | 91 +++++++++++--------\n 1 file changed, 54 insertions(+), 37 deletions(-)", "diff": "diff --git a/dts/framework/testbed_model/traffic_generator/scapy.py b/dts/framework/testbed_model/traffic_generator/scapy.py\nindex 51864b6e6b..ed4f879925 100644\n--- a/dts/framework/testbed_model/traffic_generator/scapy.py\n+++ b/dts/framework/testbed_model/traffic_generator/scapy.py\n@@ -2,14 +2,15 @@\n # Copyright(c) 2022 University of New Hampshire\n # Copyright(c) 2023 PANTHEON.tech s.r.o.\n \n-\"\"\"Scapy traffic generator.\n+\"\"\"The Scapy traffic generator.\n \n-Traffic generator used for functional testing, implemented using the Scapy library.\n+A traffic generator used for functional testing, implemented with\n+`the Scapy library <https://scapy.readthedocs.io/en/latest/>`_.\n The traffic generator uses an XML-RPC server to run Scapy on the remote TG node.\n \n-The XML-RPC server runs in an interactive remote SSH session running Python console,\n-where we start the server. The communication with the server is facilitated with\n-a local server proxy.\n+The traffic generator uses the :mod:`xmlrpc.server` module to run an XML-RPC server\n+in an interactive remote Python SSH session. The communication with the server is facilitated\n+with a local server proxy from the :mod:`xmlrpc.client` module.\n \"\"\"\n \n import inspect\n@@ -69,20 +70,20 @@ def scapy_send_packets_and_capture(\n recv_iface: str,\n duration: float,\n ) -> list[bytes]:\n- \"\"\"RPC function to send and capture packets.\n+ \"\"\"The RPC function to send and capture packets.\n \n- The function is meant to be executed on the remote TG node.\n+ The function is meant to be executed on the remote TG node via the server proxy.\n \n Args:\n xmlrpc_packets: The packets to send. These need to be converted to\n- xmlrpc.client.Binary before sending to the remote server.\n+ :class:`~xmlrpc.client.Binary` objects before sending to the remote server.\n send_iface: The logical name of the egress interface.\n recv_iface: The logical name of the ingress interface.\n duration: Capture for this amount of time, in seconds.\n \n Returns:\n A list of bytes. Each item in the list represents one packet, which needs\n- to be converted back upon transfer from the remote node.\n+ to be converted back upon transfer from the remote node.\n \"\"\"\n scapy_packets = [scapy.all.Packet(packet.data) for packet in xmlrpc_packets]\n sniffer = scapy.all.AsyncSniffer(\n@@ -98,19 +99,15 @@ def scapy_send_packets_and_capture(\n def scapy_send_packets(\n xmlrpc_packets: list[xmlrpc.client.Binary], send_iface: str\n ) -> None:\n- \"\"\"RPC function to send packets.\n+ \"\"\"The RPC function to send packets.\n \n- The function is meant to be executed on the remote TG node.\n- It doesn't return anything, only sends packets.\n+ The function is meant to be executed on the remote TG node via the server proxy.\n+ It only sends `xmlrpc_packets`, without capturing them.\n \n Args:\n xmlrpc_packets: The packets to send. These need to be converted to\n- xmlrpc.client.Binary before sending to the remote server.\n+ :class:`~xmlrpc.client.Binary` objects before sending to the remote server.\n send_iface: The logical name of the egress interface.\n-\n- Returns:\n- A list of bytes. Each item in the list represents one packet, which needs\n- to be converted back upon transfer from the remote node.\n \"\"\"\n scapy_packets = [scapy.all.Packet(packet.data) for packet in xmlrpc_packets]\n scapy.all.sendp(scapy_packets, iface=send_iface, realtime=True, verbose=True)\n@@ -130,11 +127,19 @@ def scapy_send_packets(\n \n \n class QuittableXMLRPCServer(SimpleXMLRPCServer):\n- \"\"\"Basic XML-RPC server that may be extended\n- by functions serializable by the marshal module.\n+ r\"\"\"Basic XML-RPC server.\n+\n+ The server may be augmented by functions serializable by the :mod:`marshal` module.\n \"\"\"\n \n def __init__(self, *args, **kwargs):\n+ \"\"\"Extend the XML-RPC server initialization.\n+\n+ Args:\n+ args: The positional arguments that will be passed to the superclass's constructor.\n+ kwargs: The keyword arguments that will be passed to the superclass's constructor.\n+ The `allow_none` argument will be set to :data:`True`.\n+ \"\"\"\n kwargs[\"allow_none\"] = True\n super().__init__(*args, **kwargs)\n self.register_introspection_functions()\n@@ -142,13 +147,12 @@ def __init__(self, *args, **kwargs):\n self.register_function(self.add_rpc_function)\n \n def quit(self) -> None:\n+ \"\"\"Quit the server.\"\"\"\n self._BaseServer__shutdown_request = True\n return None\n \n def add_rpc_function(self, name: str, function_bytes: xmlrpc.client.Binary) -> None:\n- \"\"\"Add a function to the server.\n-\n- This is meant to be executed remotely.\n+ \"\"\"Add a function to the server from the local server proxy.\n \n Args:\n name: The name of the function.\n@@ -159,6 +163,11 @@ def add_rpc_function(self, name: str, function_bytes: xmlrpc.client.Binary) -> N\n self.register_function(function)\n \n def serve_forever(self, poll_interval: float = 0.5) -> None:\n+ \"\"\"Extend the superclass method with an additional print.\n+\n+ Once executed in the local server proxy, the print gives us a clear string to expect\n+ when starting the server. The print means the function was executed on the XML-RPC server.\n+ \"\"\"\n print(\"XMLRPC OK\")\n super().serve_forever(poll_interval)\n \n@@ -166,19 +175,12 @@ def serve_forever(self, poll_interval: float = 0.5) -> None:\n class ScapyTrafficGenerator(CapturingTrafficGenerator):\n \"\"\"Provides access to scapy functions via an RPC interface.\n \n- The traffic generator first starts an XML-RPC on the remote TG node.\n- Then it populates the server with functions which use the Scapy library\n- to send/receive traffic.\n-\n- Any packets sent to the remote server are first converted to bytes.\n- They are received as xmlrpc.client.Binary objects on the server side.\n- When the server sends the packets back, they are also received as\n- xmlrpc.client.Binary object on the client side, are converted back to Scapy\n- packets and only then returned from the methods.\n+ The class extends the base with remote execution of scapy functions.\n \n- Arguments:\n- tg_node: The node where the traffic generator resides.\n- config: The user configuration of the traffic generator.\n+ Any packets sent to the remote server are first converted to bytes. They are received as\n+ :class:`~xmlrpc.client.Binary` objects on the server side. When the server sends the packets\n+ back, they are also received as :class:`~xmlrpc.client.Binary` objects on the client side, are\n+ converted back to :class:`scapy.packet.Packet` objects and only then returned from the methods.\n \n Attributes:\n session: The exclusive interactive remote session created by the Scapy\n@@ -192,6 +194,22 @@ class ScapyTrafficGenerator(CapturingTrafficGenerator):\n _config: ScapyTrafficGeneratorConfig\n \n def __init__(self, tg_node: Node, config: ScapyTrafficGeneratorConfig):\n+ \"\"\"Extend the constructor with Scapy TG specifics.\n+\n+ The traffic generator first starts an XML-RPC on the remote `tg_node`.\n+ Then it populates the server with functions which use the Scapy library\n+ to send/receive traffic:\n+\n+ * :func:`scapy_send_packets_and_capture`\n+ * :func:`scapy_send_packets`\n+\n+ To enable verbose logging from the xmlrpc client, use the :option:`--verbose`\n+ command line argument or the :envvar:`DTS_VERBOSE` environment variable.\n+\n+ Args:\n+ tg_node: The node where the traffic generator resides.\n+ config: The traffic generator's test run configuration.\n+ \"\"\"\n super().__init__(tg_node, config)\n \n assert (\n@@ -237,10 +255,8 @@ def _start_xmlrpc_server_in_remote_python(self, listen_port: int) -> None:\n [line for line in src.splitlines() if not line.isspace() and line != \"\"]\n )\n \n- spacing = \"\\n\" * 4\n-\n # execute it in the python terminal\n- self.session.send_command(spacing + src + spacing)\n+ self.session.send_command(src + \"\\n\")\n self.session.send_command(\n f\"server = QuittableXMLRPCServer(('0.0.0.0', {listen_port}));\"\n f\"server.serve_forever()\",\n@@ -274,6 +290,7 @@ def _send_packets_and_capture(\n return scapy_packets\n \n def close(self) -> None:\n+ \"\"\"Close the traffic generator.\"\"\"\n try:\n self.rpc_server_proxy.quit()\n except ConnectionRefusedError:\n", "prefixes": [ "v7", "20/21" ] }{ "id": 134397, "url": "