asterust_junos/protocols/mpls/
interface.rs1use crate::{args_of, has_leaf, list_values};
9use asterust::config::ConfigLine;
10
11#[derive(Clone, Debug, PartialEq, Eq)]
13#[non_exhaustive]
14pub struct MplsInterface {
15 pub name: String,
16 pub disable: bool,
17 pub admin_groups: Vec<String>,
19 pub srlg: Vec<String>,
20}
21
22pub(super) fn parse_interface(name: &str, interface: &ConfigLine) -> MplsInterface {
23 let list =
24 |keyword: &str| -> Vec<String> { args_of(interface, keyword).into_iter().flat_map(list_values).collect() };
25 MplsInterface {
26 name: name.to_string(),
27 disable: has_leaf(interface, "disable"),
28 admin_groups: list("admin-group"),
29 srlg: list("srlg"),
30 }
31}