From patchwork Fri Jan 5 11:46:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Moreno?= X-Patchwork-Id: 1882852 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=CplRMtM0; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T61sV19kkz1yP7 for ; Fri, 5 Jan 2024 22:47:26 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 2E86A83E6A; Fri, 5 Jan 2024 11:47:24 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 2E86A83E6A Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=CplRMtM0 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FRYiSN8b2WEM; Fri, 5 Jan 2024 11:47:22 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 1202D83E70; Fri, 5 Jan 2024 11:47:21 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 1202D83E70 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id BC674C0DE5; Fri, 5 Jan 2024 11:47:16 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1B09DC007C for ; Fri, 5 Jan 2024 11:47:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 9A66A421D3 for ; Fri, 5 Jan 2024 11:47:14 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 9A66A421D3 Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=CplRMtM0 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WlUWml4uZX1M for ; Fri, 5 Jan 2024 11:47:14 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id DEBEF421CB for ; Fri, 5 Jan 2024 11:47:13 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org DEBEF421CB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704455232; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=D2NyA/QMDeGwR9LusoveG0Pe9acIZ8xOKplo/xf+i0M=; b=CplRMtM0UyPDP6exWrLbjJ3IjbStRh015kk9E0ol+oz+4XHgNbWUJIjcWGxx7k4C8zY4O5 JRlaaP7J+mExqVcoWz4HXXpOJkuuxpE7b+nN8rQ43n1CktZZRMitir/39JJlS7eLRpYzDY 5zWhbIs3xoW4rO/CMZBFJxRcKE21o/Y= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-15-bnxLSC1tOgmMAf4hWhtvIw-1; Fri, 05 Jan 2024 06:47:06 -0500 X-MC-Unique: bnxLSC1tOgmMAf4hWhtvIw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 254E3280640F for ; Fri, 5 Jan 2024 11:47:06 +0000 (UTC) Received: from antares.redhat.com (unknown [10.39.192.177]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4DD78492BC7; Fri, 5 Jan 2024 11:47:05 +0000 (UTC) From: Adrian Moreno To: dev@openvswitch.org Date: Fri, 5 Jan 2024 12:46:53 +0100 Message-ID: <20240105114702.443465-2-amorenoz@redhat.com> In-Reply-To: <20240105114702.443465-1-amorenoz@redhat.com> References: <20240105114702.443465-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH v3 1/8] python: ovs: flow: Fix typo in n_packets. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" They key used in flows is "n_packets". Signed-off-by: Adrian Moreno Acked-by: Simon Horman --- python/ovs/flow/ofp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/ovs/flow/ofp.py b/python/ovs/flow/ofp.py index 20231fd9f..f1a720d75 100644 --- a/python/ovs/flow/ofp.py +++ b/python/ovs/flow/ofp.py @@ -170,7 +170,7 @@ class OFPFlow(Flow): args = { "table": decode_int, "duration": decode_time, - "n_packet": decode_int, + "n_packets": decode_int, "n_bytes": decode_int, "cookie": decode_int, "idle_timeout": decode_time, From patchwork Fri Jan 5 11:46:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Moreno?= X-Patchwork-Id: 1882848 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QhrNzPZs; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T61sL45Vhz1yP4 for ; Fri, 5 Jan 2024 22:47:18 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id C9F9F83E44; Fri, 5 Jan 2024 11:47:15 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org C9F9F83E44 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QhrNzPZs X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZH8B1FSmeXCi; Fri, 5 Jan 2024 11:47:15 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id EB47583E42; Fri, 5 Jan 2024 11:47:13 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org EB47583E42 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B4B51C007C; Fri, 5 Jan 2024 11:47:13 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 212C4C0DD0 for ; Fri, 5 Jan 2024 11:47:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id D962D421C4 for ; Fri, 5 Jan 2024 11:47:10 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org D962D421C4 Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QhrNzPZs X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6rFg6Px80NSm for ; Fri, 5 Jan 2024 11:47:10 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 0B6C542161 for ; Fri, 5 Jan 2024 11:47:09 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 0B6C542161 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704455228; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k9lnt6k+MiiXGukgghY4S1g7nUWRG0AjMY2MbkYMi0A=; b=QhrNzPZsr215QAS0vSbC71LE7Ag+Kam43bERPA6M+3KiGH4bEFQvUJTbng3JLdSXUSN4vU D6y80RZXR8PumUGsW1/rHaMqdPYqBDi++79Dab/Dki8HsdFIePBFX46gRY6aELqeFxUIDs zgXQzgtbGrunHEQoHcfty9IU8ak7zsg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-210-YrbrPyI0OAuoVNmVMH-L3A-1; Fri, 05 Jan 2024 06:47:07 -0500 X-MC-Unique: YrbrPyI0OAuoVNmVMH-L3A-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 43234185A785 for ; Fri, 5 Jan 2024 11:47:07 +0000 (UTC) Received: from antares.redhat.com (unknown [10.39.192.177]) by smtp.corp.redhat.com (Postfix) with ESMTP id 85AC8492BC6; Fri, 5 Jan 2024 11:47:06 +0000 (UTC) From: Adrian Moreno To: dev@openvswitch.org Date: Fri, 5 Jan 2024 12:46:54 +0100 Message-ID: <20240105114702.443465-3-amorenoz@redhat.com> In-Reply-To: <20240105114702.443465-1-amorenoz@redhat.com> References: <20240105114702.443465-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH v3 2/8] python: tests: Add info and key tests for OFPFlows. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Parsing of info and matches was being tested as generic k-v parsing. Also verify we don't find any unexpected field. Signed-off-by: Adrian Moreno --- python/ovs/tests/test_ofp.py | 73 +++++++++++++++++++++++++++--------- 1 file changed, 55 insertions(+), 18 deletions(-) diff --git a/python/ovs/tests/test_ofp.py b/python/ovs/tests/test_ofp.py index 27bcf0c47..5d2736ab4 100644 --- a/python/ovs/tests/test_ofp.py +++ b/python/ovs/tests/test_ofp.py @@ -6,6 +6,30 @@ from ovs.flow.kv import KeyValue, ParseError from ovs.flow.decoders import EthMask, IPMask, decode_mask +def do_test_section(input_string, section, expected): + flow = OFPFlow(input_string) + kv_list = flow.section(section).data + + for i in range(len(expected)): + assert expected[i].key == kv_list[i].key + assert expected[i].value == kv_list[i].value + + # Assert positions relative to action string are OK. + pos = flow.section(section).pos + string = flow.section(section).string + + kpos = kv_list[i].meta.kpos + kstr = kv_list[i].meta.kstring + vpos = kv_list[i].meta.vpos + vstr = kv_list[i].meta.vstring + assert string[kpos : kpos + len(kstr)] == kstr + if vpos != -1: + assert string[vpos : vpos + len(vstr)] == vstr + + # Assert string meta is correct. + assert input_string[pos : pos + len(string)] == string + + @pytest.mark.parametrize( "input_string,expected", [ @@ -570,27 +594,40 @@ from ovs.flow.decoders import EthMask, IPMask, decode_mask def test_act(input_string, expected): if isinstance(expected, type): with pytest.raises(expected): - ofp = OFPFlow(input_string) + OFPFlow(input_string) return - ofp = OFPFlow(input_string) - actions = ofp.actions_kv + do_test_section(input_string, "actions", expected) - for i in range(len(expected)): - assert expected[i].key == actions[i].key - assert expected[i].value == actions[i].value - # Assert positions relative to action string are OK. - apos = ofp.section("actions").pos - astring = ofp.section("actions").string +@pytest.mark.parametrize( + "input_string,expected", + [ + ( + "cookie=0x35f946ead8d8f9e4, duration=97746.271s, table=0, n_packets=12, n_bytes=254, priority=4,in_port=1", # noqa: E501 + ( + [ + KeyValue("cookie", 0x35f946ead8d8f9e4), + KeyValue("duration", 97746.271), + KeyValue("table", 0), + KeyValue("n_packets", 12), + KeyValue("n_bytes", 254), + ], + [ + KeyValue("priority", 4), + KeyValue("in_port", 1) + ], + ), + ), + ], +) +def test_key(input_string, expected): + if isinstance(expected, type): + with pytest.raises(expected): + OFPFlow(input_string) + return - kpos = actions[i].meta.kpos - kstr = actions[i].meta.kstring - vpos = actions[i].meta.vpos - vstr = actions[i].meta.vstring - assert astring[kpos : kpos + len(kstr)] == kstr - if vpos != -1: - assert astring[vpos : vpos + len(vstr)] == vstr + input_string += " actions=drop" - # Assert astring meta is correct. - assert input_string[apos : apos + len(astring)] == astring + do_test_section(input_string, "info", expected[0]) + do_test_section(input_string, "match", expected[1]) From patchwork Fri Jan 5 11:46:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Moreno?= X-Patchwork-Id: 1882850 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=DwgNlhVz; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T61sP5LM2z1yP4 for ; Fri, 5 Jan 2024 22:47:21 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 60E8483E40; Fri, 5 Jan 2024 11:47:19 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 60E8483E40 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=DwgNlhVz X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pwPbjl-c5oEz; Fri, 5 Jan 2024 11:47:18 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 62B3D83E59; Fri, 5 Jan 2024 11:47:17 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 62B3D83E59 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7A137C0DDF; Fri, 5 Jan 2024 11:47:15 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0B392C0DD6 for ; Fri, 5 Jan 2024 11:47:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id CA2E9421C8 for ; Fri, 5 Jan 2024 11:47:13 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org CA2E9421C8 Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=DwgNlhVz X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HaruELL5XxuN for ; Fri, 5 Jan 2024 11:47:13 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 2A1ED421C6 for ; Fri, 5 Jan 2024 11:47:13 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 2A1ED421C6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704455232; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aS/pVCk40nNsMSmq7+dHRP4BjMIiPONWtafzIj03KMo=; b=DwgNlhVzYysR1V/5PB4BEVxpFpzLEU1Zzsz/s10x+RQRCMlGOG8cuPLQFZEsdldYUMdFin ci4R1mPjZLx+w+Rk3C2SMkrVtGTy/nKlwPzW2TF2uE4aqBmZyxm22lFOZawkkqUOqB81XL CVo9lL11WCQdWJZQwZ2kgWqFTuIU7Bo= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-684-UrfUwK1hMgKLfmgHge_9qA-1; Fri, 05 Jan 2024 06:47:08 -0500 X-MC-Unique: UrfUwK1hMgKLfmgHge_9qA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 91BD93C02638 for ; Fri, 5 Jan 2024 11:47:08 +0000 (UTC) Received: from antares.redhat.com (unknown [10.39.192.177]) by smtp.corp.redhat.com (Postfix) with ESMTP id 96405492BC6; Fri, 5 Jan 2024 11:47:07 +0000 (UTC) From: Adrian Moreno To: dev@openvswitch.org Date: Fri, 5 Jan 2024 12:46:55 +0100 Message-ID: <20240105114702.443465-4-amorenoz@redhat.com> In-Reply-To: <20240105114702.443465-1-amorenoz@redhat.com> References: <20240105114702.443465-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH v3 3/8] python: ovs: flow: Add sample to nested actions. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Add the sample action to those that can be called in nested actions (such as clone). Signed-off-by: Adrian Moreno Acked-by: Simon Horman --- python/ovs/flow/odp.py | 29 +++++++++++++++-------------- python/ovs/tests/test_ofp.py | 14 ++++++++++++++ 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/python/ovs/flow/odp.py b/python/ovs/flow/odp.py index 88aee17fb..ef7e5d6b8 100644 --- a/python/ovs/flow/odp.py +++ b/python/ovs/flow/odp.py @@ -336,6 +336,21 @@ class ODPFlow(Flow): **ODPFlow._tnl_action_decoder_args(), } + _decoders["sample"] = nested_kv_decoder( + KVDecoders( + { + "sample": (lambda x: float(x.strip("%"))), + "actions": nested_kv_decoder( + KVDecoders( + decoders=_decoders, + default_free=decode_free_output, + ), + is_list=True, + ), + } + ) + ) + _decoders["clone"] = nested_kv_decoder( KVDecoders(decoders=_decoders, default_free=decode_free_output), is_list=True, @@ -343,20 +358,6 @@ class ODPFlow(Flow): return { **_decoders, - "sample": nested_kv_decoder( - KVDecoders( - { - "sample": (lambda x: float(x.strip("%"))), - "actions": nested_kv_decoder( - KVDecoders( - decoders=_decoders, - default_free=decode_free_output, - ), - is_list=True, - ), - } - ) - ), "check_pkt_len": nested_kv_decoder( KVDecoders( { diff --git a/python/ovs/tests/test_ofp.py b/python/ovs/tests/test_ofp.py index 5d2736ab4..9e2721acf 100644 --- a/python/ovs/tests/test_ofp.py +++ b/python/ovs/tests/test_ofp.py @@ -569,6 +569,20 @@ def do_test_section(input_string, section, expected): ), ], ), + ( + "actions=LOCAL,clone(sample(probability=123))", + [ + KeyValue("output", {"port": "LOCAL"}), + KeyValue( + "clone", + [ + {"sample": { + "probability": 123, + }}, + ] + ), + ], + ), ( "actions=doesnotexist(1234)", ParseError, From patchwork Fri Jan 5 11:46:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Moreno?= X-Patchwork-Id: 1882849 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=b1Zd3YiH; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T61sN3hGYz1yP4 for ; Fri, 5 Jan 2024 22:47:20 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id D9C7D614ED; Fri, 5 Jan 2024 11:47:17 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org D9C7D614ED Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=b1Zd3YiH X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id drAOAvbjYcYx; Fri, 5 Jan 2024 11:47:16 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 72A6560ECC; Fri, 5 Jan 2024 11:47:15 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 72A6560ECC Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 75A06C0DD6; Fri, 5 Jan 2024 11:47:14 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6DCF4C0072 for ; Fri, 5 Jan 2024 11:47:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 2FD986147B for ; Fri, 5 Jan 2024 11:47:13 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 2FD986147B X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vOx5lavoXof0 for ; Fri, 5 Jan 2024 11:47:12 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 706D461474 for ; Fri, 5 Jan 2024 11:47:12 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 706D461474 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704455231; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Jm3ulQJKFzq6S1gEPyB4/I1pbWzwvvn9fmTIryXTPCI=; b=b1Zd3YiHvHxMJ83BZKwHIkZMN/SP2ubno0+cQm1yBha++j7f+e/rnwq0L/+Ck17SfCxhIT xm6W+Mh3TFe9xMlw/YZOFr42x2oaJOQpmXN7BzOX2V/2G5G/y1V5lshXavXI8QzORIUGXA ZvHCUYAtuH2V+zUGM8r/iUMf6nMy308= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-380-t7A_-pCgPCWxuwwavpEprw-1; Fri, 05 Jan 2024 06:47:09 -0500 X-MC-Unique: t7A_-pCgPCWxuwwavpEprw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9AD1E80B632 for ; Fri, 5 Jan 2024 11:47:09 +0000 (UTC) Received: from antares.redhat.com (unknown [10.39.192.177]) by smtp.corp.redhat.com (Postfix) with ESMTP id 009EC492BC6; Fri, 5 Jan 2024 11:47:08 +0000 (UTC) From: Adrian Moreno To: dev@openvswitch.org Date: Fri, 5 Jan 2024 12:46:56 +0100 Message-ID: <20240105114702.443465-5-amorenoz@redhat.com> In-Reply-To: <20240105114702.443465-1-amorenoz@redhat.com> References: <20240105114702.443465-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH v3 4/8] python: ovs: flow: Add dp hash and meter actions. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Add missing actions. Signed-off-by: Adrian Moreno Acked-by: Simon Horman --- python/ovs/flow/odp.py | 9 +++++++++ python/ovs/tests/test_odp.py | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/python/ovs/flow/odp.py b/python/ovs/flow/odp.py index ef7e5d6b8..46697a1bc 100644 --- a/python/ovs/flow/odp.py +++ b/python/ovs/flow/odp.py @@ -204,6 +204,7 @@ class ODPFlow(Flow): """Generate the arguments for the action KVDecoders.""" _decoders = { "drop": decode_flag, + "meter": decode_int, "lb_output": decode_int, "trunc": decode_int, "recirc": decode_int, @@ -334,6 +335,14 @@ class ODPFlow(Flow): ) ), **ODPFlow._tnl_action_decoder_args(), + "hash": nested_kv_decoder( + KVDecoders( + { + "l4": decode_int, + "sym_l4": decode_int, + } + ) + ), } _decoders["sample"] = nested_kv_decoder( diff --git a/python/ovs/tests/test_odp.py b/python/ovs/tests/test_odp.py index a50d3185c..d60947a5c 100644 --- a/python/ovs/tests/test_odp.py +++ b/python/ovs/tests/test_odp.py @@ -534,6 +534,18 @@ def test_odp_fields(input_string, expected): ), ], ), + ( + "actions:meter(1),hash(l4(0))", + [ + KeyValue("meter", 1), + KeyValue( + "hash", + { + "l4": 0, + } + ), + ], + ), ], ) def test_odp_actions(input_string, expected): From patchwork Fri Jan 5 11:46:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Moreno?= X-Patchwork-Id: 1882851 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=H44CQ2fE; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T61sT2Pz3z1yP4 for ; Fri, 5 Jan 2024 22:47:25 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 6968343706; Fri, 5 Jan 2024 11:47:22 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 6968343706 Authentication-Results: smtp2.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=H44CQ2fE X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8CCpl-CHZ-5f; Fri, 5 Jan 2024 11:47:21 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 2BF9B436EB; Fri, 5 Jan 2024 11:47:19 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 2BF9B436EB Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 160B9C0DE1; Fri, 5 Jan 2024 11:47:16 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id AF1F6C0DD9 for ; Fri, 5 Jan 2024 11:47:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 88EA261486 for ; Fri, 5 Jan 2024 11:47:14 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 88EA261486 Authentication-Results: smtp3.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=H44CQ2fE X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5KVt_z3o_tN7 for ; Fri, 5 Jan 2024 11:47:13 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id B7D8761470 for ; Fri, 5 Jan 2024 11:47:13 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org B7D8761470 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704455232; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LDp/5amarOEnkr/22UMCUZBdZxVJ+E8gQJPpJI6OOJU=; b=H44CQ2fEDkPpmQioaFjpMdh0GTXuDiWaSzYaErCwqTPepRBAwia+WAKsmehu2H6SNKnAQg ShiNh0k7VQUpEk+7HioxFwF+23rT1D8UAM4jXBn+lvDeBVbsr3zK/v7whJUKEejW/K98TC jzmQ2TMTC+MGIyfgQFO9cB+1m1U7iQ8= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-410-0Rpc5bwNMGOTHa_DSwwGkA-1; Fri, 05 Jan 2024 06:47:11 -0500 X-MC-Unique: 0Rpc5bwNMGOTHa_DSwwGkA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D25BD2806410 for ; Fri, 5 Jan 2024 11:47:10 +0000 (UTC) Received: from antares.redhat.com (unknown [10.39.192.177]) by smtp.corp.redhat.com (Postfix) with ESMTP id 06E25492BC7; Fri, 5 Jan 2024 11:47:09 +0000 (UTC) From: Adrian Moreno To: dev@openvswitch.org Date: Fri, 5 Jan 2024 12:46:57 +0100 Message-ID: <20240105114702.443465-6-amorenoz@redhat.com> In-Reply-To: <20240105114702.443465-1-amorenoz@redhat.com> References: <20240105114702.443465-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH v3 5/8] python: tests: Refactor test_odp section testing. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Avoid code duplication by moving the section testing code to its own function. Signed-off-by: Adrian Moreno Acked-by: Simon Horman --- python/ovs/tests/test_odp.py | 66 ++++++++++++++---------------------- 1 file changed, 26 insertions(+), 40 deletions(-) diff --git a/python/ovs/tests/test_odp.py b/python/ovs/tests/test_odp.py index d60947a5c..8147a31d1 100644 --- a/python/ovs/tests/test_odp.py +++ b/python/ovs/tests/test_odp.py @@ -13,6 +13,30 @@ from ovs.flow.decoders import ( ) +def do_test_section(input_string, section, expected): + flow = ODPFlow(input_string) + kv_list = flow.section(section).data + + for i in range(len(expected)): + assert expected[i].key == kv_list[i].key + assert expected[i].value == kv_list[i].value + + # Assert positions relative to action string are OK. + pos = flow.section(section).pos + string = flow.section(section).string + + kpos = kv_list[i].meta.kpos + kstr = kv_list[i].meta.kstring + vpos = kv_list[i].meta.vpos + vstr = kv_list[i].meta.vstring + assert string[kpos : kpos + len(kstr)] == kstr + if vpos != -1: + assert string[vpos : vpos + len(vstr)] == vstr + + # Assert string meta is correct. + assert input_string[pos : pos + len(string)] == string + + @pytest.mark.parametrize( "input_string,expected", [ @@ -109,26 +133,7 @@ from ovs.flow.decoders import ( ], ) def test_odp_fields(input_string, expected): - odp = ODPFlow(input_string) - match = odp.match_kv - for i in range(len(expected)): - assert expected[i].key == match[i].key - assert expected[i].value == match[i].value - - # Assert positions relative to action string are OK. - mpos = odp.section("match").pos - mstring = odp.section("match").string - - kpos = match[i].meta.kpos - kstr = match[i].meta.kstring - vpos = match[i].meta.vpos - vstr = match[i].meta.vstring - assert mstring[kpos : kpos + len(kstr)] == kstr - if vpos != -1: - assert mstring[vpos : vpos + len(vstr)] == vstr - - # Assert mstring meta is correct. - assert input_string[mpos : mpos + len(mstring)] == mstring + do_test_section(input_string, "match", expected) @pytest.mark.parametrize( @@ -549,23 +554,4 @@ def test_odp_fields(input_string, expected): ], ) def test_odp_actions(input_string, expected): - odp = ODPFlow(input_string) - actions = odp.actions_kv - for i in range(len(expected)): - assert expected[i].key == actions[i].key - assert expected[i].value == actions[i].value - - # Assert positions relative to action string are OK. - apos = odp.section("actions").pos - astring = odp.section("actions").string - - kpos = actions[i].meta.kpos - kstr = actions[i].meta.kstring - vpos = actions[i].meta.vpos - vstr = actions[i].meta.vstring - assert astring[kpos : kpos + len(kstr)] == kstr - if vpos != -1: - assert astring[vpos : vpos + len(vstr)] == vstr - - # Assert astring meta is correct. - assert input_string[apos : apos + len(astring)] == astring + do_test_section(input_string, "actions", expected) From patchwork Fri Jan 5 11:46:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Moreno?= X-Patchwork-Id: 1882855 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=IgwD4hF9; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T61sg64SXz1yP4 for ; Fri, 5 Jan 2024 22:47:35 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 74D6E6156E; Fri, 5 Jan 2024 11:47:33 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 74D6E6156E Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=IgwD4hF9 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aSl5afunbI_O; Fri, 5 Jan 2024 11:47:32 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 4398F614B8; Fri, 5 Jan 2024 11:47:30 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 4398F614B8 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 10138C007C; Fri, 5 Jan 2024 11:47:30 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 17F8DC0DD0 for ; Fri, 5 Jan 2024 11:47:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id CEC4F421EF for ; Fri, 5 Jan 2024 11:47:20 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org CEC4F421EF Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=IgwD4hF9 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jatxS2WolopO for ; Fri, 5 Jan 2024 11:47:19 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 761C0421F9 for ; Fri, 5 Jan 2024 11:47:19 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 761C0421F9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704455238; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RpHVKPdoeojKob+z0ibxhZ198eioX+xa6qbRm8tFUhI=; b=IgwD4hF9Lg5Ue3djFT3csyDn1ItDcGWmbK2I8slYKFF/PoXD3csoUaWhxiQ2R3OwOav2Wj 66ImBtVCmR1O5exgC6eCAwAZ2cWUOUUDp6VKGQ0ZBsNxxWzaruv5q64EbeEBXnYDjojle+ ZLIn6a2sHZE1uzg9SwgkxH0BPBpo0Fg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-591-siVBAKjsM8uAaKgcJhwnxw-1; Fri, 05 Jan 2024 06:47:12 -0500 X-MC-Unique: siVBAKjsM8uAaKgcJhwnxw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F16F7867943 for ; Fri, 5 Jan 2024 11:47:11 +0000 (UTC) Received: from antares.redhat.com (unknown [10.39.192.177]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3EAA6492BC6; Fri, 5 Jan 2024 11:47:11 +0000 (UTC) From: Adrian Moreno To: dev@openvswitch.org Date: Fri, 5 Jan 2024 12:46:58 +0100 Message-ID: <20240105114702.443465-7-amorenoz@redhat.com> In-Reply-To: <20240105114702.443465-1-amorenoz@redhat.com> References: <20240105114702.443465-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH v3 6/8] python: ovs: flow: Add idle_age to openflow flows. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Add missing key. Signed-off-by: Adrian Moreno Acked-by: Simon Horman --- python/ovs/flow/ofp.py | 1 + python/ovs/tests/test_ofp.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/python/ovs/flow/ofp.py b/python/ovs/flow/ofp.py index f1a720d75..3d3226c91 100644 --- a/python/ovs/flow/ofp.py +++ b/python/ovs/flow/ofp.py @@ -176,6 +176,7 @@ class OFPFlow(Flow): "idle_timeout": decode_time, "hard_timeout": decode_time, "hard_age": decode_time, + "idle_age": decode_time, } return KVDecoders(args) diff --git a/python/ovs/tests/test_ofp.py b/python/ovs/tests/test_ofp.py index 9e2721acf..4bcbf9cdf 100644 --- a/python/ovs/tests/test_ofp.py +++ b/python/ovs/tests/test_ofp.py @@ -618,7 +618,7 @@ def test_act(input_string, expected): "input_string,expected", [ ( - "cookie=0x35f946ead8d8f9e4, duration=97746.271s, table=0, n_packets=12, n_bytes=254, priority=4,in_port=1", # noqa: E501 + "cookie=0x35f946ead8d8f9e4, duration=97746.271s, table=0, n_packets=12, n_bytes=254, idle_age=117, priority=4,in_port=1", # noqa: E501 ( [ KeyValue("cookie", 0x35f946ead8d8f9e4), @@ -626,6 +626,7 @@ def test_act(input_string, expected): KeyValue("table", 0), KeyValue("n_packets", 12), KeyValue("n_bytes", 254), + KeyValue("idle_age", 117), ], [ KeyValue("priority", 4), From patchwork Fri Jan 5 11:46:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Moreno?= X-Patchwork-Id: 1882853 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OR/8YgmT; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T61sW0cLDz1yP4 for ; Fri, 5 Jan 2024 22:47:27 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 2A81C6150F; Fri, 5 Jan 2024 11:47:25 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 2A81C6150F Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OR/8YgmT X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4osnH9HSqS0s; Fri, 5 Jan 2024 11:47:24 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id BBD8361513; Fri, 5 Jan 2024 11:47:22 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org BBD8361513 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7B6E4C0DD9; Fri, 5 Jan 2024 11:47:18 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 10AAAC007C for ; Fri, 5 Jan 2024 11:47:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 67B83421C4 for ; Fri, 5 Jan 2024 11:47:17 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 67B83421C4 Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OR/8YgmT X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gbM2RXZrPxKd for ; Fri, 5 Jan 2024 11:47:16 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id B9625421D3 for ; Fri, 5 Jan 2024 11:47:15 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org B9625421D3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704455234; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BUzyaMTPKXHIAyxw9d+vda3+Nxu8Af1e5HaK4HvS4iY=; b=OR/8YgmTxZQksKJAcffJhiQFrS1R7YpRH8XcBir8umyOUuJOWt1GUKQ4iiI7JeVBe2XhG1 c3oQ+nUlCkv6JfIMDhGfwct8uFzAcGcfVlc45RnCI42Z1R/InfJ0FFHBeJwsLwRFG+vGzL jh4/IIKzfOgteB6K9IHN3P8ePvsrgbc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-375-7QfXhdrBN2qAuDmJcCQ3TA-1; Fri, 05 Jan 2024 06:47:13 -0500 X-MC-Unique: 7QfXhdrBN2qAuDmJcCQ3TA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4E774185A787 for ; Fri, 5 Jan 2024 11:47:13 +0000 (UTC) Received: from antares.redhat.com (unknown [10.39.192.177]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91738492BC8; Fri, 5 Jan 2024 11:47:12 +0000 (UTC) From: Adrian Moreno To: dev@openvswitch.org Date: Fri, 5 Jan 2024 12:46:59 +0100 Message-ID: <20240105114702.443465-8-amorenoz@redhat.com> In-Reply-To: <20240105114702.443465-1-amorenoz@redhat.com> References: <20240105114702.443465-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH v3 7/8] python: ovs: flow: Make check_pkt_len action a list. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" In general, most actions must be lists since the keys can be repeated. Signed-off-by: Adrian Moreno Acked-by: Simon Horman --- python/ovs/flow/odp.py | 6 ++++-- python/ovs/tests/test_odp.py | 12 ++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/python/ovs/flow/odp.py b/python/ovs/flow/odp.py index 46697a1bc..7d9b165d4 100644 --- a/python/ovs/flow/odp.py +++ b/python/ovs/flow/odp.py @@ -375,13 +375,15 @@ class ODPFlow(Flow): KVDecoders( decoders=_decoders, default_free=decode_free_output, - ) + ), + is_list=True, ), "le": nested_kv_decoder( KVDecoders( decoders=_decoders, default_free=decode_free_output, - ) + ), + is_list=True, ), } ) diff --git a/python/ovs/tests/test_odp.py b/python/ovs/tests/test_odp.py index 8147a31d1..d52056794 100644 --- a/python/ovs/tests/test_odp.py +++ b/python/ovs/tests/test_odp.py @@ -517,24 +517,24 @@ def test_odp_fields(input_string, expected): "check_pkt_len", { "size": 200, - "gt": {"output": {"port": 4}}, - "le": {"output": {"port": 5}}, + "gt": [{"output": {"port": 4}}], + "le": [{"output": {"port": 5}}], }, ), KeyValue( "check_pkt_len", { "size": 200, - "gt": {"drop": True}, - "le": {"output": {"port": 5}}, + "gt": [{"drop": True}], + "le": [{"output": {"port": 5}}], }, ), KeyValue( "check_pkt_len", { "size": 200, - "gt": {"ct": {"nat": True}}, - "le": {"drop": True}, + "gt": [{"ct": {"nat": True}}], + "le": [{"drop": True}], }, ), ], From patchwork Fri Jan 5 11:47:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Moreno?= X-Patchwork-Id: 1882854 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ugc2cPKj; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T61sY2Yqmz1yP4 for ; Fri, 5 Jan 2024 22:47:29 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 4F9A243747; Fri, 5 Jan 2024 11:47:27 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 4F9A243747 Authentication-Results: smtp2.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ugc2cPKj X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PeakU8akXDUq; Fri, 5 Jan 2024 11:47:26 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 674A243719; Fri, 5 Jan 2024 11:47:24 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 674A243719 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1E659C0DD8; Fri, 5 Jan 2024 11:47:22 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 05A06C0DD0 for ; Fri, 5 Jan 2024 11:47:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 5C738421D6 for ; Fri, 5 Jan 2024 11:47:18 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 5C738421D6 Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ugc2cPKj X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LMnW75FDoIxw for ; Fri, 5 Jan 2024 11:47:17 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 0CEE0421EA for ; Fri, 5 Jan 2024 11:47:16 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 0CEE0421EA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704455235; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j1gnaaJ8QPITt2NT3JkxOHbI2w90gRC3f6S6jm7y0m4=; b=Ugc2cPKjdK/IvaJLARFkq86QBTGdfBs0x5WeBai3w5eMTI2I1B0IN92IYTWXclQy58rmgG 3BTCjULdxImXBuvjf9ZQ7hcueT1T9mC/d0CkC9zif8dz7xHbz7eCXcVeurtYcv335/Figb uUgJjd9gsws6AJNsKU6sKx4m41naBSU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-605-XILwHinCOiOi-TbvMI8bBQ-1; Fri, 05 Jan 2024 06:47:14 -0500 X-MC-Unique: XILwHinCOiOi-TbvMI8bBQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6CF7085A588 for ; Fri, 5 Jan 2024 11:47:14 +0000 (UTC) Received: from antares.redhat.com (unknown [10.39.192.177]) by smtp.corp.redhat.com (Postfix) with ESMTP id ADFE7492BC6; Fri, 5 Jan 2024 11:47:13 +0000 (UTC) From: Adrian Moreno To: dev@openvswitch.org Date: Fri, 5 Jan 2024 12:47:00 +0100 Message-ID: <20240105114702.443465-9-amorenoz@redhat.com> In-Reply-To: <20240105114702.443465-1-amorenoz@redhat.com> References: <20240105114702.443465-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH v3 8/8] python: ovs: flow: Add meter_id to controller. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Add missing option to controller action. Signed-off-by: Adrian Moreno Acked-by: Simon Horman --- python/ovs/flow/ofp_act.py | 1 + python/ovs/tests/test_ofp.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/python/ovs/flow/ofp_act.py b/python/ovs/flow/ofp_act.py index c540443ea..2c85076a3 100644 --- a/python/ovs/flow/ofp_act.py +++ b/python/ovs/flow/ofp_act.py @@ -54,6 +54,7 @@ def decode_controller(value): "id": decode_int, "userdata": decode_default, "pause": decode_flag, + "meter_id": decode_int, } ) )(value) diff --git a/python/ovs/tests/test_ofp.py b/python/ovs/tests/test_ofp.py index 4bcbf9cdf..59eab8c3a 100644 --- a/python/ovs/tests/test_ofp.py +++ b/python/ovs/tests/test_ofp.py @@ -50,6 +50,21 @@ def do_test_section(input_string, section, expected): KeyValue("controller", {"max_len": 200}), ], ), + ( + "actions=controller(max_len=123,reason=no_match,id=456,userdata=00.00.00.12.00.00.00.00,meter_id=12)", # noqa: E501 + [ + KeyValue( + "controller", + { + "max_len": 123, + "reason": "no_match", + "id": 456, + "userdata": "00.00.00.12.00.00.00.00", + "meter_id": 12, + } + ), + ], + ), ( "actions=enqueue(foo,42),enqueue:foo:42,enqueue(bar,4242)", [