get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/139241/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 139241,
    "url": "http://patches.dpdk.org/api/patches/139241/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240412111136.3470304-6-luca.vizzarro@arm.com/",
    "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": "<20240412111136.3470304-6-luca.vizzarro@arm.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240412111136.3470304-6-luca.vizzarro@arm.com",
    "date": "2024-04-12T11:11:36",
    "name": "[5/5] dts: add `show port stats` command to TestPmdShell",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "b8713201690679fbd00d0396721549a1fb3a1db6",
    "submitter": {
        "id": 3197,
        "url": "http://patches.dpdk.org/api/people/3197/?format=api",
        "name": "Luca Vizzarro",
        "email": "luca.vizzarro@arm.com"
    },
    "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/20240412111136.3470304-6-luca.vizzarro@arm.com/mbox/",
    "series": [
        {
            "id": 31729,
            "url": "http://patches.dpdk.org/api/series/31729/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=31729",
            "date": "2024-04-12T11:11:31",
            "name": "dts: testpmd show port info/stats",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/31729/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/139241/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/139241/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 94EF943E51;\n\tFri, 12 Apr 2024 13:12:25 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id F094D40DCD;\n\tFri, 12 Apr 2024 13:12:00 +0200 (CEST)",
            "from foss.arm.com (foss.arm.com [217.140.110.172])\n by mails.dpdk.org (Postfix) with ESMTP id F0BEF40A75\n for <dev@dpdk.org>; Fri, 12 Apr 2024 13:11:58 +0200 (CEST)",
            "from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])\n by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A97DA113E;\n Fri, 12 Apr 2024 04:12:27 -0700 (PDT)",
            "from localhost.localdomain (unknown [10.57.19.212])\n by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 734A33F766;\n Fri, 12 Apr 2024 04:11:57 -0700 (PDT)"
        ],
        "From": "Luca Vizzarro <luca.vizzarro@arm.com>",
        "To": "dev@dpdk.org",
        "Cc": "=?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>,\n Jeremy Spewock <jspewock@iol.unh.edu>, Luca Vizzarro <luca.vizzarro@arm.com>,\n Paul Szczepanek <paul.szczepanek@arm.com>",
        "Subject": "[PATCH 5/5] dts: add `show port stats` command to TestPmdShell",
        "Date": "Fri, 12 Apr 2024 12:11:36 +0100",
        "Message-Id": "<20240412111136.3470304-6-luca.vizzarro@arm.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20240412111136.3470304-1-luca.vizzarro@arm.com>",
        "References": "<20240412111136.3470304-1-luca.vizzarro@arm.com>",
        "MIME-Version": "1.0",
        "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": "Add a new TestPmdPortStats data structure to represent the output\nreturned by `show port stats`, which is implemented as part of\nTestPmdShell.\n\nBugzilla ID: 1407\n\nSigned-off-by: Luca Vizzarro <luca.vizzarro@arm.com>\nReviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>\n---\n dts/framework/remote_session/testpmd_shell.py | 58 +++++++++++++++++++\n 1 file changed, 58 insertions(+)",
    "diff": "diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py\nindex 3cf123ff57..baf47d1a32 100644\n--- a/dts/framework/remote_session/testpmd_shell.py\n+++ b/dts/framework/remote_session/testpmd_shell.py\n@@ -519,6 +519,42 @@ class TestPmdPort(TextParser):\n     )\n \n \n+@dataclass\n+class TestPmdPortStats(TextParser):\n+    \"\"\"Port statistics.\"\"\"\n+\n+    #:\n+    port_id: int = field(metadata=parser.to_int(parser.regex(r\"NIC statistics for port (\\d+)\")))\n+\n+    #:\n+    rx_packets: int = field(metadata=parser.to_int(parser.regex(r\"RX-packets:\\s+(\\d+)\")))\n+    #:\n+    rx_missed: int = field(metadata=parser.to_int(parser.regex(r\"RX-missed:\\s+(\\d+)\")))\n+    #:\n+    rx_bytes: int = field(metadata=parser.to_int(parser.regex(r\"RX-bytes:\\s+(\\d+)\")))\n+    #:\n+    rx_errors: int = field(metadata=parser.to_int(parser.regex(r\"RX-errors:\\s+(\\d+)\")))\n+    #:\n+    rx_nombuf: int = field(metadata=parser.to_int(parser.regex(r\"RX-nombuf:\\s+(\\d+)\")))\n+\n+    #:\n+    tx_packets: int = field(metadata=parser.to_int(parser.regex(r\"TX-packets:\\s+(\\d+)\")))\n+    #:\n+    tx_errors: int = field(metadata=parser.to_int(parser.regex(r\"TX-errors:\\s+(\\d+)\")))\n+    #:\n+    tx_bytes: int = field(metadata=parser.to_int(parser.regex(r\"TX-bytes:\\s+(\\d+)\")))\n+\n+    #:\n+    rx_pps: int = field(metadata=parser.to_int(parser.regex(r\"Rx-pps:\\s+(\\d+)\")))\n+    #:\n+    rx_bps: int = field(metadata=parser.to_int(parser.regex(r\"Rx-bps:\\s+(\\d+)\")))\n+\n+    #:\n+    tx_pps: int = field(metadata=parser.to_int(parser.regex(r\"Tx-pps:\\s+(\\d+)\")))\n+    #:\n+    tx_bps: int = field(metadata=parser.to_int(parser.regex(r\"Tx-bps:\\s+(\\d+)\")))\n+\n+\n class TestPmdShell(InteractiveShell):\n     \"\"\"Testpmd interactive shell.\n \n@@ -696,6 +732,28 @@ def show_port_info(self, port_id: int) -> TestPmdPort:\n \n         return TestPmdPort.parse(output)\n \n+    def show_port_stats_all(self) -> list[TestPmdPortStats]:\n+        \"\"\"Returns the statistics of all the ports.\"\"\"\n+        output = self.send_command(\"show port stats all\")\n+\n+        iter = re.finditer(r\"(^  #*.+#*$[^#]+)^  #*$\", output, re.MULTILINE)\n+        return [TestPmdPortStats.parse(block.group(1)) for block in iter]\n+\n+    def show_port_stats(self, port_id: int) -> TestPmdPortStats:\n+        \"\"\"Returns the given port statistics.\n+\n+        Args:\n+            port_id: The port ID to gather information for.\n+\n+        Raises:\n+            InteractiveCommandExecutionError: If `port_id` is invalid.\n+        \"\"\"\n+        output = self.send_command(f\"show port stats {port_id}\")\n+        if output.startswith(\"Invalid port\"):\n+            raise InteractiveCommandExecutionError(\"invalid port given\")\n+\n+        return TestPmdPortStats.parse(output)\n+\n     def close(self) -> None:\n         \"\"\"Overrides :meth:`~.interactive_shell.close`.\"\"\"\n         self.send_command(\"quit\", \"\")\n",
    "prefixes": [
        "5/5"
    ]
}