[pve-devel] [RFC PATCH] api: network: add return schema for interface listing

Gabriel Goller g.goller at proxmox.com
Thu Dec 5 13:49:41 CET 2024


Just in case you haven't noticed, a few typos inline:

On 05.12.2024 09:27, Dominik Csapak wrote:
>Most optiosn come from the api call parameter list

s/optiosn/options/

>(`json_config_properties`). The description and types for the remaining
>ons are either taken from the manpages, source code or similar
>documentation where available.
> [snip]
>diff --git a/PVE/API2/Network.pm b/PVE/API2/Network.pm
>index b9db9b27..df3db5af 100644
>--- a/PVE/API2/Network.pm
>+++ b/PVE/API2/Network.pm
>@@ -38,7 +38,7 @@ my $bond_mode_enum = [
>     ];
>
> my $network_type_enum = ['bridge', 'bond', 'eth', 'alias', 'vlan',
>-			 'OVSBridge', 'OVSBond', 'OVSPort', 'OVSIntPort'];
>+			 'OVSBridge', 'OVSBond', 'OVSPort', 'OVSIntPort', 'vnet'];
>
> my $confdesc = {
>     type => {
>@@ -223,7 +223,100 @@ __PACKAGE__->register_method({
> 	type => "array",
> 	items => {
> 	    type => "object",
>-	    properties => {},
>+	    properties => json_config_properties({
>+		iface => get_standard_option('pve-iface'),
>+		active => {
>+		    type => 'boolean',
>+		    optional => 1,
>+		    description => "Set to 1 if the interface is active.",
>+		},
>+		exists => {
>+		    type => 'boolean',
>+		    optional => 1,
>+		    description => "Set to 1 if the interface physically exists.",
>+		},
>+		families => {
>+		    type => "array",
>+		    description => "The network families.",
>+		    items => {
>+			type => "string",
>+			description => "A ntework familiy.",

s/ntework/network/
s/familiy/family/

>+			enum => ["inet", "inet6"],
>+		    },
>+		    optional => 1,
>+		},
>+		method => {
>+		    type => "string",
>+		    description => "The network configuration method for IPv4.",
>+		    enum => ["manual", "static", "auto"],
>+		    optional => 1,
>+		},
>+		method6 => {
>+		    type => "string",
>+		    description => "The network configuration method for IPv6.",
>+		    enum => ["manual", "static", "auto"],
>+		    optional => 1,
>+		},
>+		priority => {
>+		    type => 'integer',
>+		    description => "The order of the interface.",
>+		    optional => 1,
>+		},
>+		options => {
>+		    type => 'array',
>+		    optional => 1,
>+		    description => "A list of additional interface options for IPv4.",
>+		    items => {
>+			type => "string",
>+			description => "An interface property.",
>+		    },
>+		},
>+		options6 => {
>+		    type => 'array',
>+		    optional => 1,
>+		    description => "A list of additional interface options for IPv6.",
>+		    items => {
>+			type => "string",
>+			description => "An interface property.",
>+		    },
>+		},
>+		'uplink-id' => {
>+		    type => 'string',
>+		    optional => 1,
>+		    description => "The uplink ID.",
>+		},
>+		'link-type' => {
>+		    type => 'string',
>+		    optional => 1,
>+		    description => "The link type.",
>+		},
>+		'vlan-protocol' => {
>+		    type => 'string',
>+		    optional => 1,
>+		    enum => [qw(802.1ad 802.1q)],
>+		    description => "The vlan protocol.",

s/vlan/VLAN/

>+		},
>+		'vxlan-id' => {
>+		    type => 'integer',
>+		    optional => 1,
>+		    description => "The VXLAN ID.",
>+		},
>+		'vxlan-svcnodeip' => {
>+		    type => 'string',
>+		    optional => 1,
>+		    description => "The VXLAN SVC node IP.",
>+		},
>+		'vxlan-physdev' => {
>+		    type => 'string',
>+		    optional => 1,
>+		    description => "The physical device for the VXLAN tunnel communication.",

I would remove the "communication" as it's kinda redundant IMO.

>+		},
>+		'vxlan-local-tunnelip' => {
>+		    type => 'string',
>+		    optional => 1,
>+		    description => "The VXLAN local tunnel IP.",
>+		},
>+	    }),
> 	},
> 	links => [ { rel => 'child', href => "{iface}" } ],
>     },




More information about the pve-devel mailing list