From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: Re: [PATCH proxmox-ve-rs 03/15] sdn: generate fabric routing configuration in zone VRFs
Date: Wed, 21 Oct 2026 18:14:05 +0200 [thread overview]
Message-ID: <f0e3bf07-101e-4d23-bbee-7f453bbe9e5d@proxmox.com> (raw)
In-Reply-To: <20260821140404.322081-4-g.goller@proxmox.com>
On 8/21/26 4:03 PM, Gabriel Goller wrote:
> Map a fabric zone to the corresponding vrf_<zone> FRR instance. Generate
> OSPF routers and interfaces in that VRF, and store BGP routers under the
> same VRF name. Keep fabrics without a zone in the default routing table.
>
> Collect OSPF redistribution rules on the router for the selected VRF so
> that several fabrics in one VRF contribute to the same OSPF instance.
> This keeps protocol configuration and interface configuration in the
> routing table selected by the zone.
>
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
> proxmox-ve-config/src/sdn/fabric/frr.rs | 82 ++++++++++++++++++-------
> 1 file changed, 61 insertions(+), 21 deletions(-)
>
> diff --git a/proxmox-ve-config/src/sdn/fabric/frr.rs b/proxmox-ve-config/src/sdn/fabric/frr.rs
> index 9203dcd16dae..ca0fbfe6d542 100644
> --- a/proxmox-ve-config/src/sdn/fabric/frr.rs
> +++ b/proxmox-ve-config/src/sdn/fabric/frr.rs
> @@ -24,10 +24,13 @@ use crate::sdn::fabric::section_config::protocol::{
> openfabric::{OpenfabricInterfaceProperties, OpenfabricProperties},
> ospf::OspfInterfaceProperties,
> };
> -use crate::sdn::fabric::section_config::{fabric::FabricId, node::NodeId};
> +use crate::sdn::fabric::section_config::{
> + fabric::{FabricId, ZoneId},
> + node::NodeId,
> +};
> use crate::sdn::fabric::{FabricConfig, FabricEntry};
>
> -/// Constructs the FRR config from the the passed [`Valid<FabricConfig>`].
> +/// Constructs the FRR config from the passed [`Valid<FabricConfig>`].
> ///
> /// Iterates over the [`FabricConfig`] and constructs all the FRR routers, interfaces, route-maps,
> /// etc.
> @@ -207,27 +210,50 @@ pub fn build_fabric(
> .get_or_insert(node.ip().expect("node must have an ipv4 address"));
>
> let fabric = ospf_entry.fabric_section();
> + let vrf_name = fabric_vrf_name(fabric.properties().zone());
>
> let frr_word_area = ser::FrrWord::new(fabric.properties().area.to_string())?;
> let frr_area = ser::ospf::Area::new(frr_word_area)?;
>
> - if frr_config.ospf.router.is_none() {
> - let mut ospf_router = build_ospf_router(*router_id)?;
> -
> - ospf_router.redistribute = fabric
> - .properties()
> - .redistributions()
> - .into_iter()
> - .cloned()
> - .map(OspfRedistribution::from)
> - .collect();
> + let redistributions = fabric
> + .properties()
> + .redistributions()
> + .into_iter()
> + .cloned()
> + .map(OspfRedistribution::from);
> +
> + let ospf_router = if vrf_name == VrfName::Default {
> + if frr_config.ospf.router.is_none() {
> + frr_config.ospf.router = Some(build_ospf_router(*router_id)?);
> + }
> + frr_config
> + .ospf
> + .router
> + .as_mut()
> + .expect("router was inserted")
> + } else {
> + if !frr_config.ospf.vrf_router.contains_key(&vrf_name) {
> + frr_config
> + .ospf
> + .vrf_router
> + .insert(vrf_name.clone(), build_ospf_router(*router_id)?);
> + }
> + frr_config
> + .ospf
> + .vrf_router
> + .get_mut(&vrf_name)
> + .expect("router was inserted")
could be something like this?
vrf_router.entry(vrf_name).or_insert_with(|| vrf_router)
> + };
> + ospf_router.redistribute.extend(redistributions);
>
> - frr_config.ospf.router = Some(ospf_router);
> - }
> + let interface_vrf = match &vrf_name {
> + VrfName::Default => None,
> + custom => Some(custom.clone()),
> + };
>
> // Add dummy interface
> let (interface, interface_name) =
> - build_ospf_dummy_interface(fabric_id, frr_area.clone())?;
> + build_ospf_dummy_interface(fabric_id, frr_area.clone(), interface_vrf.clone())?;
>
> if frr_config
> .ospf
> @@ -242,7 +268,7 @@ pub fn build_fabric(
>
> for interface in node.properties().interfaces.iter() {
> let (interface, interface_name) =
> - build_ospf_interface(frr_area.clone(), interface)?;
> + build_ospf_interface(frr_area.clone(), interface, interface_vrf.clone())?;
>
> if frr_config
> .ospf
> @@ -309,6 +335,7 @@ pub fn build_fabric(
> };
>
> let fabric = bgp_entry.fabric_section();
> + let vrf_name = fabric_vrf_name(fabric.properties().zone());
>
> let local_asn = properties.asn().as_u32();
>
> @@ -323,7 +350,7 @@ pub fn build_fabric(
> let local_as = frr_config
> .bgp
> .vrf_router
> - .get(&VrfName::Default)
> + .get(&vrf_name)
> .filter(|existing| existing.asn != local_asn)
> .map(|_| LocalAsSettings {
> asn: local_asn,
> @@ -562,10 +589,10 @@ pub fn build_fabric(
> custom_frr_config: Default::default(),
> };
>
> - if let Some(existing) = frr_config.bgp.vrf_router.get_mut(&VrfName::Default) {
> + if let Some(existing) = frr_config.bgp.vrf_router.get_mut(&vrf_name) {
> existing.merge_fabric(router);
> } else {
> - frr_config.bgp.vrf_router.insert(VrfName::Default, router);
> + frr_config.bgp.vrf_router.insert(vrf_name, router);
> }
> }
> }
> @@ -595,6 +622,13 @@ pub fn build_fabric(
> Ok(())
> }
>
> +fn fabric_vrf_name(zone: Option<&ZoneId>) -> VrfName {
> + match zone {
> + Some(zone) => VrfName::Custom(format!("vrf_{zone}")),
> + None => VrfName::Default,
> + }
> +}
> +
> /// Helper that builds a OSPF router with a the router_id.
> fn build_ospf_router(router_id: Ipv4Addr) -> Result<OspfRouter, anyhow::Error> {
> Ok(OspfRouter::new(router_id))
> @@ -615,6 +649,7 @@ fn build_openfabric_router(
> fn build_ospf_interface(
> area: ser::ospf::Area,
> interface: &OspfInterfaceProperties,
> + vrf: Option<VrfName>,
> ) -> Result<(Interface<OspfInterface>, InterfaceName), anyhow::Error> {
> let frr_interface = ser::ospf::OspfInterface {
> area,
> @@ -633,13 +668,16 @@ fn build_ospf_interface(
> };
>
> let interface_name = interface.name.as_ref().try_into()?;
> - Ok((frr_interface.into(), interface_name))
> + let mut interface: Interface<OspfInterface> = frr_interface.into();
> + interface.vrf = vrf;
> + Ok((interface, interface_name))
> }
>
> /// Helper that builds the OSPF dummy interface using the [`FabricId`] and the [`ospf::Area`].
> fn build_ospf_dummy_interface(
> fabric_id: &FabricId,
> area: ospf::Area,
> + vrf: Option<VrfName>,
> ) -> Result<(Interface<OspfInterface>, InterfaceName), anyhow::Error> {
> let frr_interface = ser::ospf::OspfInterface {
> area,
> @@ -647,7 +685,9 @@ fn build_ospf_dummy_interface(
> network_type: None,
> };
> let interface_name = format!("dummy_{}", fabric_id).try_into()?;
> - Ok((frr_interface.into(), interface_name))
> + let mut interface: Interface<OspfInterface> = frr_interface.into();
> + interface.vrf = vrf;
> + Ok((interface, interface_name))
> }
>
> /// Helper that builds the OpenFabric interface.
next prev parent reply other threads:[~2026-10-21 16:14 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 14:03 [RFC manager/network/proxmox{-ve-rs,-perl-rs} 00/15] SDN VRF support Gabriel Goller
2026-08-21 14:03 ` [PATCH proxmox-ve-rs 01/15] frr: add VRF-aware OSPF rendering Gabriel Goller
2026-08-21 14:03 ` [PATCH proxmox-ve-rs 02/15] sdn: add zone references to OSPF and BGP fabrics Gabriel Goller
2026-08-21 14:03 ` [PATCH proxmox-ve-rs 03/15] sdn: generate fabric routing configuration in zone VRFs Gabriel Goller
2026-10-21 16:14 ` Stefan Hanreich [this message]
2026-08-21 14:03 ` [PATCH proxmox-ve-rs 04/15] sdn: fix VRF route-map scoping and zone ID validation Gabriel Goller
2026-08-21 14:03 ` [PATCH proxmox-ve-rs 05/15] tests: fabrics: add test for fabrics in VRFs Gabriel Goller
2026-08-21 14:03 ` [PATCH proxmox-perl-rs 06/15] pve-rs: fabrics: assign network interfaces to configured VRFs Gabriel Goller
2026-10-21 16:14 ` Stefan Hanreich
2026-08-21 14:03 ` [PATCH proxmox-perl-rs 07/15] pve-rs: fabrics: make per-fabric status queries VRF-aware Gabriel Goller
2026-10-21 16:14 ` Stefan Hanreich
2026-08-21 14:03 ` [PATCH proxmox-perl-rs 08/15] pve-rs: fabrics: include VRF routes in aggregate status Gabriel Goller
2026-08-21 14:03 ` [PATCH pve-network 09/15] sdn: add optional VRFs for simple zones Gabriel Goller
2026-08-21 14:03 ` [PATCH pve-network 10/15] sdn: allow fabrics to use simple zone VRFs Gabriel Goller
2026-08-21 14:03 ` [PATCH pve-network 11/15] sdn: always generate EVPN " Gabriel Goller
2026-08-21 14:03 ` [PATCH pve-network 12/15] api: sdn: allow EVPN zones as fabric VRFs Gabriel Goller
2026-08-21 14:03 ` [PATCH pve-network 13/15] api: sdn: disallow BGP fabrics in EVPN zone VRFs Gabriel Goller
2026-08-21 14:03 ` [PATCH pve-manager 14/15] ui: sdn: add VRF zone selection for fabrics Gabriel Goller
2026-08-21 14:03 ` [PATCH pve-manager 15/15] ui: sdn: expose EVPN zones as fabric VRFs Gabriel Goller
2026-10-21 9:38 ` [RFC manager/network/proxmox{-ve-rs,-perl-rs} 00/15] SDN VRF support Gabriel Goller
2026-10-21 16:13 ` Stefan Hanreich
-- strict thread matches above, loose matches on Subject: below --
2026-10-21 9:36 [PATCH " Gabriel Goller
2026-10-21 9:36 ` [PATCH proxmox-ve-rs 03/15] sdn: generate fabric routing configuration in zone VRFs Gabriel Goller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f0e3bf07-101e-4d23-bbee-7f453bbe9e5d@proxmox.com \
--to=s.hanreich@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox