From patchwork Thu Feb 23 06:35:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Han Zhou X-Patchwork-Id: 1746648 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=) 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PMjvr2PfXz245y for ; Thu, 23 Feb 2023 17:35:52 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 7BC1F613B9; Thu, 23 Feb 2023 06:35:49 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 7BC1F613B9 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 8E7L-fzQ071Z; Thu, 23 Feb 2023 06:35:48 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 508A7610F4; Thu, 23 Feb 2023 06:35:47 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 508A7610F4 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5DEC4C007D; Thu, 23 Feb 2023 06:35:45 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id A0BCFC002B for ; Thu, 23 Feb 2023 06:35:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 6FEAC4040D for ; Thu, 23 Feb 2023 06:35:43 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 6FEAC4040D 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 0yGPQoTbksLM for ; Thu, 23 Feb 2023 06:35:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 971CC402EB Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::229]) by smtp2.osuosl.org (Postfix) with ESMTPS id 971CC402EB for ; Thu, 23 Feb 2023 06:35:42 +0000 (UTC) Received: (Authenticated sender: hzhou@ovn.org) by mail.gandi.net (Postfix) with ESMTPSA id 20EEAFF807; Thu, 23 Feb 2023 06:35:39 +0000 (UTC) From: Han Zhou To: dev@openvswitch.org Date: Wed, 22 Feb 2023 22:35:24 -0800 Message-Id: <20230223063526.2363478-2-hzhou@ovn.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230223063526.2363478-1-hzhou@ovn.org> References: <20230223063526.2363478-1-hzhou@ovn.org> MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn 1/3] ovn.at: Fix virtual port tests. 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" The check_virtual_offlows_not_present() function in the case "virtual ports" has the wrong table id 45, which should be 44. However, correcting the table id makes the case failing, because the two ACLs added by the case were in fact overlapping: check ovn-nbctl acl-add sw0 to-lport 1000 'is_chassis_resident("sw0-vir") && ip' allow check ovn-nbctl acl-add sw0 to-lport 1000 'is_chassis_resident("sw0-vir6") && ip' allow Because ip4 v.s. ip6 is not specified, both ACLs would generate OVS flows for both ip4 and ip6 when the virtual ports are resisdent on the chassis, and the OVS flows would remain on the chassis if one of the ports are released but the other is remaining. This is why the check_virtual_offlows_not_present() would always fail. This patch corrects the table id and fixes the ACLs with proper IP protocol, and updates the check_virtual_offlows_xxx() functions so that only ipv4 flows are dumpped and checked which is what those functions are used for. Signed-off-by: Han Zhou Reviewed-by: Simon Horman Tested-by: Simon Horman --- tests/ovn.at | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/ovn.at b/tests/ovn.at index dc5c5df3f747..e7542db42503 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -20921,8 +20921,8 @@ check ovn-nbctl lsp-set-addresses sw1-lr0 00:00:00:00:ff:02 check ovn-nbctl lsp-set-options sw1-lr0 router-port=lr0-sw1 # Add an ACL that matches on sw0-vir/sw0-vir6 being bound locally. -check ovn-nbctl acl-add sw0 to-lport 1000 'is_chassis_resident("sw0-vir") && ip' allow -check ovn-nbctl acl-add sw0 to-lport 1000 'is_chassis_resident("sw0-vir6") && ip' allow +check ovn-nbctl acl-add sw0 to-lport 1000 'is_chassis_resident("sw0-vir") && ip4' allow +check ovn-nbctl acl-add sw0 to-lport 1000 'is_chassis_resident("sw0-vir6") && ip6' allow check ovn-nbctl ls-add public check ovn-nbctl lrp-add lr0 lr0-public 00:00:20:20:12:13 172.168.0.100/24 2001:db8::1/64 @@ -21007,9 +21007,8 @@ check_virtual_offlows_present() { lr0_dp_key=$(printf "%x" $(fetch_column Datapath_Binding tunnel_key external_ids:name=lr0)) lr0_public_dp_key=$(printf "%x" $(fetch_column Port_Binding tunnel_key logical_port=lr0-public)) - AT_CHECK_UNQUOTED([as $hv ovs-ofctl dump-flows br-int table=44 | ofctl_strip_all | grep "priority=2000"], [0], [dnl + AT_CHECK_UNQUOTED([as $hv ovs-ofctl dump-flows br-int table=44,ip | ofctl_strip_all | grep "priority=2000"], [0], [dnl table=44, priority=2000,ip,metadata=0x$sw0_dp_key actions=resubmit(,45) - table=44, priority=2000,ipv6,metadata=0x$sw0_dp_key actions=resubmit(,45) ]) AT_CHECK_UNQUOTED([as $hv ovs-ofctl dump-flows br-int table=11 | ofctl_strip_all | \ @@ -21020,7 +21019,7 @@ check_virtual_offlows_present() { check_virtual_offlows_not_present() { hv=$1 - AT_CHECK([as $hv ovs-ofctl dump-flows br-int table=45 | ofctl_strip_all | grep "priority=2000"], [1], [dnl + AT_CHECK([as $hv ovs-ofctl dump-flows br-int table=44,ip | ofctl_strip_all | grep "priority=2000"], [1], [dnl ]) AT_CHECK([as $hv ovs-ofctl dump-flows br-int table=11 | ofctl_strip_all | \