From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 9560B1FF13F for ; Thu, 26 Mar 2026 16:15:13 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6DF6D17EE7; Thu, 26 Mar 2026 16:15:34 +0100 (CET) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 26 Mar 2026 16:15:25 +0100 Message-Id: Subject: Re: [PATCH proxmox-ve-rs v7 02/21] frr: add proxmox-frr-templates package that contains templates To: "Gabriel Goller" X-Mailer: aerc 0.20.0 References: <20260323134934.243110-1-g.goller@proxmox.com> <20260323134934.243110-3-g.goller@proxmox.com> In-Reply-To: <20260323134934.243110-3-g.goller@proxmox.com> From: "Shannon Sterz" X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1774538076545 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.122 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 KAM_SHORT 0.001 Use of a URL Shortener for very short URL 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: QIZYDZBUXVX3YIHJSPJUYDSIOG56STQE X-Message-ID-Hash: QIZYDZBUXVX3YIHJSPJUYDSIOG56STQE X-MailFrom: s.sterz@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 CC: pve-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Mon Mar 23, 2026 at 2:48 PM CET, Gabriel Goller wrote: > This debian package contains the jinja template files used to generate > the frr config. Currently only the fabrics template files are here, the > rest will be added in later commits. When installing this package the > templates will be installed to `/usr/share/proxmox-frr/templates/`. > `proxmox-frr` will then use `include_str!` to embed the templates into > the binary. > > This package will only be published to the `devel` channel. > > Reviewed-by: Hannes Laimer > Tested-by: Stefan Hanreich > Co-authored-by: Stefan Hanreich > Signed-off-by: Gabriel Goller > --- > Makefile | 8 +++ > proxmox-frr-templates/.gitignore | 1 + > proxmox-frr-templates/Makefile | 50 +++++++++++++++++++ > proxmox-frr-templates/debian/changelog | 5 ++ > proxmox-frr-templates/debian/control | 17 +++++++ > proxmox-frr-templates/debian/copyright | 18 +++++++ > .../debian/proxmox-frr-templates.install | 1 + > proxmox-frr-templates/debian/rules | 5 ++ > .../templates/access_lists.jinja | 6 +++ > proxmox-frr-templates/templates/fabricd.jinja | 29 +++++++++++ > .../templates/frr.conf.jinja | 5 ++ > .../templates/interface.jinja | 12 +++++ > proxmox-frr-templates/templates/ospfd.jinja | 18 +++++++ > .../templates/protocol_routemaps.jinja | 10 ++++ > .../templates/route_maps.jinja | 22 ++++++++ > 15 files changed, 207 insertions(+) > create mode 100644 proxmox-frr-templates/.gitignore > create mode 100644 proxmox-frr-templates/Makefile > create mode 100644 proxmox-frr-templates/debian/changelog > create mode 100644 proxmox-frr-templates/debian/control > create mode 100644 proxmox-frr-templates/debian/copyright > create mode 100644 proxmox-frr-templates/debian/proxmox-frr-templates.in= stall > create mode 100755 proxmox-frr-templates/debian/rules > create mode 100644 proxmox-frr-templates/templates/access_lists.jinja > create mode 100644 proxmox-frr-templates/templates/fabricd.jinja > create mode 100644 proxmox-frr-templates/templates/frr.conf.jinja > create mode 100644 proxmox-frr-templates/templates/interface.jinja > create mode 100644 proxmox-frr-templates/templates/ospfd.jinja > create mode 100644 proxmox-frr-templates/templates/protocol_routemaps.ji= nja > create mode 100644 proxmox-frr-templates/templates/route_maps.jinja > > diff --git a/Makefile b/Makefile > index 812bc8e691bf..58e4475161a1 100644 > --- a/Makefile > +++ b/Makefile > @@ -2,6 +2,8 @@ > > CRATES !=3D echo proxmox-*/Cargo.toml | sed -e 's|/Cargo.toml||g' > > +BUILDDIR =3D build > + > # By default we just run checks: > .PHONY: all > all: check > @@ -25,6 +27,12 @@ dinstall: > $(MAKE) deb > sudo -k dpkg -i build/librust-*.deb > > +proxmox-frr-templates-deb: > + mkdir -p "${BUILDDIR}/proxmox-frr-templates" > + cp -r proxmox-frr-templates/* "${BUILDDIR}/proxmox-frr-templates" > + cd "${BUILDDIR}/proxmox-frr-templates"; dpkg-buildpackage -b -uc -us > + touch $@ > + > %-deb: > ./build.sh $* > touch $@ > diff --git a/proxmox-frr-templates/.gitignore b/proxmox-frr-templates/.gi= tignore > new file mode 100644 > index 000000000000..796b96d1c402 > --- /dev/null > +++ b/proxmox-frr-templates/.gitignore > @@ -0,0 +1 @@ > +/build > diff --git a/proxmox-frr-templates/Makefile b/proxmox-frr-templates/Makef= ile > new file mode 100644 > index 000000000000..0b010ed71e7a > --- /dev/null > +++ b/proxmox-frr-templates/Makefile > @@ -0,0 +1,50 @@ > +include /usr/share/dpkg/default.mk > + > +PACKAGE=3Dproxmox-frr-templates > + > +GITVERSION:=3D$(shell git rev-parse HEAD) > + > +BUILDDIR ?=3D build/$(PACKAGE)-$(DEB_VERSION) > +DSC=3D$(PACKAGE)_$(DEB_VERSION).dsc > + > +PVE_DEB=3D$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION)_all.deb > + > +DEBS=3D$(PVE_DEB) > + > +all: deb > +deb: $(DEBS) > + > +$(BUILDDIR): > + rm -rf $(BUILDDIR) > + mkdir -p $(BUILDDIR) > + cp -a debian $(BUILDDIR)/ > + cp -a templates $(BUILDDIR)/ || true > + echo "git clone git://git.proxmox.com/git/proxmox-ve-rs.git\\ngit check= out $(GITVERSION)" > $(BUILDDIR)/debian/SOURCE > + > +$(PVE_DEB): $(BUILDDIR) > + cd $(BUILDDIR); dpkg-buildpackage -b -uc -us > + lintian build/$(DEBS) > + > +dsc: $(DSC) > + $(MAKE) clean > + $(MAKE) $(DSC) > + lintian build/$(DSC) > + > +$(DSC): $(BUILDDIR) > + cd $(BUILDDIR); dpkg-buildpackage -S -uc -us > + > +sbuild: $(DSC) > + sbuild build/$(DSC) > + > +.PHONY: upload > +upload: UPLOAD_DIST ?=3D $(DEB_DISTRIBUTION) > +upload: $(DEBS) > + tar cf - build/$(DEBS)|ssh repoman@repo.proxmox.com -- upload --product= devel --dist $(UPLOAD_DIST) > + > +.PHONY: distclean > +distclean: clean > + > +.PHONY: clean > +clean: > + rm -rf build > + > diff --git a/proxmox-frr-templates/debian/changelog b/proxmox-frr-templat= es/debian/changelog > new file mode 100644 > index 000000000000..e70d0e12dfa8 > --- /dev/null > +++ b/proxmox-frr-templates/debian/changelog > @@ -0,0 +1,5 @@ > +proxmox-frr-templates (0.1.0-1) trixie; urgency=3Dmedium > + > + * Initial release. > + > + -- Proxmox Support Team Wed, 21 Jan 2026 15:53:5= 1 +0100 > diff --git a/proxmox-frr-templates/debian/control b/proxmox-frr-templates= /debian/control > new file mode 100644 > index 000000000000..d144d3f5f6b0 > --- /dev/null > +++ b/proxmox-frr-templates/debian/control > @@ -0,0 +1,17 @@ > +Source: proxmox-frr-templates > +Section: admin > +Priority: important > +Maintainer: Proxmox Support Team > +Standards-Version: 4.7.2 > +Rules-Requires-Root: no > +Build-Depends: debhelper-compat (=3D 13) > +Vcs-Git: git://git.proxmox.com/git/proxmox-ve-rs.git > +Vcs-Browser: https://git.proxmox.com/?p=3Dproxmox-ve-rs.git > +Homepage: https://proxmox.com > + > +Package: proxmox-frr-templates > +Architecture: all > +Depends: ${misc:Depends} > +Description: Provides template files which are used by the Proxmox VE SD= N stack > + to generate FRR config files. > + > diff --git a/proxmox-frr-templates/debian/copyright b/proxmox-frr-templat= es/debian/copyright > new file mode 100644 > index 000000000000..1ea8a56b4f58 > --- /dev/null > +++ b/proxmox-frr-templates/debian/copyright > @@ -0,0 +1,18 @@ > +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.= 0/ > + > +Files: > + * > +Copyright: 2019 - 2025 Proxmox Server Solutions GmbH tiny nit: but it's 2026 already ;) > +License: AGPL-3.0-or-later > + This program is free software: you can redistribute it and/or modify it= under > + the terms of the GNU Affero General Public License as published by the = Free > + Software Foundation, either version 3 of the License, or (at your optio= n) any > + later version. > + . > + This program is distributed in the hope that it will be useful, but WIT= HOUT > + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or F= ITNESS > + FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for= more > + details. > + . > + You should have received a copy of the GNU Affero General Public Licens= e along > + with this program. If not, see . > diff --git a/proxmox-frr-templates/debian/proxmox-frr-templates.install b= /proxmox-frr-templates/debian/proxmox-frr-templates.install > new file mode 100644 > index 000000000000..a8e3df9d7260 > --- /dev/null > +++ b/proxmox-frr-templates/debian/proxmox-frr-templates.install > @@ -0,0 +1 @@ > +templates/* /usr/share/proxmox-frr/templates > diff --git a/proxmox-frr-templates/debian/rules b/proxmox-frr-templates/d= ebian/rules > new file mode 100755 > index 000000000000..abde6ef2247c > --- /dev/null > +++ b/proxmox-frr-templates/debian/rules > @@ -0,0 +1,5 @@ > +#!/usr/bin/make -f > + > +%: > + dh $@ > + > diff --git a/proxmox-frr-templates/templates/access_lists.jinja b/proxmox= -frr-templates/templates/access_lists.jinja > new file mode 100644 > index 000000000000..25f27a293529 > --- /dev/null > +++ b/proxmox-frr-templates/templates/access_lists.jinja > @@ -0,0 +1,6 @@ > +{% for access_list_name, access_list in access_lists | items %} > +! > +{% for rule in access_list %} > +{{ "ipv6 " if rule.is_ipv6 }}access-list {{ access_list_name }} {{ ("seq= " ~ rule.seq ~ " ") if rule.seq }}{{ rule.action }} {{ rule.network }} > +{% endfor%} > +{% endfor %} > diff --git a/proxmox-frr-templates/templates/fabricd.jinja b/proxmox-frr-= templates/templates/fabricd.jinja > new file mode 100644 > index 000000000000..068959a97e0e > --- /dev/null > +++ b/proxmox-frr-templates/templates/fabricd.jinja > @@ -0,0 +1,29 @@ > +{% from "interface.jinja" import interface %} > +{% for router_name, router_config in openfabric.router|items %} > +! > +router openfabric {{ router_name }} > + net {{ router_config.net }} > +exit > +{% endfor %} > +{% for interface_name, interface_config in openfabric.interfaces|items %= } > +{% call interface(interface_name, interface_config.addresses_v4, interfa= ce_config.addresses_v6) %} > +{% if interface_config.fabric_id and interface_config.is_ipv4 %} > + ip router openfabric {{ interface_config.fabric_id }} > +{% endif %} > +{% if interface_config.fabric_id and interface_config.is_ipv6 %} > + ipv6 router openfabric {{ interface_config.fabric_id }} > +{% endif %} > +{% if interface_config.passive %} > + openfabric passive > +{% endif %} > +{% if interface_config.hello_interval %} > + openfabric hello-interval {{ interface_config.hello_interval}} > +{% endif %} > +{% if interface_config.hello_multiplier %} > + openfabric hello-multiplier {{ interface_config.hello_multiplier}} > +{% endif %} > +{% if interface_config.csnp_interval %} > + openfabric csnp-interval {{ interface_config.csnp_interval}} > +{% endif %} > +{%- endcall %} > +{%- endfor %} > diff --git a/proxmox-frr-templates/templates/frr.conf.jinja b/proxmox-frr= -templates/templates/frr.conf.jinja > new file mode 100644 > index 000000000000..8458c6a61112 > --- /dev/null > +++ b/proxmox-frr-templates/templates/frr.conf.jinja > @@ -0,0 +1,5 @@ > +{% include "fabricd.jinja" %} > +{% include "ospfd.jinja" %} > +{% include "access_lists.jinja" %} > +{% include "route_maps.jinja" %} > +{% include "protocol_routemaps.jinja" %} > diff --git a/proxmox-frr-templates/templates/interface.jinja b/proxmox-fr= r-templates/templates/interface.jinja > new file mode 100644 > index 000000000000..4c5014844fc8 > --- /dev/null > +++ b/proxmox-frr-templates/templates/interface.jinja > @@ -0,0 +1,12 @@ > +{% macro interface(name, addresses_v4, addresses_v6) %} > +! > +interface {{ name }} > +{% for address in addresses_v6 %} > + ipv6 address {{address}} > +{% endfor %} > +{% for address in addresses_v4 %} > + ip address {{address}} > +{% endfor %} > +{{ caller() -}} > +exit > +{% endmacro %} > diff --git a/proxmox-frr-templates/templates/ospfd.jinja b/proxmox-frr-te= mplates/templates/ospfd.jinja > new file mode 100644 > index 000000000000..0a59623de517 > --- /dev/null > +++ b/proxmox-frr-templates/templates/ospfd.jinja > @@ -0,0 +1,18 @@ > +{% from "interface.jinja" import interface %} > +{% if ospf.router %} > +! > +router ospf > + ospf router-id {{ ospf.router.router_id }} > +exit > +{% endif %} > +{% for interface_name, interface_config in ospf.interfaces|items %} > +{% call interface(interface_name, interface_config.addresses_v4, interfa= ce_config.addresses_v6) %} > + ip ospf area {{ interface_config.area }} > +{% if interface_config.passive %} > + ip ospf passive > +{% endif %} > +{% if interface_config.network_type %} > + ip ospf network {{ interface_config.network_type }} > +{% endif %} > +{% endcall %} > +{% endfor %} > diff --git a/proxmox-frr-templates/templates/protocol_routemaps.jinja b/p= roxmox-frr-templates/templates/protocol_routemaps.jinja > new file mode 100644 > index 000000000000..38c00b6407ee > --- /dev/null > +++ b/proxmox-frr-templates/templates/protocol_routemaps.jinja > @@ -0,0 +1,10 @@ > +{% for protocol_name, protocol_routemap in protocol_routemaps | items %} > +! > +{% if protocol_routemap.v4 %} > +ip protocol {{ protocol_name }} route-map {{ protocol_routemap.v4 }} > +{% endif %} > +{% if protocol_routemap.v6 %} > +! > +ipv6 protocol {{ protocol_name }} route-map {{ protocol_routemap.v6 }} > +{% endif %} > +{% endfor %} > diff --git a/proxmox-frr-templates/templates/route_maps.jinja b/proxmox-f= rr-templates/templates/route_maps.jinja > new file mode 100644 > index 000000000000..172c68290475 > --- /dev/null > +++ b/proxmox-frr-templates/templates/route_maps.jinja > @@ -0,0 +1,22 @@ > +{% for name, routemap_list in routemaps | items %} > +{% for routemap in routemap_list %} > +! > +route-map {{ name }} {{ routemap.action }} {{ routemap.seq }} > +{% for match in routemap.matches %} > +{% if match.value.list_type =3D=3D "prefixlist" %} > + match {{ match.protocol_type }} {{ match.match_type }} prefix-list {{ m= atch.value.list_name }} > +{% elif match.value.list_type =3D=3D "accesslist" %} > + match {{ match.protocol_type }} {{ match.match_type }} {{ match.value.l= ist_name }} > +{% elif match.match_type =3D=3D "next-hop" %} > + match {{ match.protocol_type }} next-hop {{ match.value }} > +{% endif %} > +{% endfor %} > +{% for set in routemap.sets %} > + set {{ set.set_type }} {{ set.value }} > +{% endfor %} > +{% for line in routemap.custom_frr_config %} > +{{ line }} > +{% endfor %} > +exit > +{% endfor %} > +{% endfor %}