asterust_junos/system/
dynamic_profile_options.rs1use crate::has_leaf;
4use asterust::config::ConfigLine;
5
6#[derive(Clone, Debug, PartialEq, Eq)]
8#[non_exhaustive]
9pub struct DynamicProfileOptions {
10 pub versioning: bool,
11}
12
13pub(super) fn parse_dynamic_profile_options(options: &ConfigLine) -> DynamicProfileOptions {
14 DynamicProfileOptions {
15 versioning: has_leaf(options, "versioning"),
16 }
17}
18
19#[cfg(test)]
20mod tests {
21 use crate::system::system;
22 use asterust::config::juniper;
23
24 #[test]
26 fn extracts_dynamic_profile_options() {
27 let system = system(&juniper::parse_braces(
28 "system {\n dynamic-profile-options {\n versioning;\n }\n}\n",
29 ))
30 .unwrap();
31 assert!(system.dynamic_profile_options.unwrap().versioning);
32 }
33}