From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id B63811FF15C for ; Fri, 5 Sep 2025 13:45:13 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 432AC13380; Fri, 5 Sep 2025 13:45:14 +0200 (CEST) From: Gabriel Goller To: pve-devel@lists.proxmox.com Date: Fri, 5 Sep 2025 13:45:01 +0200 Message-ID: <20250905114504.195110-7-g.goller@proxmox.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250905114504.195110-1-g.goller@proxmox.com> References: <20250905114504.195110-1-g.goller@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1757072690630 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.004 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH pve-network 1/1] sdn: add vnet and zone status endpoints X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" 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 --- 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//'", + 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