[pve-devel] [PATCH proxmox-ve-rs v2 15/15] ve-config: add integrations tests

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


Add integration tests for the full cycle from section-config to FRR
config file for both openfabric and ospf.

Signed-off-by: Gabriel Goller <g.goller at proxmox.com>
---
 proxmox-ve-config/Cargo.toml                  |   3 +
 proxmox-ve-config/debian/control              |   2 +
 .../tests/fabric/cfg/openfabric_default.cfg   |  24 ++++
 .../cfg/openfabric_loopback_prefix_fail.cfg   |  24 ++++
 .../fabric/cfg/openfabric_multi_fabric.cfg    |  33 +++++
 .../cfg/openfabric_verification_fail.cfg      |  16 +++
 .../tests/fabric/cfg/ospf_default.cfg         |  16 +++
 ...f_interface_properties_validation_fail.cfg |  10 ++
 .../fabric/cfg/ospf_loopback_prefix_fail.cfg  |  23 +++
 .../tests/fabric/cfg/ospf_multi_fabric.cfg    |  33 +++++
 .../fabric/cfg/ospf_verification_fail.cfg     |  17 +++
 proxmox-ve-config/tests/fabric/helper.rs      |  43 ++++++
 proxmox-ve-config/tests/fabric/main.rs        | 132 ++++++++++++++++++
 .../fabric__openfabric_default_pve.snap       |  36 +++++
 .../fabric__openfabric_default_pve1.snap      |  32 +++++
 .../fabric__openfabric_multi_fabric_pve1.snap |  48 +++++++
 .../snapshots/fabric__ospf_default_pve.snap   |  31 ++++
 .../snapshots/fabric__ospf_default_pve1.snap  |  27 ++++
 .../fabric__ospf_multi_fabric_pve1.snap       |  48 +++++++
 19 files changed, 598 insertions(+)
 create mode 100644 proxmox-ve-config/tests/fabric/cfg/openfabric_default.cfg
 create mode 100644 proxmox-ve-config/tests/fabric/cfg/openfabric_loopback_prefix_fail.cfg
 create mode 100644 proxmox-ve-config/tests/fabric/cfg/openfabric_multi_fabric.cfg
 create mode 100644 proxmox-ve-config/tests/fabric/cfg/openfabric_verification_fail.cfg
 create mode 100644 proxmox-ve-config/tests/fabric/cfg/ospf_default.cfg
 create mode 100644 proxmox-ve-config/tests/fabric/cfg/ospf_interface_properties_validation_fail.cfg
 create mode 100644 proxmox-ve-config/tests/fabric/cfg/ospf_loopback_prefix_fail.cfg
 create mode 100644 proxmox-ve-config/tests/fabric/cfg/ospf_multi_fabric.cfg
 create mode 100644 proxmox-ve-config/tests/fabric/cfg/ospf_verification_fail.cfg
 create mode 100644 proxmox-ve-config/tests/fabric/helper.rs
 create mode 100644 proxmox-ve-config/tests/fabric/main.rs
 create mode 100644 proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_default_pve.snap
 create mode 100644 proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_default_pve1.snap
 create mode 100644 proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_multi_fabric_pve1.snap
 create mode 100644 proxmox-ve-config/tests/fabric/snapshots/fabric__ospf_default_pve.snap
 create mode 100644 proxmox-ve-config/tests/fabric/snapshots/fabric__ospf_default_pve1.snap
 create mode 100644 proxmox-ve-config/tests/fabric/snapshots/fabric__ospf_multi_fabric_pve1.snap

diff --git a/proxmox-ve-config/Cargo.toml b/proxmox-ve-config/Cargo.toml
index 70c25312ac6d..74d32df49d9d 100644
--- a/proxmox-ve-config/Cargo.toml
+++ b/proxmox-ve-config/Cargo.toml
@@ -29,3 +29,6 @@ proxmox-sortable-macro = "0.1.3"
 
 [features]
 frr = ["dep:proxmox-frr" ]
+
+[dev-dependencies]
+insta = "1.21"
diff --git a/proxmox-ve-config/debian/control b/proxmox-ve-config/debian/control
index d0940b2c8ac5..d251fda43367 100644
--- a/proxmox-ve-config/debian/control
+++ b/proxmox-ve-config/debian/control
@@ -7,6 +7,7 @@ Build-Depends-Arch: cargo:native <!nocheck>,
  rustc:native <!nocheck>,
  libstd-rust-dev <!nocheck>,
  librust-anyhow-1+default-dev <!nocheck>,
+ librust-insta-1+json-dev (>= 1.21-~~),
  librust-log-0.4+default-dev <!nocheck>,
  librust-nix-0.26+default-dev <!nocheck>,
  librust-proxmox-network-types-0.1+default-dev <!nocheck>,
@@ -37,6 +38,7 @@ Multi-Arch: same
 Depends:
  ${misc:Depends},
  librust-anyhow-1+default-dev,
+ librust-insta-1+json-dev (>= 1.21-~~),
  librust-log-0.4+default-dev,
  librust-nix-0.26+default-dev,
  librust-proxmox-network-types-0.1+default-dev,
diff --git a/proxmox-ve-config/tests/fabric/cfg/openfabric_default.cfg b/proxmox-ve-config/tests/fabric/cfg/openfabric_default.cfg
new file mode 100644
index 000000000000..676862e3ce45
--- /dev/null
+++ b/proxmox-ve-config/tests/fabric/cfg/openfabric_default.cfg
@@ -0,0 +1,24 @@
+fabric: uwu
+        hello_interval 4
+        loopback_prefix 192.168.2.0/24
+
+node: uwu_pve
+        fabric_id uwu
+        interfaces name=ens20,passive=1,hello_interval=3,hello_multiplier=50
+        interfaces name=ens19,passive=1,csnp_interval=100
+        node_id pve
+        router_id 192.168.2.8
+
+node: uwu_pve1
+        fabric_id uwu
+        interfaces name=ens19
+        interfaces name=ens20
+        node_id pve1
+        router_id 192.168.2.9
+
+node: uwu_pve2
+        fabric_id uwu
+        interfaces name=ens19
+        interfaces name=ens20
+        node_id pve2
+        router_id 192.168.2.10
diff --git a/proxmox-ve-config/tests/fabric/cfg/openfabric_loopback_prefix_fail.cfg b/proxmox-ve-config/tests/fabric/cfg/openfabric_loopback_prefix_fail.cfg
new file mode 100644
index 000000000000..e795c1524f9b
--- /dev/null
+++ b/proxmox-ve-config/tests/fabric/cfg/openfabric_loopback_prefix_fail.cfg
@@ -0,0 +1,24 @@
+fabric: test
+        hello_interval 4
+        loopback_prefix 192.168.2.0/28
+
+node: test_pve
+        fabric_id test
+        interfaces name=ens20,passive=1,hello_interval=3,hello_multiplier=50
+        interfaces name=ens19,passive=1,csnp_interval=100
+        node_id pve
+        router_id 192.168.2.8
+
+node: test_pve1
+        fabric_id test
+        interfaces name=ens19
+        interfaces name=ens20
+        node_id pve1
+        router_id 192.168.2.20
+
+node: test_pve2
+        fabric_id test
+        interfaces name=ens19
+        interfaces name=ens20
+        node_id pve2
+        router_id 192.168.2.10
diff --git a/proxmox-ve-config/tests/fabric/cfg/openfabric_multi_fabric.cfg b/proxmox-ve-config/tests/fabric/cfg/openfabric_multi_fabric.cfg
new file mode 100644
index 000000000000..0c39505f44e5
--- /dev/null
+++ b/proxmox-ve-config/tests/fabric/cfg/openfabric_multi_fabric.cfg
@@ -0,0 +1,33 @@
+fabric: test1
+        hello_interval 4
+        loopback_prefix 192.168.2.0/24
+
+node: test1_pve
+        fabric_id test1
+        interfaces name=ens20,passive=1,hello_interval=3,hello_multiplier=50
+        interfaces name=ens19,passive=1,csnp_interval=100
+        node_id pve
+        router_id 192.168.2.8
+
+node: test1_pve1
+        fabric_id test1
+        interfaces name=ens19
+        node_id pve1
+        router_id 192.168.2.9
+
+fabric: test2
+        hello_interval 4
+        loopback_prefix 192.168.1.0/24
+
+node: test2_pve
+        fabric_id test2
+        interfaces name=ens20,passive=1,hello_interval=3,hello_multiplier=50
+        interfaces name=ens19,passive=1,csnp_interval=100
+        node_id pve
+        router_id 192.168.1.8
+
+node: test2_pve1
+        fabric_id test2
+        interfaces name=ens20
+        node_id pve1
+        router_id 192.168.1.9
diff --git a/proxmox-ve-config/tests/fabric/cfg/openfabric_verification_fail.cfg b/proxmox-ve-config/tests/fabric/cfg/openfabric_verification_fail.cfg
new file mode 100644
index 000000000000..00383bb24851
--- /dev/null
+++ b/proxmox-ve-config/tests/fabric/cfg/openfabric_verification_fail.cfg
@@ -0,0 +1,16 @@
+fabric: uwu
+        loopback_prefix 192.168.2.0/24
+
+node: uwu1_pve
+        fabric_id uwu1
+        interfaces name=ens20,passive=1,hello_interval=3,hello_multiplier=50
+        interfaces name=ens19,passive=1,csnp_interval=100
+        node_id pve
+        router_id 192.168.2.8
+
+node: uwu_pve1
+        fabric_id uwu
+        interfaces name=ens19
+        interfaces name=ens20
+        node_id pve1
+        router_id 192.168.2.9
diff --git a/proxmox-ve-config/tests/fabric/cfg/ospf_default.cfg b/proxmox-ve-config/tests/fabric/cfg/ospf_default.cfg
new file mode 100644
index 000000000000..d726c50a1642
--- /dev/null
+++ b/proxmox-ve-config/tests/fabric/cfg/ospf_default.cfg
@@ -0,0 +1,16 @@
+fabric: test
+        area 0
+        loopback_prefix 10.10.10.10/24
+
+node: test_pve
+        fabric_id test
+        interfaces name=ens18,passive=false,ip=4.4.4.4/24
+        interfaces name=ens19,passive=false,unnumbered=true
+        node_id pve
+        router_id 10.10.10.1
+
+node: test_pve1
+        fabric_id test
+        interfaces name=ens19,passive=false,unnumbered=true
+        node_id pve1
+        router_id 10.10.10.2
diff --git a/proxmox-ve-config/tests/fabric/cfg/ospf_interface_properties_validation_fail.cfg b/proxmox-ve-config/tests/fabric/cfg/ospf_interface_properties_validation_fail.cfg
new file mode 100644
index 000000000000..afa3f36b38e7
--- /dev/null
+++ b/proxmox-ve-config/tests/fabric/cfg/ospf_interface_properties_validation_fail.cfg
@@ -0,0 +1,10 @@
+fabric: test
+        area 0
+        loopback_prefix 10.10.10.0/24
+
+node: test_pve
+        fabric_id test
+        interfaces name=dummy0,passive=true
+        interfaces name=ens18,passive=false
+        node_id pve
+        router_id 10.10.10.1
diff --git a/proxmox-ve-config/tests/fabric/cfg/ospf_loopback_prefix_fail.cfg b/proxmox-ve-config/tests/fabric/cfg/ospf_loopback_prefix_fail.cfg
new file mode 100644
index 000000000000..7d170b6f7c4b
--- /dev/null
+++ b/proxmox-ve-config/tests/fabric/cfg/ospf_loopback_prefix_fail.cfg
@@ -0,0 +1,23 @@
+fabric: test
+        loopback_prefix 192.168.2.0/16
+
+node: test_pve
+        fabric_id test
+        interfaces name=ens20,passive=1,unnumbered=true
+        interfaces name=ens19,passive=1,unnumbered=true
+        node_id pve
+        router_id 192.168.2.8
+
+node: test_pve1
+        fabric_id test
+        interfaces name=ens19,unnumbered=true
+        interfaces name=ens20,unnumbered=true
+        node_id pve1
+        router_id 192.168.3.20
+
+node: test_pve2
+        fabric_id test
+        interfaces name=ens19,ip=3.3.3.2/31
+        interfaces name=ens20,ip=3.3.3.4/31
+        node_id pve2
+        router_id 192.169.2.10
diff --git a/proxmox-ve-config/tests/fabric/cfg/ospf_multi_fabric.cfg b/proxmox-ve-config/tests/fabric/cfg/ospf_multi_fabric.cfg
new file mode 100644
index 000000000000..0fb62bb2c9d8
--- /dev/null
+++ b/proxmox-ve-config/tests/fabric/cfg/ospf_multi_fabric.cfg
@@ -0,0 +1,33 @@
+fabric: test
+        area 0
+        loopback_prefix 192.168.2.0/24
+
+node: test_pve
+        fabric_id test
+        interfaces name=ens20,passive=1,unnumbered=true
+        interfaces name=ens19,passive=1,unnumbered=false,ip=3.3.3.4/31
+        node_id pve
+        router_id 192.168.2.8
+
+node: test_pve1
+        fabric_id test
+        interfaces name=ens19,unnumbered=true
+        node_id pve1
+        router_id 192.168.2.9
+
+fabric: ceph
+        area 1
+        loopback_prefix 192.168.1.0/24
+
+node: ceph_pve
+        fabric_id ceph
+        interfaces name=ens20,passive=1,unnumbered=true
+        interfaces name=ens19,passive=1,unnumbered=true
+        node_id pve
+        router_id 192.168.1.8
+
+node: ceph_pve1
+        fabric_id ceph
+        interfaces name=ens20,unnumbered=true
+        node_id pve1
+        router_id 192.168.1.9
diff --git a/proxmox-ve-config/tests/fabric/cfg/ospf_verification_fail.cfg b/proxmox-ve-config/tests/fabric/cfg/ospf_verification_fail.cfg
new file mode 100644
index 000000000000..f09636231320
--- /dev/null
+++ b/proxmox-ve-config/tests/fabric/cfg/ospf_verification_fail.cfg
@@ -0,0 +1,17 @@
+fabric: test
+        area 0
+        loopback_prefix 10.10.10.0/24
+
+node: test_pve
+        fabric_id test
+        interfaces name=dummy0,passive=true,unnumbered=true
+        interfaces name=ens18,passive=false,unnumbered=true
+        node_id pve
+        router_id 10.10.10.1
+
+node: test1_pve1
+        fabric_id test1
+        interfaces name=dummy0,passive=true,unnumbered=true
+        interfaces name=ens19,passive=false,unnumbered=true
+        node_id pve1
+        router_id 10.10.10.2
diff --git a/proxmox-ve-config/tests/fabric/helper.rs b/proxmox-ve-config/tests/fabric/helper.rs
new file mode 100644
index 000000000000..f307c1b96b25
--- /dev/null
+++ b/proxmox-ve-config/tests/fabric/helper.rs
@@ -0,0 +1,43 @@
+#[allow(unused_macros)]
+macro_rules! get_section_config {
+    () => {{
+        // Get current function name
+        fn f() {}
+        fn type_name_of<T>(_: T) -> &'static str {
+            std::any::type_name::<T>()
+        }
+        let mut name = type_name_of(f);
+
+        // Find and cut the rest of the path
+        name = match &name[..name.len() - 3].rfind(':') {
+            Some(pos) => &name[pos + 1..name.len() - 3],
+            None => &name[..name.len() - 3],
+        };
+        let real_filename = format!("tests/fabric/cfg/{name}.cfg");
+        std::fs::read_to_string(real_filename).expect("cannot find config file")
+    }};
+}
+
+#[allow(unused_macros)]
+macro_rules! reference_name {
+    ($suffix:expr) => {{
+        // Get current function name
+        fn f() {}
+        fn type_name_of<T>(_: T) -> &'static str {
+            std::any::type_name::<T>()
+        }
+        let mut name = type_name_of(f);
+
+        // Find and cut the rest of the path
+        name = match &name[..name.len() - 3].rfind(':') {
+            Some(pos) => &name[pos + 1..name.len() - 3],
+            None => &name[..name.len() - 3],
+        };
+        format!("{name}_{}", $suffix)
+    }};
+}
+
+#[allow(unused_imports)]
+pub(crate) use get_section_config;
+#[allow(unused_imports)]
+pub(crate) use reference_name;
diff --git a/proxmox-ve-config/tests/fabric/main.rs b/proxmox-ve-config/tests/fabric/main.rs
new file mode 100644
index 000000000000..2865b73266ea
--- /dev/null
+++ b/proxmox-ve-config/tests/fabric/main.rs
@@ -0,0 +1,132 @@
+#![cfg(feature = "frr")]
+use proxmox_frr::serializer::dump;
+use proxmox_ve_config::sdn::fabric::openfabric::OpenFabricSectionConfig;
+use proxmox_ve_config::sdn::fabric::ospf::OspfSectionConfig;
+use proxmox_ve_config::sdn::fabric::{FabricConfig, FrrConfigBuilder, Valid};
+
+mod helper;
+
+/*
+ * Use the macros helper::get_section_config!() to get the section config as a string. This uses
+ * the function name and checks for "/resources/cfg/{function name}.cfg" files.
+ * WIth the helper::reference_name!("<hostname>") macro you can get the snapshot file of this
+ * function for this specific hostname.
+ */
+
+#[test]
+fn openfabric_default() {
+    let openfabric =
+        <Valid<OpenFabricSectionConfig>>::parse_section_config("", &helper::get_section_config!())
+            .unwrap();
+
+    let config = FabricConfig::with_openfabric(openfabric);
+    let mut frr_config = FrrConfigBuilder::default()
+        .add_fabrics(config.clone())
+        .build("pve".parse().expect("valid id"))
+        .expect("error building frr config");
+
+    let mut output = dump(&frr_config).expect("error dumping stuff");
+
+    insta::assert_snapshot!(helper::reference_name!("pve"), output);
+
+    frr_config = FrrConfigBuilder::default()
+        .add_fabrics(config.clone())
+        .build("pve1".parse().expect("valid id"))
+        .expect("error building frr config");
+
+    output = dump(&frr_config).expect("error dumping stuff");
+
+    insta::assert_snapshot!(helper::reference_name!("pve1"), output);
+}
+
+#[test]
+fn ospf_default() {
+    let ospf = <Valid<OspfSectionConfig>>::parse_section_config("", &helper::get_section_config!())
+        .unwrap();
+
+    let config = FabricConfig::with_ospf(ospf);
+    let mut frr_config = FrrConfigBuilder::default()
+        .add_fabrics(config.clone())
+        .build("pve".parse().expect("valid id"))
+        .expect("error building frr config");
+
+    let mut output = dump(&frr_config).expect("error dumping stuff");
+
+    insta::assert_snapshot!(helper::reference_name!("pve"), output);
+
+    frr_config = FrrConfigBuilder::default()
+        .add_fabrics(config)
+        .build("pve1".parse().expect("valid id"))
+        .expect("error building frr config");
+
+    output = dump(&frr_config).expect("error dumping stuff");
+
+    insta::assert_snapshot!(helper::reference_name!("pve1"), output);
+}
+
+#[test]
+fn openfabric_verification_fail() {
+    let result =
+        <Valid<OpenFabricSectionConfig>>::parse_section_config("", &helper::get_section_config!());
+    assert!(result.is_err());
+}
+
+#[test]
+fn ospf_verification_fail() {
+    let result =
+        <Valid<OspfSectionConfig>>::parse_section_config("", &helper::get_section_config!());
+    assert!(result.is_err());
+}
+
+#[test]
+fn openfabric_loopback_prefix_fail() {
+    let result =
+        <Valid<OpenFabricSectionConfig>>::parse_section_config("", &helper::get_section_config!());
+    assert!(result.is_err());
+}
+
+#[test]
+fn ospf_loopback_prefix_fail() {
+    let result =
+        <Valid<OspfSectionConfig>>::parse_section_config("", &helper::get_section_config!());
+    assert!(result.is_err());
+}
+
+#[test]
+fn openfabric_multi_fabric() {
+    let openfabric =
+        <Valid<OpenFabricSectionConfig>>::parse_section_config("", &helper::get_section_config!())
+            .unwrap();
+
+    let config = FabricConfig::with_openfabric(openfabric);
+    let frr_config = FrrConfigBuilder::default()
+        .add_fabrics(config.clone())
+        .build("pve1".parse().expect("valid id"))
+        .expect("error building frr config");
+
+    let output = dump(&frr_config).expect("error dumping stuff");
+
+    insta::assert_snapshot!(helper::reference_name!("pve1"), output);
+}
+
+#[test]
+fn ospf_multi_fabric() {
+    let ospf = <Valid<OspfSectionConfig>>::parse_section_config("", &helper::get_section_config!())
+        .unwrap();
+
+    let config = FabricConfig::with_ospf(ospf);
+    let frr_config = FrrConfigBuilder::default()
+        .add_fabrics(config.clone())
+        .build("pve1".parse().expect("valid id"))
+        .expect("error building frr config");
+
+    let output = dump(&frr_config).expect("error dumping stuff");
+
+    insta::assert_snapshot!(helper::reference_name!("pve1"), output);
+}
+
+#[test]
+fn ospf_interface_properties_validation_fail() {
+    let ospf = <Valid<OspfSectionConfig>>::parse_section_config("", &helper::get_section_config!());
+    assert!(ospf.is_err());
+}
diff --git a/proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_default_pve.snap b/proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_default_pve.snap
new file mode 100644
index 000000000000..dfce9ac99ffe
--- /dev/null
+++ b/proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_default_pve.snap
@@ -0,0 +1,36 @@
+---
+source: proxmox-ve-config/tests/fabric/main.rs
+expression: output
+snapshot_kind: text
+---
+router openfabric uwu
+ net 49.0001.1921.6800.2008.00
+exit
+!
+interface dummy_uwu
+ ip router openfabric uwu
+ openfabric passive
+exit
+!
+interface ens19
+ ip router openfabric uwu
+ openfabric passive
+ openfabric hello-interval 4
+ openfabric csnp-interval 100
+exit
+!
+interface ens20
+ ip router openfabric uwu
+ openfabric passive
+ openfabric hello-interval 3
+ openfabric hello-multiplier 50
+exit
+!
+access-list openfabric_uwu_ips permit 192.168.2.0/24
+!
+route-map openfabric permit 100
+ match ip address openfabric_uwu_ips
+ set src 192.168.2.8
+exit
+!
+ip protocol openfabric route-map openfabric
diff --git a/proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_default_pve1.snap b/proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_default_pve1.snap
new file mode 100644
index 000000000000..5b30380ad47a
--- /dev/null
+++ b/proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_default_pve1.snap
@@ -0,0 +1,32 @@
+---
+source: proxmox-ve-config/tests/fabric/main.rs
+expression: output
+snapshot_kind: text
+---
+router openfabric uwu
+ net 49.0001.1921.6800.2009.00
+exit
+!
+interface dummy_uwu
+ ip router openfabric uwu
+ openfabric passive
+exit
+!
+interface ens19
+ ip router openfabric uwu
+ openfabric hello-interval 4
+exit
+!
+interface ens20
+ ip router openfabric uwu
+ openfabric hello-interval 4
+exit
+!
+access-list openfabric_uwu_ips permit 192.168.2.0/24
+!
+route-map openfabric permit 100
+ match ip address openfabric_uwu_ips
+ set src 192.168.2.9
+exit
+!
+ip protocol openfabric route-map openfabric
diff --git a/proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_multi_fabric_pve1.snap b/proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_multi_fabric_pve1.snap
new file mode 100644
index 000000000000..35d48e869164
--- /dev/null
+++ b/proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_multi_fabric_pve1.snap
@@ -0,0 +1,48 @@
+---
+source: proxmox-ve-config/tests/fabric/main.rs
+expression: output
+snapshot_kind: text
+---
+router openfabric test1
+ net 49.0001.1921.6800.2009.00
+exit
+!
+router openfabric test2
+ net 49.0001.1921.6800.2009.00
+exit
+!
+interface dummy_test1
+ ip router openfabric test1
+ openfabric passive
+exit
+!
+interface dummy_test2
+ ip router openfabric test2
+ openfabric passive
+exit
+!
+interface ens19
+ ip router openfabric test1
+ openfabric hello-interval 4
+exit
+!
+interface ens20
+ ip router openfabric test2
+ openfabric hello-interval 4
+exit
+!
+access-list openfabric_test1_ips permit 192.168.2.0/24
+!
+access-list openfabric_test2_ips permit 192.168.1.0/24
+!
+route-map openfabric permit 100
+ match ip address openfabric_test1_ips
+ set src 192.168.2.9
+exit
+!
+route-map openfabric permit 110
+ match ip address openfabric_test2_ips
+ set src 192.168.1.9
+exit
+!
+ip protocol openfabric route-map openfabric
diff --git a/proxmox-ve-config/tests/fabric/snapshots/fabric__ospf_default_pve.snap b/proxmox-ve-config/tests/fabric/snapshots/fabric__ospf_default_pve.snap
new file mode 100644
index 000000000000..83b4006e6124
--- /dev/null
+++ b/proxmox-ve-config/tests/fabric/snapshots/fabric__ospf_default_pve.snap
@@ -0,0 +1,31 @@
+---
+source: proxmox-ve-config/tests/fabric/main.rs
+expression: output
+snapshot_kind: text
+---
+router ospf
+ ospf router-id 10.10.10.1
+exit
+!
+interface dummy_test
+ ip ospf area 0
+ ip ospf passive
+exit
+!
+interface ens18
+ ip ospf area 0
+exit
+!
+interface ens19
+ ip ospf area 0
+ ip ospf network point-to-point
+exit
+!
+access-list ospf_test_ips permit 10.10.10.10/24
+!
+route-map ospf permit 100
+ match ip address ospf_test_ips
+ set src 10.10.10.1
+exit
+!
+ip protocol ospf route-map ospf
diff --git a/proxmox-ve-config/tests/fabric/snapshots/fabric__ospf_default_pve1.snap b/proxmox-ve-config/tests/fabric/snapshots/fabric__ospf_default_pve1.snap
new file mode 100644
index 000000000000..c574bd9d99bd
--- /dev/null
+++ b/proxmox-ve-config/tests/fabric/snapshots/fabric__ospf_default_pve1.snap
@@ -0,0 +1,27 @@
+---
+source: proxmox-ve-config/tests/fabric/main.rs
+expression: output
+snapshot_kind: text
+---
+router ospf
+ ospf router-id 10.10.10.2
+exit
+!
+interface dummy_test
+ ip ospf area 0
+ ip ospf passive
+exit
+!
+interface ens19
+ ip ospf area 0
+ ip ospf network point-to-point
+exit
+!
+access-list ospf_test_ips permit 10.10.10.10/24
+!
+route-map ospf permit 100
+ match ip address ospf_test_ips
+ set src 10.10.10.2
+exit
+!
+ip protocol ospf route-map ospf
diff --git a/proxmox-ve-config/tests/fabric/snapshots/fabric__ospf_multi_fabric_pve1.snap b/proxmox-ve-config/tests/fabric/snapshots/fabric__ospf_multi_fabric_pve1.snap
new file mode 100644
index 000000000000..22afba916120
--- /dev/null
+++ b/proxmox-ve-config/tests/fabric/snapshots/fabric__ospf_multi_fabric_pve1.snap
@@ -0,0 +1,48 @@
+---
+source: proxmox-ve-config/tests/fabric/main.rs
+expression: output
+snapshot_kind: text
+---
+router ospf
+ ospf router-id 192.168.2.9
+exit
+!
+router ospf
+ ospf router-id 192.168.2.9
+exit
+!
+interface dummy_ceph
+ ip ospf area 1
+ ip ospf passive
+exit
+!
+interface dummy_test
+ ip ospf area 0
+ ip ospf passive
+exit
+!
+interface ens19
+ ip ospf area 0
+ ip ospf network point-to-point
+exit
+!
+interface ens20
+ ip ospf area 1
+ ip ospf network point-to-point
+exit
+!
+access-list ospf_ceph_ips permit 192.168.1.0/24
+!
+access-list ospf_test_ips permit 192.168.2.0/24
+!
+route-map ospf permit 100
+ match ip address ospf_test_ips
+ set src 192.168.2.9
+exit
+!
+route-map ospf permit 110
+ match ip address ospf_ceph_ips
+ set src 192.168.1.9
+exit
+!
+ip protocol ospf route-map ospf
-- 
2.39.5





More information about the pve-devel mailing list