asterust_junos/policy_options/resolution_map.rs
1//! `resolution-map`
2//! `policy-options { resolution-map <name> { mode <mode>; } }`.
3//!
4//! # See also
5//!
6//! - [resolution-map](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/resolution-map-edit-policy-options.html)
7
8use crate::{args_of, list_values};
9use asterust::config::ConfigLine;
10
11/// A `resolution-map <name>`, the protocol next hop resolution modes that a `then resolution-map` action applies.
12#[derive(Clone, Debug, PartialEq, Eq)]
13#[non_exhaustive]
14pub struct ResolutionMap {
15 pub name: String,
16 /// `color-only` and `ip-color`, in the order they are tried.
17 pub modes: Vec<String>,
18}
19
20pub(super) fn parse_resolution_map(name: &str, line: &ConfigLine) -> ResolutionMap {
21 ResolutionMap {
22 name: name.to_string(),
23 modes: args_of(line, "mode").into_iter().flat_map(list_values).collect(),
24 }
25}