From patchwork Mon Jul 31 14:49:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: maximkorezkij X-Patchwork-Id: 1815056 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=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=ZA/u3f6Z; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RF1NG5nW5z1yZD for ; Tue, 1 Aug 2023 00:49:18 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id E12F981DF3; Mon, 31 Jul 2023 14:49:16 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org E12F981DF3 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=ZA/u3f6Z 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 6Rj7PIlGbtxJ; Mon, 31 Jul 2023 14:49:16 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id EBAFD817B3; Mon, 31 Jul 2023 14:49:14 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org EBAFD817B3 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C5D86C0072; Mon, 31 Jul 2023 14:49:14 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id D6B9FC0032 for ; Mon, 31 Jul 2023 14:49:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id A47F1817B3 for ; Mon, 31 Jul 2023 14:49:12 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org A47F1817B3 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 OGXiwfmvIMDT for ; Mon, 31 Jul 2023 14:49:11 +0000 (UTC) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on071c.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::71c]) by smtp1.osuosl.org (Postfix) with ESMTPS id 2362081443 for ; Mon, 31 Jul 2023 14:49:11 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 2362081443 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DfnvLs2U0/l3umPGFIEH53Ygol+spdy1JX/qF3Lh2uWl43eKSc38SAgeC9cV3qtqqZV0TR6M7k+X89RfSxvZuFRr5NGiV6JA3WiPb4a3tNzlI8iJwIVUn2+d2BYmMXRFsz3ErOkHiTbQu+PfRWeEK3niItRsCnnTjSiZr9WczA5TZ5sT1PFVVEiiLfFofUy+PLbe5O4gl1X1ei3oqWUh5kJUzF896SepXqgWWfL4tfE19ItG2v2XNscuXfZ2cLdMjfg35kxK7AwIjO6koDJh1SB+nNAU1VOgm15R5KmcGJpAzNgyBzgfoaS9ZaKgn6U2ZQWD2AS7442xLZlC55mbDg== 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=GdKG7dTo7EfNqx7KutwJ7OSHSqUq7kIcaJaVhTZmUxk=; b=IEucoqh60hnFHDc8XgjRKqmU4ZoD0BKKnJOFzimD0SDJ5xos8dvoWaRkvooRP5BeIuu+8JiE5lmHalECULP2RM+SU+JAwJK2UNEOV/sJiXqvOg1OYf23nMgriZ2H+XUMYVEcG7qB6CNOf9QqO/CE5gWcpG5GKY4riBga4j3uvtwNHDhTbcTOPDW4sHKykBHyjzLVxCVD0rJv0BnFsAoSWzpv/x5lzZ9jWA/cqypg3aAFdui3P7dLa6pvdNlQq4USpYMZIUA5SJsuJQNrqHVeFrlIrfDv0qXTqbcP1uEIXyouz3ufC7Xgue+7JDLvC25IyNhiYTnAhzj0+y0vjCu6RA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mail.schwarz; dmarc=pass action=none header.from=mail.schwarz; dkim=pass header.d=mail.schwarz; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.schwarz; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GdKG7dTo7EfNqx7KutwJ7OSHSqUq7kIcaJaVhTZmUxk=; b=ZA/u3f6ZUARgrd2HiPaEyK0cRweyVKlujKkRDjiTVifG4WXmbSpWpnXqtlXZudYDeF6t1E+s9WwLa147FyFrIJZzkAUYDhzOmfQakvetfNqwnw9f3K2BH9xwQJMXgOioJUSsw/ggcVHY0IoXIdZzBEnf1ZITthvayx6WYgawbF3qp8vcUruIbAfJw26b4tpI9yMkugQfDWi55BM22oTYDGWNC40ZRFO/u4Pi9Tk2vbYrbPnuP+qQCb0kJuGfLLjgXIJcdyCl+WB5+tXZLlhGoqswsi0IihCqmaBpaMr+qzjjvKCJ6++Q5ibplu1nijSoE4oVJ2gWWkhiqnpuhbfAng== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=mail.schwarz; Received: from AS4PR10MB5221.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:4b1::6) by DU0PR10MB5147.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:343::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.43; Mon, 31 Jul 2023 14:49:06 +0000 Received: from AS4PR10MB5221.EURPRD10.PROD.OUTLOOK.COM ([fe80::350f:1888:635c:267f]) by AS4PR10MB5221.EURPRD10.PROD.OUTLOOK.COM ([fe80::350f:1888:635c:267f%4]) with mapi id 15.20.6631.042; Mon, 31 Jul 2023 14:49:06 +0000 Date: Mon, 31 Jul 2023 16:49:03 +0200 To: dev@openvswitch.org Message-ID: Content-Disposition: inline X-ClientProxiedBy: FR2P281CA0075.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9a::17) To AS4PR10MB5221.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:4b1::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS4PR10MB5221:EE_|DU0PR10MB5147:EE_ X-MS-Office365-Filtering-Correlation-Id: 4dc32a1c-7345-4aa4-6427-08db91d54a28 x-mp-schwarz-dsgvo2: 1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dIgxPiwwFtWwWo4LXJ6SMmRI9EFEt2VoML8ocv0dGzZ3DeiSrs0deQy5FxYTF4EGKa6kvhrwPN8FZq4FjPobrcnHfJqgcIeAMFxsi8Ch2Cuwakb3mdQ76xeCFYMm8FoKxIM+VOij1BtxjUYe8KK+kjDmDwc/N11XsjFuJeolik2ZydjSxfVR0K5bDY/rSjzn5qpsMX1+ZJ3ZaBAi+XwEGAKXcNfpgWWgLWCh2/J0o97ChGBexWoBYfMX2VcsOHcS5zf6j18ZO857kVehlFsjAAP+a91sa3qtBK77KLlz+YVmbYr4v1KQu4KGOXIMB9L5HVTULAcd5KT3mppWVbfmJ0K4PXa1f77y4NwRDmymHfOrvu3R5tddwk1EjLFMDTjBtXvzHUPqIVL1SJ3K3CzFf+55jwCVr+j8ac9+hYMa72QykTlZO69oCl0AZfoOtxAPynrxlxaTa8was7OkcIyx75T9n9+rOBUUkrD3tTQoOSbfRUGBcgarTtMr71glbVXAETjbicoul+8iErzE84/Iv3LfeIijZJVX5dm85cIjZk3wUlkduE5wf5E9cwjXiZcJ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS4PR10MB5221.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230028)(4636009)(396003)(39860400002)(346002)(366004)(136003)(376002)(451199021)(38100700002)(82960400001)(86362001)(6512007)(9686003)(478600001)(6486002)(6666004)(107886003)(186003)(26005)(8676002)(8936002)(6506007)(44832011)(5660300002)(4326008)(2906002)(66476007)(66946007)(66556008)(6916009)(41300700001)(316002)(66574015)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Knk/YKKX3RkFe3Qb1L00geEHHZ8f6naH6+s6T3azF+W5G2MJyMiW0cJPHy9xIgBbQGWT5Q30SFof9ATAwq3WsVaC1SBkBn+o6SHnBTuaEzRmXtULbrirfdB95X5TaxsLTdOnTfjw8UWyCoutDjyinIx+VgDXpRIU7gDlxWLWrfFA30NQk/7m5aFa7AFQrieIprBWOpI1lSLCGbojt5Xe4FfnqnSknClcujAFHZ1RaPkXjb2KU9WxSg1Sc+C5YOHqii8cidaZyZcKltZ8QCIPsxIkbRv2M77cN4BpQGIVqT4yhGzqS6PNbn4ygk9Bnb7eLC99wD9Pn3Kr3dZUFgBmFODpnImakkNbYDTfBbyahFmsaGNNj42G2s2sk5Hox91QtfrZiKwUjYRUMV4ZTzueSvSijzruJc5RRx0yNgRHP/x3xL6D2g5J+bNQrNG5uG3puzfXzMX5PPHqI0ahar2NnKlM8XJURFCEYJnjA1exc7ggQsWNOv7R/CJKBoSE25rJBTxKzj5wFrzCIkgs9cTUPbtIS57XoE9X6JEkdtEV6FIxxg8AYMKAYSH3QdbvbQIWT0HWt7Zm0VahyvAMIXARNOO5+xBsnrbNm4kQnW4VhrOZ1d9EhKY8I6Cz/6LAcCeJlfcYoZ6WnAY5WFMB93f8BPevarW3FdzgrkbIgD8xgjzf67emHiZJgM4+NsE332UP9EXd3HkPZeqBvK1+M1QxcRYM5UeR4u6BNA/j9yJ7Xi7ui2+hWiIrzYaP/FKhS66M6vekqxD68iZkheaiNGxDNJVRVkIKZjdE/1YcLJDiOndVNhyyFFG2I3u5JYS5hylk3xmhsqGSlrdt9uaAS26jlHxFUyAq3XROLQjpY/d86exDlw6VtKhp4xpUgkZDa/f7MRITIuClONxeXhH0bgw7Jo7PBpBzvQoTuR7mmun87ay04vsKYCnz8TUOeStKBPxIzgK/+MOKpcnpmbRH9Fi69v7K22UmiSoGUcUfmTDNP/JvydAtfvLDpGGs8M8qd+GnvzVtdyh3040Yj7HpiRuodw9eDD/9VmArCBNIllSpgiihO1twAHnbvV29IspPd5hGK3MX1uWBZiHPX+LuAOUgvBlnOHAIKlo36ihyOOrvTae7+k8BM6GceG3milPMxiKdmxoEiHtjkkdyBBj0U+qMUeQauuD+D7PO3/ioAp2JxUtKSLwZft4N+Acwx0F3PAt7KXpBHqjE51q/EJvgkxkJlTts3ODwXHjAqHY5ovRGnrIIs00tpmO40Rjj2ycdyI8JMm6Wr4gHvMIj7Mn4DTMu4q1AWIK3kgQnpwU1OpPr1qMn9wvE2W1JILokZmo+hRP/vnMwTN2LmtquwzQXUEm89E73j+gdTQ6LoXXOLQ7W0QEUgTf/NGP2Zqv/yBEDTkQO/R6JswS6VfW4GNB89got771gCnrDDmUf7DUt/chsJflIDLSKBEZOIPkSgc4he78ZEVqlObUdCC85COrHFpfnkiYufA8jrjhTmKBXhqlJrLgwyke3hkisfiXJ/9s2ofQecIkuWRHrR55OyB84SGtCB4TjQddRmPP66b57SmpMDssckelG/EyvusuOvK2A5CQpJihyw6iFYdaOY9YcKJIywA== X-OriginatorOrg: mail.schwarz X-MS-Exchange-CrossTenant-Network-Message-Id: 4dc32a1c-7345-4aa4-6427-08db91d54a28 X-MS-Exchange-CrossTenant-AuthSource: AS4PR10MB5221.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2023 14:49:06.4596 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d04f4717-5a6e-4b98-b3f9-6918e0385f4c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jassJfcyP5+E2MU1LRucR8aw9S3qSfZQV+PBJ3MMroPFvIySee985iLbgU8UleXHQnGGGo+WCLym+SVf0ybgfreD3T+VqSk9s9/CeVyKFZw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR10MB5147 Subject: [ovs-dev] [PATCH ovn 1/2] ovn-ic fix multiple routers in an az 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: , X-Patchwork-Original-From: Maxim Korezkij via dev From: maximkorezkij Reply-To: Maxim Korezkij Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" previously if multiple routers in the same az are connected to the same transit switch then ovn-ic would only propagate the routes of one of these routers to the ic-sb. This commit fixes this behaviour and allows multiple routers in a single az to use route advertisements. Co-authored-by: Maxim Korezkij Signed-off-by: Maxim Korezkij Signed-off-by: Felix Huettner --- ic/ovn-ic.c | 27 ++++++++++++---- tests/ovn-ic.at | 86 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 7 deletions(-) -- 2.34.1 Diese E Mail enthält möglicherweise vertrauliche Inhalte und ist nur für die Verwertung durch den vorgesehenen Empfänger bestimmt. Sollten Sie nicht der vorgesehene Empfänger sein, setzen Sie den Absender bitte unverzüglich in Kenntnis und löschen diese E Mail. Hinweise zum Datenschutz finden Sie hier. This e-mail may contain confidential content and is intended only for the specified recipient/s. If you are not the intended recipient, please inform the sender immediately and delete this e-mail. Information on data protection can be found here. diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index 6f31037ec..708af5c4f 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -1583,8 +1583,8 @@ build_ts_routes_to_adv(struct ic_context *ctx, static void advertise_lr_routes(struct ic_context *ctx, - const struct icsbrec_availability_zone *az, - struct ic_router_info *ic_lr) + struct ic_router_info *ic_lr, + struct shash *routes_ad_by_ts) { const struct nbrec_nb_global *nb_global = nbrec_nb_global_first(ctx->ovnnb_idl); @@ -1595,7 +1595,7 @@ advertise_lr_routes(struct ic_context *ctx, struct lport_addresses ts_port_addrs; const struct icnbrec_transit_switch *key; - struct hmap routes_ad = HMAP_INITIALIZER(&routes_ad); + struct hmap *routes_ad; for (int i = 0; i < ic_lr->n_isb_pbs; i++) { isb_pb = ic_lr->isb_pbs[i]; key = icnbrec_transit_switch_index_init_row( @@ -1604,6 +1604,12 @@ advertise_lr_routes(struct ic_context *ctx, ts_name = icnbrec_transit_switch_index_find( ctx->icnbrec_transit_switch_by_name, key)->name; icnbrec_transit_switch_index_destroy_row(key); + routes_ad = shash_find_data(routes_ad_by_ts, ts_name); + if (!routes_ad) { + routes_ad = xzalloc(sizeof *routes_ad); + hmap_init(routes_ad); + shash_add(routes_ad_by_ts, ts_name, routes_ad); + } if (!extract_lsp_addresses(isb_pb->address, &ts_port_addrs)) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1); @@ -1615,12 +1621,10 @@ advertise_lr_routes(struct ic_context *ctx, } lrp_name = get_lrp_name_by_ts_port_name(ctx, isb_pb->logical_port); route_table = get_route_table_by_lrp_name(ctx, lrp_name); - build_ts_routes_to_adv(ctx, ic_lr, &routes_ad, &ts_port_addrs, + build_ts_routes_to_adv(ctx, ic_lr, routes_ad, &ts_port_addrs, nb_global, route_table); - advertise_routes(ctx, az, ts_name, &routes_ad); destroy_lport_addresses(&ts_port_addrs); } - hmap_destroy(&routes_ad); } static void @@ -1721,14 +1725,23 @@ route_run(struct ic_context *ctx, icsbrec_port_binding_index_destroy_row(isb_pb_key); struct ic_router_info *ic_lr; + struct shash routes_ad_by_ts = SHASH_INITIALIZER(&routes_ad_by_ts); + // HMAP_INITIALIZER(&routes_ad_by_ts); HMAP_FOR_EACH_SAFE (ic_lr, node, &ic_lrs) { - advertise_lr_routes(ctx, az, ic_lr); + advertise_lr_routes(ctx, ic_lr, &routes_ad_by_ts); sync_learned_routes(ctx, az, ic_lr); free(ic_lr->isb_pbs); hmap_destroy(&ic_lr->routes_learned); hmap_remove(&ic_lrs, &ic_lr->node); free(ic_lr); } + struct shash_node *node; + SHASH_FOR_EACH_SAFE (node, &routes_ad_by_ts) { + advertise_routes(ctx, az, node->name, node->data); + hmap_destroy(node->data); + shash_delete(&routes_ad_by_ts, node); + } + shash_destroy(&routes_ad_by_ts); hmap_destroy(&ic_lrs); } diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at index ceee45092..4b470d5c8 100644 --- a/tests/ovn-ic.at +++ b/tests/ovn-ic.at @@ -1159,3 +1159,89 @@ AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr12 | grep dst-ip | sort], [0], [d AT_CLEANUP ]) + +OVN_FOR_EACH_NORTHD([ +AT_SETUP([ovn-ic -- route sync -- multiple logical routers]) + +ovn_init_ic_db +ovn-ic-nbctl ts-add ts1 + +for i in 1 2; do + ovn_start az$i + ovn_as az$i + + # Enable route learning at AZ level + ovn-nbctl set nb_global . options:ic-route-learn=true + # Enable route advertising at AZ level + ovn-nbctl set nb_global . options:ic-route-adv=true +done + +# Create new transit switches and LRs. Test topology is next: +# +# logical router (lr11) - transit switch (ts1) - logical router (lr21) +# \- logical router (lr22) +# +# each LR has one connected subnet except TS port + + +# create lr11, lr21, lr22, ts1 and connect them +ovn-ic-nbctl ts-add ts1 + +ovn_as az1 + +lr=lr11 +ovn-nbctl lr-add $lr + +lrp=lrp-$lr-ts1 +lsp=lsp-ts1-$lr +# Create LRP and connect to TS +ovn-nbctl lrp-add $lr $lrp aa:aa:aa:aa:a1:01 169.254.10.11/24 +ovn-nbctl lsp-add ts1 $lsp \ + -- lsp-set-addresses $lsp router \ + -- lsp-set-type $lsp router \ + -- lsp-set-options $lsp router-port=$lrp + +ovn_as az2 +for i in 1 2; do + lr=lr2$i + ovn-nbctl lr-add $lr + + lrp=lrp-$lr-ts1 + lsp=lsp-ts1-$lr + # Create LRP and connect to TS + ovn-nbctl lrp-add $lr $lrp aa:aa:aa:aa:a2:0$i 169.254.10.2$i/24 + ovn-nbctl lsp-add ts1 $lsp \ + -- lsp-set-addresses $lsp router \ + -- lsp-set-type $lsp router \ + -- lsp-set-options $lsp router-port=$lrp +done + + +# Create directly-connected routes +ovn_as az1 ovn-nbctl lrp-add lr11 lrp-lr11 aa:aa:aa:aa:bb:01 "192.168.0.1/24" +ovn_as az2 ovn-nbctl lrp-add lr21 lrp-lr21 aa:aa:aa:aa:bc:01 "192.168.1.1/24" +ovn_as az2 ovn-nbctl lrp-add lr22 lrp-lr22 aa:aa:aa:aa:bc:02 "192.168.2.1/24" + +# Test direct routes from lr21 and lr22 were learned to lr11 +AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 | + grep learned | awk '{print $1, $2}' | sort ], [0], [dnl +192.168.1.0/24 169.254.10.21 +192.168.2.0/24 169.254.10.22 +]) + +# Test direct routes from lr11 and lr22 were learned to lr21 +AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr21 | grep 192.168 | + grep learned | awk '{print $1, $2}' | sort ], [0], [dnl +192.168.0.0/24 169.254.10.11 +]) + +# Test direct routes from lr11 and lr21 were learned to lr22 +AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr22 | grep 192.168 | + grep learned | awk '{print $1, $2}' | sort ], [0], [dnl +192.168.0.0/24 169.254.10.11 +]) + +OVN_CLEANUP_IC([az1], [az2]) + +AT_CLEANUP +]) \ No newline at end of file From patchwork Mon Jul 31 14:50:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: maximkorezkij X-Patchwork-Id: 1815059 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=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=nsg02oHl; dkim-atps=neutral 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 4RF1Pp0vC1z1yfG for ; Tue, 1 Aug 2023 00:50:38 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 0267660E8E; Mon, 31 Jul 2023 14:50:36 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 0267660E8E Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=nsg02oHl 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 5_XclUoyILod; Mon, 31 Jul 2023 14:50:34 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id D04206106F; Mon, 31 Jul 2023 14:50:33 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org D04206106F Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A93F9C0072; Mon, 31 Jul 2023 14:50:33 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1B512C0032 for ; Mon, 31 Jul 2023 14:50:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id DC61081DF2 for ; Mon, 31 Jul 2023 14:50:31 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org DC61081DF2 Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=nsg02oHl 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 19-FuHlG_yoR for ; Mon, 31 Jul 2023 14:50:30 +0000 (UTC) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0723.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1f::723]) by smtp1.osuosl.org (Postfix) with ESMTPS id 4BE3881DED for ; Mon, 31 Jul 2023 14:50:30 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 4BE3881DED ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lGz9rhURjLwu83mOa9hbi0AQG6BeXeFFs0H/ogZCI9CpRYICLxZHn//vpGVRd8t5lUyUxmHk4PKGuUfM/al6/KVpyJWhklLTfsI+yGqvWV7K+UbIacT1tTEblD3yBhNfZOX6ctFbKUuVWrVsljiu8EP2LQIxn4qiQQ5LnpuWRQr0ukHMB10fQdbKWjnxpFC7FvCfdxS1Ga4Oedwji4Q8euBhtzLwYqOxAtJbGr8olNfqGCzcY58LZ0LwmX1XlEjOoHia8r40rYwip9v68qWNLLpD6E+0Le0YeQ4MthTjSNUzFf7G7aFPcAK7meTJqp1SF6EWiu3UY7loocEIJhv2OA== 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=61JkkvE7QVilFkcaRTQCbNyLcBBufg+a33DwJh2Eq8M=; b=RdVQmklTqCbcS9O7ZfMH40Urpzuz/g6+lMtHg5PCA/Gu5PDrUqeMMEwiVn0muZP3va08Gh8DLWFqmIohK2iD+gnxUZytYaeBfXoi/FX6xCK030MkalWIiNsA7sVLdUYxVlvy/1S14TsthoIfABmiwV3oeXT3c8wXL/K+X8ez2e8Jd8cFZgUVWxxy9IWA5xG0ry+ta/GMlbFWCtH+pAZXHsHiNwY7vnJy2gHJh4Ps0pKYfMMqZ4Sn06igpflg3P13QL8eXErv4WlMWlj/96x7DglrPkF/cJLWnNKqfUjfr/MONxZjZ4FQcIe9AbO69L1ube6yK3/feEYn3F0LKPUhoQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mail.schwarz; dmarc=pass action=none header.from=mail.schwarz; dkim=pass header.d=mail.schwarz; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.schwarz; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=61JkkvE7QVilFkcaRTQCbNyLcBBufg+a33DwJh2Eq8M=; b=nsg02oHlSSByJluaLQM+M+91q1UJU0pQrmWldJdQSIuE68OHHh4ujtpQUQMcHiqbyAtgBu86NmlNOHFvzc5prKnWRZf7pfncGshwT3vE3XagUzgIo4dzT01P0JlzwebYwjOnPK5brEt+oJBbbmqQMkHZj+wYb3m8rDLYz7wcPlFzY838bz36eksXImyIbHGpRe3UCRwwIhKHXpjWI1s4xPJVn49r+4SY+Kg8H8Bnw74KNmiKyjsCnDh6ruakClo2FXq8bdgPpmDQ4I0zFH6I/EYxfcaTHA7sZOFsbK4W0KuYpxJx/YHNXHIk1vuAs0XajvBWNs1anOqYCi16u2zUaA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=mail.schwarz; Received: from AS4PR10MB5221.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:4b1::6) by GV2PR10MB6138.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:150:ae::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.42; Mon, 31 Jul 2023 14:50:27 +0000 Received: from AS4PR10MB5221.EURPRD10.PROD.OUTLOOK.COM ([fe80::350f:1888:635c:267f]) by AS4PR10MB5221.EURPRD10.PROD.OUTLOOK.COM ([fe80::350f:1888:635c:267f%4]) with mapi id 15.20.6631.042; Mon, 31 Jul 2023 14:50:27 +0000 Date: Mon, 31 Jul 2023 16:50:25 +0200 To: dev@openvswitch.org Message-ID: Content-Disposition: inline X-ClientProxiedBy: FR2P281CA0080.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9a::13) To AS4PR10MB5221.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:4b1::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS4PR10MB5221:EE_|GV2PR10MB6138:EE_ X-MS-Office365-Filtering-Correlation-Id: 878a845a-d952-4668-fc78-08db91d57a49 x-mp-schwarz-dsgvo2: 1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x1+FAByE8e6YHTBXdP+ytKvK5Byh+sT3DA9cFNlP9l+OgQ4R5wNFWTDIRBWT3aJ8fN7bDKLAMT6tZru/q3Xg+mJKoFhgcEPMQN9xb0EJrpnCC2sGiCEsDVJas2u2huSHe6vcY0wbRibq4aNm+79f4UO76ewZAiQAB0fi9qyybpYRnPfLTrCrxD30irK/ljMgze0Z/Gx7IcfmopkBYFMJbsCQ5UlvqhKK7Up7v8WsSkOeI6CZ7xWyfeSzSe+kFJae0AhpiuRWhtQstNosWS7itNkjY2FQHJiorN6bGrsWdoKm6AVbAuwjVL6w0YDFPnlO577P61oy5wxX7ml5Z3t1ewas6sK1GSA1TPuyw5YKXXzb46WGW7wefMUV3G4osnvK26cMtv8nrBwLTg78YA+3lJnztG38jwXoC8KQL1GpAJQxKoPOWkQwCbykPqeM6jjT8KVk8pS+IqaArDHhTBc4psYxhFx/urrHijQ6DbPoJw3so5pLY6NWUNWmMciYS+XEHEDNGYK08uBRzLtxCElMsbQcgLzciAg7/8ysoyVR9T5waRpAPm4+qLDfC6GoIKN5 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS4PR10MB5221.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230028)(4636009)(396003)(39860400002)(346002)(366004)(136003)(376002)(451199021)(38100700002)(82960400001)(86362001)(6512007)(9686003)(478600001)(6486002)(107886003)(186003)(26005)(8676002)(8936002)(6506007)(44832011)(5660300002)(4326008)(2906002)(66476007)(66946007)(66556008)(6916009)(41300700001)(316002)(66574015)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jXTSxlv1X5vGSLB8x5Fns8b3H2mKK7wSWgJSuZBbjiio/Ueor5PvKQpONBeIwg9BMp6x+ev8HkgGCyjsbwjq3vcAdx2n0xtIythmaPu0NXco2PnNnNily7Q0eLAK29XuVr+1zK0Rn4qkQ7ipDrgAnD7ZSqO8HIfGrwlM4RBJTFcnFSDKa+nxitBXJiu9WNc2k7cQDlYIP8hdtwLD2DYJyNm/YgzmoW8HESy6EoQWh4LRLA24c5seFiPq9O3rOonja4ICtdpRn5YjlIbLiF2k9gZccarFpXlAqO2AysmzSh45PIYtBfJO50mpEf2eSBitiAqK+0DaEn/uKetyeroWhPFohLj5ai7yBvnaVPEc0ii2c3KNphMUb3BhBrj56jJCmYF4FCC6kdO5hTNxkcvBctapgTAHXxSZxeR4vfI5n138hskWRhySMMqYRMaSW0zp+On+aF3grlJ+EiA1idWQKyL/tXikWU4NyN6qZyxT4DJ3VlXXxKOli1n/OznyRb4JMkJp1m2MGXIqw+MdVx9aHUW0ZTP4DHGM9EoQfA6rvld4LN6SJJZBQAvnD8mMeE4cpGQMNowYD0DTAd+cyocC5j/XFmdBhRE0GpWrWJvXS91elG+GxIQyL4Q4VdoSOH0D/1TV32MH0T2qwOAnH+GifXkNIwC5/TJmYLDFd8slTT+s6f4HHeIySPkqI+lKy7CM3rqulGHiZltv9tak91aFlVmfnV01N8Xt/faW74rO7KxZOu8kraAL/JqAXQMnjau+nW1+l6Ha1zMZnSp8rzJ3Faax1BXe0WOCMJvS+MUrVzdgYa2xcOlHa1HWCP5QkMdVzmWLtzZODxjtMbbn8LXrq/Uu+TcQNAtDiHAiFAYrsnFDnLByAYAzQw7m81PcdpmGi5iXGYSbYodt7+ysePDyc4NmT86pUX52bKGzLj2OLvwwoQjh8rS511mwQUanHjafh1+ruA88GTpSKuE5t+3UkWKX5qcLq3xvgtEcRfvF9ClcleQR8kWLrM1Ks3mnI303cqrXOQKXXBYZTw5ksCU3iscvd9icRWJ/XDsD1s8ZCwO0p4PzJEsDEtFbcsoL9sYj+7VynRvniwAi6jjLNY1lGm7Dv4Vlrjfrd4ttI0r4Cn01g4YW532iCEEc/NAut2JtdkJ+WXDRY7E0mLScNVJb5x3baOXzYc5yuPCDQFjwR5C03f/C36oftTMAIUBmRyT3rgFHDpGLXqoIY4v81jAEnTu0Qf7LReQVlceFrLSUy0zhwxTTzfN7weOWeV3+i+XAcznitLMEPxh9au3saArZ7WeXJLKkGmAPrH1znl9kP776CcD+kfg9jDhtzAA0ADeHlXMrH4uEt+cgqiKnbi7blK9mghg2dMBaJEvcb1STNeBXYG61aDIS8i4A0d5FSFlAqoC+CvrDuvwlCJqQr/utM4W5dR7segPZz9ON92Ni1kKCcOlcGAGL2bp2VTWtcoLvcbPfL4cb6XekhoSBj4GNSEF65apxaVBPlWZKVXYivAbioYebYQooBiaHKlMUE/KpTGe23rRqI7hKltJi4v9iLwvyp536tRmo26a4IDu0+AXwR7qYKddqZNqOBI5Vm41hFDZZwTsUUw6V4+a5a7qAtA== X-OriginatorOrg: mail.schwarz X-MS-Exchange-CrossTenant-Network-Message-Id: 878a845a-d952-4668-fc78-08db91d57a49 X-MS-Exchange-CrossTenant-AuthSource: AS4PR10MB5221.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2023 14:50:26.9990 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d04f4717-5a6e-4b98-b3f9-6918e0385f4c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8h4N8dNyy3BtWuEC7P8f62r6368PSiYkfOWcYZ3ZNcZXDFWPQqiQFZ8X7lddndnCIBHthIPdJE1lcwGGpPpzt/YZg2DIsT1e+IX5rP8kaj8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR10MB6138 Subject: [ovs-dev] [PATCH ovn 2/2] ovn-ic: support learning routes in same AZ 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: , X-Patchwork-Original-From: Maxim Korezkij via dev From: maximkorezkij Reply-To: Maxim Korezkij Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" when connecting multiple logical routers to a transit switch per az then previously the routers in the same az would not learn each others routes while the routers in the others az would learn all of them. As this is confusing and would require each user to have additional logical that configures static routing within each az. Co-Authored-By: Maxim Korezkij Signed-off-by: Maxim Korezkij Signed-off-by: Felix Huettner --- ic/ovn-ic.c | 53 +++++++++++++++++++++++++++++++++++-------------- tests/ovn-ic.at | 2 ++ 2 files changed, 40 insertions(+), 15 deletions(-) -- 2.34.1 Diese E Mail enthält möglicherweise vertrauliche Inhalte und ist nur für die Verwertung durch den vorgesehenen Empfänger bestimmt. Sollten Sie nicht der vorgesehene Empfänger sein, setzen Sie den Absender bitte unverzüglich in Kenntnis und löschen diese E Mail. Hinweise zum Datenschutz finden Sie hier. This e-mail may contain confidential content and is intended only for the specified recipient/s. If you are not the intended recipient, please inform the sender immediately and delete this e-mail. Information on data protection can be found here. diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index 708af5c4f..cea14d008 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -861,6 +861,8 @@ struct ic_route_info { const char *origin; const char *route_table; + const struct nbrec_logical_router *nb_lr; + /* Either nb_route or nb_lrp is set and the other one must be NULL. * - For a route that is learned from IC-SB, or a static route that is * generated from a route that is configured in NB, the "nb_route" @@ -937,7 +939,8 @@ parse_route(const char *s_prefix, const char *s_nexthop, /* Return false if can't be added due to bad format. */ static bool add_to_routes_learned(struct hmap *routes_learned, - const struct nbrec_logical_router_static_route *nb_route) + const struct nbrec_logical_router_static_route *nb_route, + const struct nbrec_logical_router *nb_lr) { struct in6_addr prefix, nexthop; unsigned int plen; @@ -959,6 +962,7 @@ add_to_routes_learned(struct hmap *routes_learned, ic_route->nb_route = nb_route; ic_route->origin = origin; ic_route->route_table = nb_route->route_table; + ic_route->nb_lr = nb_lr; hmap_insert(routes_learned, &ic_route->node, ic_route_hash(&prefix, plen, &nexthop, origin, nb_route->route_table)); @@ -1099,7 +1103,8 @@ add_to_routes_ad(struct hmap *routes_ad, const struct in6_addr prefix, unsigned int plen, const struct in6_addr nexthop, const char *origin, const char *route_table, const struct nbrec_logical_router_port *nb_lrp, - const struct nbrec_logical_router_static_route *nb_route) + const struct nbrec_logical_router_static_route *nb_route, + const struct nbrec_logical_router *nb_lr) { if (route_table == NULL) { route_table = ""; @@ -1117,6 +1122,7 @@ add_to_routes_ad(struct hmap *routes_ad, const struct in6_addr prefix, ic_route->origin = origin; ic_route->route_table = route_table; ic_route->nb_lrp = nb_lrp; + ic_route->nb_lr = nb_lr; hmap_insert(routes_ad, &ic_route->node, hash); } else { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1); @@ -1130,6 +1136,7 @@ static void add_static_to_routes_ad( struct hmap *routes_ad, const struct nbrec_logical_router_static_route *nb_route, + const struct nbrec_logical_router *nb_lr, const struct lport_addresses *nexthop_addresses, const struct smap *nb_options) { @@ -1172,14 +1179,15 @@ add_static_to_routes_ad( } add_to_routes_ad(routes_ad, prefix, plen, nexthop, ROUTE_ORIGIN_STATIC, - nb_route->route_table, NULL, nb_route); + nb_route->route_table, NULL, nb_route, nb_lr); } static void add_network_to_routes_ad(struct hmap *routes_ad, const char *network, const struct nbrec_logical_router_port *nb_lrp, const struct lport_addresses *nexthop_addresses, - const struct smap *nb_options) + const struct smap *nb_options, + const struct nbrec_logical_router *nb_lr) { struct in6_addr prefix, nexthop; unsigned int plen; @@ -1218,7 +1226,7 @@ add_network_to_routes_ad(struct hmap *routes_ad, const char *network, /* directly-connected routes go to
route table */ add_to_routes_ad(routes_ad, prefix, plen, nexthop, ROUTE_ORIGIN_CONNECTED, - NULL, nb_lrp, NULL); + NULL, nb_lrp, NULL, nb_lr); } static bool @@ -1322,7 +1330,6 @@ lrp_is_ts_port(struct ic_context *ctx, struct ic_router_info *ic_lr, static void sync_learned_routes(struct ic_context *ctx, - const struct icsbrec_availability_zone *az, struct ic_router_info *ic_lr) { ovs_assert(ctx->ovnnb_txn); @@ -1345,7 +1352,15 @@ sync_learned_routes(struct ic_context *ctx, ICSBREC_ROUTE_FOR_EACH_EQUAL (isb_route, isb_route_key, ctx->icsbrec_route_by_ts) { - if (isb_route->availability_zone == az) { + const char *lr_id = smap_get(&isb_route->external_ids, "lr-id"); + if (lr_id == NULL) { + continue; + } + struct uuid lr_uuid; + if (!uuid_from_string(&lr_uuid, lr_id)) { + continue; + } + if (uuid_equals(&ic_lr->lr->header_.uuid, &lr_uuid)) { continue; } @@ -1435,16 +1450,24 @@ static void ad_route_sync_external_ids(const struct ic_route_info *route_adv, const struct icsbrec_route *isb_route) { - struct uuid isb_ext_id, nb_id; + struct uuid isb_ext_id, nb_id, isb_ext_lr_id, lr_id; smap_get_uuid(&isb_route->external_ids, "nb-id", &isb_ext_id); + smap_get_uuid(&isb_route->external_ids, "lr-id", &isb_ext_lr_id); nb_id = route_adv->nb_route ? route_adv->nb_route->header_.uuid : route_adv->nb_lrp->header_.uuid; + lr_id = route_adv->nb_lr->header_.uuid; if (!uuid_equals(&isb_ext_id, &nb_id)) { char *uuid_s = xasprintf(UUID_FMT, UUID_ARGS(&nb_id)); icsbrec_route_update_external_ids_setkey(isb_route, "nb-id", uuid_s); free(uuid_s); } + if (!uuid_equals(&isb_ext_lr_id, &lr_id)) { + char *uuid_s = xasprintf(UUID_FMT, UUID_ARGS(&lr_id)); + icsbrec_route_update_external_ids_setkey(isb_route, "lr-id", + uuid_s); + free(uuid_s); + } } /* Sync routes from routes_ad to IC-SB. */ @@ -1549,7 +1572,7 @@ build_ts_routes_to_adv(struct ic_context *ctx, if (smap_get_uuid(&nb_route->external_ids, "ic-learned-route", &isb_uuid)) { /* It is a learned route */ - if (!add_to_routes_learned(&ic_lr->routes_learned, nb_route)) { + if (!add_to_routes_learned(&ic_lr->routes_learned, nb_route, lr)) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1); VLOG_WARN_RL(&rl, "Bad format of learned route in NB: " "%s -> %s. Delete it.", nb_route->ip_prefix, @@ -1559,7 +1582,7 @@ build_ts_routes_to_adv(struct ic_context *ctx, } } else if (!strcmp(ts_route_table, nb_route->route_table)) { /* It may be a route to be advertised */ - add_static_to_routes_ad(routes_ad, nb_route, ts_port_addrs, + add_static_to_routes_ad(routes_ad, nb_route, lr, ts_port_addrs, &nb_global->options); } } @@ -1571,7 +1594,8 @@ build_ts_routes_to_adv(struct ic_context *ctx, for (int j = 0; j < lrp->n_networks; j++) { add_network_to_routes_ad(routes_ad, lrp->networks[j], lrp, ts_port_addrs, - &nb_global->options); + &nb_global->options, + lr); } } else { /* The router port of the TS port is ignored. */ @@ -1582,7 +1606,7 @@ build_ts_routes_to_adv(struct ic_context *ctx, } static void -advertise_lr_routes(struct ic_context *ctx, +collect_lr_routes(struct ic_context *ctx, struct ic_router_info *ic_lr, struct shash *routes_ad_by_ts) { @@ -1726,10 +1750,9 @@ route_run(struct ic_context *ctx, struct ic_router_info *ic_lr; struct shash routes_ad_by_ts = SHASH_INITIALIZER(&routes_ad_by_ts); - // HMAP_INITIALIZER(&routes_ad_by_ts); HMAP_FOR_EACH_SAFE (ic_lr, node, &ic_lrs) { - advertise_lr_routes(ctx, ic_lr, &routes_ad_by_ts); - sync_learned_routes(ctx, az, ic_lr); + collect_lr_routes(ctx, ic_lr, &routes_ad_by_ts); + sync_learned_routes(ctx, ic_lr); free(ic_lr->isb_pbs); hmap_destroy(&ic_lr->routes_learned); hmap_remove(&ic_lrs, &ic_lr->node); diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at index 4b470d5c8..a49d47041 100644 --- a/tests/ovn-ic.at +++ b/tests/ovn-ic.at @@ -1233,12 +1233,14 @@ AT_CHECK([ovn_as az1 ovn-nbctl lr-route-list lr11 | grep 192.168 | AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr21 | grep 192.168 | grep learned | awk '{print $1, $2}' | sort ], [0], [dnl 192.168.0.0/24 169.254.10.11 +192.168.2.0/24 169.254.10.22 ]) # Test direct routes from lr11 and lr21 were learned to lr22 AT_CHECK([ovn_as az2 ovn-nbctl lr-route-list lr22 | grep 192.168 | grep learned | awk '{print $1, $2}' | sort ], [0], [dnl 192.168.0.0/24 169.254.10.11 +192.168.1.0/24 169.254.10.21 ]) OVN_CLEANUP_IC([az1], [az2])