Skip to main content

asterust_junos/policy_options/
as_path_group.rs

1//! `policy-options { as-path-group <name> { ... } }`.
2
3use super::as_path::{parse_as_path, AsPath};
4use crate::active_children;
5use asterust::config::ConfigLine;
6
7/// An `as-path-group <name>` of AS path expressions.
8#[derive(Clone, Debug, PartialEq, Eq)]
9#[non_exhaustive]
10pub struct AsPathGroup {
11    pub name: String,
12    pub as_paths: Vec<AsPath>,
13}
14
15pub(super) fn parse_as_path_group(name: &str, group: &ConfigLine) -> AsPathGroup {
16    AsPathGroup {
17        name: name.to_string(),
18        as_paths: active_children(group).filter_map(parse_as_path).collect(),
19    }
20}