diff --git a/junos/default.nix b/junos/default.nix
index a3e9d20..473d2a3 100644
--- a/junos/default.nix
+++ b/junos/default.nix
@@ -10,6 +10,7 @@ with lib;
./protocols.nix
./interfaces.nix
./vlans.nix
+ ./poe.nix
];
options = {
netconf.xmls.configuration = mkOption {
@@ -31,6 +32,7 @@ with lib;
${config.netconf.xmls.interfaces}
${config.netconf.xmls.protocols}
${config.netconf.xmls.vlans}
+ ${config.netconf.xmls.poe}
'';
}
diff --git a/junos/poe.nix b/junos/poe.nix
new file mode 100644
index 0000000..550b6c1
--- /dev/null
+++ b/junos/poe.nix
@@ -0,0 +1,39 @@
+{ lib, config, ... }:
+with lib;
+let
+ interface-module =
+ { name, config, ... }:
+ {
+ options = {
+ enable = mkEnableOption "The PoE for interface ${name}.";
+ xml = mkOption {
+ type = types.str;
+ visible = false;
+ readOnly = true;
+ };
+ };
+ config.xml = ''
+ ${name}${optionalString (!config.enable) ""}
+ '';
+ };
+in
+{
+ options = {
+ poe.interfaces = mkOption {
+ type = types.attrsOf (types.submodule interface-module);
+ default = { };
+ };
+ netconf.xmls.poe = mkOption {
+ type = types.str;
+ visible = false;
+ readOnly = true;
+ };
+ };
+ config.netconf.xmls.poe = ''
+
+ ${
+ builtins.concatStringsSep "" (attrsets.mapAttrsToList (_: intf: intf.xml) config.poe.interfaces)
+ }
+
+ '';
+}