[pve-devel] [PATCH pve-network 5/9] api: nodes: fabrics: add endpoint for querying neighbor information
Stefan Hanreich
s.hanreich at proxmox.com
Thu Oct 30 16:48:30 CET 2025
From: Gabriel Goller <g.goller at proxmox.com>
This endpoint returns all neighbors for a given fabric and their
current status. For more information about the return value, consult
the respective proxmox-perl-rs commit. It is used by the
NetworkBrowser panel.
Co-authored-by: Stefan Hanreich <s.hanreich at proxmox.com>
Signed-off-by: Gabriel Goller <g.goller at proxmox.com>
Signed-off-by: Stefan Hanreich <s.hanreich at proxmox.com>
---
src/PVE/API2/Network/SDN/Nodes/Fabric.pm | 48 +++++++++++++++++++++++-
1 file changed, 47 insertions(+), 1 deletion(-)
diff --git a/src/PVE/API2/Network/SDN/Nodes/Fabric.pm b/src/PVE/API2/Network/SDN/Nodes/Fabric.pm
index c1886b7..b5971c7 100644
--- a/src/PVE/API2/Network/SDN/Nodes/Fabric.pm
+++ b/src/PVE/API2/Network/SDN/Nodes/Fabric.pm
@@ -40,7 +40,7 @@ __PACKAGE__->register_method({
code => sub {
my ($param) = @_;
my $res = [
- { subdir => 'routes' },
+ { subdir => 'neighbors' }, { subdir => 'routes' },
];
return $res;
@@ -92,3 +92,49 @@ __PACKAGE__->register_method({
},
});
+__PACKAGE__->register_method({
+ name => 'neighbors',
+ path => 'neighbors',
+ method => 'GET',
+ description => "Get neighbors of all fabrics.",
+ permissions => {
+ check => ['perm', '/sdn/fabrics/{fabric}', ['SDN.Audit']],
+ },
+ protected => 1,
+ proxyto => 'node',
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ fabric => get_standard_option('pve-sdn-fabric-id'),
+ },
+ },
+ returns => {
+ type => 'array',
+ items => {
+ type => "object",
+ properties => {
+ neighbor => {
+ description => "The IP of the neighbor.",
+ type => 'string',
+ },
+ status => {
+ description => "The status of the neighbor, as returned by FRR.",
+ type => 'string',
+ },
+ uptime => {
+ description =>
+ "The uptime of this neighbor, as returned by FRR (e.g. 8h24m12s).",
+ type => 'string',
+ },
+ },
+ },
+ },
+ code => sub {
+ my ($param) = @_;
+
+ my $fabric_id = extract_param($param, 'fabric');
+ return PVE::RS::SDN::Fabrics::neighbors($fabric_id);
+ },
+});
+
--
2.47.3
More information about the pve-devel
mailing list