Struct bgp_models::bgp::attributes::AsPath
source · pub struct AsPath {
pub segments: Vec<AsPathSegment>,
}Fields§
§segments: Vec<AsPathSegment>Implementations§
source§impl AsPath
impl AsPath
pub fn new() -> AsPath
pub fn from_segments(segments: Vec<AsPathSegment>) -> AsPath
pub fn add_segment(&mut self, segment: AsPathSegment)
pub fn segments(&self) -> &Vec<AsPathSegment>
pub fn count_asns(&self) -> usize
sourcepub fn merge_aspath_as4path(aspath: &AsPath, as4path: &AsPath) -> Option<AsPath>
pub fn merge_aspath_as4path(aspath: &AsPath, as4path: &AsPath) -> Option<AsPath>
Construct AsPath from AS_PATH and AS4_PATH
https://datatracker.ietf.org/doc/html/rfc6793#section-4.2.3 If the number of AS numbers in the AS_PATH attribute is less than the number of AS numbers in the AS4_PATH attribute, then the AS4_PATH attribute SHALL be ignored, and the AS_PATH attribute SHALL be taken as the AS path information.
If the number of AS numbers in the AS_PATH attribute is larger than or equal to the number of AS numbers in the AS4_PATH attribute, then the AS path information SHALL be constructed by taking as many AS numbers and path segments as necessary from the leading part of the AS_PATH attribute, and then prepending them to the AS4_PATH attribute so that the AS path information has a number of AS numbers identical to that of the AS_PATH attribute. Note that a valid AS_CONFED_SEQUENCE or AS_CONFED_SET path segment SHALL be prepended if it is either the leading path segment or is adjacent to a path segment that is prepended.