From patchwork Tue Oct 1 15:17:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1991567 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=PJoXxUt9; 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 4XJ1kz2l5bz1xtg for ; Wed, 2 Oct 2024 01:17:15 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 7B6E480D3B; Tue, 1 Oct 2024 15:17:13 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id AZs4DncWS5EK; Tue, 1 Oct 2024 15:17:12 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 584A080D19 Authentication-Results: smtp1.osuosl.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=PJoXxUt9 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 584A080D19; Tue, 1 Oct 2024 15:17:12 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 01C08C002B; Tue, 1 Oct 2024 15:17:12 +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 438E2C002A for ; Tue, 1 Oct 2024 15:17:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 1BA11405A1 for ; Tue, 1 Oct 2024 15:17:10 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id hS-qfId22EcU for ; Tue, 1 Oct 2024 15:17:09 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=xsimonar@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org DBE7A40584 Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org DBE7A40584 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=PJoXxUt9 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 DBE7A40584 for ; Tue, 1 Oct 2024 15:17:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727795827; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BxrZ0rMc+g9/Z7tx0HJ9Nv6TdsmJ9wBl9tj8BheHMkI=; b=PJoXxUt9Xad8Nb+GveC6R+6qr7S8ueXaudCDesHE7IoPsaYaDNAu9K09Bwdy0WG/t18ILE b6R0JK9qXKcPhC/YBH2cs9awaZu/NpPuUVBisQsmDqjhRMEwDQCBBz/9vuIWdlS5peuZ7q Ayjpf34BaZHGT3cpW3qtWEckNgTwcmU= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-221-DreCIPJEMxa879NuIEtVZw-1; Tue, 01 Oct 2024 11:17:06 -0400 X-MC-Unique: DreCIPJEMxa879NuIEtVZw-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (unknown [10.30.177.12]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 41E3219772C1 for ; Tue, 1 Oct 2024 15:17:05 +0000 (UTC) Received: from wsfd-netdev90.ntdv.lab.eng.bos.redhat.com (unknown [10.6.38.135]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AF5791954B0F; Tue, 1 Oct 2024 15:17:04 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Tue, 1 Oct 2024 17:17:04 +0200 Message-Id: <20241001151704.1627752-1-xsimonar@redhat.com> In-Reply-To: <20241001125509.132540-1-xsimonar@redhat.com> References: <20241001125509.132540-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn v2] controller: Properly handle localnet flows in I+P. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Delete flows on localnet port deletion, and add localnet related flows when peer ports are added. This was properly done when recomputing, but not when doing IP. When peer ports are added, some flows such as chassis_mac flows must be added. Signed-off-by: Xavier Simonart Acked-by: Ales Musil --- v2: rebase on origin/main for scapy fix. --- controller/physical.c | 9 ++++--- tests/ovn.at | 58 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 4 deletions(-) diff --git a/controller/physical.c b/controller/physical.c index 16e312f9d..762a2e756 100644 --- a/controller/physical.c +++ b/controller/physical.c @@ -699,7 +699,7 @@ put_replace_chassis_mac_flows(const struct shash *ct_zones, put_resubmit(OFTABLE_LOG_INGRESS_PIPELINE, ofpacts_p); ofctrl_add_flow(flow_table, OFTABLE_PHY_TO_LOG, 180, rport_binding->header_.uuid.parts[0], - &match, ofpacts_p, hc_uuid); + &match, ofpacts_p, &localnet_port->header_.uuid); /* Provide second search criteria, i.e localnet port's * vlan ID for conjunction flow */ @@ -719,7 +719,7 @@ put_replace_chassis_mac_flows(const struct shash *ct_zones, conj->clause = 1; ofctrl_add_flow(flow_table, OFTABLE_PHY_TO_LOG, 180, rport_binding->header_.uuid.parts[0], - &match, ofpacts_p, hc_uuid); + &match, ofpacts_p, &localnet_port->header_.uuid); } } @@ -2392,8 +2392,9 @@ physical_handle_flows_for_lport(const struct sbrec_port_binding *pb, struct local_datapath *ldp = get_local_datapath(p_ctx->local_datapaths, pb->datapath->tunnel_key); - if (!strcmp(pb->type, "external")) { - /* External lports have a dependency on the localnet port. + if (!strcmp(pb->type, "external") || + !strcmp(pb->type, "patch") || !strcmp(pb->type, "l3gateway")) { + /* Those lports have a dependency on the localnet port. * We need to remove the flows of the localnet port as well * and re-consider adding the flows for it. */ diff --git a/tests/ovn.at b/tests/ovn.at index 826b52051..d2b14be53 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -39011,3 +39011,61 @@ OVN_CLEANUP([hv1],[hv2]) AT_CLEANUP ]) + +OVN_FOR_EACH_NORTHD([ +AT_SETUP([localnet port flows after deletion]) +ovn_start +net_add n1 + +check ovn-nbctl ls-add sw0 + +for i in 1 2; do + check ovn-nbctl lsp-add sw0 sw0-p${i} -- lsp-set-addresses sw0-p${i} "00:00:10:01:02:0${i} 10.0.0.${i}" + sim_add hv${i} + as hv${i} + ovs-vsctl add-br br-phys + ovn_attach n1 br-phys 192.168.0.${i} + ovs-vsctl set open . external_ids:ovn-bridge-mappings=physnet1:br-phys + ovs-vsctl add-port br-int vif${i} -- \ + set Interface vif${i} external-ids:iface-id=sw0-p${i} \ + options:tx_pcap=hv${i}/vif${i}-tx.pcap \ + options:rxq_pcap=hv${i}/vif${i}-rx.pcap +done + +check ovn-nbctl lr-add lr0 +check ovn-nbctl lrp-add lr0 lr0-sw0 00:00:00:00:ff:01 10.0.0.254/24 +check ovn-nbctl lsp-add sw0 sw0-lr0 +check ovn-nbctl lsp-set-type sw0-lr0 router +check ovn-nbctl lsp-set-addresses sw0-lr0 router +check ovn-nbctl lsp-set-options sw0-lr0 router-port=lr0-sw0 + +check ovn-nbctl --wait=hv sync +wait_for_ports_up + +# We should not have any flows in table OFTABLE_PHY_TO_LOG from in_port different from vif1 and ovn-hv2-0 +OVN_WAIT_REMOTE_INPUT_FLOWS(["hv1"],["hv2"]) +of1=$(as hv1 ovs-vsctl --bare --columns ofport find Interface name=vif1) +of2=$(as hv1 ovs-vsctl --bare --columns ofport find Interface name=ovn-hv2-0) +AT_CHECK([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_PHY_TO_LOG | grep -v NXST_FLOW | grep "in_port=" | grep -v "in_port=$of1" | grep -v "in_port=$of2" | wc -l], [0], [dnl +0 +]) + +# Add localnet port to sw0 +check ovn-nbctl lsp-add sw0 ln-sw0 -- lsp-set-addresses ln-sw0 unknown -- lsp-set-type ln-sw0 localnet +check ovn-nbctl --wait=hv lsp-set-options ln-sw0 network_name=physnet1 -- set logical_switch_port ln-sw0 tag_request=100 + +OVN_WAIT_PATCH_PORT_FLOWS(["ln-sw0"], ["hv1"]) +AT_CHECK([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_PHY_TO_LOG | grep -v NXST_FLOW | grep "in_port=" | grep -v "in_port=$of1" | grep -v "in_port=$of2" | wc -l], [0], [dnl +2 +]) + +# Remove localnet port from sw0. Peer-ports flows should be deleted. +check ovn-nbctl --wait=hv lsp-del ln-sw0 +AT_CHECK([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_PHY_TO_LOG | grep -v NXST_FLOW | grep "in_port=" | grep -v "in_port=$of1" | grep -v "in_port=$of2" | wc -l], [0], [dnl +0 +]) + +OVN_CLEANUP([hv1],[hv2]) + +AT_CLEANUP +])