On 2026-03-10 13:08, Gabriel Goller wrote:
> Add a new serializer which uses only the builtin (include_str!) templates from
> the `proxmox-frr-templates` package in `/usr/share/proxmox-frr/templates` to
> generate the frr config file. Also update the `build_fabric` function and the
> tests accordingly.
>
> Use the `phf` crate to store them in a const map.
>
> Signed-off-by: Gabriel Goller <[email protected]>
> ---
[..]
> /// A match statement inside a route-map.
> ///
> /// A route-map has one or more match statements which decide on which
> routes the route-map will
> /// execute its actions. If we match on an IP, there are two different
> syntaxes: `match ip ...` or
> /// `match ipv6 ...`.
> -///
> -/// Serializes to:
> -///
> -/// ```text
> -/// match ip address <access-list-name>
> -/// ! or
> -/// match ip next-hop <ip-address>
> -/// ! or
> -/// match ipv6 address <access-list-name>
> -/// ! or
> -/// match ipv6 next-hop <ip-address>
> -/// ```
> -#[derive(Clone, Debug, PartialEq, Eq)]
> +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
> +#[serde(tag = "protocol_type")]
^
> pub enum RouteMapMatch {
> + #[serde(rename = "ip")]
> V4(RouteMapMatchInner),
> + #[serde(rename = "ipv6")]
> V6(RouteMapMatchInner),
> + Vni(u32),
we don't use this yet, but we can't inject a `protocol_type` field into
a `u32`. We probably need some kind of wrapper struct
```
pub struct VniMatch {
pub vni: u32,
}
```
? not sure if there's a better way
> }
>
[..]