From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 0057C1FF0AF for ; Fri, 20 Nov 2026 16:23:01 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 7C88221793; Fri, 20 Nov 2026 16:23:00 +0100 (CET) From: Gabriel Goller To: pve-devel@lists.proxmox.com Subject: [PATCH proxmox-perl-rs 1/3] pve-rs: fabrics: list nodes of all fabrics Date: Fri, 20 Nov 2026 16:22:44 +0100 Message-ID: <20261120152251.265831-2-g.goller@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261120152251.265831-1-g.goller@proxmox.com> References: <20261120152251.265831-1-g.goller@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795188176233 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.069 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: PXRLBT6ZVPT4AAZ63SYZVCBGB6BBBOG6 X-Message-ID-Hash: PXRLBT6ZVPT4AAZ63SYZVCBGB6BBBOG6 X-MailFrom: g.goller@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The nodes of a host that is part of multiple fabrics overwrote each other, so GET /cluster/sdn/fabrics/node only returned the node of the fabric that sorts last for each host. Among others, the node edit window lost the WireGuard interfaces offered for OSPF and BGP fabrics. Fixes: 1c5f6859ad36 ("pve-rs: sdn: fabrics: add api methods") Signed-off-by: Gabriel Goller --- pve-rs/src/bindings/sdn/fabrics.rs | 41 ++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/pve-rs/src/bindings/sdn/fabrics.rs b/pve-rs/src/bindings/sdn/fabrics.rs index 98c132dd7f28..caa637ac3047 100644 --- a/pve-rs/src/bindings/sdn/fabrics.rs +++ b/pve-rs/src/bindings/sdn/fabrics.rs @@ -232,7 +232,7 @@ pub mod pve_rs_sdn_fabrics { .flat_map(|entry| { entry .nodes() - .map(|(id, node)| (id.to_string(), node.clone().into())) + .map(|(_node_id, node)| (node.id().to_string(), node.clone().into())) }) .collect()) } @@ -1221,7 +1221,11 @@ pub mod pve_rs_sdn_fabrics { #[cfg(test)] mod tests { - use super::parse_routes; + use std::sync::Mutex; + + use proxmox_ve_config::sdn::fabric::FabricConfig; + + use super::{PerlFabricConfig, parse_routes}; #[test] fn parses_batched_routes_with_duplicate_prefixes() { @@ -1238,6 +1242,39 @@ pub mod pve_rs_sdn_fabrics { assert_eq!(routes[1].vrf_name, "vrf_b"); } + #[test] + fn list_nodes_returns_host_of_every_fabric() { + let raw = " +wireguard_fabric: test + +wireguard_node: test_node1 +\tinterfaces name=wg0,listen_port=51820,public_key=rsS0GeYRbguBG1DAzc+xxQqPDvouxlKtc+c1PPEM92I= +\trole internal + +ospf_fabric: underlay +\tarea 0 +\tip_prefix 10.0.0.0/24 + +ospf_node: underlay_node1 +\tinterfaces name=nic1 +\tip 10.0.0.1 +"; + let config = PerlFabricConfig { + fabric_config: Mutex::new( + FabricConfig::parse_section_config(raw) + .expect("config should parse") + .into_inner(), + ), + }; + + let nodes = super::list_nodes(&config).expect("nodes should be listed"); + + assert_eq!( + nodes.keys().collect::>(), + ["test_node1", "underlay_node1"], + ); + } + #[test] fn parses_empty_output() { let routes = parse_routes(b"", "BGP").expect("empty output should parse"); -- 2.47.3