[pve-devel] [PATCH pve-network 1/1] sdn: add vnet and zone status endpoints

Gabriel Goller g.goller at proxmox.com
Fri Sep 5 13:45:01 CEST 2025


Add status endpoints for vnets and zones. This endpoint will return the
Layer 2 routes for zones and the Layer 3 routes for vnets.

Signed-off-by: Gabriel Goller <g.goller at proxmox.com>
---
 src/PVE/API2/Network/SDN/Vnets.pm | 36 +++++++++++++++++++++++++++++++
 src/PVE/API2/Network/SDN/Zones.pm | 26 ++++++++++++++++++++++
 2 files changed, 62 insertions(+)

diff --git a/src/PVE/API2/Network/SDN/Vnets.pm b/src/PVE/API2/Network/SDN/Vnets.pm
index 1d9e500665f6..ccaa9f792909 100644
--- a/src/PVE/API2/Network/SDN/Vnets.pm
+++ b/src/PVE/API2/Network/SDN/Vnets.pm
@@ -16,6 +16,8 @@ use PVE::API2::Network::SDN::Subnets;
 use PVE::API2::Network::SDN::Ips;
 use PVE::API2::Firewall::Vnet;
 
+use PVE::RS::SDN::Fabrics;
+
 use Storable qw(dclone);
 use PVE::JSONSchema qw(get_standard_option);
 use PVE::RPCEnvironment;
@@ -467,4 +469,38 @@ __PACKAGE__->register_method({
     },
 });
 
+__PACKAGE__->register_method({
+    name => 'status',
+    path => '{vnet}/status',
+    method => 'GET',
+    description => "Get sdn vnet status.",
+    permissions => {
+        description =>
+            "Require 'SDN.Audit' or 'SDN.Allocate' permissions on '/sdn/zones/<zone>/<vnet>'",
+        user => 'all',
+    },
+    parameters => {
+        additionalProperties => 0,
+        properties => {
+            vnet => get_standard_option(
+                'pve-sdn-vnet-id',
+                {
+                    completion => \&PVE::Network::SDN::Vnets::complete_sdn_vnets,
+                },
+            ),
+        },
+    },
+    returns => { type => 'object' },
+    code => sub {
+        my ($param) = @_;
+
+        my $id = extract_param($param, 'vnet');
+
+        my $privs = ['SDN.Audit', 'SDN.Allocate'];
+        &$check_vnet_access($id, $privs);
+
+        return PVE::RS::SDN::Fabrics::l2vpn_routes($id);
+    },
+});
+
 1;
diff --git a/src/PVE/API2/Network/SDN/Zones.pm b/src/PVE/API2/Network/SDN/Zones.pm
index 8d829a9fd60b..0953c0c5dcad 100644
--- a/src/PVE/API2/Network/SDN/Zones.pm
+++ b/src/PVE/API2/Network/SDN/Zones.pm
@@ -26,6 +26,8 @@ use PVE::Network::SDN::Zones::VlanPlugin;
 use PVE::Network::SDN::Zones::VxlanPlugin;
 use PVE::Network::SDN::Zones;
 
+use PVE::RS::SDN::Fabrics;
+
 use PVE::RESTHandler;
 use base qw(PVE::RESTHandler);
 
@@ -594,4 +596,28 @@ __PACKAGE__->register_method({
     },
 });
 
+__PACKAGE__->register_method({
+    name => 'status',
+    path => '{zone}/status',
+    method => 'GET',
+    description => "Get sdn zone status.",
+    permissions => {
+        check => ['perm', '/sdn/zones/{zone}', ['SDN.Allocate']],
+    },
+
+    parameters => {
+        additionalProperties => 0,
+        properties => {
+            zone => get_standard_option('pve-sdn-zone-id'),
+        },
+    },
+    returns => { type => 'object' },
+    code => sub {
+        my ($param) = @_;
+        my $zone = extract_param($param, 'zone');
+
+        return PVE::RS::SDN::Fabrics::l3vpn_routes($zone);
+    },
+});
+
 1;
-- 
2.47.2





More information about the pve-devel mailing list