1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! `demux-options`
//! `system { demux-options { ... } }`.
//!
//! # See also
//!
//! - [demux-options (All Demux Interfaces)](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/demux-options-edit-system.html)
//! - [use-underlying-interface-mac](https://networkingdocs.hpe.com/documentation/us/en/software/junos/cli-reference/topics/ref/statement/use-underlying-interface-mac-edit-system.html)
use crate::has_leaf;
use asterust::config::ConfigLine;
/// The `system demux-options` settings.
#[derive(Clone, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub struct DemuxOptions {
/// Use the same link-local address on a dynamic demux interface and its underlying static one.
pub use_underlying_interface_mac: bool,
}
pub(super) fn parse_demux_options(demux: &ConfigLine) -> DemuxOptions {
DemuxOptions {
use_underlying_interface_mac: has_leaf(demux, "use-underlying-interface-mac"),
}
}
#[cfg(test)]
mod tests {
use crate::system::system;
use asterust::config::juniper;
// Not from documentation: written from the CLI Reference syntax pages. See the README "Sources".
#[test]
fn extracts_demux_options() {
let demux = system(&juniper::parse_braces(
"system {\n demux-options {\n use-underlying-interface-mac;\n }\n}\n",
))
.unwrap()
.demux_options
.unwrap();
assert!(demux.use_underlying_interface_mac);
}
#[test]
fn no_demux_options_is_none() {
let system = system(&juniper::parse_braces("system {\n host-name pe1;\n}\n")).unwrap();
assert!(system.demux_options.is_none());
}
}