[PATCH proxmox-perl-rs v5 22/46] sdn: add prefix list / route maps to frr config generation helper

Stefan Hanreich
2026-05-05T15:41:16Z

With the addition of prefix lists and route maps, the helper needs to
be adapted so the FRR configuration for prefix lists and route maps
gets generated as well. Prefix lists and route maps are generated
before generating the fabric configuration, so it is possible for the
fabric config generation logic to check for the existence of prefix
lists and route maps.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
pve-rs/src/bindings/sdn/mod.rs | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/pve-rs/src/bindings/sdn/mod.rs b/pve-rs/src/bindings/sdn/mod.rs
index 9bddf1c..c6361c3 100644
--- a/pve-rs/src/bindings/sdn/mod.rs
+++ b/pve-rs/src/bindings/sdn/mod.rs
@@ -15,17 +15,39 @@ pub mod pve_rs_sdn {
use proxmox_ve_config::sdn::fabric::section_config::node::NodeId;

use crate::bindings::pve_rs_sdn_fabrics::PerlFabricConfig;
+ use crate::bindings::sdn::prefix_lists::pve_rs_sdn_prefix_lists::PerlPrefixListConfig;
+ use crate::bindings::sdn::route_maps::pve_rs_sdn_route_maps::PerlRouteMapConfig;

/// Return the FRR configuration for the passed FrrConfig and the FabricsConfig as an array of
/// strings, where each line represents a line in the FRR configuration.
#[export]
pub fn get_frr_raw_config(
mut frr_config: FrrConfig,
- #[try_from_ref] cfg: &PerlFabricConfig,
+ #[try_from_ref] prefix_list_config: &PerlPrefixListConfig,
+ #[try_from_ref] route_map_config: &PerlRouteMapConfig,
+ #[try_from_ref] fabric_config: &PerlFabricConfig,
node_id: NodeId,
) -> Result<Vec<String>, Error> {
- let fabric_config = cfg.fabric_config.lock().unwrap().clone().into_valid()?;
+ let prefix_list_config = prefix_list_config.prefix_lists.lock().unwrap();
+ proxmox_ve_config::sdn::prefix_list::frr::build_frr_prefix_lists(
+ prefix_list_config.values().cloned(),
+ &mut frr_config,
+ )?;
+
+ let route_map_config = route_map_config.route_maps.lock().unwrap();
+ proxmox_ve_config::sdn::route_map::frr::build_frr_route_maps(
+ route_map_config.values().cloned(),
+ &mut frr_config,
+ )?;
+
+ let fabric_config = fabric_config
+ .fabric_config
+ .lock()
+ .unwrap()
+ .clone()
+ .into_valid()?;
proxmox_ve_config::sdn::fabric::frr::build_fabric(node_id, fabric_config, &mut frr_config)?;
+
to_raw_config(&frr_config)
}
}
--
2.47.3