feat(protocols): Refactor
This commit is contained in:
parent
887dbbc6c8
commit
5018ab847c
1 changed files with 23 additions and 0 deletions
23
junos/protocols.nix
Normal file
23
junos/protocols.nix
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{ lib, config, ... }:
|
||||||
|
with lib;
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
protocols.rstp = mkOption { type = types.listOf types.str; };
|
||||||
|
netconf.xmls.protocols = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
visible = false;
|
||||||
|
readOnly = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config.netconf.xmls.protocols =
|
||||||
|
let
|
||||||
|
rstps = map (intf: "<interface><name>${intf}</name></interface>") config.protocols.rstp;
|
||||||
|
in
|
||||||
|
''
|
||||||
|
<protocols>
|
||||||
|
<rstp operation="replace">
|
||||||
|
${concatStringsSep "" rstps}
|
||||||
|
</rstp>
|
||||||
|
</protocols>
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in a new issue