Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/133921/?format=api
http://patches.dpdk.org/api/patches/133921/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20231106171601.160749-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": "<20231106171601.160749-21-juraj.linkes@pantheon.tech>", "list_archive_url": "https://inbox.dpdk.org/dev/20231106171601.160749-21-juraj.linkes@pantheon.tech", "date": "2023-11-06T17:15:58", "name": "[v5,20/23] dts: scapy tg docstring update", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "767170eb329cb7da2bdbf35b1a03e8380b559a08", "submitter": { "id": 1626, "url": "http://patches.dpdk.org/api/people/1626/?format=api", "name": "Juraj Linkeš", "email": "juraj.linkes@pantheon.tech" }, "delegate": { "id": 2642, "url": "http://patches.dpdk.org/api/users/2642/?format=api", "username": "mcoquelin", "first_name": "Maxime", "last_name": "Coquelin", "email": "maxime.coquelin@redhat.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20231106171601.160749-21-juraj.linkes@pantheon.tech/mbox/", "series": [ { "id": 30173, "url": "http://patches.dpdk.org/api/series/30173/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=30173", "date": "2023-11-06T17:15:38", "name": "dts: add dts api docs", "version": 5, "mbox": "http://patches.dpdk.org/series/30173/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/133921/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/133921/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 9717C432BB;\n\tMon, 6 Nov 2023 18:18:59 +0100 (CET)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id D5A6C42DE4;\n\tMon, 6 Nov 2023 18:16:35 +0100 (CET)", "from mail-ed1-f52.google.com (mail-ed1-f52.google.com\n [209.85.208.52]) by mails.dpdk.org (Postfix) with ESMTP id 7559942D87\n for <dev@dpdk.org>; Mon, 6 Nov 2023 18:16:32 +0100 (CET)", "by mail-ed1-f52.google.com with SMTP id\n 4fb4d7f45d1cf-54394328f65so7889584a12.3\n for <dev@dpdk.org>; Mon, 06 Nov 2023 09:16:32 -0800 (PST)", "from jlinkes-PT-Latitude-5530.. (ip-46.34.243.197.o2inet.sk.\n [46.34.243.197]) by smtp.gmail.com with ESMTPSA id\n s10-20020a170906354a00b009b947aacb4bsm47016eja.191.2023.11.06.09.16.30\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 06 Nov 2023 09:16:31 -0800 (PST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=pantheon.tech; s=google; t=1699290992; x=1699895792; 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=ic2HSjaaUtpFow78DherjJZEUbGpTzSWTYcIUK3zrxE=;\n b=EtICj0Y5TZVZPqybixOX++NORl/g6jCLjItab07h11oVGwF7NiyViA7HBBRapc66uK\n gwxu1aeH7zwhmQurnFQbAh9uOqOO+ZjxVKdrbsNZXb0ciDugA62xEoAM2SRKMHMXuQ17\n jqVfR2sAKTF9aNNxoGgRYBXmgzc5rZFTXDmalAzDHvxJU4XJdh0onutDw+mkcm4PhvD/\n +i/AYvb6YwskvtCNdmfqpXhlxdqgFCUQC62meryc/SMkhrwDkm8BWkf2iWmWDIMwGVqK\n ILQ/fb6vU2Jd8w5wBwVFK8RC02zsAGPxZQRwrsr5LcVHzKbnHVU6lDj2yxkuVCHpXVy0\n zlTw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1699290992; x=1699895792;\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=ic2HSjaaUtpFow78DherjJZEUbGpTzSWTYcIUK3zrxE=;\n b=a79ZItMvs8puQQYz1DWpEPoAOIjh7R72K0yo35Iw7iFj/dffg7tiAUoodRlT8uo2Eq\n pCUNDpZbwBdLwOQIKWuhMCV5QVev1029v+t4/xuMbBmUED1afyWZfeATB8cMTvyYh1cJ\n /RwNd0EB4cRTr3XeuWLPF2NoqNlwVQRYd6JCaQitrV+C2YVDNrkQjHafjA3HutfqfwPm\n EmHlef/e3BBX6QShLL6Qt3YsjL727v+T+PcMn3L3hnzKMENVL5g0Fwy2ELexf+280uX5\n N7cKnPSkGn7m1tyKhe7u1yNivFMOi4xKIqEf6WYgpFfy7qQfzVZtDS4PfuSesQd9Yvnk\n iCZw==", "X-Gm-Message-State": "AOJu0Yy+ozFuiU9pPd8hIJvnh5n34z0fi9AqU3F2x15pFrLn+WtwN1F+\n Mu0PK8tmcoZhDPfBJ9XOcNlJpw==", "X-Google-Smtp-Source": "\n AGHT+IFmiILaeGuw0eqepbPfPB6sIpv4A9n2AKn1+ea20xFbxPQY/rOOVrwYbQDgCQf4DVnEY7KvTg==", "X-Received": "by 2002:a17:907:70c:b0:9d3:5d4a:8b6a with SMTP id\n xb12-20020a170907070c00b009d35d4a8b6amr14778323ejb.42.1699290991998;\n Mon, 06 Nov 2023 09:16:31 -0800 (PST)", "From": "=?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>", "To": "thomas@monjalon.net, Honnappa.Nagarahalli@arm.com,\n bruce.richardson@intel.com, jspewock@iol.unh.edu, probb@iol.unh.edu,\n 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 v5 20/23] dts: scapy tg docstring update", "Date": "Mon, 6 Nov 2023 18:15:58 +0100", "Message-Id": "<20231106171601.160749-21-juraj.linkes@pantheon.tech>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20231106171601.160749-1-juraj.linkes@pantheon.tech>", "References": "<20230831100407.59865-1-juraj.linkes@pantheon.tech>\n <20231106171601.160749-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..d0fe03055a 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 ``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": [ "v5", "20/23" ] }{ "id": 133921, "url": "