From: Gabriel Goller <g.goller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-network 11/15] sdn: always generate EVPN zone VRFs
Date: Fri, 21 Aug 2026 16:03:55 +0200 [thread overview]
Message-ID: <20260821140404.322081-12-g.goller@proxmox.com> (raw)
In-Reply-To: <20260821140404.322081-1-g.goller@proxmox.com>
Move per-zone interface generation into the zone plugin API and use it for
EVPN zones. This creates the EVPN VRF even when the zone has no VNets
-- previously the VRF was only created when at least one VNet existed on
the zone.
Keep the unreachable default route handling on the VRF device. Exit
nodes remove that route, while other nodes install it. Add a test for an
empty EVPN zone.
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
src/PVE/Network/SDN/Zones.pm | 6 ++--
src/PVE/Network/SDN/Zones/EvpnPlugin.pm | 35 +++++++++++--------
src/PVE/Network/SDN/Zones/Plugin.pm | 6 ++++
.../evpn/vrf-empty/expected_sdn_interfaces | 6 ++++
src/test/zones/evpn/vrf-empty/interfaces | 2 ++
src/test/zones/evpn/vrf-empty/sdn_config | 13 +++++++
6 files changed, 50 insertions(+), 18 deletions(-)
create mode 100644 src/test/zones/evpn/vrf-empty/expected_sdn_interfaces
create mode 100644 src/test/zones/evpn/vrf-empty/interfaces
create mode 100644 src/test/zones/evpn/vrf-empty/sdn_config
diff --git a/src/PVE/Network/SDN/Zones.pm b/src/PVE/Network/SDN/Zones.pm
index 893ec436d536..ad23cee4c292 100644
--- a/src/PVE/Network/SDN/Zones.pm
+++ b/src/PVE/Network/SDN/Zones.pm
@@ -127,12 +127,10 @@ sub generate_etc_network_config {
for my $zone_id (sort keys %$zone_ids) {
my $plugin_config = $zone_ids->{$zone_id};
- next if $plugin_config->{type} ne 'simple';
next if defined($plugin_config->{nodes}) && !$plugin_config->{nodes}->{$nodename};
- PVE::Network::SDN::Zones::SimplePlugin->generate_zone_config(
- $plugin_config, $zone_id, $config,
- );
+ my $plugin = PVE::Network::SDN::Zones::Plugin->lookup($plugin_config->{type});
+ $plugin->generate_zone_config($plugin_config, $zone_id, $config);
}
for my $id (sort keys %$vnet_ids) {
diff --git a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
index 0e79707c3746..4c019071ecce 100644
--- a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
+++ b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
@@ -129,6 +129,25 @@ sub options {
}
# Plugin implementation
+sub generate_zone_config {
+ my ($class, $plugin_config, $zone_id, $config) = @_;
+
+ my $vrf_iface = "vrf_$zone_id";
+ my $local_node = PVE::INotify::nodename();
+ my $is_evpn_gateway =
+ $plugin_config->{exitnodes} && $plugin_config->{exitnodes}->{$local_node};
+ my $route_action = $is_evpn_gateway ? 'del' : 'add';
+
+ if (!defined($config->{$vrf_iface})) {
+ $config->{$vrf_iface} = [
+ 'vrf-table auto',
+ "post-up ip route $route_action vrf $vrf_iface unreachable default metric 4278198272",
+ ];
+ }
+
+ return $config;
+}
+
sub generate_sdn_config {
my (
$class,
@@ -209,7 +228,8 @@ sub generate_sdn_config {
die "neither fabric nor peers configured for EVPN controller $controller->{id}";
}
- my $is_evpn_gateway = $plugin_config->{'exitnodes'}->{$local_node};
+ my $is_evpn_gateway =
+ $plugin_config->{exitnodes} && $plugin_config->{exitnodes}->{$local_node};
my $exitnodes_local_routing = $plugin_config->{'exitnodes-local-routing'};
my $mtu = 1450;
@@ -308,19 +328,6 @@ sub generate_sdn_config {
push(@{ $config->{$vnetid} }, @iface_config) if !$config->{$vnetid};
if ($vrf_iface) {
- #vrf interface
- @iface_config = ();
- push @iface_config, "vrf-table auto";
- if (!$is_evpn_gateway) {
- push @iface_config,
- "post-up ip route add vrf $vrf_iface unreachable default metric 4278198272";
- } else {
- push @iface_config,
- "post-up ip route del vrf $vrf_iface unreachable default metric 4278198272";
- }
-
- push(@{ $config->{$vrf_iface} }, @iface_config) if !$config->{$vrf_iface};
-
if ($vrfvxlan) {
#l3vni vxlan interface
my $iface_vrf_vxlan = "vrfvx_$zoneid";
diff --git a/src/PVE/Network/SDN/Zones/Plugin.pm b/src/PVE/Network/SDN/Zones/Plugin.pm
index 74a3384cd7ae..5a752a0545f6 100644
--- a/src/PVE/Network/SDN/Zones/Plugin.pm
+++ b/src/PVE/Network/SDN/Zones/Plugin.pm
@@ -100,6 +100,12 @@ sub encode_value {
return $value;
}
+sub generate_zone_config {
+ my ($class, $plugin_config, $zone_id, $config) = @_;
+
+ return $config;
+}
+
sub generate_sdn_config {
my (
$class,
diff --git a/src/test/zones/evpn/vrf-empty/expected_sdn_interfaces b/src/test/zones/evpn/vrf-empty/expected_sdn_interfaces
new file mode 100644
index 000000000000..f78a7d21782c
--- /dev/null
+++ b/src/test/zones/evpn/vrf-empty/expected_sdn_interfaces
@@ -0,0 +1,6 @@
+#version:1
+
+auto vrf_myzone
+iface vrf_myzone
+ vrf-table auto
+ post-up ip route add vrf vrf_myzone unreachable default metric 4278198272
diff --git a/src/test/zones/evpn/vrf-empty/interfaces b/src/test/zones/evpn/vrf-empty/interfaces
new file mode 100644
index 000000000000..f1bd92ed2b43
--- /dev/null
+++ b/src/test/zones/evpn/vrf-empty/interfaces
@@ -0,0 +1,2 @@
+auto lo
+iface lo inet loopback
diff --git a/src/test/zones/evpn/vrf-empty/sdn_config b/src/test/zones/evpn/vrf-empty/sdn_config
new file mode 100644
index 000000000000..00c1c724b95e
--- /dev/null
+++ b/src/test/zones/evpn/vrf-empty/sdn_config
@@ -0,0 +1,13 @@
+{
+ version => 1,
+ vnets => { ids => {} },
+ zones => {
+ ids => {
+ myzone => {
+ type => "evpn",
+ controller => "evpnctl",
+ "vrf-vxlan" => 1000,
+ },
+ },
+ },
+}
--
2.47.3
next prev parent reply other threads:[~2026-08-21 14:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 14:03 [RFC manager/network/proxmox{-ve-rs,-perl-rs} 00/15] SDN VRF support Gabriel Goller
2026-08-21 14:03 ` [PATCH proxmox-ve-rs 01/15] frr: add VRF-aware OSPF rendering Gabriel Goller
2026-08-21 14:03 ` [PATCH proxmox-ve-rs 02/15] sdn: add zone references to OSPF and BGP fabrics Gabriel Goller
2026-08-21 14:03 ` [PATCH proxmox-ve-rs 03/15] sdn: generate fabric routing configuration in zone VRFs Gabriel Goller
2026-08-21 14:03 ` [PATCH proxmox-ve-rs 04/15] sdn: fix VRF route-map scoping and zone ID validation Gabriel Goller
2026-08-21 14:03 ` [PATCH proxmox-ve-rs 05/15] tests: fabrics: add test for fabrics in VRFs Gabriel Goller
2026-08-21 14:03 ` [PATCH proxmox-perl-rs 06/15] pve-rs: fabrics: assign network interfaces to configured VRFs Gabriel Goller
2026-08-21 14:03 ` [PATCH proxmox-perl-rs 07/15] pve-rs: fabrics: make per-fabric status queries VRF-aware Gabriel Goller
2026-08-21 14:03 ` [PATCH proxmox-perl-rs 08/15] pve-rs: fabrics: include VRF routes in aggregate status Gabriel Goller
2026-08-21 14:03 ` [PATCH pve-network 09/15] sdn: add optional VRFs for simple zones Gabriel Goller
2026-08-21 14:03 ` [PATCH pve-network 10/15] sdn: allow fabrics to use simple zone VRFs Gabriel Goller
2026-08-21 14:03 ` Gabriel Goller [this message]
2026-08-21 14:03 ` [PATCH pve-network 12/15] api: sdn: allow EVPN zones as fabric VRFs Gabriel Goller
2026-08-21 14:03 ` [PATCH pve-network 13/15] api: sdn: disallow BGP fabrics in EVPN zone VRFs Gabriel Goller
2026-08-21 14:03 ` [PATCH pve-manager 14/15] ui: sdn: add VRF zone selection for fabrics Gabriel Goller
2026-08-21 14:03 ` [PATCH pve-manager 15/15] ui: sdn: expose EVPN zones as fabric VRFs Gabriel Goller
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=20260821140404.322081-12-g.goller@proxmox.com \
--to=g.goller@proxmox.com \
--cc=pve-devel@lists.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.