all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH proxmox-api-types 04/12] sdn: generate vnet endpoints
Date: Fri, 28 Feb 2025 16:17:41 +0100	[thread overview]
Message-ID: <20250228151803.158984-5-s.hanreich@proxmox.com> (raw)
In-Reply-To: <20250228151803.158984-1-s.hanreich@proxmox.com>

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
 pve-api-types/src/generated/code.rs  |  34 +++-
 pve-api-types/src/generated/types.rs | 245 +++++++++++++++++++++++++++
 2 files changed, 278 insertions(+), 1 deletion(-)

diff --git a/pve-api-types/src/generated/code.rs b/pve-api-types/src/generated/code.rs
index c1f0e74..f5a993c 100644
--- a/pve-api-types/src/generated/code.rs
+++ b/pve-api-types/src/generated/code.rs
@@ -118,7 +118,6 @@
 /// - /cluster/sdn/ipams/{ipam}/status
 /// - /cluster/sdn/lock
 /// - /cluster/sdn/rollback
-/// - /cluster/sdn/vnets
 /// - /cluster/sdn/vnets/{vnet}
 /// - /cluster/sdn/vnets/{vnet}/firewall
 /// - /cluster/sdn/vnets/{vnet}/firewall/options
@@ -411,6 +410,11 @@ pub trait PveClient {
         Err(Error::Other("create_token not implemented"))
     }
 
+    /// Create a new sdn vnet object.
+    async fn create_vnet(&self, params: CreateVnet) -> Result<(), Error> {
+        Err(Error::Other("create_vnet not implemented"))
+    }
+
     /// Create a new sdn zone object.
     async fn create_zone(&self, params: CreateZone) -> Result<(), Error> {
         Err(Error::Other("create_zone not implemented"))
@@ -489,6 +493,15 @@ pub trait PveClient {
         Err(Error::Other("list_storages not implemented"))
     }
 
+    /// SDN vnets index.
+    async fn list_vnets(
+        &self,
+        pending: Option<bool>,
+        running: Option<bool>,
+    ) -> Result<Vec<SdnVnet>, Error> {
+        Err(Error::Other("list_vnets not implemented"))
+    }
+
     /// SDN zones index.
     async fn list_zones(
         &self,
@@ -726,6 +739,12 @@ where
         Ok(self.0.post(url, &params).await?.expect_json()?.data)
     }
 
+    /// Create a new sdn vnet object.
+    async fn create_vnet(&self, params: CreateVnet) -> Result<(), Error> {
+        let url = "/api2/extjs/cluster/sdn/vnets";
+        self.0.post(url, &params).await?.nodata()
+    }
+
     /// Create a new sdn zone object.
     async fn create_zone(&self, params: CreateZone) -> Result<(), Error> {
         let url = "/api2/extjs/cluster/sdn/zones";
@@ -852,6 +871,19 @@ where
         Ok(self.0.get(url).await?.expect_json()?.data)
     }
 
+    /// SDN vnets index.
+    async fn list_vnets(
+        &self,
+        pending: Option<bool>,
+        running: Option<bool>,
+    ) -> Result<Vec<SdnVnet>, Error> {
+        let (mut query, mut sep) = (String::new(), '?');
+        add_query_bool(&mut query, &mut sep, "pending", pending);
+        add_query_bool(&mut query, &mut sep, "running", running);
+        let url = &format!("/api2/extjs/cluster/sdn/vnets{query}");
+        Ok(self.0.get(url).await?.expect_json()?.data)
+    }
+
     /// SDN zones index.
     async fn list_zones(
         &self,
diff --git a/pve-api-types/src/generated/types.rs b/pve-api-types/src/generated/types.rs
index 408d8ca..871707a 100644
--- a/pve-api-types/src/generated/types.rs
+++ b/pve-api-types/src/generated/types.rs
@@ -932,6 +932,91 @@ pub struct CreateTokenResponseInfo {
 
 const_regex! {
 
+CREATE_VNET_VNET_RE = r##"^[a-z][a-z0-9]*[a-z0-9]$"##;
+
+}
+
+#[api(
+    properties: {
+        alias: {
+            max_length: 256,
+            optional: true,
+            type: String,
+        },
+        "isolate-ports": {
+            default: false,
+            optional: true,
+        },
+        "lock-secret": {
+            optional: true,
+            type: String,
+        },
+        tag: {
+            maximum: 16777215,
+            minimum: 1,
+            optional: true,
+            type: Integer,
+        },
+        type: {
+            optional: true,
+            type: SdnVnetType,
+        },
+        vlanaware: {
+            default: false,
+            optional: true,
+        },
+        vnet: {
+            format: &ApiStringFormat::Pattern(&CREATE_VNET_VNET_RE),
+            type: String,
+        },
+        zone: {
+            type: String,
+        },
+    },
+)]
+/// Object.
+#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
+pub struct CreateVnet {
+    /// Alias name of the VNet.
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    pub alias: Option<String>,
+
+    /// If true, sets the isolated property for all interfaces on the bridge of
+    /// this VNet.
+    #[serde(deserialize_with = "proxmox_login::parse::deserialize_bool")]
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    #[serde(rename = "isolate-ports")]
+    pub isolate_ports: Option<bool>,
+
+    /// the secret for unlocking the global SDN configuration
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    #[serde(rename = "lock-secret")]
+    pub lock_secret: Option<String>,
+
+    /// VLAN Tag (for VLAN or QinQ zones) or VXLAN VNI (for VXLAN or EVPN
+    /// zones).
+    #[serde(deserialize_with = "proxmox_login::parse::deserialize_u32")]
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    pub tag: Option<u32>,
+
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    #[serde(rename = "type")]
+    pub ty: Option<SdnVnetType>,
+
+    /// Allow VLANs to pass through this vnet.
+    #[serde(deserialize_with = "proxmox_login::parse::deserialize_bool")]
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    pub vlanaware: Option<bool>,
+
+    /// The SDN vnet object identifier.
+    pub vnet: String,
+
+    /// Name of the zone this VNet belongs to.
+    pub zone: String,
+}
+
+const_regex! {
+
 CREATE_ZONE_EXITNODES_RE = r##"^(?i:[a-z0-9](?i:[a-z0-9\-]*[a-z0-9])?)$"##;
 CREATE_ZONE_EXITNODES_PRIMARY_RE = r##"^(?i:[a-z0-9](?i:[a-z0-9\-]*[a-z0-9])?)$"##;
 CREATE_ZONE_MAC_RE = r##"^(?i)[a-f0-9][02468ace](?::[a-f0-9]{2}){5}$"##;
@@ -9127,6 +9212,166 @@ pub enum SdnObjectState {
 serde_plain::derive_display_from_serialize!(SdnObjectState);
 serde_plain::derive_fromstr_from_deserialize!(SdnObjectState);
 
+#[api(
+    properties: {
+        alias: {
+            max_length: 256,
+            optional: true,
+            type: String,
+        },
+        digest: {
+            optional: true,
+            type: String,
+        },
+        "isolate-ports": {
+            default: false,
+            optional: true,
+        },
+        pending: {
+            optional: true,
+            type: SdnVnetPending,
+        },
+        state: {
+            optional: true,
+            type: SdnObjectState,
+        },
+        tag: {
+            maximum: 16777215,
+            minimum: 1,
+            optional: true,
+            type: Integer,
+        },
+        type: {
+            type: SdnVnetType,
+        },
+        vlanaware: {
+            default: false,
+            optional: true,
+        },
+        vnet: {
+            type: String,
+        },
+        zone: {
+            optional: true,
+            type: String,
+        },
+    },
+)]
+/// Object.
+#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
+pub struct SdnVnet {
+    /// Alias name of the VNet.
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    pub alias: Option<String>,
+
+    /// Digest of the VNet section.
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    pub digest: Option<String>,
+
+    /// If true, sets the isolated property for all interfaces on the bridge of
+    /// this VNet.
+    #[serde(deserialize_with = "proxmox_login::parse::deserialize_bool")]
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    #[serde(rename = "isolate-ports")]
+    pub isolate_ports: Option<bool>,
+
+    /// Changes that have not yet been applied to the running configuration.
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    pub pending: Option<SdnVnetPending>,
+
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    pub state: Option<SdnObjectState>,
+
+    /// VLAN Tag (for VLAN or QinQ zones) or VXLAN VNI (for VXLAN or EVPN
+    /// zones).
+    #[serde(deserialize_with = "proxmox_login::parse::deserialize_u32")]
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    pub tag: Option<u32>,
+
+    #[serde(rename = "type")]
+    pub ty: SdnVnetType,
+
+    /// Allow VLANs to pass through this VNet.
+    #[serde(deserialize_with = "proxmox_login::parse::deserialize_bool")]
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    pub vlanaware: Option<bool>,
+
+    /// Name of the VNet.
+    pub vnet: String,
+
+    /// Name of the zone this VNet belongs to.
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    pub zone: Option<String>,
+}
+
+#[api(
+    properties: {
+        alias: {
+            max_length: 256,
+            optional: true,
+            type: String,
+        },
+        "isolate-ports": {
+            default: false,
+            optional: true,
+        },
+        tag: {
+            maximum: 16777215,
+            minimum: 1,
+            optional: true,
+            type: Integer,
+        },
+        vlanaware: {
+            default: false,
+            optional: true,
+        },
+        zone: {
+            optional: true,
+            type: String,
+        },
+    },
+)]
+/// Changes that have not yet been applied to the running configuration.
+#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
+pub struct SdnVnetPending {
+    /// Alias name of the VNet.
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    pub alias: Option<String>,
+
+    /// If true, sets the isolated property for all interfaces on the bridge of
+    /// this VNet.
+    #[serde(deserialize_with = "proxmox_login::parse::deserialize_bool")]
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    #[serde(rename = "isolate-ports")]
+    pub isolate_ports: Option<bool>,
+
+    /// VLAN Tag (for VLAN or QinQ zones) or VXLAN VNI (for VXLAN or EVPN
+    /// zones).
+    #[serde(deserialize_with = "proxmox_login::parse::deserialize_u32")]
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    pub tag: Option<u32>,
+
+    /// Allow VLANs to pass through this VNet.
+    #[serde(deserialize_with = "proxmox_login::parse::deserialize_bool")]
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    pub vlanaware: Option<bool>,
+
+    /// Name of the zone this VNet belongs to.
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    pub zone: Option<String>,
+}
+
+#[api]
+/// Type of the VNet.
+#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
+pub enum SdnVnetType {
+    #[serde(rename = "vnet")]
+    /// vnet.
+    Vnet,
+}
+serde_plain::derive_display_from_serialize!(SdnVnetType);
+serde_plain::derive_fromstr_from_deserialize!(SdnVnetType);
+
 const_regex! {
 
 SDN_ZONE_EXITNODES_RE = r##"^(?i:[a-z0-9](?i:[a-z0-9\-]*[a-z0-9])?)$"##;
-- 
2.39.5


_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


  parent reply	other threads:[~2025-02-28 15:19 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-28 15:17 [pdm-devel] [RFC proxmox{-api-types, -yew-comp, -datacenter-manager} 00/26] Add initial SDN / EVPN integration Stefan Hanreich
2025-02-28 15:17 ` [pdm-devel] [PATCH proxmox-api-types 01/12] sdn: add list/create zone endpoints Stefan Hanreich
2025-02-28 15:17 ` [pdm-devel] [PATCH proxmox-api-types 02/12] sdn: generate zones endpoints Stefan Hanreich
2025-02-28 15:17 ` [pdm-devel] [PATCH proxmox-api-types 03/12] sdn: add list/create vnet endpoints Stefan Hanreich
2025-02-28 15:17 ` Stefan Hanreich [this message]
2025-02-28 15:17 ` [pdm-devel] [PATCH proxmox-api-types 05/12] sdn: add list/create controller endpoints Stefan Hanreich
2025-02-28 15:17 ` [pdm-devel] [PATCH proxmox-api-types 06/12] sdn: generate " Stefan Hanreich
2025-02-28 15:17 ` [pdm-devel] [PATCH proxmox-api-types 07/12] sdn: add acquire/release lock endpoints Stefan Hanreich
2025-02-28 15:17 ` [pdm-devel] [PATCH proxmox-api-types 08/12] sdn: generate " Stefan Hanreich
2025-02-28 15:17 ` [pdm-devel] [PATCH proxmox-api-types 09/12] sdn: add apply configuration endpoint Stefan Hanreich
2025-02-28 15:17 ` [pdm-devel] [PATCH proxmox-api-types 10/12] sdn: generate " Stefan Hanreich
2025-02-28 15:17 ` [pdm-devel] [PATCH proxmox-api-types 11/12] tasks: add helper for querying successfully finished tasks Stefan Hanreich
2025-02-28 15:17 ` [pdm-devel] [PATCH proxmox-api-types 12/12] sdn: add helpers for pending values Stefan Hanreich
2025-02-28 15:17 ` [pdm-devel] [PATCH proxmox-yew-comp 1/1] sdn: add descriptions for sdn tasks Stefan Hanreich
2025-02-28 15:17 ` [pdm-devel] [PATCH proxmox-datacenter-manager 01/13] server: add locked sdn client and helper methods Stefan Hanreich
2025-02-28 15:17 ` [pdm-devel] [PATCH proxmox-datacenter-manager 02/13] api: sdn: add list_zones endpoint Stefan Hanreich
2025-02-28 15:17 ` [pdm-devel] [PATCH proxmox-datacenter-manager 03/13] api: sdn: add create_zone endpoint Stefan Hanreich
2025-02-28 15:17 ` [pdm-devel] [PATCH proxmox-datacenter-manager 04/13] api: sdn: add list_vnets endpoint Stefan Hanreich
2025-02-28 15:17 ` [pdm-devel] [PATCH proxmox-datacenter-manager 05/13] api: sdn: add create_vnet endpoint Stefan Hanreich
2025-02-28 15:17 ` [pdm-devel] [PATCH proxmox-datacenter-manager 06/13] api: sdn: add list_controllers endpoint Stefan Hanreich
2025-02-28 15:17 ` [pdm-devel] [PATCH proxmox-datacenter-manager 07/13] ui: add VrfTree component Stefan Hanreich
2025-02-28 15:17 ` [pdm-devel] [PATCH proxmox-datacenter-manager 08/13] ui: sdn: add RouterTable component Stefan Hanreich
2025-02-28 15:17 ` [pdm-devel] [PATCH proxmox-datacenter-manager 09/13] ui: sdn: add AddVnetWindow component Stefan Hanreich
2025-02-28 15:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 10/13] ui: sdn: add AddZoneWindow component Stefan Hanreich
2025-02-28 15:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 11/13] ui: sdn: add EvpnPanel Stefan Hanreich
2025-02-28 15:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 12/13] ui: sdn: add EvpnPanel to main menu Stefan Hanreich
2025-02-28 15:18 ` [pdm-devel] [PATCH proxmox-datacenter-manager 13/13] pve: sdn: add descriptions for sdn tasks 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=20250228151803.158984-5-s.hanreich@proxmox.com \
    --to=s.hanreich@proxmox.com \
    --cc=pdm-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal