From: Gabriel Goller <g.goller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox-ve-rs v5 22/22] ve-config: remove serde_plain and serde_with
Date: Wed, 16 Jul 2025 15:07:48 +0200 [thread overview]
Message-ID: <20250716130837.585796-28-g.goller@proxmox.com> (raw)
In-Reply-To: <20250716130837.585796-1-g.goller@proxmox.com>
Use proxmox-serde instead, which contains macros to do the same
stuff. The main use-case here is to generate Serialize and Deserialize
impls from the FromStr and Display implementations.
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
Cargo.toml | 2 +-
proxmox-sdn-types/Cargo.toml | 3 +--
proxmox-sdn-types/debian/control | 16 ++++++----------
proxmox-sdn-types/src/area.rs | 8 ++++----
proxmox-ve-config/Cargo.toml | 4 +---
proxmox-ve-config/debian/control | 9 ++-------
proxmox-ve-config/src/firewall/types/address.rs | 5 +++--
proxmox-ve-config/src/firewall/types/alias.rs | 6 ++++--
proxmox-ve-config/src/firewall/types/ipset.rs | 5 +++--
proxmox-ve-config/src/firewall/types/log.rs | 2 +-
proxmox-ve-config/src/firewall/types/port.rs | 5 +++--
proxmox-ve-config/src/firewall/types/rule.rs | 4 ++--
proxmox-ve-config/src/guest/types.rs | 8 ++++----
proxmox-ve-config/src/guest/vm.rs | 13 +++++++++----
proxmox-ve-config/src/sdn/config.rs | 14 +++++++-------
.../src/sdn/fabric/section_config/node.rs | 8 ++++----
proxmox-ve-config/src/sdn/mod.rs | 13 +++++++++----
17 files changed, 64 insertions(+), 61 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index 427837d544e4..5ee6ce989807 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,10 +22,10 @@ anyhow = "1"
const_format = "0.2"
regex = "1.7"
serde = { version = "1" }
-serde_with = "3"
thiserror = "2.0.0"
proxmox-frr = { version = "0.1", path = "proxmox-frr" }
proxmox-network-types = { version = "0.1" }
proxmox-schema = { version = "4" }
proxmox-sdn-types = { version = "0.1", path = "proxmox-sdn-types" }
+proxmox-serde = { version = "1.0.0" }
diff --git a/proxmox-sdn-types/Cargo.toml b/proxmox-sdn-types/Cargo.toml
index 54de2807385a..7d244d2491b9 100644
--- a/proxmox-sdn-types/Cargo.toml
+++ b/proxmox-sdn-types/Cargo.toml
@@ -12,7 +12,6 @@ rust-version.workspace = true
anyhow = { workspace = true }
regex = { workspace = true }
serde = { workspace = true, features = [ "derive" ] }
-serde_with = { workspace = true }
proxmox-schema = { workspace = true, features = [ "api-macro", "api-types" ] }
-proxmox-serde = { version = "1.0.0", features = [ "perl" ] }
+proxmox-serde = { workspace = true, features = [ "perl" ] }
diff --git a/proxmox-sdn-types/debian/control b/proxmox-sdn-types/debian/control
index bfdb47eb0b55..5bb716e36fec 100644
--- a/proxmox-sdn-types/debian/control
+++ b/proxmox-sdn-types/debian/control
@@ -7,16 +7,14 @@ Build-Depends-Arch: cargo:native <!nocheck>,
rustc:native (>= 1.82) <!nocheck>,
libstd-rust-dev <!nocheck>,
librust-anyhow-1+default-dev <!nocheck>,
- librust-const-format-0.2+default-dev <!nocheck>,
librust-proxmox-schema-4+api-macro-dev <!nocheck>,
librust-proxmox-schema-4+api-types-dev <!nocheck>,
librust-proxmox-schema-4+default-dev <!nocheck>,
- librust-proxmox-serde-0.1+default-dev (>= 0.1.2-~~) <!nocheck>,
- librust-proxmox-serde-0.1+perl-dev (>= 0.1.2-~~) <!nocheck>,
+ librust-proxmox-serde-1+default-dev <!nocheck>,
+ librust-proxmox-serde-1+perl-dev <!nocheck>,
librust-regex-1+default-dev (>= 1.7-~~) <!nocheck>,
librust-serde-1+default-dev <!nocheck>,
- librust-serde-1+derive-dev <!nocheck>,
- librust-serde-with-3+default-dev <!nocheck>
+ librust-serde-1+derive-dev <!nocheck>
Maintainer: Proxmox Support Team <support@proxmox.com>
Standards-Version: 4.7.0
Vcs-Git: git://git.proxmox.com/git/proxmox-ve-rs.git
@@ -31,16 +29,14 @@ Multi-Arch: same
Depends:
${misc:Depends},
librust-anyhow-1+default-dev,
- librust-const-format-0.2+default-dev,
librust-proxmox-schema-4+api-macro-dev,
librust-proxmox-schema-4+api-types-dev,
librust-proxmox-schema-4+default-dev,
- librust-proxmox-serde-0.1+default-dev (>= 0.1.2-~~),
- librust-proxmox-serde-0.1+perl-dev (>= 0.1.2-~~),
+ librust-proxmox-serde-1+default-dev,
+ librust-proxmox-serde-1+perl-dev,
librust-regex-1+default-dev (>= 1.7-~~),
librust-serde-1+default-dev,
- librust-serde-1+derive-dev,
- librust-serde-with-3+default-dev
+ librust-serde-1+derive-dev
Provides:
librust-proxmox-sdn-types+default-dev (= ${binary:Version}),
librust-proxmox-sdn-types-0-dev (= ${binary:Version}),
diff --git a/proxmox-sdn-types/src/area.rs b/proxmox-sdn-types/src/area.rs
index 71d2d53ba02f..3eba3b1b2545 100644
--- a/proxmox-sdn-types/src/area.rs
+++ b/proxmox-sdn-types/src/area.rs
@@ -2,21 +2,21 @@ use std::{fmt::Display, net::Ipv4Addr};
use anyhow::Error;
use proxmox_schema::{ApiType, Schema, StringSchema, UpdaterType};
-use serde_with::{DeserializeFromStr, SerializeDisplay};
/// An OSPF Area.
///
/// Internally the area is just a 32 bit number and is often represented in dotted-decimal
/// notation, like an IPv4. FRR also allows us to specify it as a number or an IPv4-Address.
/// To keep a nice user experience we keep whichever format the user entered.
-#[derive(
- Debug, DeserializeFromStr, SerializeDisplay, Clone, Hash, PartialEq, Eq, PartialOrd, Ord,
-)]
+#[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub enum Area {
Number(u32),
IpAddress(Ipv4Addr),
}
+proxmox_serde::forward_deserialize_to_from_str!(Area);
+proxmox_serde::forward_serialize_to_display!(Area);
+
impl ApiType for Area {
const API_SCHEMA: Schema =
StringSchema::new("The OSPF area, which can be a number or a ip-address.").schema();
diff --git a/proxmox-ve-config/Cargo.toml b/proxmox-ve-config/Cargo.toml
index d5663f953614..ea70f0fa1687 100644
--- a/proxmox-ve-config/Cargo.toml
+++ b/proxmox-ve-config/Cargo.toml
@@ -17,15 +17,13 @@ tracing = "0.1.37"
serde = { workspace = true, features = [ "derive" ] }
serde_json = "1"
-serde_plain = "1"
-serde_with = { workspace = true }
-proxmox-serde = { version = "1.0.0", features = [ "perl" ]}
proxmox-frr = { workspace = true, optional = true }
proxmox-network-types = { workspace = true, features = [ "api-types" ] }
proxmox-schema = { workspace = true, features = [ "api-types" ] }
proxmox-sdn-types = { workspace = true }
proxmox-section-config = { version = "3" }
+proxmox-serde = { workspace = true, features = [ "perl" ]}
proxmox-sys = "1"
proxmox-sortable-macro = "1"
diff --git a/proxmox-ve-config/debian/control b/proxmox-ve-config/debian/control
index 23daefa92734..3e9f655a0c1b 100644
--- a/proxmox-ve-config/debian/control
+++ b/proxmox-ve-config/debian/control
@@ -13,7 +13,7 @@ Build-Depends-Arch: cargo:native <!nocheck>,
librust-proxmox-network-types-0.1+api-types-dev <!nocheck>,
librust-proxmox-network-types-0.1+default-dev <!nocheck>,
librust-proxmox-schema-4+api-types-dev <!nocheck>,
- librust-proxmox-schema-4+default-dev (>= 4.1-~~) <!nocheck>,
+ librust-proxmox-schema-4+default-dev <!nocheck>,
librust-proxmox-sdn-types-0.1+default-dev <!nocheck>,
librust-proxmox-section-config-3+default-dev <!nocheck>,
librust-proxmox-serde-1+default-dev <!nocheck>,
@@ -24,8 +24,6 @@ Build-Depends-Arch: cargo:native <!nocheck>,
librust-serde-1+default-dev <!nocheck>,
librust-serde-1+derive-dev <!nocheck>,
librust-serde-json-1+default-dev <!nocheck>,
- librust-serde-plain-1+default-dev <!nocheck>,
- librust-serde-with-3+default-dev <!nocheck>,
librust-thiserror-2+default-dev <!nocheck>,
librust-tracing-0.1+default-dev (>= 0.1.37-~~) <!nocheck>
Maintainer: Proxmox Support Team <support@proxmox.com>
@@ -47,7 +45,7 @@ Depends:
librust-proxmox-network-types-0.1+api-types-dev,
librust-proxmox-network-types-0.1+default-dev,
librust-proxmox-schema-4+api-types-dev,
- librust-proxmox-schema-4+default-dev (>= 4.1-~~),
+ librust-proxmox-schema-4+default-dev,
librust-proxmox-sdn-types-0.1+default-dev,
librust-proxmox-section-config-3+default-dev,
librust-proxmox-serde-1+default-dev,
@@ -58,8 +56,6 @@ Depends:
librust-serde-1+default-dev,
librust-serde-1+derive-dev,
librust-serde-json-1+default-dev,
- librust-serde-plain-1+default-dev,
- librust-serde-with-3+default-dev,
librust-thiserror-2+default-dev,
librust-tracing-0.1+default-dev (>= 0.1.37-~~)
Suggests:
@@ -89,4 +85,3 @@ Provides:
Description: Rust crate "proxmox-ve-config" - feature "frr"
This metapackage enables feature "frr" for the Rust proxmox-ve-config crate, by
pulling in any additional dependencies needed by that feature.
-
diff --git a/proxmox-ve-config/src/firewall/types/address.rs b/proxmox-ve-config/src/firewall/types/address.rs
index 3ed255c5b4e2..89d9b8b8565b 100644
--- a/proxmox-ve-config/src/firewall/types/address.rs
+++ b/proxmox-ve-config/src/firewall/types/address.rs
@@ -3,7 +3,6 @@ use std::ops::Deref;
use anyhow::{bail, Error};
use proxmox_network_types::ip_address::{Cidr, Family, IpRange};
-use serde_with::DeserializeFromStr;
#[derive(Clone, Debug)]
#[cfg_attr(test, derive(Eq, PartialEq))]
@@ -58,7 +57,7 @@ impl From<IpRange> for IpEntry {
}
}
-#[derive(Clone, Debug, DeserializeFromStr)]
+#[derive(Clone, Debug)]
#[cfg_attr(test, derive(Eq, PartialEq))]
pub struct IpList {
// guaranteed to have the same family
@@ -66,6 +65,8 @@ pub struct IpList {
family: Family,
}
+proxmox_serde::forward_deserialize_to_from_str!(IpList);
+
impl Deref for IpList {
type Target = Vec<IpEntry>;
diff --git a/proxmox-ve-config/src/firewall/types/alias.rs b/proxmox-ve-config/src/firewall/types/alias.rs
index a463e5231280..c7a58c1ffa44 100644
--- a/proxmox-ve-config/src/firewall/types/alias.rs
+++ b/proxmox-ve-config/src/firewall/types/alias.rs
@@ -3,7 +3,6 @@ use std::str::FromStr;
use anyhow::{bail, format_err, Error};
use proxmox_network_types::ip_address::Cidr;
-use serde_with::{DeserializeFromStr, SerializeDisplay};
use crate::firewall::parse::{match_name, match_non_whitespace};
@@ -37,13 +36,16 @@ impl Display for AliasScope {
/// Represents the name of an alias in a firewall rule in the RULES section of the firewall
/// configuration.
-#[derive(Debug, Clone, DeserializeFromStr, SerializeDisplay)]
+#[derive(Debug, Clone)]
#[cfg_attr(test, derive(Eq, PartialEq))]
pub struct AliasName {
scope: AliasScope,
name: String,
}
+proxmox_serde::forward_deserialize_to_from_str!(AliasName);
+proxmox_serde::forward_serialize_to_display!(AliasName);
+
impl Display for AliasName {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_fmt(format_args!("{}/{}", self.scope, self.name))
diff --git a/proxmox-ve-config/src/firewall/types/ipset.rs b/proxmox-ve-config/src/firewall/types/ipset.rs
index 2aaf26152d2c..8a51e38d7c62 100644
--- a/proxmox-ve-config/src/firewall/types/ipset.rs
+++ b/proxmox-ve-config/src/firewall/types/ipset.rs
@@ -4,7 +4,6 @@ use std::str::FromStr;
use anyhow::{bail, format_err, Error};
use proxmox_network_types::ip_address::{Cidr, IpRange};
-use serde_with::DeserializeFromStr;
use crate::firewall::parse::match_non_whitespace;
use crate::firewall::types::alias::AliasName;
@@ -42,13 +41,15 @@ impl Display for IpsetScope {
}
}
-#[derive(Debug, Clone, DeserializeFromStr)]
+#[derive(Debug, Clone)]
#[cfg_attr(test, derive(Eq, PartialEq))]
pub struct IpsetName {
pub scope: IpsetScope,
pub name: String,
}
+proxmox_serde::forward_deserialize_to_from_str!(IpsetName);
+
impl IpsetName {
pub fn new(scope: IpsetScope, name: impl Into<String>) -> Self {
Self {
diff --git a/proxmox-ve-config/src/firewall/types/log.rs b/proxmox-ve-config/src/firewall/types/log.rs
index 72344e4c2da5..212650298941 100644
--- a/proxmox-ve-config/src/firewall/types/log.rs
+++ b/proxmox-ve-config/src/firewall/types/log.rs
@@ -164,7 +164,7 @@ impl fmt::Display for LogLevel {
}
}
-serde_plain::derive_deserialize_from_fromstr!(LogLevel, "valid log level");
+proxmox_serde::forward_deserialize_to_from_str!(LogLevel);
#[cfg(test)]
mod tests {
diff --git a/proxmox-ve-config/src/firewall/types/port.rs b/proxmox-ve-config/src/firewall/types/port.rs
index c1252d9e449e..8755516e9db5 100644
--- a/proxmox-ve-config/src/firewall/types/port.rs
+++ b/proxmox-ve-config/src/firewall/types/port.rs
@@ -2,7 +2,6 @@ use std::fmt;
use std::ops::Deref;
use anyhow::{bail, Error};
-use serde_with::DeserializeFromStr;
use crate::firewall::ports::parse_named_port;
@@ -65,10 +64,12 @@ impl TryFrom<(u16, u16)> for PortEntry {
}
}
-#[derive(Clone, Debug, DeserializeFromStr)]
+#[derive(Clone, Debug)]
#[cfg_attr(test, derive(Eq, PartialEq))]
pub struct PortList(pub(crate) Vec<PortEntry>);
+proxmox_serde::forward_deserialize_to_from_str!(PortList);
+
impl FromIterator<PortEntry> for PortList {
fn from_iter<T: IntoIterator<Item = PortEntry>>(iter: T) -> Self {
Self(iter.into_iter().collect())
diff --git a/proxmox-ve-config/src/firewall/types/rule.rs b/proxmox-ve-config/src/firewall/types/rule.rs
index b6b83d2f5557..3ad8cf059f09 100644
--- a/proxmox-ve-config/src/firewall/types/rule.rs
+++ b/proxmox-ve-config/src/firewall/types/rule.rs
@@ -34,7 +34,7 @@ impl std::str::FromStr for Direction {
}
}
-serde_plain::derive_deserialize_from_fromstr!(Direction, "valid packet direction");
+proxmox_serde::forward_deserialize_to_from_str!(Direction);
impl fmt::Display for Direction {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@ -83,7 +83,7 @@ impl Display for Verdict {
}
}
-serde_plain::derive_deserialize_from_fromstr!(Verdict, "valid verdict");
+proxmox_serde::forward_deserialize_to_from_str!(Verdict);
#[derive(Clone, Debug)]
#[cfg_attr(test, derive(Eq, PartialEq))]
diff --git a/proxmox-ve-config/src/guest/types.rs b/proxmox-ve-config/src/guest/types.rs
index ed6a48c672d8..6df138290ffc 100644
--- a/proxmox-ve-config/src/guest/types.rs
+++ b/proxmox-ve-config/src/guest/types.rs
@@ -2,13 +2,13 @@ use std::fmt;
use std::str::FromStr;
use anyhow::{format_err, Error};
-use serde_with::{DeserializeFromStr, SerializeDisplay};
-#[derive(
- Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash, SerializeDisplay, DeserializeFromStr,
-)]
+#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
pub struct Vmid(u32);
+proxmox_serde::forward_deserialize_to_from_str!(Vmid);
+proxmox_serde::forward_serialize_to_display!(Vmid);
+
impl Vmid {
pub fn new(id: u32) -> Self {
Vmid(id)
diff --git a/proxmox-ve-config/src/guest/vm.rs b/proxmox-ve-config/src/guest/vm.rs
index 34b9075db317..cc977818b01d 100644
--- a/proxmox-ve-config/src/guest/vm.rs
+++ b/proxmox-ve-config/src/guest/vm.rs
@@ -4,7 +4,6 @@ use std::str::FromStr;
use anyhow::{bail, Error};
use serde::Deserialize;
-use serde_with::DeserializeFromStr;
use proxmox_network_types::ip_address::{Ipv4Cidr, Ipv6Cidr};
use proxmox_network_types::mac_address::MacAddress;
@@ -15,7 +14,7 @@ use proxmox_sortable_macro::sortable;
use crate::firewall::parse::match_digits;
/// All possible models of network devices for both QEMU and LXC guests.
-#[derive(Debug, Clone, Copy, DeserializeFromStr)]
+#[derive(Debug, Clone, Copy)]
#[cfg_attr(test, derive(Eq, PartialEq))]
pub enum NetworkDeviceModel {
VirtIO,
@@ -25,6 +24,8 @@ pub enum NetworkDeviceModel {
RTL8139,
}
+proxmox_serde::forward_deserialize_to_from_str!(NetworkDeviceModel);
+
impl FromStr for NetworkDeviceModel {
type Err = Error;
@@ -85,7 +86,7 @@ impl ApiType for QemuNetworkDevice {
}
/// Representation of possible values for an LXC guest IPv4 field.
-#[derive(Debug, DeserializeFromStr, Copy, Clone)]
+#[derive(Debug, Copy, Clone)]
#[cfg_attr(test, derive(Eq, PartialEq))]
pub enum LxcIpv4Addr {
Ip(Ipv4Cidr),
@@ -93,6 +94,8 @@ pub enum LxcIpv4Addr {
Manual,
}
+proxmox_serde::forward_deserialize_to_from_str!(LxcIpv4Addr);
+
impl LxcIpv4Addr {
pub fn cidr(&self) -> Option<Ipv4Cidr> {
match self {
@@ -115,7 +118,7 @@ impl FromStr for LxcIpv4Addr {
}
/// Representation of possible values for an LXC guest IPv6 field.
-#[derive(Debug, DeserializeFromStr, Copy, Clone)]
+#[derive(Debug, Copy, Clone)]
#[cfg_attr(test, derive(Eq, PartialEq))]
pub enum LxcIpv6Addr {
Ip(Ipv6Cidr),
@@ -124,6 +127,8 @@ pub enum LxcIpv6Addr {
Manual,
}
+proxmox_serde::forward_deserialize_to_from_str!(LxcIpv6Addr);
+
impl LxcIpv6Addr {
pub fn cidr(&self) -> Option<Ipv6Cidr> {
match self {
diff --git a/proxmox-ve-config/src/sdn/config.rs b/proxmox-ve-config/src/sdn/config.rs
index 898121c01332..031fedcebbfc 100644
--- a/proxmox-ve-config/src/sdn/config.rs
+++ b/proxmox-ve-config/src/sdn/config.rs
@@ -9,7 +9,6 @@ use std::{
use proxmox_network_types::ip_address::{Cidr, IpRange, IpRangeError};
use proxmox_schema::{property_string::PropertyString, ApiType, ObjectSchema, StringSchema};
use serde::Deserialize;
-use serde_with::{DeserializeFromStr, SerializeDisplay};
use crate::{
common::Allowlist,
@@ -63,9 +62,7 @@ impl Display for SdnConfigError {
}
}
-#[derive(
- Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, SerializeDisplay, DeserializeFromStr,
-)]
+#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum ZoneType {
Simple,
Vlan,
@@ -74,6 +71,9 @@ pub enum ZoneType {
Evpn,
}
+proxmox_serde::forward_deserialize_to_from_str!(ZoneType);
+proxmox_serde::forward_serialize_to_display!(ZoneType);
+
impl FromStr for ZoneType {
type Err = SdnConfigError;
@@ -101,12 +101,12 @@ impl Display for ZoneType {
}
}
-#[derive(
- Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, SerializeDisplay, DeserializeFromStr,
-)]
+#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum DhcpType {
Dnsmasq,
}
+proxmox_serde::forward_deserialize_to_from_str!(DhcpType);
+proxmox_serde::forward_serialize_to_display!(DhcpType);
impl FromStr for DhcpType {
type Err = SdnConfigError;
diff --git a/proxmox-ve-config/src/sdn/fabric/section_config/node.rs b/proxmox-ve-config/src/sdn/fabric/section_config/node.rs
index b8a14d2268a0..17d2f0b8de8a 100644
--- a/proxmox-ve-config/src/sdn/fabric/section_config/node.rs
+++ b/proxmox-ve-config/src/sdn/fabric/section_config/node.rs
@@ -1,7 +1,6 @@
use const_format::concatcp;
use proxmox_schema::api_types::{IP_V4_SCHEMA, IP_V6_SCHEMA};
use serde::{Deserialize, Serialize};
-use serde_with::{DeserializeFromStr, SerializeDisplay};
use proxmox_network_types::ip_address::api_types::{Ipv4Addr, Ipv6Addr};
@@ -44,14 +43,15 @@ api_string_type! {
///
/// This struct is a helper for parsing the string into the two separate parts. It (de-)serializes
/// from and into a String.
-#[derive(
- Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, SerializeDisplay, DeserializeFromStr,
-)]
+#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct NodeSectionId {
pub(crate) fabric_id: FabricId,
pub(crate) node_id: NodeId,
}
+proxmox_serde::forward_deserialize_to_from_str!(NodeSectionId);
+proxmox_serde::forward_serialize_to_display!(NodeSectionId);
+
impl ApiType for NodeSectionId {
const API_SCHEMA: Schema = StringSchema::new("ID of a SDN node in the section config")
.format(&NODE_SECTION_ID_FORMAT)
diff --git a/proxmox-ve-config/src/sdn/mod.rs b/proxmox-ve-config/src/sdn/mod.rs
index 6252601f507e..4586c56358ef 100644
--- a/proxmox-ve-config/src/sdn/mod.rs
+++ b/proxmox-ve-config/src/sdn/mod.rs
@@ -7,7 +7,6 @@ pub mod ipam;
use std::{error::Error, fmt::Display, str::FromStr};
use proxmox_network_types::ip_address::Cidr;
-use serde_with::DeserializeFromStr;
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum SdnNameError {
@@ -54,9 +53,11 @@ fn validate_sdn_name(name: &str) -> Result<(), SdnNameError> {
}
/// represents the name of an sdn zone
-#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, DeserializeFromStr)]
+#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ZoneName(String);
+proxmox_serde::forward_deserialize_to_from_str!(ZoneName);
+
impl ZoneName {
/// construct a new zone name
///
@@ -91,9 +92,11 @@ impl Display for ZoneName {
}
/// represents the name of an sdn vnet
-#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, DeserializeFromStr)]
+#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct VnetName(String);
+proxmox_serde::forward_deserialize_to_from_str!(VnetName);
+
impl VnetName {
/// construct a new vnet name
///
@@ -135,9 +138,11 @@ impl Display for VnetName {
///
/// # Textual representation
/// A subnet name has the form `{zone_id}-{cidr_ip}-{cidr_mask}`
-#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, DeserializeFromStr)]
+#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SubnetName(ZoneName, Cidr);
+proxmox_serde::forward_deserialize_to_from_str!(SubnetName);
+
impl SubnetName {
pub fn new(zone: ZoneName, cidr: Cidr) -> Self {
SubnetName(zone, cidr)
--
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-07-16 13:12 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-16 13:07 [pve-devel] [PATCH access-control/cluster/docs/gui-tests/manager/network/proxmox{, -firewall, -ve-rs, -perl-rs, -widget-toolkit} v5 00/76] Add SDN Fabrics Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox v5 1/4] network-types: initial commit Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox v5 2/4] network-types: make cidr and mac-address types usable by the api Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox v5 3/4] network-types: add api types for ipv4/6 Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox v5 4/4] network-types: add CIDR overlap detection for IPv4 and IPv6 Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-firewall v5 1/1] firewall: nftables: migrate to proxmox-network-types Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-ve-rs v5 01/22] ve-config: move types " Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-ve-rs v5 02/22] sdn-types: initial commit Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-ve-rs v5 03/22] frr: create proxmox-frr crate Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-ve-rs v5 04/22] frr: add common frr types Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-ve-rs v5 05/22] frr: add openfabric types Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-ve-rs v5 06/22] frr: add ospf types Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-ve-rs v5 07/22] frr: add route-map types Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-ve-rs v5 08/22] frr: add generic types over openfabric and ospf Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-ve-rs v5 09/22] frr: add serializer for all FRR types Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-ve-rs v5 10/22] config: sdn: fabrics: add section types Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-ve-rs v5 11/22] config: sdn: fabrics: add node " Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-ve-rs v5 12/22] config: sdn: fabrics: add interface name struct Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-ve-rs v5 13/22] config: sdn: fabrics: add openfabric properties Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-ve-rs v5 14/22] config: sdn: fabrics: add ospf properties Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-ve-rs v5 15/22] config: sdn: fabrics: add api types Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-ve-rs v5 16/22] config: sdn: fabrics: add section config Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-ve-rs v5 17/22] config: sdn: fabrics: add fabric config Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-ve-rs v5 18/22] common: sdn: fabrics: implement validation Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-ve-rs v5 19/22] sdn: fabrics: config: add conversion from / to section config Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-ve-rs v5 20/22] sdn: fabrics: implement FRR configuration generation Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-ve-rs v5 21/22] ve-config: add integrations tests Gabriel Goller
2025-07-16 13:07 ` Gabriel Goller [this message]
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-perl-rs v5 1/5] pve-rs: Add PVE::RS::SDN::Fabrics module Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-perl-rs v5 2/5] pve-rs: sdn: fabrics: add api methods Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-perl-rs v5 3/5] pve-rs: sdn: fabrics: add frr config generation Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-perl-rs v5 4/5] pve-rs: sdn: fabrics: add helper to generate ifupdown2 configuration Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH proxmox-perl-rs v5 5/5] pve-rs: sdn: fabrics: add helper for network API endpoint Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH pve-cluster v5 1/1] cfs: add fabrics.cfg to observed files Gabriel Goller
2025-07-16 14:02 ` [pve-devel] applied: " Thomas Lamprecht
2025-07-16 14:41 ` [pve-devel] " Thomas Lamprecht
2025-07-16 13:07 ` [pve-devel] [PATCH pve-access-control v5 1/1] permissions: add ACL paths for SDN fabrics Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH pve-network v5 01/21] sdn: fix value returned by pending_config Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH pve-network v5 02/21] debian: add dependency to proxmox-perl-rs Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH pve-network v5 03/21] fabrics: add fabrics module Gabriel Goller
2025-07-16 13:07 ` [pve-devel] [PATCH pve-network v5 04/21] refactor: controller: move frr methods into helper Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-network v5 05/21] frr: add new helpers for reloading frr configuration Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-network v5 06/21] controllers: define new api for frr config generation Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-network v5 07/21] sdn: add frr config generation helpers Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-network v5 08/21] sdn: api: add check for rewriting frr configuration Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-network v5 09/21] test: isis: add test for standalone configuration Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-network v5 10/21] sdn: frr: add daemon status to frr helper Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-network v5 11/21] sdn: commit fabrics config to running configuration Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-network v5 12/21] fabrics: generate ifupdown configuration Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-network v5 13/21] fabrics: add jsonschema for fabrics and nodes Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-network v5 14/21] api: fabrics: add root-level module Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-network v5 15/21] api: fabrics: add fabric submodule Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-network v5 16/21] api: fabrics: add node submodule Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-network v5 17/21] api: fabrics: add fabricnode submodule Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-network v5 18/21] controller: evpn: add fabrics integration Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-network v5 19/21] zone: vxlan: " Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-network v5 20/21] test: fabrics: add test cases for ospf and openfabric + evpn Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-network v5 21/21] frr: bump frr config version to 10.3.1 Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH proxmox-widget-toolkit v5 1/1] network selector: add type parameter Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-manager v5 01/18] api: use new sdn config generation functions Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-manager v5 02/18] ui: fabrics: add model definitions for fabrics Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-manager v5 03/18] fabric: add common interface panel Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-manager v5 04/18] fabric: add OpenFabric interface properties Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-manager v5 05/18] fabric: add OSPF " Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-manager v5 06/18] fabric: add generic node edit panel Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-manager v5 07/18] fabric: add OpenFabric node edit Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-manager v5 08/18] fabric: add OSPF " Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-manager v5 09/18] fabric: add generic fabric edit panel Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-manager v5 10/18] fabric: add OpenFabric " Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-manager v5 11/18] fabric: add OSPF " Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-manager v5 12/18] fabrics: Add main FabricView Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-manager v5 13/18] utils: avoid line-break in pending changes message Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-manager v5 14/18] ui: permissions: add ACL path for fabrics Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-manager v5 15/18] api: network: add include_sdn / fabric type Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-manager v5 16/18] ui: add sdn networks to ceph / migration Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-manager v5 17/18] ui: sdn: add evpn controller fabric integration Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-manager v5 18/18] ui: sdn: vxlan: add fabric property Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-gui-tests v5 1/1] pve: add sdn/fabrics screenshots Gabriel Goller
2025-07-16 13:08 ` [pve-devel] [PATCH pve-docs v5 1/1] fabrics: add initial documentation for sdn fabrics Gabriel Goller
2025-07-18 7:37 ` Gabriel Goller
2025-07-18 7:51 ` Thomas Lamprecht
2025-07-18 8:09 ` Gabriel Goller
2025-07-17 0:10 ` [pve-devel] applied-series: [PATCH access-control/cluster/docs/gui-tests/manager/network/proxmox{, -firewall, -ve-rs, -perl-rs, -widget-toolkit} v5 00/76] Add SDN Fabrics Thomas Lamprecht
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=20250716130837.585796-28-g.goller@proxmox.com \
--to=g.goller@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 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.