From 8345a8ee1297d437c4b16fe2e9f31c3aff92ae09 Mon Sep 17 00:00:00 2001 From: catvayor Date: Mon, 2 Dec 2024 15:45:56 +0100 Subject: [PATCH] feat(rstp): made an option --- dgn-module.nix | 11 +++++++---- netconf-hive.nix | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dgn-module.nix b/dgn-module.nix index 616d9d5..e20af33 100644 --- a/dgn-module.nix +++ b/dgn-module.nix @@ -2,7 +2,7 @@ with lib; let intf-mod = - { name, config, ... }: + { config, ... }: { options = { enable = mkEnableOption "this interface" // { @@ -15,6 +15,10 @@ let default = config.ethernet-switching.interface-mode != null; defaultText = ''config.ethernet-switching.interface-mode != null''; }; + rstp = mkEnableOption "RSTP on this interface" // { + default = config.ethernet-switching.enable; + defaultText = ''config.ethernet-switching.enable''; + }; interface-mode = mkOption { type = types.nullOr ( types.enum [ @@ -69,7 +73,6 @@ let }; cfg = config.dgn-interfaces; - intf-list = config.netconf.mandatoryInterfaces; in { options.dgn-interfaces = mkOption { @@ -88,12 +91,12 @@ in inherit (intf) enable; unit."0".family = { inherit (intf) inet inet6; - ethernet-switching = mkIf intf.ethernet-switching.enable intf.ethernet-switching; + ethernet-switching = mkIf intf.ethernet-switching.enable (removeAttrs intf.ethernet-switching [ "rstp" ]); }; }) cfg; poe.interfaces = filterAttrs ( name: _: config.netconf.mandatoryInterfaces.${name}.supportPoE or false ) (mapAttrs (_: intf: { enable = intf.poe; }) cfg); - protocols.rstp = attrNames (filterAttrs (_: intf: intf.ethernet-switching.enable) cfg); + protocols.rstp = attrNames (filterAttrs (_: intf: intf.ethernet-switching.rstp) cfg); }; } diff --git a/netconf-hive.nix b/netconf-hive.nix index 9d739c0..5d2027b 100644 --- a/netconf-hive.nix +++ b/netconf-hive.nix @@ -75,7 +75,8 @@ in # uplink oob "ge-0/0/46".ethernet-switching = { interface-mode = "access"; - vlans = [ 500 ]; + vlans = [ 222 ]; + rstp = false; }; # ilo "ge-0/0/47".ethernet-switching = {