[pve-devel] [PATCH proxmox-ve-rs v2 12/15] ve-config: add FRR conversion helpers for openfabric and ospf

Gabriel Goller g.goller at proxmox.com
Fri Apr 4 18:28:24 CEST 2025


Add conversion helpers for FRR interfaces. We can't put these in eg.
`TryInto` implementations, as we need a tupel and tupels are foreign
types. Create a simple conversion function that converts the OpenFabric
and OSPF interfaces to FRR interfaces.

Signed-off-by: Gabriel Goller <g.goller at proxmox.com>
---
 .../src/sdn/fabric/openfabric/frr.rs          | 24 +++++++++++++++++++
 proxmox-ve-config/src/sdn/fabric/ospf/frr.rs  | 21 ++++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 proxmox-ve-config/src/sdn/fabric/openfabric/frr.rs
 create mode 100644 proxmox-ve-config/src/sdn/fabric/ospf/frr.rs

diff --git a/proxmox-ve-config/src/sdn/fabric/openfabric/frr.rs b/proxmox-ve-config/src/sdn/fabric/openfabric/frr.rs
new file mode 100644
index 000000000000..682fe62ab72f
--- /dev/null
+++ b/proxmox-ve-config/src/sdn/fabric/openfabric/frr.rs
@@ -0,0 +1,24 @@
+use proxmox_frr::{
+    openfabric::{OpenFabricInterface, OpenFabricInterfaceError},
+    FrrWord,
+};
+
+use super::{FabricId, InterfaceProperties};
+
+impl InterfaceProperties {
+    pub fn to_frr_interface(
+        &self,
+        fabric_id: &FabricId,
+        is_ipv6: bool,
+    ) -> Result<OpenFabricInterface, OpenFabricInterfaceError> {
+        let frr_word = FrrWord::new(fabric_id.to_string())?;
+        Ok(OpenFabricInterface {
+            fabric_id: frr_word.into(),
+            passive: self.passive(),
+            hello_interval: self.hello_interval,
+            csnp_interval: self.csnp_interval,
+            hello_multiplier: self.hello_multiplier,
+            is_ipv6,
+        })
+    }
+}
diff --git a/proxmox-ve-config/src/sdn/fabric/ospf/frr.rs b/proxmox-ve-config/src/sdn/fabric/ospf/frr.rs
new file mode 100644
index 000000000000..1a09dd9b5a9b
--- /dev/null
+++ b/proxmox-ve-config/src/sdn/fabric/ospf/frr.rs
@@ -0,0 +1,21 @@
+use proxmox_frr::{
+    ospf::{NetworkType, OspfInterface, OspfInterfaceError},
+    FrrWord,
+};
+
+use super::{Area, InterfaceProperties};
+
+impl InterfaceProperties {
+    pub fn to_frr_interface(&self, area: &Area) -> Result<OspfInterface, OspfInterfaceError> {
+        let frr_word = FrrWord::new(area.to_string())?;
+        Ok(OspfInterface {
+            area: frr_word.try_into()?,
+            passive: self.passive,
+            network_type: if let Some(true) = self.unnumbered {
+                Some(NetworkType::PointToPoint)
+            } else {
+                None
+            },
+        })
+    }
+}
-- 
2.39.5





More information about the pve-devel mailing list