From 1f516303793096fe9e972c6f64630f620e3ba25b Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Sat, 4 Nov 2023 19:25:10 -0300 Subject: [PATCH] routing: introduce support for opaque route attributes This change allows protocol crates to install routes with opaque attributes in the RIB. These attributes can be useful both for implementing advanced routing policies as well as aiding in network troubleshooting. Signed-off-by: Renato Westphal --- README.md | 2 +- holo-ospf/src/northbound/yang.rs | 12 ------- holo-ospf/src/route.rs | 13 ++------ holo-ospf/src/southbound/tx.rs | 4 +++ holo-rip/src/southbound/tx.rs | 5 ++- holo-routing/src/ibus.rs | 1 + holo-routing/src/northbound/configuration.rs | 5 ++- holo-routing/src/northbound/state.rs | 30 ++++++++++++++++- holo-routing/src/rib.rs | 7 +++- holo-utils/src/southbound.rs | 32 +++++++++++++++++++ .../deviations/ietf-ospf-holo-deviations.yang | 12 ------- 11 files changed, 84 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 3b7653ff..ad3a7b74 100644 --- a/README.md +++ b/README.md @@ -200,7 +200,7 @@ Holo supports the following IETF RFCs and Internet drafts: | ietf-mpls-ldp@2022-03-14 | 86.96% | 92.31% | 100.00% | 100.00% | [92.38%](http://westphal.com.br/holo/ietf-mpls-ldp.html) | | ietf-mpls@2020-12-18 | 0.00% | 57.14% | - | - | [35.29%](http://westphal.com.br/holo/ietf-mpls.html) | | ietf-ospf-sr@2023-07-09 | 25.00% | 53.95% | - | - | [52.81%](http://westphal.com.br/holo/ietf-ospf-sr.html) | -| ietf-ospf@2022-10-19 | 75.00% | 59.36% | 100.00% | 41.94% | [59.33%](http://westphal.com.br/holo/ietf-ospf.html) | +| ietf-ospf@2022-10-19 | 75.00% | 59.64% | 100.00% | 41.94% | [59.57%](http://westphal.com.br/holo/ietf-ospf.html) | | ietf-ospfv3-extended-lsa@2023-08-21 | 50.00% | 85.28% | - | - | [84.85%](http://westphal.com.br/holo/ietf-ospfv3-extended-lsa.html) | | ietf-rip@2020-02-20 | 27.91% | 93.33% | 100.00% | - | [55.41%](http://westphal.com.br/holo/ietf-rip.html) | | ietf-routing-policy@2021-10-11 | 100.00% | 0.00% | - | - | [98.11%](http://westphal.com.br/holo/ietf-routing-policy.html) | diff --git a/holo-ospf/src/northbound/yang.rs b/holo-ospf/src/northbound/yang.rs index 02473eb1..eb228c6d 100644 --- a/holo-ospf/src/northbound/yang.rs +++ b/holo-ospf/src/northbound/yang.rs @@ -19,7 +19,6 @@ use crate::packet::tlv::{ AdjSidFlags, GrReason, PrefixSidFlags, RouterInfoCaps, }; use crate::packet::PacketType; -use crate::route::PathType; use crate::spf::SpfLogType; use crate::{ospfv2, ospfv3, spf}; @@ -97,17 +96,6 @@ impl ToYang for SpfLogType { } } -impl ToYang for PathType { - fn to_yang(&self) -> String { - match self { - PathType::IntraArea => "intra-area".to_owned(), - PathType::InterArea => "inter-area".to_owned(), - PathType::Type1External => "external-1".to_owned(), - PathType::Type2External => "external-2".to_owned(), - } - } -} - impl ToYang for InterfaceCfgError { fn to_yang(&self) -> String { match self { diff --git a/holo-ospf/src/route.rs b/holo-ospf/src/route.rs index 9a7576e6..fac6c702 100644 --- a/holo-ospf/src/route.rs +++ b/holo-ospf/src/route.rs @@ -12,6 +12,7 @@ use bitflags::bitflags; use derive_new::new; use holo_utils::ip::IpAddrKind; use holo_utils::mpls::Label; +use holo_utils::southbound::OspfRouteType; use holo_utils::sr::IgpAlgoType; use crate::area::Area; @@ -84,15 +85,6 @@ pub struct SummaryRtr { pub metric: u32, } -// OSPF path types in decreasing order of preference. -#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] -pub enum PathType { - IntraArea, - InterArea, - Type1External, - Type2External, -} - // Route nexthop key. #[derive(Clone, Copy, Debug, Eq, new, Ord, PartialEq, PartialOrd)] pub struct NexthopKey { @@ -116,8 +108,9 @@ pub struct Nexthop { pub sr_label: Option