From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id DC66F1FF16F for ; Tue, 2 Sep 2025 16:10:19 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E23EA15B31; Tue, 2 Sep 2025 16:10:30 +0200 (CEST) From: Stefan Hanreich To: pdm-devel@lists.proxmox.com Date: Tue, 2 Sep 2025 16:09:31 +0200 Message-ID: <20250902140956.228031-8-s.hanreich@proxmox.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250902140956.228031-1-s.hanreich@proxmox.com> References: <20250902140956.228031-1-s.hanreich@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.188 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 KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Subject: [pdm-devel] [PATCH pve-network v3 4/6] api: controllers: update schema of endpoints X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" The possible properties returned by the controller endpoints were only partly documented. Add all missing properties and update descriptions for existing properties. Update the descriptions of the schemas in the plugin to provide more detailed information about the different configuration options. Move all duplicate properties between the GET endpoints into its own variable, so we can reuse them. Signed-off-by: Stefan Hanreich --- src/PVE/API2/Network/SDN/Controllers.pm | 116 +++++++++++++++++- src/PVE/Network/SDN/Controllers/BgpPlugin.pm | 7 +- src/PVE/Network/SDN/Controllers/IsisPlugin.pm | 6 +- 3 files changed, 119 insertions(+), 10 deletions(-) diff --git a/src/PVE/API2/Network/SDN/Controllers.pm b/src/PVE/API2/Network/SDN/Controllers.pm index 5c2b6c3..bc3ec09 100644 --- a/src/PVE/API2/Network/SDN/Controllers.pm +++ b/src/PVE/API2/Network/SDN/Controllers.pm @@ -34,6 +34,67 @@ my $api_sdn_controllers_config = sub { return $scfg; }; +my $CONTROLLER_PROPERTIES = { + asn => { + type => 'integer', + description => 'The local ASN of the controller. BGP & EVPN only.', + optional => 1, + minimum => 0, + maximum => 4294967295, + }, + node => { + type => 'string', + optional => 1, + description => 'Node(s) where this controller is active.', + }, + peers => { + type => 'string', + optional => 1, + description => 'Comma-separated list of the peers IP addresses.', + }, + 'bgp-multipath-as-relax' => { + type => 'boolean', + optional => 1, + description => + 'Consider different AS paths of equal length for multipath computation. BGP only.', + }, + ebgp => { + type => 'boolean', + optional => 1, + description => "Enable eBGP (remote-as external). BGP only.", + }, + 'ebgp-multihop' => { + type => 'integer', + optional => 1, + description => + "Set maximum amount of hops for eBGP peers. Needs ebgp set to 1. BGP only.", + }, + loopback => { + description => + "Name of the loopback/dummy interface that provides the Router-IP. BGP only.", + optional => 1, + type => 'string', + }, + 'isis-domain' => { + description => "Name of the IS-IS domain. IS-IS only.", + optional => 1, + type => 'string', + }, + 'isis-ifaces' => { + description => + "Comma-separated list of interfaces where IS-IS should be active. IS-IS only.", + optional => 1, + type => 'string', + format => 'pve-iface-list', + }, + 'isis-net' => { + description => "Network Entity title for this node in the IS-IS network. IS-IS only.", + optional => 1, + type => 'string', + format => 'pve-sdn-isis-net', + }, +}; + __PACKAGE__->register_method({ name => 'index', path => '', @@ -70,10 +131,29 @@ __PACKAGE__->register_method({ items => { type => "object", properties => { - controller => { type => 'string' }, - type => { type => 'string' }, - state => { type => 'string', optional => 1 }, - pending => { type => 'boolean', optional => 1 }, + digest => { + type => 'string', + description => 'Digest of the controller section.', + optional => 1, + }, + state => get_standard_option('pve-sdn-config-state'), + controller => { + type => 'string', + description => 'Name of the controller.', + }, + type => { + type => 'string', + description => 'Type of the controller', + enum => PVE::Network::SDN::Controllers::Plugin->lookup_types(), + }, + pending => { + type => 'object', + description => + 'Changes that have not yet been applied to the running configuration.', + optional => 1, + properties => $CONTROLLER_PROPERTIES, + }, + %$CONTROLLER_PROPERTIES, }, }, links => [{ rel => 'child', href => "{controller}" }], @@ -139,7 +219,33 @@ __PACKAGE__->register_method({ }, }, }, - returns => { type => 'object' }, + returns => { + properties => { + digest => { + type => 'string', + description => 'Digest of the controller section.', + optional => 1, + }, + state => get_standard_option('pve-sdn-config-state'), + controller => { + type => 'string', + description => 'Name of the controller.', + }, + type => { + type => 'string', + description => 'Type of the controller', + enum => PVE::Network::SDN::Controllers::Plugin->lookup_types(), + }, + pending => { + type => 'object', + description => + 'Changes that have not yet been applied to the running configuration.', + optional => 1, + properties => $CONTROLLER_PROPERTIES, + }, + %$CONTROLLER_PROPERTIES, + }, + }, code => sub { my ($param) = @_; diff --git a/src/PVE/Network/SDN/Controllers/BgpPlugin.pm b/src/PVE/Network/SDN/Controllers/BgpPlugin.pm index 5f3fcb0..c84b384 100644 --- a/src/PVE/Network/SDN/Controllers/BgpPlugin.pm +++ b/src/PVE/Network/SDN/Controllers/BgpPlugin.pm @@ -22,18 +22,21 @@ sub properties { 'bgp-multipath-as-path-relax' => { type => 'boolean', optional => 1, + description => + 'Consider different AS paths of equal length for multipath computation.', }, ebgp => { type => 'boolean', optional => 1, - description => "Enable ebgp. (remote-as external)", + description => "Enable eBGP (remote-as external).", }, 'ebgp-multihop' => { type => 'integer', optional => 1, + description => 'Set maximum amount of hops for eBGP peers.', }, loopback => { - description => "source loopback interface.", + description => "Name of the loopback/dummy interface that provides the Router-IP.", type => 'string', }, node => get_standard_option('pve-node'), diff --git a/src/PVE/Network/SDN/Controllers/IsisPlugin.pm b/src/PVE/Network/SDN/Controllers/IsisPlugin.pm index 716bb0f..3a9acfd 100644 --- a/src/PVE/Network/SDN/Controllers/IsisPlugin.pm +++ b/src/PVE/Network/SDN/Controllers/IsisPlugin.pm @@ -31,16 +31,16 @@ sub pve_verify_sdn_isis_net { sub properties { return { 'isis-domain' => { - description => "ISIS domain.", + description => "Name of the IS-IS domain.", type => 'string', }, 'isis-ifaces' => { - description => "ISIS interface.", + description => "Comma-separated list of interfaces where IS-IS should be active.", type => 'string', format => 'pve-iface-list', }, 'isis-net' => { - description => "ISIS network entity title.", + description => "Network Entity title for this node in the IS-IS network.", type => 'string', format => 'pve-sdn-isis-net', }, -- 2.47.2 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel