summaryrefslogtreecommitdiff
path: root/src/PVE/API2/Network/SDN
diff options
context:
space:
mode:
authorStefan Hanreich <s.hanreich@proxmox.com>2025-09-04 10:18:33 +0200
committerWolfgang Bumiller <w.bumiller@proxmox.com>2025-09-04 14:16:41 +0200
commitd3bd0d5b48265f5f9e1e872cfdded385a0d28725 (patch)
treefeac62f5d1e1b9a68eba35ed8a69bb456b9d0fa6 /src/PVE/API2/Network/SDN
parented013f92ce890b82d919ccb0aaf309e65973bfc8 (diff)
api: vnets: update schema of endpoints
The possible properties returned by the vnet endpoints were only partly documented. Add all missing properties and improve descriptions for existing properties. Extract all duplicate properties into a separate variable, so we don't have to rewrite the whole API definition for every endpoint. Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com> Reviewed-by: Dominik Csapak <d.csapak@proxmox.com> Tested-by: Dominik Csapak <d.csapak@proxmox.com>
Diffstat (limited to 'src/PVE/API2/Network/SDN')
-rw-r--r--src/PVE/API2/Network/SDN/Vnets.pm92
1 files changed, 90 insertions, 2 deletions
diff --git a/src/PVE/API2/Network/SDN/Vnets.pm b/src/PVE/API2/Network/SDN/Vnets.pm
index e6eb5d4..1d9e500 100644
--- a/src/PVE/API2/Network/SDN/Vnets.pm
+++ b/src/PVE/API2/Network/SDN/Vnets.pm
@@ -74,6 +74,40 @@ my $check_vnet_access = sub {
$rpcenv->check_any($authuser, "/sdn/zones/$zoneid/$vnet", $privs);
};
+my $VNET_PROPERTIES = {
+ alias => {
+ type => 'string',
+ description => "Alias name of the VNet.",
+ pattern => qr/[\(\)-_.\w\d\s]{0,256}/i,
+ maxLength => 256,
+ optional => 1,
+ },
+ 'isolate-ports' => {
+ type => 'boolean',
+ description =>
+ "If true, sets the isolated property for all interfaces on the bridge of this VNet.",
+ optional => 1,
+ },
+ tag => {
+ type => 'integer',
+ description =>
+ 'VLAN Tag (for VLAN or QinQ zones) or VXLAN VNI (for VXLAN or EVPN zones).',
+ optional => 1,
+ minimum => 1,
+ maximum => 16777215,
+ },
+ vlanaware => {
+ type => 'boolean',
+ description => 'Allow VLANs to pass through this VNet.',
+ optional => 1,
+ },
+ zone => {
+ type => 'string',
+ description => 'Name of the zone this VNet belongs to.',
+ optional => 1,
+ },
+};
+
__PACKAGE__->register_method({
name => 'index',
path => '',
@@ -103,7 +137,33 @@ __PACKAGE__->register_method({
type => 'array',
items => {
type => "object",
- properties => {},
+ properties => {
+ digest => {
+ type => 'string',
+ optional => 1,
+ description => 'Digest of the VNet section.',
+ },
+ state => get_standard_option('pve-sdn-config-state'),
+ type => {
+ type => 'string',
+ enum => ['vnet'],
+ optional => 0,
+ description => 'Type of the VNet.',
+ },
+ vnet => {
+ type => 'string',
+ optional => 0,
+ description => 'Name of the VNet.',
+ },
+ pending => {
+ type => 'object',
+ description =>
+ 'Changes that have not yet been applied to the running configuration.',
+ optional => 1,
+ properties => $VNET_PROPERTIES,
+ },
+ %$VNET_PROPERTIES,
+ },
},
links => [{ rel => 'child', href => "{vnet}" }],
},
@@ -171,7 +231,35 @@ __PACKAGE__->register_method({
},
},
},
- returns => { type => 'object' },
+ returns => {
+ properties => {
+ digest => {
+ type => 'string',
+ optional => 1,
+ description => 'Digest of the VNet section.',
+ },
+ state => get_standard_option('pve-sdn-config-state'),
+ type => {
+ type => 'string',
+ enum => ['vnet'],
+ optional => 0,
+ description => 'Type of the VNet.',
+ },
+ vnet => {
+ type => 'string',
+ optional => 0,
+ description => 'Name of the VNet.',
+ },
+ pending => {
+ type => 'object',
+ description =>
+ 'Changes that have not yet been applied to the running configuration.',
+ optional => 1,
+ properties => $VNET_PROPERTIES,
+ },
+ %$VNET_PROPERTIES,
+ },
+ },
code => sub {
my ($param) = @_;