From: Gabriel Goller <g.goller@proxmox.com>
To: Stefan Hanreich <s.hanreich@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [PATCH proxmox-ve-rs 03/15] sdn: generate fabric routing configuration in zone VRFs
Date: Fri, 23 Oct 2026 10:57:13 +0200 [thread overview]
Message-ID: <atsg6cYXIt7wZJLd@luna.proxmox.com> (raw)
In-Reply-To: <f0e3bf07-101e-4d23-bbee-7f453bbe9e5d@proxmox.com>
On 21.10.2026 18:14, Stefan Hanreich wrote:
> 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
> > @@ -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)
>
build_ospf_router returns a Result, so I'll use
match frr_config.ospf.vrf_router.entry(vrf_name.clone()) {
btree_map::Entry::Occupied(entry) => entry.into_mut(),
btree_map::Entry::Vacant(entry) => {
entry.insert(build_ospf_router(*router_id)?)
}
}
Building the ospf_router eagerly before is weird IMO, because it could be
unused.
> > + };
> > + 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,
> > [snip]
next prev parent reply other threads:[~2026-10-23 8:57 UTC|newest]
Thread overview: 26+ 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
2026-10-23 8:57 ` Gabriel Goller [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-10-23 9:33 ` Gabriel Goller
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-10-23 11:29 ` Gabriel Goller
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
2026-10-23 16:55 ` Gabriel Goller
-- 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=atsg6cYXIt7wZJLd@luna.proxmox.com \
--to=g.goller@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
--cc=s.hanreich@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