From patchwork Mon May 20 09:32:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indrajitt Valsaraj X-Patchwork-Id: 1936975 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" (2048-bit key; unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=proofpoint20171006 header.b=CVR1jmym; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=selector1 header.b=O4QyBTZc; 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 4VjXRW6DR7z20KF for ; Mon, 20 May 2024 19:32:55 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 9DA8140AE4; Mon, 20 May 2024 09:32:52 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id oWeNa2-QpYx3; Mon, 20 May 2024 09:32:51 +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 smtp2.osuosl.org ECD89402F2 Authentication-Results: smtp2.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=proofpoint20171006 header.b=CVR1jmym; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=selector1 header.b=O4QyBTZc Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id ECD89402F2; Mon, 20 May 2024 09:32:50 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id BD534C0077; Mon, 20 May 2024 09:32:50 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id BF97FC0037 for ; Mon, 20 May 2024 09:32:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 9756340467 for ; Mon, 20 May 2024 09:32:48 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id ujtmJGeuh9mG for ; Mon, 20 May 2024 09:32:47 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=148.163.151.68; helo=mx0a-002c1b01.pphosted.com; envelope-from=indrajitt.valsaraj@nutanix.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 1CA0A400F2 Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=nutanix.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 1CA0A400F2 Received: from mx0a-002c1b01.pphosted.com (mx0a-002c1b01.pphosted.com [148.163.151.68]) by smtp2.osuosl.org (Postfix) with ESMTPS id 1CA0A400F2 for ; Mon, 20 May 2024 09:32:46 +0000 (UTC) Received: from pps.filterd (m0127837.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44K0wJAG007397 for ; Mon, 20 May 2024 02:32:46 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h= from:to:cc:subject:date:message-id:content-transfer-encoding :content-type:mime-version; s=proofpoint20171006; bh=mT67hfALu7o GsoHioHeGudvoSKzwqgt7Oz9G2O2UT8Q=; b=CVR1jmymVBeT0H7oQ0aEebs4WuE RjoYRB3vcGR1KjdmcERII/8DJpLAXHiynNhn8fTAKCVzJ9s0YeJD+HsDkmDembss kqUN4gRk6TnPYGRzTNlKr8qvU7TfnLjfvsUrnNrOF+LK47KOc+frZwY41o8Ax+WY dxxHMWAlbdHK4DuowJdGqrsYC/fsQvVOYiPPrC5dfBdrhd/tjUC+tQnaJoeHdr9J PZz+hm+My4V74kfvGURoUoLNFrmqh945avFv0yw1n7SNFi6XvxZ+PqOUeGnyn1Wr 7TfcuFv57OMRROUc+1S8wr5vOaX+iOnF2acR5uTkIQc23e7W2JIiaouKGCQ== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2168.outbound.protection.outlook.com [104.47.55.168]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3y6rbfu0na-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 20 May 2024 02:32:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ufp2rK1OcgTVFb98NM4UHZCq9uOAlbFVZgaGyZGbnlUV207Lyw2zodblGz+Z8uoB8yM6evqT8Q+Ng7qtEd2XwTI/Z/YZfPuQS0EkhKCACnYKZJzkhtw7SyR7fzBMaIB7HjI8j+em6rld7wb0hFTnIiYftzsdJ7wvI7XqrgRO749zv710LOXDSULoP3Yh2AAPH/fh5fQh0eVfyiEnZvdWQWSMlnrnsXhT2xwJfyKT6nxhTGwVI3BEgYSISI6kHgyFJPOQFmc6+D0Wt3phAqJl03z4G6/+Z9duwkJmOp8VDvkpXK+FqLk3+7za5pPlgZN3t0a3IW0tLVZj6fb4PBkRnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mT67hfALu7oGsoHioHeGudvoSKzwqgt7Oz9G2O2UT8Q=; b=CZcxm7WWBYlZi4IIkauokT/4B03WQQD2t5JAv9e2sIzaXQv8HGsebboLYF3tKAfBjGJIR6xWpX/n3TRhJOqqjOdCnaKK/K1qmXsEsWR3pMLMsCOWhOJCSq6XVFA6+XQSBLKohwKKmu59M8iSiJoL6kgNhpyQMa7M+CwXv4QlPh0cO+Q/lZ+OQJwYc2YiATaTI2maUbEfCNsKKe5xi/ZTyDQPBsuVpP8sQjWe1IDbfhvp1nLeeAXfYwrktbnIjiTe/Okj6ba8izw8449pFvg+6nScV0oK1AMccr14q206N3OHm4G3kieQjiSWWCwbuOAmTMQFJoWhbo5Y8m3RsU9Ktw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mT67hfALu7oGsoHioHeGudvoSKzwqgt7Oz9G2O2UT8Q=; b=O4QyBTZciHfPWEd8cRldwOK5tGyNMnLiS1uwQvo/4yKHgIWlIRw/y59XJzFZYWrHPS4Yrl0vRlLYT6T8gKBOOCkGYJW2m9PjNAWEN5PUTPG+xDbwHUK6qAoA9rwLC3D0WnzHDY2l5cytuZdft21/7ezVIcSd4Z71RqxgKiVfriB6393jUV0EXP9kiSJj9l+wROrqm9kwX4Xh78+CIJGZD8H3sMlSKhoyVzt+RonDx79tiokpQ+xriBvnvw9E2guSGk5ed4JJreiCgPGDPpIYQs065w1jMY6SlUKMkwfUaG4L3shWG7x99VDYps74sIk3ba2NPKhR3mgg1KK0gkPHLQ== Received: from DM6PR02MB6747.namprd02.prod.outlook.com (2603:10b6:5:220::15) by SJ0PR02MB8733.namprd02.prod.outlook.com (2603:10b6:a03:3da::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.27; Mon, 20 May 2024 09:32:41 +0000 Received: from DM6PR02MB6747.namprd02.prod.outlook.com ([fe80::8dba:5918:2130:6dcc]) by DM6PR02MB6747.namprd02.prod.outlook.com ([fe80::8dba:5918:2130:6dcc%3]) with mapi id 15.20.7587.028; Mon, 20 May 2024 09:32:40 +0000 From: Indrajitt Valsaraj To: dev@openvswitch.org Date: Mon, 20 May 2024 09:32:29 +0000 Message-Id: <20240520093229.36757-1-indrajitt.valsaraj@nutanix.com> X-Mailer: git-send-email 2.22.3 X-ClientProxiedBy: BYAPR05CA0066.namprd05.prod.outlook.com (2603:10b6:a03:74::43) To DM6PR02MB6747.namprd02.prod.outlook.com (2603:10b6:5:220::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR02MB6747:EE_|SJ0PR02MB8733:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e5c5e17-c7ff-49ef-3b22-08dc78afcacb x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|366007|1800799015|376005|52116005|38350700005; X-Microsoft-Antispam-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aC/mUPJolKaR6c8s4X31Wc3wYVjmQyouGSOG7yjeREtpPzw2yod/Zgixyqp2PZM8d5FcrsAvIYOvFCtCl/4OLCvn0AWWBd+A3vB3WfReoTA/K5NeB3leVe7aekl3KlhAVSt1b++GF+wC3eeae0DqHYhBO1IL79E0OD+dgy/9DLlvCI6qu7OVm5pUuQ+NINQmPYGjrYIpHOuxr3m3jphgN5J4YSMrhJiEueG6agZ5y602Y1v4SoQNWulWxVVcqLuQjNUycHku52L4d/ZfXfewYDH6IF0ZsSpJOjihYi/cjxotWEyTDQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR02MB6747.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(52116005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: x+a1Yl7qtAw7VOmIQnaKSP/k0QoOoU2mCe+8r2FaaiW09XiIkoBpT9zCSuCrqckqNg84K01MdkAUMjQ7r79t5c+KUr8KDep5Bl9xB+K9dD4wH0jzrZmEPGf3fpgYXVeu8d15igAfxvFAM+3mlcxj+X1/wGbaSEl+SNZs7mP/zT4jxBUJ7BnJJirO2Z/o51Ai4H9IUot9H+E96V4kkAD9Dy8oLnAPWxSUwjXOa+gzsa8btq1tV7yIm8WOcEvpxlGeHmKy4BEgvYziEgI6qeUj0TPH0UxcMi1g9/05oypXcCCaHxOVfVSf1OmDeqFXcs8heDkMuJoYYqgYsZzT3AmmVKFeQNXq0I4j4/IG4R3XUJQ69JMcZUqp3XbDEUB8Jo67GzRE5TAuv/2qvxa4X03hHTlTAlWApmKL6K/jvsdgMTNF8jcWCBSAvTEE4uAg4167YtHYRoW5zLwfSgCutCWMZ4ACpD4QcYdINx3mLa4HHuzrJLR5p8XY9fO2MuUd/TYO/SHWhkxeuQdVV5uLN3aBKpS3PO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gIqR84Y8oHPlGxlRGlWnHOPUDaX5v1DEM= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e5c5e17-c7ff-49ef-3b22-08dc78afcacb X-MS-Exchange-CrossTenant-AuthSource: DM6PR02MB6747.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2024 09:32:39.8832 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ldpTRKbq1vYgaky/Io3XunHkioVcEaoVE39Ge/vi4F1KeV8OBAbhD4FtXjMQkgYsmuO0498g4PVJNQgFLgw2CvZSWif6UYYWKbm/zihN/jg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR02MB8733 X-Proofpoint-GUID: xNIUGsPBw1EKrUJFXcfOQfXePLCNQOpL X-Proofpoint-ORIG-GUID: xNIUGsPBw1EKrUJFXcfOQfXePLCNQOpL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-20_05,2024-05-17_03,2023-05-22_02 X-Proofpoint-Spam-Reason: safe Cc: Indrajitt Valsaraj Subject: [ovs-dev] [PATCH ovn v3] northd: Fix an issue wrt mac binding aging. 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" Issue: In case of a Logical_Router without mac_binding_age_threshold set or a Logical_Router with an incorrectly formatted mac_binding_threshold option, entries were not being purged from the Mac Binding table in SouthBound. This was because in the function `en_mac_binding_aging_run` in case of an invalid mac_binding_threshold entry or if mac_binding_threshold is not set we are returning from the loop instead of iterating through the remaining LRs. As a result, subsequent runs of the aging_waker node are also not scehduled and we end up not purging any MAC Bindings. Fix: This patch fixes this issue by changing the return to a continue so that we skip the current LR but continue processing for the remaining LRs. Fixes: 78851b6ffb58 ("Support CIDR-based MAC binding aging threshold.") Signed-off-by: Indrajitt Valsaraj Acked-by: Naveen Yerramneni --- v1: - Addressed review comment from Ales v2: - Fix test failure v3: - Addresssed review comments from Han --- northd/aging.c | 2 +- tests/ovn.at | 146 ++++++++++++++++++++++++++++++++++++------------- 2 files changed, 108 insertions(+), 40 deletions(-) -- 2.22.3 diff --git a/northd/aging.c b/northd/aging.c index b76963a2d..9685044e7 100644 --- a/northd/aging.c +++ b/northd/aging.c @@ -421,7 +421,7 @@ en_mac_binding_aging_run(struct engine_node *node, void *data OVS_UNUSED) if (!parse_aging_threshold(smap_get(&od->nbr->options, "mac_binding_age_threshold"), &threshold_config)) { - return; + continue; } aging_context_set_threshold(&ctx, &threshold_config); diff --git a/tests/ovn.at b/tests/ovn.at index 486680649..96e43d80c 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -34414,10 +34414,15 @@ AT_CHECK([ovn-nbctl lsp-set-addresses ln_port unknown]) AT_CHECK([ovn-nbctl lsp-set-type ln_port localnet]) AT_CHECK([ovn-nbctl lsp-set-options ln_port network_name=physnet1]) -AT_CHECK([ovn-nbctl lsp-add public public-gw]) -AT_CHECK([ovn-nbctl lsp-set-type public-gw router]) -AT_CHECK([ovn-nbctl lsp-set-addresses public-gw 00:00:00:00:10:00 router]) -AT_CHECK([ovn-nbctl lsp-set-options public-gw router-port=gw-public]) +AT_CHECK([ovn-nbctl lsp-add public public-gw-1]) +AT_CHECK([ovn-nbctl lsp-set-type public-gw-1 router]) +AT_CHECK([ovn-nbctl lsp-set-addresses public-gw-1 00:00:00:00:10:00 router]) +AT_CHECK([ovn-nbctl lsp-set-options public-gw-1 router-port=gw-1-public]) + +AT_CHECK([ovn-nbctl lsp-add public public-gw-2]) +AT_CHECK([ovn-nbctl lsp-set-type public-gw-2 router]) +AT_CHECK([ovn-nbctl lsp-set-addresses public-gw-2 00:00:00:00:30:00 router]) +AT_CHECK([ovn-nbctl lsp-set-options public-gw-2 router-port=gw-2-public]) AT_CHECK([ovn-nbctl lsp-add internal internal-gw]) AT_CHECK([ovn-nbctl lsp-set-type internal-gw router]) @@ -34430,9 +34435,12 @@ AT_CHECK([ovn-nbctl lsp-set-addresses vif1 "00:00:00:00:20:10 192.168.20.10"]) AT_CHECK([ovn-nbctl lsp-add internal vif2]) AT_CHECK([ovn-nbctl lsp-set-addresses vif2 "00:00:00:00:20:20 192.168.20.20"]) -AT_CHECK([ovn-nbctl lr-add gw]) -AT_CHECK([ovn-nbctl lrp-add gw gw-public 00:00:00:00:10:00 192.168.10.1/24]) -AT_CHECK([ovn-nbctl lrp-add gw gw-internal 00:00:00:00:20:00 192.168.20.1/24]) +AT_CHECK([ovn-nbctl lr-add gw-1]) +AT_CHECK([ovn-nbctl lrp-add gw-1 gw-1-public 00:00:00:00:10:00 192.168.10.1/24]) +AT_CHECK([ovn-nbctl lrp-add gw-1 gw-internal 00:00:00:00:20:00 192.168.20.1/24]) + +AT_CHECK([ovn-nbctl lr-add gw-2]) +AT_CHECK([ovn-nbctl lrp-add gw-2 gw-2-public 00:00:00:00:30:00 192.168.10.2/24]) sim_add hv1 as hv1 @@ -34500,21 +34508,27 @@ send_udp() { as $hv ovs-appctl netdev-dummy/receive $dev $packet } # Check if the option is not present by default -AT_CHECK([fetch_column nb:logical_router options name="gw" | grep -q mac_binding_age_threshold], [1]) +AT_CHECK([fetch_column nb:logical_router options name="gw-1" | grep -q mac_binding_age_threshold], [1]) +AT_CHECK([fetch_column nb:logical_router options name="gw-2" | grep -q mac_binding_age_threshold], [1]) # Send GARP to populate MAC binding table records send_garp hv1 ext1 10 send_garp hv2 ext2 20 -wait_row_count mac_binding 1 ip="192.168.10.10" -wait_row_count mac_binding 1 ip="192.168.10.20" +# Two rows present for each IP, one corresponding to each logical_port +wait_row_count mac_binding 2 ip="192.168.10.10" +wait_row_count mac_binding 2 ip="192.168.10.20" -dp_key=$(printf "0x%x" $(as hv1 fetch_column datapath tunnel_key external_ids:name=gw)) -port_key=$(printf "0x%x" $(as hv1 fetch_column port_binding tunnel_key logical_port=gw-public)) +dp_key_1=$(printf "0x%x" $(as hv1 fetch_column datapath tunnel_key external_ids:name=gw-1)) +port_key_1=$(printf "0x%x" $(as hv1 fetch_column port_binding tunnel_key logical_port=gw-1-public)) +dp_key_2=$(printf "0x%x" $(as hv1 fetch_column datapath tunnel_key external_ids:name=gw-2)) +port_key_2=$(printf "0x%x" $(as hv1 fetch_column port_binding tunnel_key logical_port=gw-2-public)) AT_CHECK_UNQUOTED([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_MAC_CACHE_USE --no-stats | strip_cookie | sort], [0], [dnl - table=OFTABLE_MAC_CACHE_USE, priority=100,ip,reg14=${port_key},metadata=${dp_key},dl_src=00:00:00:00:10:10,nw_src=192.168.10.10 actions=drop - table=OFTABLE_MAC_CACHE_USE, priority=100,ip,reg14=${port_key},metadata=${dp_key},dl_src=00:00:00:00:10:20,nw_src=192.168.10.20 actions=drop + table=OFTABLE_MAC_CACHE_USE, priority=100,ip,reg14=${port_key_1},metadata=${dp_key_1},dl_src=00:00:00:00:10:10,nw_src=192.168.10.10 actions=drop + table=OFTABLE_MAC_CACHE_USE, priority=100,ip,reg14=${port_key_1},metadata=${dp_key_1},dl_src=00:00:00:00:10:20,nw_src=192.168.10.20 actions=drop + table=OFTABLE_MAC_CACHE_USE, priority=100,ip,reg14=${port_key_2},metadata=${dp_key_2},dl_src=00:00:00:00:10:10,nw_src=192.168.10.10 actions=drop + table=OFTABLE_MAC_CACHE_USE, priority=100,ip,reg14=${port_key_2},metadata=${dp_key_2},dl_src=00:00:00:00:10:20,nw_src=192.168.10.20 actions=drop ]) timestamp=$(fetch_column mac_binding timestamp ip="192.168.10.20") @@ -34525,8 +34539,8 @@ send_udp hv2 ext2 20 OVS_WAIT_UNTIL([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_MAC_CACHE_USE | grep "192.168.10.10" | grep -q "n_packets=1"]) OVS_WAIT_UNTIL([as hv2 ovs-ofctl dump-flows br-int table=OFTABLE_MAC_CACHE_USE | grep "192.168.10.20" | grep -q "n_packets=1"]) -# Set the MAC binding aging threshold -AT_CHECK([ovn-nbctl set logical_router gw options:mac_binding_age_threshold=5]) +# Set the MAC binding aging threshold for gw-1 router. No option for gw-2 router. +AT_CHECK([ovn-nbctl set logical_router gw-1 options:mac_binding_age_threshold=5]) AT_CHECK([fetch_column nb:logical_router options | grep -q mac_binding_age_threshold=5]) AT_CHECK([ovn-nbctl --wait=sb sync]) @@ -34535,28 +34549,31 @@ send_udp hv2 ext2 20 sleep 1 send_udp hv2 ext2 20 -# Set the timeout for OVS_WAIT* functions to 5 seconds +# Set the timeout for OVS_WAIT* functions to 10 seconds OVS_CTL_TIMEOUT=10 OVS_WAIT_UNTIL([ test "$timestamp" != "$(fetch_column mac_binding timestamp ip='192.168.10.20')" ]) check test "$(fetch_column mac_binding timestamp ip='192.168.10.20')" != "" -# Check if the records are removed after some inactivity +# Check if the records are removed after some inactivity for gw-1. Only 1 entry should be present for gw-2. OVS_WAIT_UNTIL([ - test "0" = "$(ovn-sbctl list mac_binding | grep -c '192.168.10.10')" + test "1" = "$(ovn-sbctl list mac_binding | grep -c '192.168.10.10')" ]) # The second one takes longer because it got refreshed OVS_WAIT_UNTIL([ - test "0" = "$(ovn-sbctl list mac_binding | grep -c '192.168.10.20')" + test "1" = "$(ovn-sbctl list mac_binding | grep -c '192.168.10.20')" ]) -AT_CHECK([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_MAC_CACHE_USE --no-stats | strip_cookie], [0], []) +AT_CHECK_UNQUOTED([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_MAC_CACHE_USE --no-stats | strip_cookie | sort], [0], [dnl + table=OFTABLE_MAC_CACHE_USE, priority=100,ip,reg14=${port_key_2},metadata=${dp_key_2},dl_src=00:00:00:00:10:10,nw_src=192.168.10.10 actions=drop + table=OFTABLE_MAC_CACHE_USE, priority=100,ip,reg14=${port_key_2},metadata=${dp_key_2},dl_src=00:00:00:00:10:20,nw_src=192.168.10.20 actions=drop +]) # Test CIDR-based threshold configuration -check ovn-nbctl set logical_router gw options:mac_binding_age_threshold="192.168.10.0/255.255.255.0:2;192.168.10.64/26:0;192.168.10.20:0" +check ovn-nbctl set logical_router gw-1 options:mac_binding_age_threshold="192.168.10.0/255.255.255.0:2;192.168.10.64/26:0;192.168.10.20:0" check ovn-nbctl --wait=sb sync -uuid=$(fetch_column datapath _uuid external_ids:name=gw) +uuid=$(fetch_column datapath _uuid external_ids:name=gw-1) AT_CHECK([ovn-sbctl get datapath $uuid external_ids:mac_binding_age_threshold], [0], [dnl "2" ]) @@ -34566,22 +34583,32 @@ send_garp hv1 ext1 10 # belong to 192.168.10.0/24 send_garp hv2 ext2 20 # belong to 192.168.10.20/32 send_garp hv2 ext2 65 # belong to 192.168.10.64/26 -OVS_WAIT_UNTIL([ovn-sbctl list mac_binding | grep -q "192.168.10.10"]) -OVS_WAIT_UNTIL([ovn-sbctl list mac_binding | grep -q "192.168.10.20"]) -OVS_WAIT_UNTIL([ovn-sbctl list mac_binding | grep -q "192.168.10.65"]) +ip_addresses=("192.168.10.10" "192.168.10.20" "192.168.10.65") +logical_ports=("gw-1-public" "gw-2-public") +for ip in "${ip_addresses[@]}"; do + for port in "${logical_ports[@]}"; do + wait_row_count mac_binding 1 ip=$ip logical_port=$port + done +done OVS_WAIT_UNTIL([ - test "0" = "$(ovn-sbctl list mac_binding | grep -c '192.168.10.10')" + test "1" = "$(ovn-sbctl list mac_binding | grep -c '192.168.10.10')" ]) + # The other two should remain because the corresponding prefixes have threshold 0 -AT_CHECK([ovn-sbctl list mac_binding | grep -q "192.168.10.20"]) -AT_CHECK([ovn-sbctl list mac_binding | grep -q "192.168.10.65"]) +ip_addresses=("192.168.10.20" "192.168.10.65") +for ip in "${ip_addresses[@]}"; do + for port in "${logical_ports[@]}"; do + check_row_count mac_binding 1 ip=$ip logical_port=$port + done +done + check ovn-sbctl --all destroy mac_binding # Set the aging threshold mixed with IPv6 prefixes and default threshold -check ovn-nbctl set logical_router gw options:mac_binding_age_threshold="2;192.168.10.64/26:0;ff00:1234::/32:888;ff00::abcd:1" +check ovn-nbctl set logical_router gw-1 options:mac_binding_age_threshold="2;192.168.10.64/26:0;ff00:1234::/32:888;ff00::abcd:1" check ovn-nbctl --wait=sb sync -uuid=$(fetch_column datapath _uuid external_ids:name=gw) +uuid=$(fetch_column datapath _uuid external_ids:name=gw-1) AT_CHECK([ovn-sbctl get datapath $uuid external_ids:mac_binding_age_threshold], [0], [dnl "1" ]) @@ -34590,28 +34617,69 @@ AT_CHECK([ovn-sbctl get datapath $uuid external_ids:mac_binding_age_threshold], send_garp hv1 ext1 10 # belong to default send_garp hv2 ext2 65 # belong to 192.168.10.64/26 -OVS_WAIT_UNTIL([ovn-sbctl list mac_binding | grep -q "192.168.10.10"]) -OVS_WAIT_UNTIL([ovn-sbctl list mac_binding | grep -q "192.168.10.65"]) +for ip in "${ip_addresses[@]}"; do + for port in "${logical_ports[@]}"; do + wait_row_count mac_binding 1 ip=$ip logical_port=$port + done +done OVS_WAIT_UNTIL([ - test "0" = "$(ovn-sbctl list mac_binding | grep -c '192.168.10.10')" + test "1" = "$(ovn-sbctl list mac_binding | grep -c '192.168.10.10')" ]) -AT_CHECK([ovn-sbctl list mac_binding | grep -q "192.168.10.65"]) +for port in "${logical_ports[@]}"; do + check_row_count mac_binding 1 ip="192.168.10.65" logical_port=$port +done check ovn-sbctl --all destroy mac_binding # Set the aging threshold with invalid format -check ovn-nbctl set logical_router gw options:mac_binding_age_threshold="1;abc/26:0" +check ovn-nbctl set logical_router gw-1 options:mac_binding_age_threshold="1;abc/26:0" check ovn-nbctl --wait=sb sync -uuid=$(fetch_column datapath _uuid external_ids:name=gw) +uuid=$(fetch_column datapath _uuid external_ids:name=gw-1) AT_CHECK([ovn-sbctl get datapath $uuid external_ids:mac_binding_age_threshold], [1], [ignore], [ignore]) # Send GARP to populate MAC binding table records send_garp hv1 ext1 10 -OVS_WAIT_UNTIL([ovn-sbctl list mac_binding | grep -q "192.168.10.10"]) +wait_row_count mac_binding 1 ip="192.168.10.10" logical_port="gw-1-public" +wait_row_count mac_binding 1 ip="192.168.10.10" logical_port="gw-2-public" # The record is not deleted sleep 5 -AT_CHECK([ovn-sbctl list mac_binding | grep -q "192.168.10.10"]) +check_row_count mac_binding 1 ip="192.168.10.10" logical_port=gw-1-public +check_row_count mac_binding 1 ip="192.168.10.10" logical_port=gw-2-public +check ovn-sbctl --all destroy mac_binding + +# Set the aging threshold on both routers and ensure that they are aged out of both the routers +AT_CHECK([ovn-nbctl set logical_router gw-1 options:mac_binding_age_threshold=5]) +AT_CHECK([ovn-nbctl set logical_router gw-2 options:mac_binding_age_threshold=5]) +check ovn-nbctl --wait=sb sync +uuid=$(fetch_column datapath _uuid external_ids:name=gw-1) +AT_CHECK([ovn-sbctl get datapath $uuid external_ids:mac_binding_age_threshold], [0], [dnl +"5" +]) +uuid=$(fetch_column datapath _uuid external_ids:name=gw-2) +AT_CHECK([ovn-sbctl get datapath $uuid external_ids:mac_binding_age_threshold], [0], [dnl +"5" +]) + +# Send GARP to populate MAC binding table records +send_garp hv1 ext1 10 # belong to 192.168.10.0/24 +send_garp hv2 ext2 20 # belong to 192.168.10.20/32 + +ip_addresses=("192.168.10.10" "192.168.10.20") +logical_ports=("gw-1-public" "gw-2-public") +for ip in "${ip_addresses[@]}"; do + for port in "${logical_ports[@]}"; do + wait_row_count mac_binding 1 ip=$ip logical_port=$port + done +done + + +OVS_WAIT_UNTIL([ + test "0" = "$(ovn-sbctl list mac_binding | grep -c '192.168.10.10')" +]) +OVS_WAIT_UNTIL([ + test "0" = "$(ovn-sbctl list mac_binding | grep -c '192.168.10.20')" +]) OVN_CLEANUP([hv1], [hv2]) AT_CLEANUP