From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-network 3/5] api: controllers: update schema of endpoints
Date: Fri, 28 Feb 2025 15:01:34 +0100 [thread overview]
Message-ID: <20250228140136.124286-4-s.hanreich@proxmox.com> (raw)
In-Reply-To: <20250228140136.124286-1-s.hanreich@proxmox.com>
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 <s.hanreich@proxmox.com>
---
src/PVE/API2/Network/SDN/Controllers.pm | 111 +++++++++++++++++-
src/PVE/Network/SDN/Controllers/BgpPlugin.pm | 6 +-
src/PVE/Network/SDN/Controllers/EvpnPlugin.pm | 3 +-
src/PVE/Network/SDN/Controllers/IsisPlugin.pm | 12 +-
4 files changed, 119 insertions(+), 13 deletions(-)
diff --git a/src/PVE/API2/Network/SDN/Controllers.pm b/src/PVE/API2/Network/SDN/Controllers.pm
index 29f6ca4..29f54ee 100644
--- a/src/PVE/API2/Network/SDN/Controllers.pm
+++ b/src/PVE/API2/Network/SDN/Controllers.pm
@@ -34,6 +34,63 @@ 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 => '',
@@ -68,10 +125,29 @@ __PACKAGE__->register_method ({
type => 'array',
items => {
type => "object",
- properties => { controller => { type => 'string' },
- type => { type => 'string' },
- state => { type => 'string', optional => 1 },
- pending => { type => 'boolean', optional => 1 },
+ 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,
},
},
links => [ { rel => 'child', href => "{controller}" } ],
@@ -136,7 +212,32 @@ __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 53963e5..278097f 100644
--- a/src/PVE/Network/SDN/Controllers/BgpPlugin.pm
+++ b/src/PVE/Network/SDN/Controllers/BgpPlugin.pm
@@ -22,18 +22,20 @@ 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/EvpnPlugin.pm b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
index 78c9798..6aa6825 100644
--- a/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
+++ b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
@@ -28,7 +28,8 @@ sub properties {
},
peers => {
description => "peers address list.",
- type => 'string', format => 'ip-list'
+ type => 'string',
+ format => 'ip-list'
},
};
}
diff --git a/src/PVE/Network/SDN/Controllers/IsisPlugin.pm b/src/PVE/Network/SDN/Controllers/IsisPlugin.pm
index 97c6876..e9f4147 100644
--- a/src/PVE/Network/SDN/Controllers/IsisPlugin.pm
+++ b/src/PVE/Network/SDN/Controllers/IsisPlugin.pm
@@ -30,16 +30,18 @@ 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.",
- type => 'string', format => 'pve-iface-list',
+ 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.",
- type => 'string', format => 'pve-sdn-isis-net',
+ description => "Network Entity title for this node in the IS-IS network.",
+ type => 'string',
+ format => 'pve-sdn-isis-net',
},
};
}
--
2.39.5
_______________________________________________
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-02-28 14:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-28 14:01 [pve-devel] [PATCH network 0/5] Improve documentation for SDN API endpoints used by PDM Stefan Hanreich
2025-02-28 14:01 ` [pve-devel] [PATCH pve-network 1/5] controllers: fix maximum value for ASN Stefan Hanreich
2025-03-10 15:29 ` Shannon Sterz
2025-03-11 5:53 ` Matthieu Pignolet via pve-devel
2025-03-11 10:50 ` DERUMIER, Alexandre via pve-devel
2025-02-28 14:01 ` [pve-devel] [PATCH pve-network 2/5] api: add state standard option Stefan Hanreich
2025-02-28 14:01 ` Stefan Hanreich [this message]
2025-02-28 14:01 ` [pve-devel] [PATCH pve-network 4/5] api: vnets: update schema of endpoints Stefan Hanreich
2025-02-28 14:01 ` [pve-devel] [PATCH pve-network 5/5] api: zones: " Stefan Hanreich
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=20250228140136.124286-4-s.hanreich@proxmox.com \
--to=s.hanreich@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