From: Gabriel Goller <g.goller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-network v2 2/3] fabrics: add api endpoint to return fabrics routes
Date: Fri, 22 Aug 2025 11:00:40 +0200 [thread overview]
Message-ID: <20250822090102.102949-9-g.goller@proxmox.com> (raw)
In-Reply-To: <20250822090102.102949-1-g.goller@proxmox.com>
Add api endpoint that returns all the routes distributed through the
fabrics.
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
src/PVE/API2/Network/SDN/Fabrics.pm | 61 ++++++++++++++++++++++++++++-
1 file changed, 60 insertions(+), 1 deletion(-)
diff --git a/src/PVE/API2/Network/SDN/Fabrics.pm b/src/PVE/API2/Network/SDN/Fabrics.pm
index 5644fbee0fff..94905e865ce1 100644
--- a/src/PVE/API2/Network/SDN/Fabrics.pm
+++ b/src/PVE/API2/Network/SDN/Fabrics.pm
@@ -12,6 +12,7 @@ use PVE::API2::Network::SDN::Fabrics::Fabric;
use PVE::API2::Network::SDN::Fabrics::Node;
use PVE::RESTHandler;
+use PVE::JSONSchema qw(get_standard_option);
use base qw(PVE::RESTHandler);
__PACKAGE__->register_method({
@@ -49,7 +50,10 @@ __PACKAGE__->register_method({
my ($param) = @_;
my $res = [
- { subdir => 'fabric' }, { subdir => 'node' }, { subdir => 'all' },
+ { subdir => 'fabric' },
+ { subdir => 'node' },
+ { subdir => 'all' },
+ { subdir => 'routes' },
];
return $res;
@@ -175,4 +179,59 @@ __PACKAGE__->register_method({
},
});
+__PACKAGE__->register_method({
+ name => 'routes',
+ path => 'routes',
+ method => 'GET',
+ description => "Get routes of all fabrics.",
+ permissions => {
+ description => "Only list entries where you have 'SDN.Audit' or 'SDN.Allocate'",
+ user => 'all',
+ },
+ protected => 1,
+ proxyto => 'node',
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ },
+ },
+ returns => {
+ type => 'array',
+ items => {
+ type => "object",
+ properties => {
+ fabric_id => get_standard_option('pve-sdn-fabric-id'),
+ protocol => get_standard_option('pve-sdn-fabric-protocol'),
+ route => {
+ description => "Route",
+ type => 'string',
+ },
+ via => {
+ description => "Nexthop",
+ type => 'string',
+ },
+ },
+ },
+ },
+ code => sub {
+ my ($param) = @_;
+
+ my $rpcenv = PVE::RPCEnvironment::get();
+ my $authuser = $rpcenv->get_user();
+
+ my $res = [];
+
+ my $routes = PVE::RS::SDN::Fabrics::routes();
+ my $fabric_privs = ['SDN.Audit', 'SDN.Allocate'];
+ for my $route (@$routes) {
+ my $fabric_id = $route->{fabric_id};
+ next if !$rpcenv->check_any($authuser, "/sdn/fabrics/$fabric_id", $fabric_privs, 1);
+ push @$res, $route;
+ }
+
+ return $res;
+ },
+});
+
1;
--
2.47.2
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-08-22 9:01 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-22 9:00 [pve-devel] [PATCH manager/network/proxmox{-ve-rs, -perl-rs} v2 00/12] Add fabric status view Gabriel Goller
2025-08-22 9:00 ` [pve-devel] [PATCH proxmox-ve-rs v2 1/2] frr: make room for deserialization structs Gabriel Goller
2025-08-22 9:00 ` [pve-devel] [PATCH proxmox-ve-rs v2 2/2] frr: add deserialization types for openfabric and ospf Gabriel Goller
2025-08-22 9:00 ` [pve-devel] [PATCH proxmox-perl-rs v2 1/4] pve: fabrics: update proxmox-frr import path Gabriel Goller
2025-08-22 9:00 ` [pve-devel] [PATCH proxmox-perl-rs v2 2/4] fabrics: add function to get status of fabric Gabriel Goller
2025-08-25 8:11 ` Wolfgang Bumiller
2025-08-25 8:25 ` Wolfgang Bumiller
2025-08-25 11:39 ` Gabriel Goller
2025-08-25 14:37 ` Wolfgang Bumiller
2025-08-25 15:33 ` Gabriel Goller
2025-08-26 7:55 ` Wolfgang Bumiller
2025-08-26 8:29 ` Gabriel Goller
2025-08-22 9:00 ` [pve-devel] [PATCH proxmox-perl-rs v2 3/4] fabrics: add function to get all routes distributed by the fabrics Gabriel Goller
2025-08-25 8:22 ` Wolfgang Bumiller
2025-08-25 11:40 ` Gabriel Goller
2025-08-22 9:00 ` [pve-devel] [PATCH proxmox-perl-rs v2 4/4] fabrics: add function to get all neighbors of the fabric Gabriel Goller
2025-08-25 8:28 ` Wolfgang Bumiller
2025-08-25 11:41 ` Gabriel Goller
2025-08-22 9:00 ` [pve-devel] [PATCH pve-network v2 1/3] fabrics: add fabrics status to SDN::status function Gabriel Goller
2025-08-22 9:00 ` Gabriel Goller [this message]
2025-08-22 9:00 ` [pve-devel] [PATCH pve-network v2 3/3] fabrics: add api endpoint to return fabric neighbors Gabriel Goller
2025-08-22 9:00 ` [pve-devel] [PATCH pve-manager v2 1/3] pvestatd: add fabrics status to pvestatd Gabriel Goller
2025-08-22 9:00 ` [pve-devel] [PATCH pve-manager v2 2/3] fabrics: add resource view for fabrics Gabriel Goller
2025-08-22 9:00 ` [pve-devel] [PATCH pve-manager v2 3/3] permissions: differentiate between zone and fabric paths Gabriel Goller
2025-08-26 9:52 ` [pve-devel] [PATCH manager/network/proxmox{-ve-rs, -perl-rs} v2 00/12] Add fabric status view 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=20250822090102.102949-9-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox