use super::as_path::{parse_as_path, AsPath};
use crate::{active_children, has_leaf};
use asterust::config::ConfigLine;
#[derive(Clone, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub struct AsPathGroup {
pub name: String,
pub as_paths: Vec<AsPath>,
pub dynamic_db: bool,
}
pub(super) fn parse_as_path_group(name: &str, group: &ConfigLine) -> AsPathGroup {
AsPathGroup {
name: name.to_string(),
as_paths: active_children(group).filter_map(parse_as_path).collect(),
dynamic_db: has_leaf(group, "dynamic-db"),
}
}