From patchwork Fri Oct 23 23:28:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Owen Hilyard X-Patchwork-Id: 82026 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B4B47A04B0; Sat, 24 Oct 2020 01:29:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7FFCE677D; Sat, 24 Oct 2020 01:29:21 +0200 (CEST) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) by dpdk.org (Postfix) with ESMTP id 245E0B62 for ; Sat, 24 Oct 2020 01:29:20 +0200 (CEST) Received: by mail-qt1-f195.google.com with SMTP id h12so2582599qtu.1 for ; Fri, 23 Oct 2020 16:29:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=I6CI6+pccuu1vv1pEHVweoFqfZ1x4MC8lh+CdQmLP3o=; b=GQtkqieubD5xfDKhTlgpa84hz0IAsPhsO2irbQxOtX3lDNVwh7w+zacMMqpb/GqUcU MKvdgoxNexfcyisNBbDS9lQrviQidOHdwJEuRTgY0tlcL7JX5JR1gZCNiPsUeFtEx4pt HX51exnaYgtgFLHVDF3TWyuO9/TeoT5KMRQME= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=I6CI6+pccuu1vv1pEHVweoFqfZ1x4MC8lh+CdQmLP3o=; b=ntEsYX2kWEYHWbuCnm4+FzN0lSH4zFMBWZ1JTFnMUvLwVaJ3AufNhBRbAeM/ktgkcg AuMG5/YsOOlilEdBtEcv7uS26ygwIDKkVwtbacAVf8E1ODiZP0gYLSBC39maV+fDor/O WyigcjfmZg0adAkmefCMkM4/mZ6Xpl0FZGEp9x8/EhSAS6moAsSr/feiUvdRO09FFMma TKoErXv/zssn9F9ameB32suXfw/FtOQIH8FDmr4bVsqyXJtgVeowXkZlhYBgotrPCdTU FyZ1PthYivp8ejjJrpvPutdfXIgZOfxkbT08uP+idNI+ixRwFsOWiTuRW7dnP1GdVEaR lcHw== X-Gm-Message-State: AOAM530oQSBNYxgu1/HcPkd/QtYGHr14Ax5s6dr65zcOQ35NbgrWoMkk kzWC1aUHYp8e2qpaqv8F04e0PA== X-Google-Smtp-Source: ABdhPJwYCKzEhRiYvV7FHyRuTqNn2I2OBVfasELaPe3vMSs29fr3hpD0mD1oYaMj6ywmmzGXwNgjWg== X-Received: by 2002:ac8:728b:: with SMTP id v11mr4725552qto.373.1603495758504; Fri, 23 Oct 2020 16:29:18 -0700 (PDT) Received: from ohilyard-Alienware-m17.iol.unh.edu (nt-238-66.w4.unh.edu. [132.177.238.66]) by smtp.googlemail.com with ESMTPSA id j16sm1851673qkg.26.2020.10.23.16.29.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Oct 2020 16:29:18 -0700 (PDT) From: Owen Hilyard To: ohilyard@iol.unh.edu, dts@dpdk.org, lijuan.tu@intel.com Cc: shall@iol.unh.edu, lihongx.ma@intel.com, lylavoie@iol.unh.edu, zhaoyan.chen@intel.com, yuan.peng@intel.com Date: Fri, 23 Oct 2020 19:28:57 -0400 Message-Id: <20201023232903.37387-2-ohilyard@iol.unh.edu> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201023232903.37387-1-ohilyard@iol.unh.edu> References: <20201023232903.37387-1-ohilyard@iol.unh.edu> MIME-Version: 1.0 Subject: [dts] [PATCH v2 2/7] rte flow: add supporting data structures X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" This contains the __init__ file for the module, which is empty since the module needs no setup, and the enums and the exceptions for the flow module. Signed-off-by: Owen Hilyard --- framework/flow/__init__.py | 0 framework/flow/enums.py | 122 +++++++++++++++++++++++++++++++++++ framework/flow/exceptions.py | 44 +++++++++++++ 3 files changed, 166 insertions(+) create mode 100644 framework/flow/__init__.py create mode 100644 framework/flow/enums.py create mode 100644 framework/flow/exceptions.py diff --git a/framework/flow/__init__.py b/framework/flow/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/framework/flow/enums.py b/framework/flow/enums.py new file mode 100644 index 0000000..4e08ac2 --- /dev/null +++ b/framework/flow/enums.py @@ -0,0 +1,122 @@ +# BSD LICENSE +# +# Copyright(c) 2020 Intel Corporation. All rights reserved. +# Copyright © 2018[, 2019] The University of New Hampshire. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +from enum import Enum + + +class FlowRuleType(Enum): + INGRESS = "ingress" + EGRESS = "egress" + BOTH = "" + + +class FlowItemType(Enum): + UDP = "udp" + TCP = "tcp" + SCTP = "sctp" + IPV4 = "ipv4" + IPV6 = "ipv6" + END = "end" + VOID = "void" + INVERT = "invert" + ANY = "any" + RAW = "raw" + ETH = "eth" + VLAN = "vlan" + VXLAN = "vxlan" + GRE = "gre" + VXLAN_GPE = "vxlan_gpe" + ARP_ETH_IPV4 = "arp_eth_ipv4" + ICMP = "icmp" + ICMP6 = "icmp6" + MARK = "mark" + META = "meta" + TAG = "tag" + FUZZY = "fuzzy" + + +class FlowActionType(Enum): + # "Simple" actions that don't need parameters + VOID = "void" + PASSTHRU = "passthru" + FLAG = "flag" + DROP = "drop" + COUNT = "count" + MAC_SWAP = "mac_swap" + DEC_TTL = "dec_ttl" + + # Actions that do need parameters + JUMP = "jump" + MARK = "mark" + QUEUE = "queue" + RSS = "rss" + PF = "pf" + VF = "vf" + PHY_PORT = "phy_port" + PORT_ID = "port_id" + METER = "meter" + SECURITY = "security" + OF_SET_MPLS_TTL = "of_set_mpls_ttl" + OF_DEC_MPLS_TTL = "of_dec_mpls_ttl" + OF_SET_NW_TTL = "of_set_nw_ttl" + OF_DEC_NW_TTL = "of_dec_nw_ttl" + OF_COPY_TTL_OUT = "of_copy_ttl_out" + OF_COPY_TTL_IN = "of_copy_ttl_in" + OF_POP_VLAN = "of_pop_vlan" + OF_PUSH_VLAN = "of_push_vlan" + OF_SET_VLAN_VID = "of_set_vlan_vid" + OF_SET_VLAN_PCP = "of_set_vlan_pcp" + OF_POP_MPLS = "of_pop_mpls" + OF_PUSH_MPLS = "of_push_mpls" + VXLAN_ENCAP = "vxlan_encap" + VXLAN_DECAP = "vxlan_decap" + NVGRE_ENCAP = "nvgre_encap" + NVGRE_DECAP = "nvgre_decap" + RAW_ENCAP = "raw_encap" + RAW_DECAP = "raw_decap" + SET_IPV4_SRC = "set_ipv4_src" + SET_IPV4_DST = "set_ipv4_dst" + SET_IPV6_SRC = "set_ipv6_src" + SET_IPV6_DST = "set_ipv6_dst" + SET_TP_SRC = "set_tp_src" + SET_TP_DST = "set_tp_dst" + SET_TTL = "set_ttl" + SET_MAC_SRC = "set_mac_src" + SET_MAC_DST = "set_mac_dst" + INC_TCP_SEQ = "inc_tcp_seq" + DEC_TCP_SEQ = "dec_tcp_seq" + INC_TCP_ACK = "inc_tcp_ack" + DEC_TCP_ACK = "dec_tcp_ack" + SET_TAG = "set_tag" + SET_META = "set_meta" + SET_IPV4_DSCP = "set_ipv4_dscp" + SET_IPV6_DSCP = "set_ipv6_dscp" + AGE = "age" diff --git a/framework/flow/exceptions.py b/framework/flow/exceptions.py new file mode 100644 index 0000000..0cf999e --- /dev/null +++ b/framework/flow/exceptions.py @@ -0,0 +1,44 @@ +# BSD LICENSE +# +# Copyright(c) 2020 Intel Corporation. All rights reserved. +# Copyright © 2018[, 2019] The University of New Hampshire. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +class CompositionException(Exception): + + def __init__(self): + self.message = "There was an unexpected error in composition" + + +class InvalidFlowItemException(CompositionException): + def __init__(self, first_item, second_item, flow=None): + if flow is not None: + self.message = f'"{first_item}" was not able to accept "{second_item}" as the next item in flow {flow}.' + else: + self.message = f'"{first_item}" was not able to accept "{second_item}".'