Skip to main content

asterust_junos/protocols/mpls/
path_mtu.rs

1//! `path-mtu`
2//! `protocols { mpls { path-mtu { allow-fragmentation; rsvp { mtu-signaling; } } } }`.
3//!
4//! # See also
5//!
6//! - [path-mtu](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/path-mtu-edit-protocols-mpls.html)
7
8use crate::{child_block, has_leaf};
9use asterust::config::ConfigLine;
10
11/// The `path-mtu` options of MPLS.
12#[derive(Clone, Debug, Default, PartialEq, Eq)]
13#[non_exhaustive]
14pub struct MplsPathMtu {
15    pub allow_fragmentation: bool,
16    /// `rsvp { mtu-signaling; }`.
17    pub rsvp_mtu_signaling: bool,
18}
19
20pub(super) fn parse_path_mtu(mpls: &ConfigLine) -> Option<MplsPathMtu> {
21    let mtu = child_block(mpls, "path-mtu")?;
22    Some(MplsPathMtu {
23        allow_fragmentation: has_leaf(mtu, "allow-fragmentation"),
24        rsvp_mtu_signaling: child_block(mtu, "rsvp").is_some_and(|rsvp| has_leaf(rsvp, "mtu-signaling")),
25    })
26}