From: Hannes Laimer <h.laimer@proxmox.com>
To: Stefan Hanreich <s.hanreich@proxmox.com>, pve-devel@lists.proxmox.com
Subject: Re: [PATCH proxmox-ve-rs v4 1/7] sdn: fabric: add BGP protocol support
Date: Wed, 13 May 2026 15:00:47 +0200 [thread overview]
Message-ID: <b5d25585-6c3b-4157-9ea4-23afddef0dfd@proxmox.com> (raw)
In-Reply-To: <ebd653ed-cfb2-4a9d-b131-7027f7e2b481@proxmox.com>
thanks, will address in v5!
On 2026-05-13 14:30, Stefan Hanreich wrote:
> On 5/12/26 4:12 PM, Hannes Laimer wrote:
>> +impl AddressFamilies {
>> + /// Merge another [`AddressFamilies`] into this one.
>> + ///
>> + /// For each address family: if `self` already has it, extend its neighbors, networks, and
>> + /// redistribute lists. If `self` doesn't have it, take it from `other`.
>> + pub fn merge(&mut self, other: AddressFamilies) {
>
> maybe extend is the better name, as it mirrors existing conventions from
> std::Vec?
>
makes sense, can do
[..]
>> }
>> FabricEntry::WireGuard(_) => {} // not a frr fabric
>> + FabricEntry::Bgp(bgp_entry) => {
>> + let Ok(node) = bgp_entry.node_section(¤t_node) else {
>> + continue;
>> + };
>> +
>> + let BgpNode::Internal(properties) = node.properties() else {
>> + continue;
>> + };
>> +
>> + let fabric = bgp_entry.fabric_section();
>> +
>> + let local_asn = properties.asn().as_u32();
>
> makes me wonder if implementing AsRef<u32> would simplify handling ASN
> throughout the code?
>
good point, probably also `Deref<Target=u32>`
[..]
>> +
>> +#[api(
>> + type: Integer,
>> + minimum: u32::MIN as i64,
>> + maximum: u32::MAX as i64,
>> +)]
>> +#[derive(Debug, Clone, Serialize, Updater, Hash)]
>> +/// Autonomous system number as defined by RFC 6793
>> +pub struct ASN(u32);
>
> potentially something for later, but I think we use ASN in several
> places - so we might want to add this to sdn-types instead and reuse it
> across the ve-rs crates?
>
yes, sounds like a good follow-up that covers all places then
[..]
>> +impl<'de> Deserialize<'de> for ASN {
>> + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
>> + where
>> + D: serde::Deserializer<'de>,
>> + {
>> + use serde::de::{self, Visitor};
>> +
>> + struct AsnVisitor;
>> +
>> + impl<'de> Visitor<'de> for AsnVisitor {
>> + type Value = ASN;
>> +
>> + fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
>> + formatter.write_str("a u32 or string containing a u32")
>> + }
>> +
>> + fn visit_i64<E: de::Error>(self, v: i64) -> Result<ASN, E> {
>> + u32::try_from(v)
>> + .map(ASN)
>> + .map_err(|_| E::custom(format!("ASN out of range: {v}")))
>> + }
>> +
>> + fn visit_u64<E: de::Error>(self, v: u64) -> Result<ASN, E> {
>> + u32::try_from(v)
>> + .map(ASN)
>> + .map_err(|_| E::custom(format!("ASN out of range: {v}")))
>> + }
>> +
>> + fn visit_str<E: de::Error>(self, v: &str) -> Result<ASN, E> {
>> + v.parse::<u32>()
>> + .map(ASN)
>> + .map_err(|_| E::custom(format!("invalid ASN: {v}")))
>> + }
>> + }
>> +
>> + deserializer.deserialize_any(AsnVisitor)
>> + }
>> +}
>
> Is there a reason why proxmox_serde::perl::deserialize_u32 doesn't work?
> It should work the same afaict.
>
i remeber there was a problem with the information that this is an int
being lost when passed through perlmod, but i tried to reproduce this
again and could not. so no reason :)
[..]
next prev parent reply other threads:[~2026-05-13 13:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 14:12 [PATCH docs/manager/network/proxmox{-ve-rs,-perl-rs} v4 0/7] sdn: add BGP fabric Hannes Laimer
2026-05-12 14:12 ` [PATCH proxmox-ve-rs v4 1/7] sdn: fabric: add BGP protocol support Hannes Laimer
2026-05-13 12:29 ` Stefan Hanreich
2026-05-13 13:00 ` Hannes Laimer [this message]
2026-05-12 14:13 ` [PATCH proxmox-perl-rs v4 2/7] sdn: fabrics: add BGP config generation Hannes Laimer
2026-05-12 14:13 ` [PATCH proxmox-perl-rs v4 3/7] sdn: fabrics: add BGP status endpoints Hannes Laimer
2026-05-13 12:33 ` Stefan Hanreich
2026-05-13 13:02 ` Hannes Laimer
2026-05-12 14:13 ` [PATCH pve-network v4 4/7] sdn: fabrics: register bgp as a fabric protocol type Hannes Laimer
2026-05-12 14:13 ` [PATCH pve-network v4 5/7] test: evpn: add integration test for EVPN over BGP fabric Hannes Laimer
2026-05-12 14:13 ` [PATCH pve-manager v4 6/7] ui: sdn: add BGP fabric support Hannes Laimer
2026-05-13 12:38 ` Stefan Hanreich
2026-05-12 14:13 ` [PATCH pve-docs v4 7/7] sdn: add bgp fabric section Hannes Laimer
2026-05-13 12:39 ` [PATCH docs/manager/network/proxmox{-ve-rs,-perl-rs} v4 0/7] sdn: add BGP fabric Stefan Hanreich
2026-05-13 18:43 ` superseded: " Hannes Laimer
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=b5d25585-6c3b-4157-9ea4-23afddef0dfd@proxmox.com \
--to=h.laimer@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
--cc=s.hanreich@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.