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