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
Cc: Wolfgang Bumiller <w.bumiller@proxmox.com>
Subject: [PATCH proxmox-ve-rs v8 06/21] frr: add isis configuration and templates
Date: Fri, 27 Mar 2026 16:01:09 +0100	[thread overview]
Message-ID: <20260327150127.545193-7-g.goller@proxmox.com> (raw)
In-Reply-To: <20260327150127.545193-1-g.goller@proxmox.com>

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.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
Co-authored-by: Stefan Hanreich <s.hanreich@proxmox.com>
Reviewed-by: Hannes Laimer <h.laimer@proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
---
 .../templates/frr.conf.jinja                  |  1 +
 proxmox-frr-templates/templates/isisd.jinja   | 34 ++++++++++++++
 proxmox-frr/src/ser/isis.rs                   | 47 +++++++++++++++++++
 proxmox-frr/src/ser/mod.rs                    | 12 +++++
 proxmox-frr/src/ser/serializer.rs             |  6 ++-
 5 files changed, 99 insertions(+), 1 deletion(-)
 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..e3c9292d575c
--- /dev/null
+++ b/proxmox-frr-templates/templates/isisd.jinja
@@ -0,0 +1,34 @@
+{% 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 %}
+{% 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 %}
+{% 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_v4, interface_config.addresses_v6) %}
+{% 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<bool>,
+    pub redistribute: Option<Redistribute>,
+    #[serde(default)]
+    pub custom_frr_config: Vec<String>,
+}
+
+#[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<String>,
+}
diff --git a/proxmox-frr/src/ser/mod.rs b/proxmox-frr/src/ser/mod.rs
index ef56d742857b..fd491c9a0390 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;
@@ -190,6 +191,9 @@ pub struct FrrConfig {
     pub openfabric: OpenfabricFrrConfig,
     #[serde(default)]
     pub ospf: OspfFrrConfig,
+    #[serde(default)]
+    pub isis: IsisFrrConfig,
+
     #[serde(default)]
     pub protocol_routemaps: BTreeMap<FrrProtocol, IpProtocolRouteMap>,
     #[serde(default)]
@@ -206,6 +210,14 @@ pub struct OpenfabricFrrConfig {
     pub interfaces: BTreeMap<InterfaceName, Interface<openfabric::OpenfabricInterface>>,
 }
 
+#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
+pub struct IsisFrrConfig {
+    #[serde(default)]
+    pub router: BTreeMap<isis::IsisRouterName, isis::IsisRouter>,
+    #[serde(default)]
+    pub interfaces: BTreeMap<InterfaceName, Interface<isis::IsisInterface>>,
+}
+
 #[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 52e3553f1c32..9b553486e5f1 100644
--- a/proxmox-frr/src/ser/serializer.rs
+++ b/proxmox-frr/src/ser/serializer.rs
@@ -5,11 +5,15 @@ use crate::ser::FrrConfig;
 use proxmox_sortable_macro::sortable;
 
 #[sortable]
-pub static TEMPLATES: [(&str, &str); 7] = sorted!([
+pub static TEMPLATES: [(&str, &str); 8] = sorted!([
     (
         "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"),
-- 
2.47.3





  parent reply	other threads:[~2026-03-27 15:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-27 15:01 [PATCH manager/network/proxmox{-ve-rs,-perl-rs} v8 00/21] Generate frr config using jinja templates and rust types Gabriel Goller
2026-03-27 15:01 ` [PATCH proxmox-ve-rs v8 01/21] ve-config: firewall: cargo fmt Gabriel Goller
2026-03-27 15:01 ` [PATCH proxmox-ve-rs v8 02/21] frr: add proxmox-frr-templates package that contains templates Gabriel Goller
2026-03-27 15:01 ` [PATCH proxmox-ve-rs v8 03/21] ve-config: remove FrrConfigBuilder struct Gabriel Goller
2026-03-27 15:01 ` [PATCH proxmox-ve-rs v8 04/21] sdn-types: support variable-length NET identifier Gabriel Goller
2026-03-27 15:01 ` [PATCH proxmox-ve-rs v8 05/21] frr: add template serializer and serialize fabrics using templates Gabriel Goller
2026-03-27 15:01 ` Gabriel Goller [this message]
2026-03-27 15:01 ` [PATCH proxmox-ve-rs v8 07/21] frr: support custom frr configuration lines Gabriel Goller
2026-03-27 15:01 ` [PATCH proxmox-ve-rs v8 08/21] frr: add bgp support with templates and serialization Gabriel Goller
2026-03-27 15:01 ` [PATCH proxmox-ve-rs v8 09/21] frr: enable minijinja strict undefined behavior mode Gabriel Goller
2026-03-27 15:01 ` [PATCH proxmox-perl-rs v8 11/21] sdn: add function to generate the frr config for all daemons Gabriel Goller
2026-03-27 15:01 ` [PATCH pve-network v8 12/21] tests: use Test::Differences to make test assertions Gabriel Goller
2026-03-27 15:01 ` [PATCH pve-network v8 13/21] test: add tests for frr.conf.local merging Gabriel Goller
2026-03-27 15:01 ` [PATCH pve-network v8 14/21] test: bgp: add some various integration tests Gabriel Goller
2026-03-27 15:01 ` [PATCH pve-network v8 15/21] sdn: write structured frr config that can be rendered using templates Gabriel Goller
2026-03-27 15:01 ` [PATCH pve-network v8 16/21] sdn: remove duplicate comment line '!' in frr config Gabriel Goller
2026-03-27 15:01 ` [PATCH pve-network v8 17/21] tests: rearrange some statements in the " Gabriel Goller
2026-03-27 15:01 ` [PATCH pve-network v8 18/21] sdn: adjust frr.conf.local merging to rust template types Gabriel Goller
2026-03-27 15:01 ` [PATCH pve-network v8 19/21] test: adjust frr_local_merge test for new template generation Gabriel Goller
2026-03-27 15:01 ` [PATCH pve-network v8 20/21] api: add dry-run endpoint for sdn apply to preview changes Gabriel Goller
2026-03-27 15:01 ` [PATCH pve-manager v8 21/21] sdn: add dry-run diff view for sdn apply Gabriel Goller
2026-03-28 16:55 ` applied: [PATCH manager/network/proxmox{-ve-rs,-perl-rs} v8 00/21] Generate frr config using jinja templates and rust types Thomas Lamprecht

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=20260327150127.545193-7-g.goller@proxmox.com \
    --to=g.goller@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=w.bumiller@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