get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 47520,
    "url": "https://patches.dpdk.org/api/patches/47520/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20181027091750.17254-12-harry.van.haaren@intel.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<20181027091750.17254-12-harry.van.haaren@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20181027091750.17254-12-harry.van.haaren@intel.com",
    "date": "2018-10-27T09:17:49",
    "name": "[v10,11/12] usertools: add client python script for telemetry",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "9c70a79c97fb2cec9f123c9b132d0f543a0b0a29",
    "submitter": {
        "id": 317,
        "url": "https://patches.dpdk.org/api/people/317/?format=api",
        "name": "Van Haaren, Harry",
        "email": "harry.van.haaren@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20181027091750.17254-12-harry.van.haaren@intel.com/mbox/",
    "series": [
        {
            "id": 2132,
            "url": "https://patches.dpdk.org/api/series/2132/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=2132",
            "date": "2018-10-27T09:17:38",
            "name": "Introduce Telemetry Library",
            "version": 10,
            "mbox": "https://patches.dpdk.org/series/2132/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/47520/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/47520/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id E58A95F1C;\n\tSat, 27 Oct 2018 11:20:33 +0200 (CEST)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n\tby dpdk.org (Postfix) with ESMTP id BCCBB58CB\n\tfor <dev@dpdk.org>; Sat, 27 Oct 2018 11:19:51 +0200 (CEST)",
            "from orsmga008.jf.intel.com ([10.7.209.65])\n\tby orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t27 Oct 2018 02:19:51 -0700",
            "from silpixa00399779.ir.intel.com (HELO\n\tsilpixa00399779.ger.corp.intel.com) ([10.237.223.188])\n\tby orsmga008.jf.intel.com with ESMTP; 27 Oct 2018 02:19:49 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.54,431,1534834800\"; d=\"scan'208\";a=\"84903919\"",
        "From": "Harry van Haaren <harry.van.haaren@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "thomas@monjalon.net, bruce.richardson@intel.com,\n\tstephen@networkplumber.org, gaetan.rivet@6wind.com,\n\tshreyansh.jain@nxp.com, \n\tmattias.ronnblom@ericsson.com, Ciara Power <ciara.power@intel.com>,\n\tBrian Archbold <brian.archbold@intel.com>,\n\tKevin Laatz <kevin.laatz@intel.com>",
        "Date": "Sat, 27 Oct 2018 10:17:49 +0100",
        "Message-Id": "<20181027091750.17254-12-harry.van.haaren@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20181027091750.17254-1-harry.van.haaren@intel.com>",
        "References": "<20181026235933.79779-1-harry.van.haaren@intel.com>\n\t<20181027091750.17254-1-harry.van.haaren@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v10 11/12] usertools: add client python script\n\tfor telemetry",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Ciara Power <ciara.power@intel.com>\n\nThis patch adds a python script which can be used as a demo\nclient. The script is interactive and will allow the user to\nregister, request statistics, and unregister.\n\nTo run the script, an argument for the client file path must\nbe passed in: \"python telemetry_client.py <file_path>\".\n\nThis script is useful to see how the Telemetry API for DPDK\nis used, and how to make the initial connection.\n\nSigned-off-by: Ciara Power <ciara.power@intel.com>\nSigned-off-by: Brian Archbold <brian.archbold@intel.com>\nSigned-off-by: Kevin Laatz <kevin.laatz@intel.com>\nAcked-by: Harry van Haaren <harry.van.haaren@intel.com>\n\n---\n\nv10:\n - Add MAINTAINER entry for client script (Thomas)\n---\n MAINTAINERS                        |   1 +\n usertools/dpdk-telemetry-client.py | 116 +++++++++++++++++++++++++++++\n 2 files changed, 117 insertions(+)\n create mode 100644 usertools/dpdk-telemetry-client.py",
    "diff": "diff --git a/MAINTAINERS b/MAINTAINERS\nindex 86712b139..a919ffd45 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -1212,6 +1212,7 @@ Telemetry - EXPERIMENTAL\n M: Kevin Laatz <kevin.laatz@intel.com>\n F: lib/librte_telemetry/\n F: doc/guides/howto/telemetry.rst\n+F: usertools/dpdk-telemetry-client.py\n \n Test Applications\n -----------------\ndiff --git a/usertools/dpdk-telemetry-client.py b/usertools/dpdk-telemetry-client.py\nnew file mode 100644\nindex 000000000..6dcf62bac\n--- /dev/null\n+++ b/usertools/dpdk-telemetry-client.py\n@@ -0,0 +1,116 @@\n+# SPDK-License-Identifier: BSD-3-Clause\n+# Copyright(c) 2018 Intel Corporation\n+\n+import socket\n+import os\n+import sys\n+import time\n+\n+BUFFER_SIZE = 200000\n+\n+METRICS_REQ = \"{\\\"action\\\":0,\\\"command\\\":\\\"ports_all_stat_values\\\",\\\"data\\\":null}\"\n+API_REG = \"{\\\"action\\\":1,\\\"command\\\":\\\"clients\\\",\\\"data\\\":{\\\"client_path\\\":\\\"\"\n+API_UNREG = \"{\\\"action\\\":2,\\\"command\\\":\\\"clients\\\",\\\"data\\\":{\\\"client_path\\\":\\\"\"\n+DEFAULT_FP = \"/var/run/dpdk/default_client\"\n+\n+class Socket:\n+\n+    def __init__(self):\n+        self.send_fd = socket.socket(socket.AF_UNIX, socket.SOCK_SEQPACKET)\n+        self.recv_fd = socket.socket(socket.AF_UNIX, socket.SOCK_SEQPACKET)\n+        self.client_fd = None\n+\n+    def __del__(self):\n+        try:\n+            self.send_fd.close()\n+            self.recv_fd.close()\n+            self.client_fd.close()\n+        except:\n+            print(\"Error - Sockets could not be closed\")\n+\n+class Client:\n+\n+    def __init__(self): # Creates a client instance\n+        self.socket = Socket()\n+        self.file_path = None\n+        self.choice = None\n+        self.unregistered = 0\n+\n+    def __del__(self):\n+        try:\n+            if self.unregistered == 0:\n+                self.unregister();\n+        except:\n+            print(\"Error - Client could not be destroyed\")\n+\n+    def getFilepath(self, file_path): # Gets arguments from Command-Line and assigns to instance of client\n+        self.file_path = file_path\n+\n+    def register(self): # Connects a client to DPDK-instance\n+        if os.path.exists(self.file_path):\n+            os.unlink(self.file_path)\n+        try:\n+            self.socket.recv_fd.bind(self.file_path)\n+        except socket.error as msg:\n+            print (\"Error - Socket binding error: \" + str(msg) + \"\\n\")\n+        self.socket.recv_fd.settimeout(2)\n+        self.socket.send_fd.connect(\"/var/run/dpdk/rte/telemetry\")\n+        JSON = (API_REG + self.file_path + \"\\\"}}\")\n+        self.socket.send_fd.sendall(JSON)\n+        self.socket.recv_fd.listen(1)\n+        self.socket.client_fd = self.socket.recv_fd.accept()[0]\n+\n+    def unregister(self): # Unregister a given client\n+        self.socket.client_fd.send(API_UNREG + self.file_path + \"\\\"}}\")\n+        self.socket.client_fd.close()\n+\n+    def requestMetrics(self): # Requests metrics for given client\n+        self.socket.client_fd.send(METRICS_REQ)\n+        data = self.socket.client_fd.recv(BUFFER_SIZE)\n+        print \"\\nResponse: \\n\", str(data)\n+\n+    def repeatedlyRequestMetrics(self, sleep_time): # Recursively requests metrics for given client\n+        print(\"\\nPlease enter the number of times you'd like to continuously request Metrics:\")\n+        n_requests = int(input(\"\\n:\"))\n+        print(\"\\033[F\") #Removes the user input from screen, cleans it up\n+        print(\"\\033[K\")\n+        for i in range(n_requests):\n+            self.requestMetrics()\n+            time.sleep(sleep_time)\n+\n+    def interactiveMenu(self, sleep_time): # Creates Interactive menu within the script\n+        while self.choice != 3:\n+            print(\"\\nOptions Menu\")\n+            print(\"[1] Send for Metrics for all ports\")\n+            print(\"[2] Send for Metrics for all ports recursively\")\n+            print(\"[3] Unregister client\")\n+\n+            try:\n+                self.choice = int(input(\"\\n:\"))\n+                print(\"\\033[F\") #Removes the user input for screen, cleans it up\n+                print(\"\\033[K\")\n+                if self.choice == 1:\n+                    self.requestMetrics()\n+                elif self.choice == 2:\n+                    self.repeatedlyRequestMetrics(sleep_time)\n+                elif self.choice == 3:\n+                    self.unregister()\n+                    self.unregistered = 1\n+                else:\n+                    print(\"Error - Invalid request choice\")\n+            except:\n+                pass\n+\n+if __name__ == \"__main__\":\n+\n+    sleep_time = 1\n+    file_path = \"\"\n+    if (len(sys.argv) == 2):\n+\tfile_path = sys.argv[1]\n+    else:\n+        print(\"Warning - No filepath passed, using default (\" + DEFAULT_FP + \").\")\n+\tfile_path = DEFAULT_FP\n+    client = Client()\n+    client.getFilepath(file_path)\n+    client.register()\n+    client.interactiveMenu(sleep_time)\n",
    "prefixes": [
        "v10",
        "11/12"
    ]
}