[pve-devel] [PATCH pve-network 8/9] api: nodes: zones: add ip vrf endpoint for evpn zones

Stefan Hanreich s.hanreich at proxmox.com
Thu Oct 30 16:48:33 CET 2025


This endpoint returns the state of the routing table on a node for a
given EVPN zone. This is used by the SDN browser panel to display
status information in the UI.

Signed-off-by: Stefan Hanreich <s.hanreich at proxmox.com>
---
 src/PVE/API2/Network/SDN/Nodes/Zone.pm | 79 ++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)

diff --git a/src/PVE/API2/Network/SDN/Nodes/Zone.pm b/src/PVE/API2/Network/SDN/Nodes/Zone.pm
index d7312df..43acbe9 100644
--- a/src/PVE/API2/Network/SDN/Nodes/Zone.pm
+++ b/src/PVE/API2/Network/SDN/Nodes/Zone.pm
@@ -297,4 +297,83 @@ __PACKAGE__->register_method({
     },
 });
 
+__PACKAGE__->register_method({
+    name => 'ip-vrf',
+    path => 'ip-vrf',
+    proxyto => 'node',
+    method => 'GET',
+    protected => 1,
+    description => "Get the IP VRF of an EVPN zone.",
+    permissions => {
+        check => ['perm', '/sdn/zones/{zone}', ['SDN.Audit']],
+    },
+    parameters => {
+        additionalProperties => 0,
+        properties => {
+            zone => {
+                type => 'string',
+                description => 'Name of an EVPN zone.',
+            },
+            node => get_standard_option('pve-node'),
+        },
+    },
+    returns => {
+        description => 'All entries in the VRF table of zone {zone} of the node.'
+            . 'This does not include /32 routes for guests on this host,'
+            . 'since they are handled via the respective vnet bridge directly.',
+        type => 'array',
+        items => {
+            type => 'object',
+            properties => {
+                ip => {
+                    type => 'string',
+                    format => 'CIDR',
+                    description => 'The CIDR of the route table entry.',
+                },
+                metric => {
+                    type => 'integer',
+                    description => 'This route\'s metric.',
+                },
+                protocol => {
+                    type => 'string',
+                    description => 'The protocol where this route was learned from (e.g. BGP).',
+                },
+                'nexthops' => {
+                    type => 'array',
+                    description => 'A list of nexthops for the route table entry.',
+                    items => {
+                        type => 'string',
+                        description => 'the interface name or ip address of the next hop',
+                    },
+                },
+            },
+        },
+    },
+    code => sub {
+        my ($param) = @_;
+
+        my $zone_id = extract_param($param, 'zone');
+        my $zone = PVE::Network::SDN::Zones::get_zone($zone_id, 1);
+
+        raise_param_exc({
+            zone => "zone does not exist",
+        })
+            if !$zone;
+
+        raise_param_exc({
+            zone => "zone is not an EVPN zone",
+        })
+            if $zone->{type} ne 'evpn';
+
+        my $node_id = extract_param($param, 'node');
+
+        raise_param_exc({
+            zone => "zone does not exist on node $node_id",
+        })
+            if defined($zone->{nodes}) && !grep { $_ eq $node_id } $zone->{nodes}->@*;
+
+        return PVE::RS::SDN::Fabrics::l3vpn_routes($zone_id);
+    },
+});
+
 1;
-- 
2.47.3




More information about the pve-devel mailing list