Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/134586/?format=api
http://patches.dpdk.org/api/patches/134586/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20231123151344.162812-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": "<20231123151344.162812-21-juraj.linkes@pantheon.tech>", "list_archive_url": "https://inbox.dpdk.org/dev/20231123151344.162812-21-juraj.linkes@pantheon.tech", "date": "2023-11-23T15:13:43", "name": "[v8,20/21] dts: scapy tg docstring update", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "71452a739142d6332dcaaf769f4388012f8636c9", "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/20231123151344.162812-21-juraj.linkes@pantheon.tech/mbox/", "series": [ { "id": 30375, "url": "http://patches.dpdk.org/api/series/30375/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=30375", "date": "2023-11-23T15:13:23", "name": "dts: docstrings update", "version": 8, "mbox": "http://patches.dpdk.org/series/30375/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/134586/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/134586/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 86A11433AC;\n\tThu, 23 Nov 2023 16:17:01 +0100 (CET)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 736FB432C4;\n\tThu, 23 Nov 2023 16:14:30 +0100 (CET)", "from mail-wr1-f41.google.com (mail-wr1-f41.google.com\n [209.85.221.41]) by mails.dpdk.org (Postfix) with ESMTP id 8FE8D43254\n for <dev@dpdk.org>; Thu, 23 Nov 2023 16:14:13 +0100 (CET)", "by mail-wr1-f41.google.com with SMTP id\n ffacd0b85a97d-332cb136335so635526f8f.0\n for <dev@dpdk.org>; Thu, 23 Nov 2023 07:14:13 -0800 (PST)", "from jlinkes-PT-Latitude-5530.. ([84.245.121.10])\n by smtp.gmail.com with ESMTPSA id\n q4-20020adfea04000000b003296b488961sm1870143wrm.31.2023.11.23.07.14.12\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 23 Nov 2023 07:14:12 -0800 (PST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=pantheon.tech; s=google; t=1700752453; x=1701357253; 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=L2pgBiNC+M0CDWk5LE0ZO7ROyha4y6BygIw8dBZSi1c=;\n b=sM4XfduQ00aaAwDAg8jNgrELa+GWb1JtTQao0Ki82GvUne6JON2azJui/FLB+1gDZF\n DiZctqbXqjZP8byf6hYqvloZxFf2Yi0DsnU+9BiWzc5RS0usquIuzhmAfnJ9YGTGvHVk\n 1uV0OStXQ1XMBTCV83WbybgAiz6WKAnBCFE/zmGWRz0JRKocXBfY6SWxhQWqQ+sKi9pr\n jhtSlldx5b9x6/96GcirQTbXlnzIiK7P86MFQ6pxHPcUI3bAyBvtOXDGwfTN9IshWBnO\n E3bn7wmRm9rgKuka3tTcL2MIT34e8jGE9yOItFhGs4ZWLVvm13LdGslo6gYnhm76fBA/\n lMEA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1700752453; x=1701357253;\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=L2pgBiNC+M0CDWk5LE0ZO7ROyha4y6BygIw8dBZSi1c=;\n b=F1ywoVDuR9N4JMTkxE5hWFCLuDlnQy5A2WLwg5blNX8OCdmmFFsTwMlidcjLP+jR8n\n hjDu0xyVb+VaYTxAcudC0svIUaDqaZnjnuVjWPcCJZ/Uaz51WJqv+/5rsWS/eRf41lXF\n GfBkGxpPM/uW1SqjIIZP0atyPOi8oVUhvdCkyc2YqYHVRvrG7SEPkZwSN94xCGm3OQnz\n 7d36Fu0H4FNneAb3bNDQYMW7vHc8HsnV84TCbDg7i4JNbGWWP09SbGdO0iTf1HUYZ2NT\n ZyHB1QzCygYt202/5CXwXI8hn/sbYSYOfCic8kbq5AAkiJl0jak5kv+hZH/xzfvH3SzB\n 1P8Q==", "X-Gm-Message-State": "AOJu0Yyw5XCpLwG+4dnd4x/PKJkiPulUpxQMsVO1lfdXX8r2gG63xZN0\n 6XR/m7My0HDYF82CaTJOmizGWQ==", "X-Google-Smtp-Source": "\n AGHT+IHXZmOcu5EH9haJdXnp+u4zXHK5CWcXEEr/vVzJuRjz8ONXF32/AApo+bxn966fHkpgGzOPzg==", "X-Received": "by 2002:a5d:6da7:0:b0:332:ca10:37f with SMTP id\n u7-20020a5d6da7000000b00332ca10037fmr4732592wrs.43.1700752453200;\n Thu, 23 Nov 2023 07:14:13 -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,\n Luca.Vizzarro@arm.com", "Cc": "dev@dpdk.org, =?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>", "Subject": "[PATCH v8 20/21] dts: scapy tg docstring update", "Date": "Thu, 23 Nov 2023 16:13:43 +0100", "Message-Id": "<20231123151344.162812-21-juraj.linkes@pantheon.tech>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20231123151344.162812-1-juraj.linkes@pantheon.tech>", "References": "<20231115130959.39420-1-juraj.linkes@pantheon.tech>\n <20231123151344.162812-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 c88cf28369..30ea3914ee 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@@ -96,19 +97,15 @@ def scapy_send_packets_and_capture(\n \n \n def scapy_send_packets(xmlrpc_packets: list[xmlrpc.client.Binary], send_iface: str) -> 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@@ -128,11 +125,19 @@ def scapy_send_packets(xmlrpc_packets: list[xmlrpc.client.Binary], send_iface: s\n \n \n class QuittableXMLRPCServer(SimpleXMLRPCServer):\n- \"\"\"Basic XML-RPC server that may be extended\n- by functions serializable by the marshal module.\n+ \"\"\"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@@ -140,13 +145,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@@ -157,6 +161,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@@ -164,19 +173,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@@ -190,6 +192,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@@ -231,10 +249,8 @@ def _start_xmlrpc_server_in_remote_python(self, listen_port: int) -> None:\n # or class, so strip all lines containing only whitespace\n src = \"\\n\".join([line for line in src.splitlines() if not line.isspace() and line != \"\"])\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}));server.serve_forever()\",\n \"XMLRPC OK\",\n@@ -267,6 +283,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": [ "v8", "20/21" ] }{ "id": 134586, "url": "