feat(rstp): made an option
This commit is contained in:
parent
2a16d196f7
commit
8345a8ee12
2 changed files with 9 additions and 5 deletions
|
@ -2,7 +2,7 @@
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
intf-mod =
|
intf-mod =
|
||||||
{ name, config, ... }:
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
enable = mkEnableOption "this interface" // {
|
enable = mkEnableOption "this interface" // {
|
||||||
|
@ -15,6 +15,10 @@ let
|
||||||
default = config.ethernet-switching.interface-mode != null;
|
default = config.ethernet-switching.interface-mode != null;
|
||||||
defaultText = ''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 {
|
interface-mode = mkOption {
|
||||||
type = types.nullOr (
|
type = types.nullOr (
|
||||||
types.enum [
|
types.enum [
|
||||||
|
@ -69,7 +73,6 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
cfg = config.dgn-interfaces;
|
cfg = config.dgn-interfaces;
|
||||||
intf-list = config.netconf.mandatoryInterfaces;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.dgn-interfaces = mkOption {
|
options.dgn-interfaces = mkOption {
|
||||||
|
@ -88,12 +91,12 @@ in
|
||||||
inherit (intf) enable;
|
inherit (intf) enable;
|
||||||
unit."0".family = {
|
unit."0".family = {
|
||||||
inherit (intf) inet inet6;
|
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;
|
}) cfg;
|
||||||
poe.interfaces = filterAttrs (
|
poe.interfaces = filterAttrs (
|
||||||
name: _: config.netconf.mandatoryInterfaces.${name}.supportPoE or false
|
name: _: config.netconf.mandatoryInterfaces.${name}.supportPoE or false
|
||||||
) (mapAttrs (_: intf: { enable = intf.poe; }) cfg);
|
) (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);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,8 @@ in
|
||||||
# uplink oob
|
# uplink oob
|
||||||
"ge-0/0/46".ethernet-switching = {
|
"ge-0/0/46".ethernet-switching = {
|
||||||
interface-mode = "access";
|
interface-mode = "access";
|
||||||
vlans = [ 500 ];
|
vlans = [ 222 ];
|
||||||
|
rstp = false;
|
||||||
};
|
};
|
||||||
# ilo
|
# ilo
|
||||||
"ge-0/0/47".ethernet-switching = {
|
"ge-0/0/47".ethernet-switching = {
|
||||||
|
|
Loading…
Reference in a new issue