Skip to main content

asterust_junos/interfaces/unit/family/
policer.rs

1//! `policer`
2//! `interfaces { <name> { unit <n> { family <name> { policer { ... } } } } }`.
3//!
4//! # See also
5//!
6//! - [policer (Applying to a Logical Interface)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/policer-edit-interfaces-unit-family.html)
7
8use crate::{statement_words, value_after};
9use asterust::config::ConfigLine;
10
11/// The policers applied to a family.
12#[derive(Clone, Debug, Default, PartialEq, Eq)]
13#[non_exhaustive]
14pub struct FamilyPolicer {
15    pub arp: Option<String>,
16    pub input: Option<String>,
17    pub output: Option<String>,
18}
19
20pub(super) fn parse_policer(family: &ConfigLine) -> Option<FamilyPolicer> {
21    let words = statement_words(family, "policer")?;
22    Some(FamilyPolicer {
23        arp: value_after(&words, "arp"),
24        input: value_after(&words, "input"),
25        output: value_after(&words, "output"),
26    })
27}