asterust_junos/interfaces/
tca.rs1use crate::split_keyword;
9
10#[derive(Clone, Debug, PartialEq, Eq)]
12#[non_exhaustive]
13pub struct Tca {
14 pub identifier: String,
16 pub enabled: Option<bool>,
18 pub threshold: Option<String>,
19 pub threshold_24hrs: Option<String>,
20}
21
22pub(super) fn parse_tca(arg: &str) -> Tca {
24 let (identifier, rest) = split_keyword(arg);
25 let words: Vec<&str> = rest.split_whitespace().collect();
26 let enabled = if words.contains(&"enable-tca") {
27 Some(true)
28 } else if words.contains(&"no-enable-tca") {
29 Some(false)
30 } else {
31 None
32 };
33 Tca {
34 identifier: identifier.to_string(),
35 enabled,
36 threshold: crate::value_after(&words, "threshold"),
37 threshold_24hrs: crate::value_after(&words, "threshold-24hrs"),
38 }
39}