all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-network v3 22/32] sdn: evpn: allow static routes
Date: Mon, 16 Nov 2026 17:11:42 +0100	[thread overview]
Message-ID: <20261116161154.343743-23-g.goller@proxmox.com> (raw)
In-Reply-To: <20261116161154.343743-1-g.goller@proxmox.com>

Allow EVPN zones to reach networks through a configured gateway or
interface, using the same route options as simple zones. Routes are
installed in the zone VRF on each node where the zone is enabled, and
can also use a next hop in another VRF.

Configuring a route does not enable static-route redistribution into
BGP. The unreachable default routes and exit-node behavior stay as they
are, so adding static routes does not change how other traffic leaves
the zone.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/PVE/API2/Network/SDN/Zones.pm             |  2 +-
 src/PVE/Network/SDN.pm                        |  5 +-
 src/PVE/Network/SDN/Zones/EvpnPlugin.pm       |  1 +
 src/test/run_test_static_routes.pl            | 47 +++++++++++++++++--
 .../expected_controller_config                |  6 +++
 .../zones/evpn/advertise_subnets/sdn_config   |  8 +++-
 6 files changed, 61 insertions(+), 8 deletions(-)

diff --git a/src/PVE/API2/Network/SDN/Zones.pm b/src/PVE/API2/Network/SDN/Zones.pm
index 8df1bf8527fd..25e0aed017dc 100644
--- a/src/PVE/API2/Network/SDN/Zones.pm
+++ b/src/PVE/API2/Network/SDN/Zones.pm
@@ -71,7 +71,7 @@ my $ZONE_PROPERTIES = {
     route => {
         type => 'array',
         optional => 1,
-        description => 'Static routes in the zone routing table. Simple zone only.',
+        description => 'Static routes in the zone routing table. Simple and EVPN zones only.',
         items => {
             type => 'string',
             format => 'pve-sdn-static-route',
diff --git a/src/PVE/Network/SDN.pm b/src/PVE/Network/SDN.pm
index 626fe7387f54..ea7372213394 100644
--- a/src/PVE/Network/SDN.pm
+++ b/src/PVE/Network/SDN.pm
@@ -132,8 +132,9 @@ sub running_config_has_frr {
     my $route_maps = $running_config->{'route-maps'}->{ids} // {};
     my $prefix_lists = $running_config->{'prefix-lists'}->{ids} // {};
     my $zones = $running_config->{zones}->{ids} // {};
-    my $zone_routes =
-        grep { $_->{type} eq 'simple' && scalar(@{ $_->{route} // [] }) } values %$zones;
+    my $zone_routes = grep {
+        ($_->{type} eq 'simple' || $_->{type} eq 'evpn') && scalar(@{ $_->{route} // [] })
+    } values %$zones;
 
     my $local_frr_config = PVE::Network::SDN::Frr::local_frr_config_exists();
 
diff --git a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
index e5b8ea16446f..1933ce86f997 100644
--- a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
+++ b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
@@ -113,6 +113,7 @@ sub options {
     return {
         nodes => { optional => 1 },
         'vrf-vxlan' => { optional => 0 },
+        route => { optional => 1 },
         controller => { optional => 0 },
         'secondary-controllers' => { optional => 1 },
         exitnodes => { optional => 1 },
diff --git a/src/test/run_test_static_routes.pl b/src/test/run_test_static_routes.pl
index c6809fe4dc9c..8f3acc25d21f 100644
--- a/src/test/run_test_static_routes.pl
+++ b/src/test/run_test_static_routes.pl
@@ -85,7 +85,7 @@ subtest 'route API schema and Rust validation' => sub {
             1,
         );
     };
-    like($@, qr/unexpected property 'route'/, 'routes are only supported on simple zones');
+    like($@, qr/unexpected property 'route'/, 'routes are only supported on simple and evpn zones');
 };
 
 subtest 'repeatable config persistence' => sub {
@@ -96,6 +96,39 @@ subtest 'repeatable config persistence' => sub {
     is_deeply($parsed->{ids}, $zones->{ids}, 'routes and node restrictions survive round trip');
 };
 
+subtest 'EVPN routes reuse validation and persistence' => sub {
+    my $evpn = {
+        type => 'evpn',
+        controller => 'evpnctl',
+        'vrf-vxlan' => 1000,
+        nodes => { localhost => 1 },
+        route => $routes,
+    };
+    my $plugin = PVE::Network::SDN::Zones::Plugin->lookup('evpn');
+    for my $create (0, 1) {
+        my $params = dclone($evpn);
+        $params->{nodes} = 'localhost';
+        my $opts = $plugin->check_config('overlay', $params, $create, 1);
+        is_deeply($opts->{route}, $routes, 'EVPN accepts the shared route property');
+    }
+
+    my $errors = {};
+    PVE::JSONSchema::check_prop(
+        ['prefix=::/0,via=fe80::1'],
+        $plugin->get_property_schema('evpn', 'route'),
+        'route',
+        $errors,
+    );
+    ok(scalar(keys %$errors), 'EVPN uses the same Rust-backed validation');
+
+    my $config = dclone($zones);
+    $config->{ids}->{overlay} = $evpn;
+    my $raw = PVE::Network::SDN::Zones::Plugin->write_config('zones.cfg', $config);
+    my $parsed = PVE::Network::SDN::Zones::Plugin->parse_config('zones.cfg', $raw);
+    ok(!$parsed->{errors}, 'Simple and EVPN routes parse together');
+    is_deeply($parsed->{ids}, $config->{ids}, 'both zone types preserve repeated routes');
+};
+
 subtest 'pending arrays compare by value' => sub {
     my $running = { zones => dclone($zones) };
     my $configured = dclone($zones);
@@ -134,9 +167,15 @@ $frr->mock(
 );
 
 subtest 'route-only FRR detection' => sub {
-    ok(PVE::Network::SDN::running_config_has_frr(), 'routes without controllers require FRR');
-    local $running->{zones} = { ids => { empty => { type => 'simple', route => [] } } };
-    ok(!PVE::Network::SDN::running_config_has_frr(), 'empty route array does not require FRR');
+    for my $type ('simple', 'evpn') {
+        local $running->{zones} = { ids => { zone1 => { type => $type, route => $routes } } };
+        ok(PVE::Network::SDN::running_config_has_frr(), "$type routes require FRR");
+        $running->{zones}->{ids}->{zone1}->{route} = [];
+        ok(
+            !PVE::Network::SDN::running_config_has_frr(),
+            "empty $type routes do not require FRR",
+        );
+    }
 };
 
 subtest 'zone routes reach FRR with local config' => sub {
diff --git a/src/test/zones/evpn/advertise_subnets/expected_controller_config b/src/test/zones/evpn/advertise_subnets/expected_controller_config
index 8ab18ef648fc..fd1ee333ba78 100644
--- a/src/test/zones/evpn/advertise_subnets/expected_controller_config
+++ b/src/test/zones/evpn/advertise_subnets/expected_controller_config
@@ -53,5 +53,11 @@ exit
 route-map MAP_VTEP_OUT permit 1
 exit
 !
+ip route 0.0.0.0/0 10.0.0.2 vrf vrf_myzone
+!
+ip route 198.51.100.0/24 192.0.2.1 nexthop-vrf default vrf vrf_myzone
+!
+ipv6 route ::/0 fe80::2 myvnet vrf vrf_myzone
+!
 line vty
 !
diff --git a/src/test/zones/evpn/advertise_subnets/sdn_config b/src/test/zones/evpn/advertise_subnets/sdn_config
index 76f16a16af6a..aedcf40524a0 100644
--- a/src/test/zones/evpn/advertise_subnets/sdn_config
+++ b/src/test/zones/evpn/advertise_subnets/sdn_config
@@ -7,7 +7,13 @@
              },
 
   zones   => {
-               ids => { myzone => { ipam => "pve", type => "evpn", controller => "evpnctl", 'vrf-vxlan' => 1000, 'mac' => 'A2:1D:CB:1A:C0:8B', 'advertise-subnets' => 1 } },
+               ids => { myzone => { ipam => "pve", type => "evpn", controller => "evpnctl", 'vrf-vxlan' => 1000, 'mac' => 'A2:1D:CB:1A:C0:8B', 'advertise-subnets' => 1,
+                   route => [
+                       'prefix=0.0.0.0/0,via=10.0.0.2',
+                       'prefix=198.51.100.0/24,via=192.0.2.1,nexthop-vrf=default',
+                       'prefix=::/0,via=fe80::2,iface=myvnet',
+                   ],
+               } },
              },
   controllers  => {
                ids => { evpnctl => { type => "evpn", 'peers' => '192.168.0.1,192.168.0.2,192.168.0.3', asn => "65000" } },
-- 
2.47.3





  parent reply	other threads:[~2026-11-16 16:15 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 16:11 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-common v3 01/32] interfaces: preserve VRF membership across address family changes Gabriel Goller
2026-11-18 14:13   ` Stefan Hanreich
2026-11-18 15:41     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 02/32] frr: add VRF-aware OSPF rendering Gabriel Goller
2026-11-18 14:41   ` Stefan Hanreich
2026-11-18 16:21     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 03/32] sdn: add zone references to OSPF and BGP fabrics Gabriel Goller
2026-11-18 14:10   ` Stefan Hanreich
2026-11-18 16:55     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 04/32] sdn: generate fabric routing configuration in zone VRFs Gabriel Goller
2026-11-18 14:53   ` Stefan Hanreich
2026-11-18 17:26     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 05/32] sdn: fix VRF route-map scoping and zone ID validation Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 06/32] tests: fabrics: add test for fabrics in VRFs Gabriel Goller
2026-11-18 15:01   ` Stefan Hanreich
2026-11-18 17:33     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 07/32] sdn: allow static routes in simple zone VRFs Gabriel Goller
2026-11-18 15:29   ` Stefan Hanreich
2026-11-18 18:10     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-ve-rs v3 08/32] sdn: support static routes in EVPN " Gabriel Goller
2026-11-18 15:32   ` Stefan Hanreich
2026-11-19 13:12     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-perl-rs v3 09/32] pve-rs: fabrics: assign network interfaces to configured VRFs Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-perl-rs v3 10/32] pve-rs: fabrics: make per-fabric status queries VRF-aware Gabriel Goller
2026-11-18 15:42   ` Stefan Hanreich
2026-11-19 13:30     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-perl-rs v3 11/32] pve-rs: fabrics: include VRF routes in aggregate status Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-perl-rs v3 12/32] pve-rs: fabrics: expose host interface membership Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-perl-rs v3 13/32] sdn: expose static routes for simple zone uplinks Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-network v3 14/32] sdn: evpn: add unreachable IPv6 default route to zone VRFs Gabriel Goller
2026-11-18 16:08   ` Stefan Hanreich
2026-11-18 16:39     ` Stefan Hanreich
2026-11-19 13:38       ` Gabriel Goller
2026-11-19 15:51         ` Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-network v3 15/32] sdn: add optional VRFs for simple zones Gabriel Goller
2026-11-18 16:18   ` Stefan Hanreich
2026-11-19 13:44     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-network v3 16/32] sdn: allow fabrics to use simple zone VRFs Gabriel Goller
2026-11-18 16:27   ` Stefan Hanreich
2026-11-19 14:14     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-network v3 17/32] sdn: require underlay fabrics to use the default VRF Gabriel Goller
2026-11-18 16:30   ` Stefan Hanreich
2026-11-19 14:33     ` Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-network v3 18/32] sdn: always generate EVPN zone VRFs Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-network v3 19/32] api: sdn: allow EVPN zones as fabric VRFs Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-network v3 20/32] api: sdn: disallow BGP fabrics in EVPN zone VRFs Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-network v3 21/32] sdn: simple: support static routes in zone routing tables Gabriel Goller
2026-11-18 16:49   ` Stefan Hanreich
2026-11-19 14:53     ` Gabriel Goller
2026-11-16 16:11 ` Gabriel Goller [this message]
2026-11-16 16:11 ` [PATCH pve-network v3 23/32] sdn: zones: SNAT via dedicated uplinks in zone VRFs Gabriel Goller
2026-11-18 18:07   ` Stefan Hanreich
2026-11-16 16:11 ` [PATCH pve-network v3 24/32] sdn: dhcp: only configure DHCP for zones on the local node Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-network v3 25/32] sdn: dhcp: run dnsmasq in the zone VRF Gabriel Goller
2026-11-16 16:11 ` [PATCH proxmox-widget-toolkit v3 26/32] ui: network: allow selecting a VRF for host interfaces Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-manager v3 27/32] ui: sdn: add VRF zone selection for fabrics Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-manager v3 28/32] ui: sdn: expose EVPN zones as fabric VRFs Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-manager v3 29/32] network: allow setting the VRF of host interfaces Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-manager v3 30/32] ui: sdn: allow static routes for Simple zone VRFs Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-manager v3 31/32] ui: sdn: allow static routes in EVPN zones Gabriel Goller
2026-11-16 16:11 ` [PATCH pve-manager v3 32/32] network: generate SDN DHCP config after ifreload Gabriel Goller
2026-11-18 18:27 ` [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/32] SDN VRF support Stefan Hanreich
2026-11-19 15:33   ` Gabriel Goller
2026-11-19 20:10 ` 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=20261116161154.343743-23-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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal