Netconf-Module/junos/protocols.nix

38 lines
733 B
Nix
Raw Normal View History

2024-04-30 16:47:55 +02:00
{ lib, config, ... }:
2024-12-13 14:37:43 +01:00
let
inherit (lib)
mkOption
concatStringsSep
;
inherit (lib.types)
listOf
str
;
in
2024-04-30 16:47:55 +02:00
{
options = {
2024-09-03 23:04:30 +02:00
protocols.rstp = mkOption {
2024-12-13 14:37:43 +01:00
type = listOf str;
2024-09-03 23:04:30 +02:00
description = ''
List of interfaces on which Rapid Spanning Tree Protocol should be enabled.
'';
};
2024-04-30 16:47:55 +02:00
netconf.xmls.protocols = mkOption {
2024-12-13 14:37:43 +01:00
type = str;
2024-04-30 16:47:55 +02:00
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>
'';
}