get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 109322,
    "url": "http://patches.dpdk.org/api/patches/109322/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20220406151903.2916254-24-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": "<20220406151903.2916254-24-juraj.linkes@pantheon.tech>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220406151903.2916254-24-juraj.linkes@pantheon.tech",
    "date": "2022-04-06T15:19:03",
    "name": "[RFC,v1,23/23] dts: merge DTS framework/flow/generator.py to DPDK",
    "commit_ref": null,
    "pull_url": null,
    "state": "rfc",
    "archived": true,
    "hash": "b289f31df0370cd16b67de0d85b9d8a20688c4e1",
    "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/20220406151903.2916254-24-juraj.linkes@pantheon.tech/mbox/",
    "series": [
        {
            "id": 22381,
            "url": "http://patches.dpdk.org/api/series/22381/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=22381",
            "date": "2022-04-06T15:18:40",
            "name": "merge DTS test resource files to DPDK",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/22381/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/109322/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/109322/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 E8C85A0509;\n\tWed,  6 Apr 2022 17:22:01 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 8C8844298E;\n\tWed,  6 Apr 2022 17:19:34 +0200 (CEST)",
            "from lb.pantheon.sk (lb.pantheon.sk [46.229.239.20])\n by mails.dpdk.org (Postfix) with ESMTP id 0AC294296F\n for <dev@dpdk.org>; Wed,  6 Apr 2022 17:19:31 +0200 (CEST)",
            "from localhost (localhost [127.0.0.1])\n by lb.pantheon.sk (Postfix) with ESMTP id 55204184FF0;\n Wed,  6 Apr 2022 17:19:30 +0200 (CEST)",
            "from lb.pantheon.sk ([127.0.0.1])\n by localhost (lb.pantheon.sk [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id FiRwZTNlGSHQ; Wed,  6 Apr 2022 17:19:29 +0200 (CEST)",
            "from entguard.lab.pantheon.local (unknown [46.229.239.141])\n by lb.pantheon.sk (Postfix) with ESMTP id 26BC8184FF9;\n Wed,  6 Apr 2022 17:19:18 +0200 (CEST)"
        ],
        "X-Virus-Scanned": "amavisd-new at siecit.sk",
        "From": "=?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>",
        "To": "thomas@monjalon.net, david.marchand@redhat.com,\n Honnappa.Nagarahalli@arm.com, ohilyard@iol.unh.edu, lijuan.tu@intel.com",
        "Cc": "dev@dpdk.org, =?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>",
        "Subject": "[RFC PATCH v1 23/23] dts: merge DTS framework/flow/generator.py to\n DPDK",
        "Date": "Wed,  6 Apr 2022 15:19:03 +0000",
        "Message-Id": "<20220406151903.2916254-24-juraj.linkes@pantheon.tech>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20220406151903.2916254-1-juraj.linkes@pantheon.tech>",
        "References": "<20220406151903.2916254-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": "---\n dts/framework/flow/generator.py | 204 ++++++++++++++++++++++++++++++++\n 1 file changed, 204 insertions(+)\n create mode 100644 dts/framework/flow/generator.py",
    "diff": "diff --git a/dts/framework/flow/generator.py b/dts/framework/flow/generator.py\nnew file mode 100644\nindex 0000000000..c2bde76e53\n--- /dev/null\n+++ b/dts/framework/flow/generator.py\n@@ -0,0 +1,204 @@\n+# BSD LICENSE\n+#\n+# Copyright(c) 2020 Intel Corporation. All rights reserved.\n+# Copyright © 2018[, 2019] The University of New Hampshire. All rights reserved.\n+# All rights reserved.\n+#\n+# Redistribution and use in source and binary forms, with or without\n+# modification, are permitted provided that the following conditions\n+# are met:\n+#\n+#   * Redistributions of source code must retain the above copyright\n+#     notice, this list of conditions and the following disclaimer.\n+#   * Redistributions in binary form must reproduce the above copyright\n+#     notice, this list of conditions and the following disclaimer in\n+#     the documentation and/or other materials provided with the\n+#     distribution.\n+#   * Neither the name of Intel Corporation nor the names of its\n+#     contributors may be used to endorse or promote products derived\n+#     from this software without specific prior written permission.\n+#\n+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+from __future__ import annotations\n+\n+import os\n+import sys\n+from typing import FrozenSet, Generator, Iterable, List, Set, Tuple\n+\n+path = os.path.dirname(os.path.dirname(__file__))\n+if path not in sys.path:\n+    sys.path.append(path)\n+\n+from .flow import Flow\n+from .flow_pattern_items import (\n+    ALWAYS_ALLOWED_ITEMS,\n+    L3_FLOW_TYPES,\n+    PATTERN_ITEMS_TYPE_CLASS_MAPPING,\n+    PATTERN_OPERATION_TYPES,\n+    FlowItemEth,\n+    FlowItemGre,\n+    FlowItemIpv4,\n+    FlowItemUdp,\n+    FlowItemVxlan,\n+    PatternFlowItem,\n+)\n+from .flow_rule import FlowItemType\n+\n+\n+def get_valid_next_protocols(current_protocol, protocol_stack, type_denylist):\n+    return list(\n+        filter(\n+            lambda patent_item: patent_item not in type_denylist\n+            and patent_item not in {p.type for p in protocol_stack},\n+            current_protocol.valid_parent_items,\n+        )\n+    )\n+\n+\n+def _generate(type_denylist=None) -> List[List[PatternFlowItem]]:\n+    if type_denylist is None:\n+        type_denylist = set()\n+    UNUSED_PATTERN_ITEMS = {PATTERN_ITEMS_TYPE_CLASS_MAPPING[i] for i in type_denylist}\n+\n+    patterns: List[List[PatternFlowItem]] = []\n+    for pattern_item in [\n+        clazz\n+        for clazz in PATTERN_ITEMS_TYPE_CLASS_MAPPING.values()\n+        if clazz not in UNUSED_PATTERN_ITEMS\n+    ]:\n+        protocol_stack = []\n+        if protocol_stack.count(pattern_item) >= 2:\n+            continue\n+\n+        current_protocol = pattern_item()\n+        valid_next_protocols = get_valid_next_protocols(\n+            current_protocol, protocol_stack, type_denylist\n+        )\n+        while len(valid_next_protocols) > 0:\n+            protocol_stack.append(current_protocol)\n+            current_protocol = PATTERN_ITEMS_TYPE_CLASS_MAPPING[\n+                list(valid_next_protocols)[0]\n+            ]()\n+            valid_next_protocols = get_valid_next_protocols(\n+                current_protocol, protocol_stack, type_denylist\n+            )\n+\n+        protocol_stack.append(current_protocol)\n+\n+        patterns.append(\n+            list(reversed(protocol_stack))\n+        )  # This will place the lowest level protocols first\n+    return patterns\n+\n+\n+def convert_protocol_stack_to_flow_pattern(protocol_stack):\n+    return Flow(pattern_items=protocol_stack)\n+\n+\n+def _get_patterns_with_type_denylist(type_denylist: Set):\n+    return [\n+        convert_protocol_stack_to_flow_pattern(protocol_stack)\n+        for protocol_stack in (_generate(type_denylist=type_denylist))\n+    ]\n+\n+\n+def _get_normal_protocol_patterns() -> List[Flow]:\n+    return _get_patterns_with_type_denylist(\n+        PATTERN_OPERATION_TYPES\n+        | ALWAYS_ALLOWED_ITEMS\n+        | {FlowItemType.ANY, FlowItemType.END}\n+    )\n+\n+\n+def _get_tunnelled_protocol_patterns(patterns: List[Flow]) -> Generator[Flow]:\n+    VXLAN_FLOW = Flow(\n+        pattern_items=[FlowItemEth(), FlowItemIpv4(), FlowItemUdp(), FlowItemVxlan()]\n+    )\n+    for pattern in patterns:\n+        yield VXLAN_FLOW / pattern\n+\n+    GRE_FLOW = Flow(pattern_items=[FlowItemEth(), FlowItemIpv4(), FlowItemGre()])\n+    for pattern in patterns:\n+        if len(pattern.pattern_items) >= 2:\n+            if pattern.pattern_items[1].type in L3_FLOW_TYPES:\n+                yield GRE_FLOW / pattern\n+\n+\n+def get_patterns() -> Iterable[Iterable[Flow]]:\n+    patterns: List[Flow] = _get_normal_protocol_patterns()\n+\n+    # The flow with only an ethernet header was a consequence of the\n+    # generation algorithm, but isn't that useful to test since we can't\n+    # create a failing case without getting each NIC to write arbitrary\n+    # bytes over the link.\n+    eth_only_flow = Flow(pattern_items=[FlowItemEth()])\n+    patterns.remove(eth_only_flow)\n+\n+    # tunnelled_patterns = _get_tunnelled_protocol_patterns(patterns)\n+\n+    return patterns\n+\n+\n+def add_properties_to_patterns(\n+    patterns: Iterable[Flow],\n+) -> Iterable[Tuple[Flow, FrozenSet[str], FrozenSet[str], str]]:\n+    test_property_flow_iters = map(lambda f: f.get_test_property_flows(), patterns)\n+    for iterator in test_property_flow_iters:\n+        yield from iterator\n+\n+\n+def get_patterns_with_properties() -> Iterable[\n+    Tuple[Flow, FrozenSet[str], FrozenSet[str], str]\n+]:\n+    base_patterns = get_patterns()\n+    return add_properties_to_patterns(base_patterns)\n+\n+\n+def create_test_function_strings(\n+    test_configurations: Iterable[Tuple[Flow, FrozenSet[str], FrozenSet[str], str]]\n+) -> Iterable[str]:\n+    \"\"\"\n+    This will break if the __str__ methods of frozenset ever changes or if % formatting syntax is removed.\n+\n+    @param test_configurations: An iterable with test configurations to convert into test case strings.\n+    @return: An iterable containing strings that are function parameters.\n+    \"\"\"\n+    function_template = \"\"\"\n+def test_%s(self):\n+    self.do_test_with_queue_action(\"%s\", %s, %s)\n+        \"\"\"\n+    return map(\n+        lambda test_configuration: function_template\n+        % (\n+            test_configuration[-1],\n+            test_configuration[0],\n+            test_configuration[1],\n+            test_configuration[2],\n+        ),\n+        test_configurations,\n+    )\n+\n+\n+def main():\n+    \"\"\"\n+    Run this file (python3 generator.py) from the flow directory to print\n+    out the pattern functions which are normally automatically generated\n+    and added to the RTE Flow test suite at runtime.\n+    \"\"\"\n+    pattern_tests = list(get_patterns_with_properties())\n+    pattern_functions = create_test_function_strings(pattern_tests)\n+    print(\"\\n\".join(pattern_functions))\n+\n+\n+if __name__ == \"__main__\":\n+    main()\n",
    "prefixes": [
        "RFC",
        "v1",
        "23/23"
    ]
}