Netconf-Module/junos/protocols.nix
2024-12-13 14:37:43 +01:00

37 lines
733 B
Nix

{ lib, config, ... }:
let
inherit (lib)
mkOption
concatStringsSep
;
inherit (lib.types)
listOf
str
;
in
{
options = {
protocols.rstp = mkOption {
type = listOf str;
description = ''
List of interfaces on which Rapid Spanning Tree Protocol should be enabled.
'';
};
netconf.xmls.protocols = mkOption {
type = 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>
'';
}