use crate::{args_of, has_leaf, list_values};
use asterust::config::ConfigLine;
#[derive(Clone, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub struct MplsInterface {
pub name: String,
pub disable: bool,
pub admin_groups: Vec<String>,
pub srlg: Vec<String>,
}
pub(super) fn parse_interface(name: &str, interface: &ConfigLine) -> MplsInterface {
let list =
|keyword: &str| -> Vec<String> { args_of(interface, keyword).into_iter().flat_map(list_values).collect() };
MplsInterface {
name: name.to_string(),
disable: has_leaf(interface, "disable"),
admin_groups: list("admin-group"),
srlg: list("srlg"),
}
}