From: Gabriel Goller <g.gol...@proxmox.com> Add integration tests for the full cycle from section-config to FRR config file for both openfabric and ospf. It tests everything end-to-end, from reading the configuration file to converting it into a FabricConfig and then serializing an FRR configuration from it.
Signed-off-by: Gabriel Goller <g.gol...@proxmox.com> --- proxmox-ve-config/Cargo.toml | 3 + .../fabric/cfg/openfabric_default/fabrics.cfg | 18 +++ .../cfg/openfabric_dualstack/fabrics.cfg | 22 +++ .../cfg/openfabric_ipv6_only/fabrics.cfg | 18 +++ .../cfg/openfabric_loopback/fabrics.cfg | 18 +++ .../fabrics.cfg | 25 ++++ .../cfg/openfabric_multi_fabric/fabrics.cfg | 25 ++++ .../fabrics.cfg | 25 ++++ .../openfabric_verification_fail/fabrics.cfg | 12 ++ .../tests/fabric/cfg/ospf_default/fabrics.cfg | 13 ++ .../cfg/ospf_loopback_prefix_fail/fabrics.cfg | 17 +++ .../fabric/cfg/ospf_multi_fabric/fabrics.cfg | 25 ++++ .../cfg/ospf_verification_fail/fabrics.cfg | 13 ++ proxmox-ve-config/tests/fabric/helper.rs | 43 ++++++ proxmox-ve-config/tests/fabric/main.rs | 141 ++++++++++++++++++ .../fabric__openfabric_default_pve.snap | 34 +++++ .../fabric__openfabric_default_pve1.snap | 33 ++++ .../fabric__openfabric_dualstack_pve.snap | 46 ++++++ .../fabric__openfabric_ipv6_only_pve.snap | 34 +++++ .../fabric__openfabric_multi_fabric_pve1.snap | 49 ++++++ .../snapshots/fabric__ospf_default_pve.snap | 32 ++++ .../snapshots/fabric__ospf_default_pve1.snap | 28 ++++ .../fabric__ospf_multi_fabric_pve1.snap | 45 ++++++ 23 files changed, 719 insertions(+) create mode 100644 proxmox-ve-config/tests/fabric/cfg/openfabric_default/fabrics.cfg create mode 100644 proxmox-ve-config/tests/fabric/cfg/openfabric_dualstack/fabrics.cfg create mode 100644 proxmox-ve-config/tests/fabric/cfg/openfabric_ipv6_only/fabrics.cfg create mode 100644 proxmox-ve-config/tests/fabric/cfg/openfabric_loopback/fabrics.cfg create mode 100644 proxmox-ve-config/tests/fabric/cfg/openfabric_loopback_prefix_fail/fabrics.cfg create mode 100644 proxmox-ve-config/tests/fabric/cfg/openfabric_multi_fabric/fabrics.cfg create mode 100644 proxmox-ve-config/tests/fabric/cfg/openfabric_same_net_on_same_node/fabrics.cfg create mode 100644 proxmox-ve-config/tests/fabric/cfg/openfabric_verification_fail/fabrics.cfg create mode 100644 proxmox-ve-config/tests/fabric/cfg/ospf_default/fabrics.cfg create mode 100644 proxmox-ve-config/tests/fabric/cfg/ospf_loopback_prefix_fail/fabrics.cfg create mode 100644 proxmox-ve-config/tests/fabric/cfg/ospf_multi_fabric/fabrics.cfg create mode 100644 proxmox-ve-config/tests/fabric/cfg/ospf_verification_fail/fabrics.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_dualstack_pve.snap create mode 100644 proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_ipv6_only_pve.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 cea541e..eca5299 100644 --- a/proxmox-ve-config/Cargo.toml +++ b/proxmox-ve-config/Cargo.toml @@ -31,3 +31,6 @@ proxmox-sortable-macro = "0.1.3" [features] frr = ["dep:proxmox-frr"] + +[dev-dependencies] +insta = "1.21" diff --git a/proxmox-ve-config/tests/fabric/cfg/openfabric_default/fabrics.cfg b/proxmox-ve-config/tests/fabric/cfg/openfabric_default/fabrics.cfg new file mode 100644 index 0000000..3df8450 --- /dev/null +++ b/proxmox-ve-config/tests/fabric/cfg/openfabric_default/fabrics.cfg @@ -0,0 +1,18 @@ +openfabric_fabric: uwu + hello_interval 4 + ip_prefix 192.168.2.0/24 + +openfabric_node: uwu_pve + interfaces name=ens20,hello_multiplier=50 + interfaces name=ens19 + ip 192.168.2.8 + +openfabric_node: uwu_pve1 + interfaces name=ens19 + interfaces name=ens20 + ip 192.168.2.9 + +openfabric_node: uwu_pve2 + interfaces name=ens19 + interfaces name=ens20 + ip 192.168.2.10 diff --git a/proxmox-ve-config/tests/fabric/cfg/openfabric_dualstack/fabrics.cfg b/proxmox-ve-config/tests/fabric/cfg/openfabric_dualstack/fabrics.cfg new file mode 100644 index 0000000..fe1e986 --- /dev/null +++ b/proxmox-ve-config/tests/fabric/cfg/openfabric_dualstack/fabrics.cfg @@ -0,0 +1,22 @@ +openfabric_fabric: uwu + hello_interval 4 + ip_prefix 192.168.2.0/24 + ip6_prefix 2001:db8::0/64 + +openfabric_node: uwu_pve + interfaces name=ens20,hello_multiplier=50 + interfaces name=ens19 + ip 192.168.2.8 + ip6 2001:db8::1 + +openfabric_node: uwu_pve1 + interfaces name=ens19 + interfaces name=ens20 + ip 192.168.2.9 + ip6 2001:db8::2 + +openfabric_node: uwu_pve2 + interfaces name=ens19 + interfaces name=ens20 + ip 192.168.2.10 + ip6 2001:db8::3 diff --git a/proxmox-ve-config/tests/fabric/cfg/openfabric_ipv6_only/fabrics.cfg b/proxmox-ve-config/tests/fabric/cfg/openfabric_ipv6_only/fabrics.cfg new file mode 100644 index 0000000..286a5a3 --- /dev/null +++ b/proxmox-ve-config/tests/fabric/cfg/openfabric_ipv6_only/fabrics.cfg @@ -0,0 +1,18 @@ +openfabric_fabric: uwu + hello_interval 4 + ip6_prefix a:b::0/75 + +openfabric_node: uwu_pve + interfaces name=ens20,hello_multiplier=50 + interfaces name=ens19 + ip6 a:b::a + +openfabric_node: uwu_pve1 + interfaces name=ens19 + interfaces name=ens20 + ip6 a:b::b + +openfabric_node: uwu_pve2 + interfaces name=ens19 + interfaces name=ens20 + ip6 a:b::c diff --git a/proxmox-ve-config/tests/fabric/cfg/openfabric_loopback/fabrics.cfg b/proxmox-ve-config/tests/fabric/cfg/openfabric_loopback/fabrics.cfg new file mode 100644 index 0000000..ea93eb7 --- /dev/null +++ b/proxmox-ve-config/tests/fabric/cfg/openfabric_loopback/fabrics.cfg @@ -0,0 +1,18 @@ +openfabric_fabric: test + hello_interval 4 + ip_prefix 192.168.2.0/28 + +openfabric_node: test_pve + interfaces name=ens20,hello_multiplier=50 + interfaces name=ens19 + ip 192.168.2.8 + +openfabric_node: test_pve1 + interfaces name=ens19 + interfaces name=ens20 + ip 192.168.2.20 + +openfabric_node: test_pve2 + interfaces name=ens19 + interfaces name=ens20 + ip 192.168.2.10 diff --git a/proxmox-ve-config/tests/fabric/cfg/openfabric_loopback_prefix_fail/fabrics.cfg b/proxmox-ve-config/tests/fabric/cfg/openfabric_loopback_prefix_fail/fabrics.cfg new file mode 100644 index 0000000..46acd1d --- /dev/null +++ b/proxmox-ve-config/tests/fabric/cfg/openfabric_loopback_prefix_fail/fabrics.cfg @@ -0,0 +1,25 @@ +openfabric_fabric: test + hello_interval 4 + ip_prefix 192.168.2.0/28 + +openfabric_node: test_pve + fabric_id test + interfaces name=ens20,hello_multiplier=50 + interfaces name=ens19 + node_id pve + ip 192.168.2.8 + +openfabric_node: test_pve1 + fabric_id test + interfaces name=ens19 + interfaces name=ens20 + node_id pve1 + ip 192.168.2.20 + +openfabric_node: test_pve2 + fabric_id test + interfaces name=ens19 + interfaces name=ens20 + node_id pve2 + ip 192.168.2.10 + diff --git a/proxmox-ve-config/tests/fabric/cfg/openfabric_multi_fabric/fabrics.cfg b/proxmox-ve-config/tests/fabric/cfg/openfabric_multi_fabric/fabrics.cfg new file mode 100644 index 0000000..dcfdfa7 --- /dev/null +++ b/proxmox-ve-config/tests/fabric/cfg/openfabric_multi_fabric/fabrics.cfg @@ -0,0 +1,25 @@ +openfabric_fabric: test1 + hello_interval 4 + ip_prefix 192.168.2.0/24 + +openfabric_fabric: test2 + hello_interval 4 + ip_prefix 192.168.1.0/24 + +openfabric_node: test1_pve + interfaces name=ens20,hello_multiplier=50 + interfaces name=ens19, + ip 192.168.2.8 + +openfabric_node: test1_pve1 + interfaces name=ens19 + ip 192.168.2.9 + +openfabric_node: test2_pve + interfaces name=ens22,hello_multiplier=50 + interfaces name=ens21 + ip 192.168.1.8 + +openfabric_node: test2_pve1 + interfaces name=ens21 + ip 192.168.1.9 diff --git a/proxmox-ve-config/tests/fabric/cfg/openfabric_same_net_on_same_node/fabrics.cfg b/proxmox-ve-config/tests/fabric/cfg/openfabric_same_net_on_same_node/fabrics.cfg new file mode 100644 index 0000000..dcfdfa7 --- /dev/null +++ b/proxmox-ve-config/tests/fabric/cfg/openfabric_same_net_on_same_node/fabrics.cfg @@ -0,0 +1,25 @@ +openfabric_fabric: test1 + hello_interval 4 + ip_prefix 192.168.2.0/24 + +openfabric_fabric: test2 + hello_interval 4 + ip_prefix 192.168.1.0/24 + +openfabric_node: test1_pve + interfaces name=ens20,hello_multiplier=50 + interfaces name=ens19, + ip 192.168.2.8 + +openfabric_node: test1_pve1 + interfaces name=ens19 + ip 192.168.2.9 + +openfabric_node: test2_pve + interfaces name=ens22,hello_multiplier=50 + interfaces name=ens21 + ip 192.168.1.8 + +openfabric_node: test2_pve1 + interfaces name=ens21 + ip 192.168.1.9 diff --git a/proxmox-ve-config/tests/fabric/cfg/openfabric_verification_fail/fabrics.cfg b/proxmox-ve-config/tests/fabric/cfg/openfabric_verification_fail/fabrics.cfg new file mode 100644 index 0000000..5f26a9c --- /dev/null +++ b/proxmox-ve-config/tests/fabric/cfg/openfabric_verification_fail/fabrics.cfg @@ -0,0 +1,12 @@ +openfabric_fabric: uwu + ip_prefix 192.168.2.0/24 + +openfabric_node: uwu1_pve + interfaces name=ens20,hello_multiplier=50 + interfaces name=ens19 + ip 192.168.2.8 + +openfabric_node: uwu_pve1 + interfaces name=ens19 + interfaces name=ens20 + ip 192.168.2.9 diff --git a/proxmox-ve-config/tests/fabric/cfg/ospf_default/fabrics.cfg b/proxmox-ve-config/tests/fabric/cfg/ospf_default/fabrics.cfg new file mode 100644 index 0000000..8f2d054 --- /dev/null +++ b/proxmox-ve-config/tests/fabric/cfg/ospf_default/fabrics.cfg @@ -0,0 +1,13 @@ +ospf_fabric: test + area 0 + ip_prefix 10.10.10.10/24 + +ospf_node: test_pve + interfaces name=ens18,ip=4.4.4.4/24 + interfaces name=ens19 + ip 10.10.10.1 + +ospf_node: test_pve1 + interfaces name=ens19 + ip 10.10.10.2 + diff --git a/proxmox-ve-config/tests/fabric/cfg/ospf_loopback_prefix_fail/fabrics.cfg b/proxmox-ve-config/tests/fabric/cfg/ospf_loopback_prefix_fail/fabrics.cfg new file mode 100644 index 0000000..8e3b8ba --- /dev/null +++ b/proxmox-ve-config/tests/fabric/cfg/ospf_loopback_prefix_fail/fabrics.cfg @@ -0,0 +1,17 @@ +ospf_fabric: test + ip_prefix 192.168.2.0/16 + +ospf_node: test_pve + interfaces name=ens20 + interfaces name=ens19 + ip 192.168.2.8 + +ospf_node: test_pve1 + interfaces name=ens19 + interfaces name=ens20 + ip 192.168.3.20 + +ospf_node: test_pve2 + interfaces name=ens19,ip=3.3.3.2/31 + interfaces name=ens20,ip=3.3.3.4/31 + ip 192.169.2.10 diff --git a/proxmox-ve-config/tests/fabric/cfg/ospf_multi_fabric/fabrics.cfg b/proxmox-ve-config/tests/fabric/cfg/ospf_multi_fabric/fabrics.cfg new file mode 100644 index 0000000..36dd573 --- /dev/null +++ b/proxmox-ve-config/tests/fabric/cfg/ospf_multi_fabric/fabrics.cfg @@ -0,0 +1,25 @@ +ospf_fabric: test + area 0 + ip_prefix 192.168.2.0/24 + +ospf_fabric: ceph + area 1 + ip_prefix 192.168.1.0/24 + +ospf_node: test_pve + interfaces name=ens20, + interfaces name=ens19,ip=3.3.3.4/31 + ip 192.168.2.8 + +ospf_node: test_pve1 + interfaces name=ens19 + ip 192.168.2.9 + +ospf_node: ceph_pve + interfaces name=ens22 + interfaces name=ens21 + ip 192.168.1.8 + +ospf_node: ceph_pve1 + interfaces name=ens21 + ip 192.168.1.9 diff --git a/proxmox-ve-config/tests/fabric/cfg/ospf_verification_fail/fabrics.cfg b/proxmox-ve-config/tests/fabric/cfg/ospf_verification_fail/fabrics.cfg new file mode 100644 index 0000000..d1a4509 --- /dev/null +++ b/proxmox-ve-config/tests/fabric/cfg/ospf_verification_fail/fabrics.cfg @@ -0,0 +1,13 @@ +ospf_fabric: test + area 0 + ip_prefix 10.10.10.0/24 + +ospf_node: test_pve + interfaces name=dummy0 + interfaces name=ens18 + ip 10.10.10.1 + +ospf_node: test1_pve1 + interfaces name=dummy0 + interfaces name=ens19 + ip 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 0000000..93404b8 --- /dev/null +++ b/proxmox-ve-config/tests/fabric/helper.rs @@ -0,0 +1,43 @@ +#[allow(unused_macros)] +macro_rules! get_fabrics_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}/fabrics.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_fabrics_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 0000000..47bbbeb --- /dev/null +++ b/proxmox-ve-config/tests/fabric/main.rs @@ -0,0 +1,141 @@ +#![cfg(feature = "frr")] +use proxmox_frr::serializer::dump; +use proxmox_ve_config::sdn::{ + fabric::{section_config::node::NodeId, FabricConfig}, + frr::FrrConfigBuilder, +}; + +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}/fabrics.cfg" files. + * With the `helper::reference_name!("<hostname>")` macro you can get the snapshot file of the + * function for this specific hostname. + */ + +#[test] +fn openfabric_default() { + let config = FabricConfig::parse_section_config(helper::get_fabrics_config!()).unwrap(); + + let mut frr_config = FrrConfigBuilder::default() + .add_fabrics(config.clone()) + .build(NodeId::from_string("pve".to_owned()).expect("invalid nodeid")) + .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(NodeId::from_string("pve1".to_owned()).expect("invalid nodeid")) + .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 config = FabricConfig::parse_section_config(helper::get_fabrics_config!()).unwrap(); + + let mut frr_config = FrrConfigBuilder::default() + .add_fabrics(config.clone()) + .build(NodeId::from_string("pve".to_owned()).expect("invalid nodeid")) + .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(NodeId::from_string("pve1".to_owned()).expect("invalid nodeid")) + .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 = FabricConfig::parse_section_config(helper::get_fabrics_config!()); + assert!(result.is_err()); +} + +#[test] +fn ospf_verification_fail() { + let result = FabricConfig::parse_section_config(helper::get_fabrics_config!()); + assert!(result.is_err()); +} + +#[test] +fn openfabric_loopback_prefix_fail() { + let result = FabricConfig::parse_section_config(helper::get_fabrics_config!()); + assert!(result.is_err()); +} + +#[test] +fn ospf_loopback_prefix_fail() { + let result = FabricConfig::parse_section_config(helper::get_fabrics_config!()); + assert!(result.is_err()); +} + +#[test] +fn openfabric_multi_fabric() { + let config = FabricConfig::parse_section_config(helper::get_fabrics_config!()).unwrap(); + + let frr_config = FrrConfigBuilder::default() + .add_fabrics(config) + .build(NodeId::from_string("pve1".to_owned()).expect("invalid nodeid")) + .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 config = FabricConfig::parse_section_config(helper::get_fabrics_config!()).unwrap(); + + let frr_config = FrrConfigBuilder::default() + .add_fabrics(config) + .build(NodeId::from_string("pve1".to_owned()).expect("invalid nodeid")) + .expect("error building frr config"); + + let output = dump(&frr_config).expect("error dumping stuff"); + + insta::assert_snapshot!(helper::reference_name!("pve1"), output); +} + +#[test] +fn openfabric_dualstack() { + let config = FabricConfig::parse_section_config(helper::get_fabrics_config!()).unwrap(); + + let frr_config = FrrConfigBuilder::default() + .add_fabrics(config) + .build(NodeId::from_string("pve".to_owned()).expect("invalid nodeid")) + .expect("error building frr config"); + + let output = dump(&frr_config).expect("error dumping stuff"); + + insta::assert_snapshot!(helper::reference_name!("pve"), output); +} + +#[test] +fn openfabric_ipv6_only() { + let config = FabricConfig::parse_section_config(helper::get_fabrics_config!()).unwrap(); + + let frr_config = FrrConfigBuilder::default() + .add_fabrics(config) + .build(NodeId::from_string("pve".to_owned()).expect("invalid nodeid")) + .expect("error building frr config"); + + let output = dump(&frr_config).expect("error dumping stuff"); + + insta::assert_snapshot!(helper::reference_name!("pve"), output); +} 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 0000000..98eb504 --- /dev/null +++ b/proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_default_pve.snap @@ -0,0 +1,34 @@ +--- +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 hello-interval 4 +exit +! +interface ens20 + ip router openfabric uwu + openfabric hello-interval 4 + openfabric hello-multiplier 50 +exit +! +access-list pve_openfabric_uwu_ips permit 192.168.2.0/24 +! +route-map pve_openfabric permit 100 + match ip address pve_openfabric_uwu_ips + set src 192.168.2.8 +exit +! +ip protocol openfabric route-map pve_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 0000000..4453ac4 --- /dev/null +++ b/proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_default_pve1.snap @@ -0,0 +1,33 @@ +--- +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 pve_openfabric_uwu_ips permit 192.168.2.0/24 +! +route-map pve_openfabric permit 100 + match ip address pve_openfabric_uwu_ips + set src 192.168.2.9 +exit +! +ip protocol openfabric route-map pve_openfabric +! diff --git a/proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_dualstack_pve.snap b/proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_dualstack_pve.snap new file mode 100644 index 0000000..48ac909 --- /dev/null +++ b/proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_dualstack_pve.snap @@ -0,0 +1,46 @@ +--- +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 + ipv6 router openfabric uwu + ip router openfabric uwu + openfabric passive +exit +! +interface ens19 + ipv6 router openfabric uwu + ip router openfabric uwu + openfabric hello-interval 4 +exit +! +interface ens20 + ipv6 router openfabric uwu + ip router openfabric uwu + openfabric hello-interval 4 + openfabric hello-multiplier 50 +exit +! +access-list pve_openfabric_uwu_ips permit 192.168.2.0/24 +! +ipv6 access-list pve_openfabric_uwu_ip6s permit 2001:db8::/64 +! +route-map pve_openfabric permit 100 + match ip address pve_openfabric_uwu_ips + set src 192.168.2.8 +exit +! +route-map pve_openfabric6 permit 110 + match ipv6 address pve_openfabric_uwu_ip6s + set src 2001:db8::1 +exit +! +ip protocol openfabric route-map pve_openfabric +! +ipv6 protocol openfabric route-map pve_openfabric6 +! diff --git a/proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_ipv6_only_pve.snap b/proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_ipv6_only_pve.snap new file mode 100644 index 0000000..d7ab1d7 --- /dev/null +++ b/proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_ipv6_only_pve.snap @@ -0,0 +1,34 @@ +--- +source: proxmox-ve-config/tests/fabric/main.rs +expression: output +snapshot_kind: text +--- +router openfabric uwu + net 49.0001.0000.0000.000a.00 +exit +! +interface dummy_uwu + ipv6 router openfabric uwu + openfabric passive +exit +! +interface ens19 + ipv6 router openfabric uwu + openfabric hello-interval 4 +exit +! +interface ens20 + ipv6 router openfabric uwu + openfabric hello-interval 4 + openfabric hello-multiplier 50 +exit +! +ipv6 access-list pve_openfabric_uwu_ip6s permit a:b::/75 +! +route-map pve_openfabric6 permit 100 + match ipv6 address pve_openfabric_uwu_ip6s + set src a:b::a +exit +! +ipv6 protocol openfabric route-map pve_openfabric6 +! 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 0000000..ad6c6db --- /dev/null +++ b/proxmox-ve-config/tests/fabric/snapshots/fabric__openfabric_multi_fabric_pve1.snap @@ -0,0 +1,49 @@ +--- +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 ens21 + ip router openfabric test2 + openfabric hello-interval 4 +exit +! +access-list pve_openfabric_test1_ips permit 192.168.2.0/24 +! +access-list pve_openfabric_test2_ips permit 192.168.1.0/24 +! +route-map pve_openfabric permit 100 + match ip address pve_openfabric_test1_ips + set src 192.168.2.9 +exit +! +route-map pve_openfabric permit 110 + match ip address pve_openfabric_test2_ips + set src 192.168.1.9 +exit +! +ip protocol openfabric route-map pve_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 0000000..a303f31 --- /dev/null +++ b/proxmox-ve-config/tests/fabric/snapshots/fabric__ospf_default_pve.snap @@ -0,0 +1,32 @@ +--- +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 pve_ospf_test_ips permit 10.10.10.10/24 +! +route-map pve_ospf permit 100 + match ip address pve_ospf_test_ips + set src 10.10.10.1 +exit +! +ip protocol ospf route-map pve_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 0000000..46c30b2 --- /dev/null +++ b/proxmox-ve-config/tests/fabric/snapshots/fabric__ospf_default_pve1.snap @@ -0,0 +1,28 @@ +--- +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 pve_ospf_test_ips permit 10.10.10.10/24 +! +route-map pve_ospf permit 100 + match ip address pve_ospf_test_ips + set src 10.10.10.2 +exit +! +ip protocol ospf route-map pve_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 0000000..1d2a7c3 --- /dev/null +++ b/proxmox-ve-config/tests/fabric/snapshots/fabric__ospf_multi_fabric_pve1.snap @@ -0,0 +1,45 @@ +--- +source: proxmox-ve-config/tests/fabric/main.rs +expression: output +snapshot_kind: text +--- +router ospf + ospf router-id 192.168.1.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 ens21 + ip ospf area 1 + ip ospf network point-to-point +exit +! +access-list pve_ospf_ceph_ips permit 192.168.1.0/24 +! +access-list pve_ospf_test_ips permit 192.168.2.0/24 +! +route-map pve_ospf permit 100 + match ip address pve_ospf_ceph_ips + set src 192.168.1.9 +exit +! +route-map pve_ospf permit 110 + match ip address pve_ospf_test_ips + set src 192.168.2.9 +exit +! +ip protocol ospf route-map pve_ospf +! -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel