Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/109318/?format=api
http://patches.dpdk.org/api/patches/109318/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20220406151903.2916254-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": "<20220406151903.2916254-21-juraj.linkes@pantheon.tech>", "list_archive_url": "https://inbox.dpdk.org/dev/20220406151903.2916254-21-juraj.linkes@pantheon.tech", "date": "2022-04-06T15:19:00", "name": "[RFC,v1,20/23] dts: merge DTS framework/flow/flow_items.py to DPDK", "commit_ref": null, "pull_url": null, "state": "rfc", "archived": true, "hash": "b3eff2723dfd974596919c0f3513ad8019f55b78", "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-21-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/109318/comments/", "check": "warning", "checks": "http://patches.dpdk.org/api/patches/109318/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 02517A0509;\n\tWed, 6 Apr 2022 17:21:26 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id DB7704296B;\n\tWed, 6 Apr 2022 17:19:29 +0200 (CEST)", "from lb.pantheon.sk (lb.pantheon.sk [46.229.239.20])\n by mails.dpdk.org (Postfix) with ESMTP id 7565142962\n for <dev@dpdk.org>; Wed, 6 Apr 2022 17:19:27 +0200 (CEST)", "from localhost (localhost [127.0.0.1])\n by lb.pantheon.sk (Postfix) with ESMTP id CA710184FF0;\n Wed, 6 Apr 2022 17:19:26 +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 0x9IkR68HJGi; Wed, 6 Apr 2022 17:19:25 +0200 (CEST)", "from entguard.lab.pantheon.local (unknown [46.229.239.141])\n by lb.pantheon.sk (Postfix) with ESMTP id 67FFC129C28;\n Wed, 6 Apr 2022 17:19:16 +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 20/23] dts: merge DTS framework/flow/flow_items.py to\n DPDK", "Date": "Wed, 6 Apr 2022 15:19:00 +0000", "Message-Id": "<20220406151903.2916254-21-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/flow_items.py | 128 +++++++++++++++++++++++++++++++\n 1 file changed, 128 insertions(+)\n create mode 100644 dts/framework/flow/flow_items.py", "diff": "diff --git a/dts/framework/flow/flow_items.py b/dts/framework/flow/flow_items.py\nnew file mode 100644\nindex 0000000000..e43614c587\n--- /dev/null\n+++ b/dts/framework/flow/flow_items.py\n@@ -0,0 +1,128 @@\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+\n+from __future__ import annotations\n+\n+import copy\n+import itertools\n+from functools import reduce\n+from typing import Any, Dict, FrozenSet, Hashable, Iterable, Set, Tuple, Union\n+\n+from .enums import FlowActionType, FlowItemType\n+from .exceptions import InvalidFlowItemException\n+\n+PATTERN_ACTION_ITEMS = {\n+ FlowItemType.INVERT,\n+ FlowItemType.VOID,\n+ FlowItemType.MARK,\n+ FlowItemType.META,\n+}\n+\n+\n+class FlowItem(object):\n+ type: Union[FlowItemType, FlowActionType]\n+ # Defines what items this may not appear with\n+ allowed_with: FrozenSet[Union[FlowItemType, FlowActionType]]\n+ # OSI Model layer of the protocol\n+ # This should be the lowest layer a protocol is used in, for example\n+ # QUIC would be considered L5 since it needs to go after UDP (L4),\n+ # even though it has capabilities in L6.\n+ layer: int\n+ valid_next_items: FrozenSet[Union[FlowItemType, FlowActionType]]\n+\n+ # Types subject to change, should only be accessed through\n+ possible_properties: Dict[str, Tuple[str, FrozenSet[str], FrozenSet[str]]]\n+ properties: str\n+\n+ def get_property_stream(\n+ self,\n+ ) -> Iterable[Tuple[FlowItem, FrozenSet[str], FrozenSet[str], str]]:\n+ \"\"\"\n+ This function will return a generator that will provide all\n+ configured property combinations.\n+\n+ This function will not mutate the instance it is called on.\n+\n+ @return: a generator that will provide all\n+ permutations of possible properties this object has as a flow\n+ item with properties\n+ \"\"\"\n+ base_copy = copy.deepcopy(self)\n+ for key, value in self.possible_properties.items():\n+ new_copy = copy.deepcopy(base_copy)\n+ new_copy.properties = value[0] # The properties string\n+ yield new_copy, *value[1:], f\"{self.type.value}_{key}\"\n+\n+ def __init__(self):\n+ self.properties = \"\"\n+\n+ def __truediv__(self, other: FlowItem):\n+ \"\"\"\n+ Used in a similar way to scapy's packet composition.\n+ @param other: The other flow item.\n+ @return: A Flow containing both items\n+ \"\"\"\n+ if type(self) != type(other):\n+ raise InvalidFlowItemException(self, other)\n+ elif other.type in self.valid_next_items:\n+ # These imports are in here so there is no circular import\n+ from framework.flow.flow_action_items import ActionFlowItem\n+ from framework.flow.flow_pattern_items import PatternFlowItem\n+\n+ from .flow import Flow\n+\n+ if isinstance(self, PatternFlowItem):\n+ return Flow(pattern_items=[self, other])\n+ elif isinstance(self, ActionFlowItem):\n+ return Flow(action_items=[self, other])\n+ else:\n+ raise TypeError(\n+ f\"{type(self):s} is not one of {PatternFlowItem:s}, {ActionFlowItem:s}.\"\n+ )\n+ else:\n+ raise InvalidFlowItemException(self, other)\n+\n+ def __eq__(self, other) -> bool:\n+ return (\n+ type(self) == type(other)\n+ and self.type == other.type\n+ and self.properties == other.properties\n+ )\n+\n+ def __str__(self):\n+ if self.properties != \"\":\n+ return self.properties\n+ else:\n+ return self.type.value\n+\n+ def __repr__(self):\n+ return str(self)\n", "prefixes": [ "RFC", "v1", "20/23" ] }{ "id": 109318, "url": "