From: Gabriel Goller <[email protected]> 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 <[email protected]> Signed-off-by: Gabriel Goller <[email protected]> Signed-off-by: Stefan Hanreich <[email protected]> --- 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 43a7a36..436d987 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 all neighbors for a fabric.", + 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 or hostname 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 _______________________________________________ pve-devel mailing list [email protected] https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
