Skip to main content

asterust_junos/interfaces/unit/family/
rpf_check.rs

1//! `rpf-check`
2//! `interfaces { <name> { unit <n> { family <name> { rpf-check { ... } } } } }`.
3//!
4//! # See also
5//!
6//! - [rpf-check](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/rpf-check-edit-interfaces.html)
7
8use crate::{statement_words, value_after};
9use asterust::config::ConfigLine;
10
11/// The `rpf-check` unicast reverse-path-forwarding settings; both fields are `None` for a bare
12/// `rpf-check;`.
13#[derive(Clone, Debug, Default, PartialEq, Eq)]
14#[non_exhaustive]
15pub struct RpfCheck {
16    pub fail_filter: Option<String>,
17    /// `strict` or `loose`.
18    pub mode: Option<String>,
19}
20
21pub(super) fn parse_rpf_check(family: &ConfigLine) -> Option<RpfCheck> {
22    let words = statement_words(family, "rpf-check")?;
23    Some(RpfCheck {
24        fail_filter: value_after(&words, "fail-filter"),
25        mode: value_after(&words, "mode"),
26    })
27}