From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id C0CC01FF142 for ; Mon, 02 Mar 2026 13:56:52 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A242A1F3FA; Mon, 2 Mar 2026 13:57:45 +0100 (CET) From: Gabriel Goller To: pve-devel@lists.proxmox.com Subject: [PATCH proxmox-ve-rs v2 6/8] frr: add isis configuration and templates Date: Mon, 2 Mar 2026 13:55:25 +0100 Message-ID: <20260302125701.196916-7-g.goller@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260302125701.196916-1-g.goller@proxmox.com> References: <20260302125701.196916-1-g.goller@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1772456205762 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.005 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: J2N47YKHWCRA3NHVUQANANNAN5EWNGOI X-Message-ID-Hash: J2N47YKHWCRA3NHVUQANANNAN5EWNGOI X-MailFrom: g.goller@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Add templates and rust configuration types to render configuration for the isis daemon. This allows us to generate the config in perl, then pass it to rust and then render the template in rust. Co-authored-by: Stefan Hanreich Signed-off-by: Gabriel Goller --- .../templates/frr.conf.jinja | 1 + proxmox-frr-templates/templates/isisd.jinja | 32 +++++++++++++ proxmox-frr/src/ser/isis.rs | 47 +++++++++++++++++++ proxmox-frr/src/ser/mod.rs | 12 +++++ proxmox-frr/src/ser/serializer.rs | 1 + 5 files changed, 93 insertions(+) create mode 100644 proxmox-frr-templates/templates/isisd.jinja create mode 100644 proxmox-frr/src/ser/isis.rs diff --git a/proxmox-frr-templates/templates/frr.conf.jinja b/proxmox-frr-templates/templates/frr.conf.jinja index 8458c6a61112..f8802f845332 100644 --- a/proxmox-frr-templates/templates/frr.conf.jinja +++ b/proxmox-frr-templates/templates/frr.conf.jinja @@ -1,3 +1,4 @@ +{% include "isisd.jinja" %} {% include "fabricd.jinja" %} {% include "ospfd.jinja" %} {% include "access_lists.jinja" %} diff --git a/proxmox-frr-templates/templates/isisd.jinja b/proxmox-frr-templates/templates/isisd.jinja new file mode 100644 index 000000000000..75f066166ad2 --- /dev/null +++ b/proxmox-frr-templates/templates/isisd.jinja @@ -0,0 +1,32 @@ +{% from "interface.jinja" import interface %} +{% for router_name, router_config in isis.router|items %} +! +router isis {{ router_name }} + net {{ router_config.net }} +{% if router_config.redistribute.ipv4_connected %} + redistribute ipv4 connected {{ router_config.redistribute.ipv4_connected }} +{% endif %} +{% if router_config.redistribute.ipv6_connected %} + redistribute ipv6 connected {{ router_config.redistribute.ipv6_connected }} +{% endif %} +{% if router_config.log_adjacency_changes %} + log-adjacency-changes +{% endif %} +{% for line in router_config.custom_frr_config %} +{{ line }} +{% endfor %} +exit +{% endfor %} +{% for interface_name, interface_config in isis.interfaces|items %} +{% call interface(interface_name, interface_config.addresses) %} +{% if interface_config.domain and interface_config.is_ipv4 %} + ip router isis {{ interface_config.domain }} +{% endif %} +{% if interface_config.domain and interface_config.is_ipv6 %} + ipv6 router isis {{ interface_config.domain }} +{% endif %} +{% for line in interface_config.custom_frr_config %} +{{ line }} +{% endfor %} +{% endcall %} +{% endfor %} diff --git a/proxmox-frr/src/ser/isis.rs b/proxmox-frr/src/ser/isis.rs new file mode 100644 index 000000000000..211c5b21e9e1 --- /dev/null +++ b/proxmox-frr/src/ser/isis.rs @@ -0,0 +1,47 @@ +use std::fmt::Debug; + +use proxmox_sdn_types::net::Net; +use serde::Deserialize; +use serde::Serialize; + +use crate::ser::FrrWord; + +#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)] +pub struct IsisRouterName(FrrWord); + +#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)] +pub enum IsisLevel { + #[serde(rename = "level-1")] + Level1, + #[serde(rename = "level-2")] + Level2, + #[serde(rename = "level-1-2")] + Level12, +} + +#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)] +pub struct Redistribute { + ipv4_connected: IsisLevel, + ipv6_connected: IsisLevel, +} + +#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)] +pub struct IsisRouter { + pub net: Net, + #[serde(default, deserialize_with = "proxmox_serde::perl::deserialize_bool")] + pub log_adjacency_changes: Option, + pub redistribute: Option, + #[serde(default)] + pub custom_frr_config: Vec, +} + +#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)] +pub struct IsisInterface { + pub domain: IsisRouterName, + #[serde(deserialize_with = "proxmox_serde::perl::deserialize_bool")] + pub is_ipv4: bool, + #[serde(deserialize_with = "proxmox_serde::perl::deserialize_bool")] + pub is_ipv6: bool, + #[serde(default)] + pub custom_frr_config: Vec, +} diff --git a/proxmox-frr/src/ser/mod.rs b/proxmox-frr/src/ser/mod.rs index 86813c7d6415..55bbe0522cf5 100644 --- a/proxmox-frr/src/ser/mod.rs +++ b/proxmox-frr/src/ser/mod.rs @@ -1,3 +1,4 @@ +pub mod isis; pub mod openfabric; pub mod ospf; pub mod route_map; @@ -178,6 +179,9 @@ pub struct FrrConfig { pub openfabric: OpenfabricFrrConfig, #[serde(default)] pub ospf: OspfFrrConfig, + #[serde(default)] + pub isis: IsisFrrConfig, + #[serde(default)] pub protocol_routemaps: BTreeMap, #[serde(default)] @@ -194,6 +198,14 @@ pub struct OpenfabricFrrConfig { pub interfaces: BTreeMap>, } +#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)] +pub struct IsisFrrConfig { + #[serde(default)] + pub router: BTreeMap, + #[serde(default)] + pub interfaces: BTreeMap>, +} + #[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)] pub struct OspfFrrConfig { #[serde(default)] diff --git a/proxmox-frr/src/ser/serializer.rs b/proxmox-frr/src/ser/serializer.rs index 51c46729c8ce..1f5f4897fea3 100644 --- a/proxmox-frr/src/ser/serializer.rs +++ b/proxmox-frr/src/ser/serializer.rs @@ -5,6 +5,7 @@ use crate::ser::FrrConfig; pub static TEMPLATES: phf::Map<&'static str, &'static str> = phf::phf_map! { "fabricd.jinja" => include_str!("/usr/share/proxmox-frr/templates/fabricd.jinja"), + "isisd.jinja" => include_str!("/usr/share/proxmox-frr/templates/isisd.jinja"), "ospfd.jinja" => include_str!("/usr/share/proxmox-frr/templates/ospfd.jinja"), "interface.jinja" => include_str!("/usr/share/proxmox-frr/templates/interface.jinja"), "access_lists.jinja" => include_str!("/usr/share/proxmox-frr/templates/access_lists.jinja"), -- 2.47.3