public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH proxmox-perl-rs 07/15] pve-rs: fabrics: make per-fabric status queries VRF-aware
Date: Fri, 21 Aug 2026 16:03:51 +0200	[thread overview]
Message-ID: <20260821140404.322081-8-g.goller@proxmox.com> (raw)
In-Reply-To: <20260821140404.322081-1-g.goller@proxmox.com>

Use the fabric VRF in FRR route, neighbor, and interface queries for
OSPF and BGP.

Keep the existing commands for fabrics in the default routing table.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 pve-rs/src/bindings/sdn/fabrics.rs | 63 +++++++++++++++++++-----------
 1 file changed, 41 insertions(+), 22 deletions(-)

diff --git a/pve-rs/src/bindings/sdn/fabrics.rs b/pve-rs/src/bindings/sdn/fabrics.rs
index 98470eeaa397..0fb1ccec9b7c 100644
--- a/pve-rs/src/bindings/sdn/fabrics.rs
+++ b/pve-rs/src/bindings/sdn/fabrics.rs
@@ -848,6 +848,7 @@ pub mod pve_rs_sdn_fabrics {
         };
 
         let fabric = config.get_fabric(&fabric_id)?;
+        let vrf = fabric_vrf_name(fabric);
         match fabric {
             FabricEntry::Openfabric(_) => {
                 let openfabric_ipv4_routes_string = String::from_utf8(
@@ -885,12 +886,12 @@ pub mod pve_rs_sdn_fabrics {
                 )
             }
             FabricEntry::Ospf(_) => {
-                let ospf_routes_string = String::from_utf8(
-                    Command::new("sh")
-                        .args(["-c", "vtysh -c 'show ip route ospf json'"])
-                        .output()?
-                        .stdout,
-                )?;
+                let command = match &vrf {
+                    Some(vrf) => format!("vtysh -c 'show ip route vrf {vrf} ospf json'"),
+                    None => "vtysh -c 'show ip route ospf json'".to_string(),
+                };
+                let ospf_routes_string =
+                    String::from_utf8(Command::new("sh").args(["-c", &command]).output()?.stdout)?;
                 let ospf_routes: proxmox_frr::de::Routes = if ospf_routes_string.is_empty() {
                     proxmox_frr::de::Routes::default()
                 } else {
@@ -902,10 +903,18 @@ pub mod pve_rs_sdn_fabrics {
             }
             FabricEntry::WireGuard(_) => Ok(Vec::new()),
             FabricEntry::Bgp(_) => {
+                let ipv4_command = match &vrf {
+                    Some(vrf) => format!("vtysh -c 'show ip route vrf {vrf} bgp json'"),
+                    None => "vtysh -c 'show ip route bgp json'".to_string(),
+                };
+                let ipv6_command = match &vrf {
+                    Some(vrf) => format!("vtysh -c 'show ipv6 route vrf {vrf} bgp json'"),
+                    None => "vtysh -c 'show ipv6 route bgp json'".to_string(),
+                };
                 let bgp_ipv4_routes_string = String::from_utf8(
                     Command::new("sh")
                         .env("VTYSH_HISTFILE", "/dev/null")
-                        .args(["-c", "vtysh -c 'show ip route bgp json'"])
+                        .args(["-c", &ipv4_command])
                         .output()?
                         .stdout,
                 )?;
@@ -913,7 +922,7 @@ pub mod pve_rs_sdn_fabrics {
                 let bgp_ipv6_routes_string = String::from_utf8(
                     Command::new("sh")
                         .env("VTYSH_HISTFILE", "/dev/null")
-                        .args(["-c", "vtysh -c 'show ipv6 route bgp json'"])
+                        .args(["-c", &ipv6_command])
                         .output()?
                         .stdout,
                 )?;
@@ -948,6 +957,7 @@ pub mod pve_rs_sdn_fabrics {
         };
 
         let fabric = config.get_fabric(&fabric_id)?;
+        let vrf = fabric_vrf_name(fabric);
 
         match fabric {
             FabricEntry::Openfabric(_) => {
@@ -968,12 +978,12 @@ pub mod pve_rs_sdn_fabrics {
                 status::get_neighbors_openfabric(fabric_id, openfabric_neighbors).map(|v| v.into())
             }
             FabricEntry::Ospf(fabric) => {
-                let ospf_neighbors_string = String::from_utf8(
-                    Command::new("sh")
-                        .args(["-c", "vtysh -c 'show ip ospf neighbor json'"])
-                        .output()?
-                        .stdout,
-                )?;
+                let command = match &vrf {
+                    Some(vrf) => format!("vtysh -c 'show ip ospf vrf {vrf} neighbor json'"),
+                    None => "vtysh -c 'show ip ospf neighbor json'".to_string(),
+                };
+                let ospf_neighbors_string =
+                    String::from_utf8(Command::new("sh").args(["-c", &command]).output()?.stdout)?;
                 let ospf_neighbors: proxmox_frr::de::ospf::Neighbors =
                     if ospf_neighbors_string.is_empty() {
                         proxmox_frr::de::ospf::Neighbors::default()
@@ -992,10 +1002,14 @@ pub mod pve_rs_sdn_fabrics {
             }
             FabricEntry::WireGuard(_) => Ok(status::NeighborStatus::WireGuard(Vec::new())),
             FabricEntry::Bgp(_) => {
+                let command = match &vrf {
+                    Some(vrf) => format!("vtysh -c 'show bgp vrf {vrf} neighbors json'"),
+                    None => "vtysh -c 'show bgp neighbors json'".to_string(),
+                };
                 let bgp_neighbors_string = String::from_utf8(
                     Command::new("sh")
                         .env("VTYSH_HISTFILE", "/dev/null")
-                        .args(["-c", "vtysh -c 'show bgp neighbors json'"])
+                        .args(["-c", &command])
                         .output()?
                         .stdout,
                 )?;
@@ -1025,6 +1039,7 @@ pub mod pve_rs_sdn_fabrics {
         };
 
         let fabric = config.get_fabric(&fabric_id)?;
+        let vrf = fabric_vrf_name(fabric);
 
         match fabric {
             FabricEntry::Openfabric(_) => {
@@ -1046,12 +1061,12 @@ pub mod pve_rs_sdn_fabrics {
                     .map(|v| v.into())
             }
             FabricEntry::Ospf(fabric) => {
-                let ospf_interfaces_string = String::from_utf8(
-                    Command::new("sh")
-                        .args(["-c", "vtysh -c 'show ip ospf interface json'"])
-                        .output()?
-                        .stdout,
-                )?;
+                let command = match &vrf {
+                    Some(vrf) => format!("vtysh -c 'show ip ospf vrf {vrf} interface json'"),
+                    None => "vtysh -c 'show ip ospf interface json'".to_string(),
+                };
+                let ospf_interfaces_string =
+                    String::from_utf8(Command::new("sh").args(["-c", &command]).output()?.stdout)?;
                 let ospf_interfaces: proxmox_frr::de::ospf::Interfaces =
                     if ospf_interfaces_string.is_empty() {
                         proxmox_frr::de::ospf::Interfaces::default()
@@ -1070,10 +1085,14 @@ pub mod pve_rs_sdn_fabrics {
             }
             FabricEntry::WireGuard(_) => Ok(status::InterfaceStatus::WireGuard(Vec::new())),
             FabricEntry::Bgp(_) => {
+                let command = match &vrf {
+                    Some(vrf) => format!("vtysh -c 'show bgp vrf {vrf} neighbors json'"),
+                    None => "vtysh -c 'show bgp neighbors json'".to_string(),
+                };
                 let bgp_neighbors_string = String::from_utf8(
                     Command::new("sh")
                         .env("VTYSH_HISTFILE", "/dev/null")
-                        .args(["-c", "vtysh -c 'show bgp neighbors json'"])
+                        .args(["-c", &command])
                         .output()?
                         .stdout,
                 )?;
-- 
2.47.3





  parent reply	other threads:[~2026-08-21 14:04 UTC|newest]

Thread overview: 16+ 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-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-08-21 14:03 ` Gabriel Goller [this message]
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

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=20260821140404.322081-8-g.goller@proxmox.com \
    --to=g.goller@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal