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: [pve-devel] [PATCH pve-network 1/1] sdn: add vnet and zone status endpoints
Date: Fri,  5 Sep 2025 13:45:01 +0200	[thread overview]
Message-ID: <20250905114504.195110-7-g.goller@proxmox.com> (raw)
In-Reply-To: <20250905114504.195110-1-g.goller@proxmox.com>

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@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



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


      parent reply	other threads:[~2025-09-05 11:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-05 11:44 [pve-devel] [PATCH network/proxmox{-ve-rs, -perl-rs} 0/6] Add status endpoints for EVPN statistics Gabriel Goller
2025-09-05 11:44 ` [pve-devel] [PATCH proxmox-ve-rs 1/3] ve-config: add optional tag property to vnet Gabriel Goller
2025-09-05 11:44 ` [pve-devel] [PATCH proxmox-ve-rs 2/3] frr: fix some route deserialization types Gabriel Goller
2025-09-05 11:44 ` [pve-devel] [PATCH proxmox-ve-rs 3/3] frr: add deserialization types for EVPN Gabriel Goller
2025-09-05 11:44 ` [pve-devel] [PATCH proxmox-perl-rs 1/2] pve-rs: sdn: fabrics: update openfabric/ospf route filtering Gabriel Goller
2025-09-05 11:45 ` [pve-devel] [PATCH proxmox-perl-rs 2/2] pve-rs: sdn: add functions to retrieve the Zone/Vnet routes Gabriel Goller
2025-09-05 11:45 ` Gabriel Goller [this message]

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=20250905114504.195110-7-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