The ISIS types in proxmox-frr are used by pve-network to generate FRR configuration for ISIS controllers. To share these types between ISIS fabric and controller implementations, add properties required by fabrics and rename the "domain" field to "fabric_id" for consistency with fabric terminology. This rename is also applied in pve-network.
Signed-off-by: Gabriel Goller <[email protected]> --- proxmox-frr-templates/templates/isisd.jinja | 23 +++++++++++--- proxmox-frr/src/ser/isis.rs | 33 +++++++++++++++++++-- proxmox-frr/src/ser/mod.rs | 10 +++++++ 3 files changed, 60 insertions(+), 6 deletions(-) diff --git a/proxmox-frr-templates/templates/isisd.jinja b/proxmox-frr-templates/templates/isisd.jinja index 75f066166ad2..22772dd3886d 100644 --- a/proxmox-frr-templates/templates/isisd.jinja +++ b/proxmox-frr-templates/templates/isisd.jinja @@ -19,11 +19,26 @@ exit {% endfor %} {% for interface_name, interface_config in isis.interfaces|items %} {% call interface(interface_name, interface_config.addresses) %} -{% if interface_config.domain and interface_config.is_ipv4 %} - ip router isis {{ interface_config.domain }} +{% if interface_config.fabric_id and interface_config.is_ipv4 %} + ip router isis {{ interface_config.fabric_id }} {% endif %} -{% if interface_config.domain and interface_config.is_ipv6 %} - ipv6 router isis {{ interface_config.domain }} +{% if interface_config.fabric_id and interface_config.is_ipv6 %} + ipv6 router isis {{ interface_config.fabric_id }} +{% endif %} +{% if interface_config.passive %} + isis passive +{% endif %} +{% if interface_config.hello_interval %} + isis hello-interval {{ interface_config.hello_interval }} +{% endif %} +{% if interface_config.csnp_interval %} + isis csnp-interval {{ interface_config.csnp_interval }} +{% endif %} +{% if interface_config.hello_multiplier %} + isis hello-multiplier {{ interface_config.hello_multiplier }} +{% endif %} +{% if interface_config.point_to_point %} + isis network point-to-point {% endif %} {% for line in interface_config.custom_frr_config %} {{ line }} diff --git a/proxmox-frr/src/ser/isis.rs b/proxmox-frr/src/ser/isis.rs index 2a38a8310fb5..3a48b7612d73 100644 --- a/proxmox-frr/src/ser/isis.rs +++ b/proxmox-frr/src/ser/isis.rs @@ -11,6 +11,18 @@ use crate::ser::FrrWord; #[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)] pub struct IsisRouterName(FrrWord); +impl From<FrrWord> for IsisRouterName { + fn from(value: FrrWord) -> Self { + Self(value) + } +} + +impl IsisRouterName { + pub fn new(name: FrrWord) -> Self { + Self(name) + } +} + #[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)] pub enum IsisLevel { #[serde(rename = "level-1")] @@ -27,7 +39,7 @@ pub struct Redistribute { ipv6_connected: IsisLevel, } -#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)] +#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize, Builder)] pub struct IsisRouter { pub net: Net, #[serde(default, deserialize_with = "proxmox_serde::perl::deserialize_bool")] @@ -39,11 +51,28 @@ pub struct IsisRouter { #[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize, Builder)] pub struct IsisInterface { - pub domain: IsisRouterName, + pub fabric_id: IsisRouterName, #[serde(deserialize_with = "proxmox_serde::perl::deserialize_bool")] pub is_ipv4: bool, #[serde(deserialize_with = "proxmox_serde::perl::deserialize_bool")] pub is_ipv6: bool, #[serde(default)] + pub passive: Option<bool>, + // Note: openfabric is very similar to isis, so we can use the same properties here + #[serde(default)] + #[builder(required, default = None)] + pub hello_interval: Option<proxmox_sdn_types::openfabric::HelloInterval>, + #[serde(default)] + #[builder(required, default = None)] + pub csnp_interval: Option<proxmox_sdn_types::openfabric::CsnpInterval>, + #[serde(default)] + #[builder(required, default = None)] + pub hello_multiplier: Option<proxmox_sdn_types::openfabric::HelloMultiplier>, + + #[serde(default)] + pub point_to_point: bool, + + #[serde(default)] + #[builder(default)] pub custom_frr_config: Vec<String>, } diff --git a/proxmox-frr/src/ser/mod.rs b/proxmox-frr/src/ser/mod.rs index f3578ef1323a..dfae70cc01e2 100644 --- a/proxmox-frr/src/ser/mod.rs +++ b/proxmox-frr/src/ser/mod.rs @@ -123,6 +123,15 @@ impl From<openfabric::OpenfabricInterface> for Interface<openfabric::OpenfabricI } } +impl From<isis::IsisInterface> for Interface<isis::IsisInterface> { + fn from(value: isis::IsisInterface) -> Self { + Interface { + addresses: Vec::new(), + properties: value, + } + } +} + impl From<ospf::OspfInterface> for Interface<ospf::OspfInterface> { fn from(value: ospf::OspfInterface) -> Self { Interface { @@ -153,6 +162,7 @@ pub struct IpRoute { pub enum FrrProtocol { Ospf, Openfabric, + Isis, Bgp, } -- 2.47.3
