pkgs/switches/linksys-srw2048: implement bonded non-trunked ports
This commit is contained in:
parent
7354cf5f2d
commit
90cd903381
|
@ -68,8 +68,8 @@ with lib;
|
||||||
linkConfig = hostConfig.links.${name};
|
linkConfig = hostConfig.links.${name};
|
||||||
isAccess = config.site.net ? ${name};
|
isAccess = config.site.net ? ${name};
|
||||||
netConfig = config.site.net.${name};
|
netConfig = config.site.net.${name};
|
||||||
isTrunk = !isAccess;
|
isTrunk = linkConfig.trunk;
|
||||||
isBond = isTrunk && builtins.length linkConfig.ports > 1;
|
isBond = builtins.length linkConfig.ports > 1;
|
||||||
vlans = concatStringsSep "," (map toString (sort linkConfig.vlans));
|
vlans = concatStringsSep "," (map toString (sort linkConfig.vlans));
|
||||||
ports = concatStringsSep "," linkConfig.ports;
|
ports = concatStringsSep "," linkConfig.ports;
|
||||||
in
|
in
|
||||||
|
@ -108,6 +108,29 @@ with lib;
|
||||||
send "exit\r"
|
send "exit\r"
|
||||||
expect "(config)#"
|
expect "(config)#"
|
||||||
'') linkConfig.ports
|
'') linkConfig.ports
|
||||||
|
else if isBond
|
||||||
|
then
|
||||||
|
if builtins.length linkConfig.vlans != 1
|
||||||
|
then throw "Cannot configure non-trunked port with multiple vlans"
|
||||||
|
else ''
|
||||||
|
send "interface range ethernet ${ports}\r"
|
||||||
|
expect "(config-if)#"
|
||||||
|
send "channel-group ${linkConfig.group} mode auto\r"
|
||||||
|
expect "(config-if)#"
|
||||||
|
send "interface port-channel ${linkConfig.group}\r"
|
||||||
|
expect "(config-if)#"
|
||||||
|
send "exit\r"
|
||||||
|
|
||||||
|
send "interface port-channel ${linkConfig.group}\r"
|
||||||
|
expect "(config-if)#"
|
||||||
|
send "switchport mode access\r"
|
||||||
|
expect "(config-if)#"
|
||||||
|
send "switchport access vlan ${toString (builtins.head linkConfig.vlans)}\r"
|
||||||
|
expect "(config-if)#"
|
||||||
|
|
||||||
|
send "exit\r"
|
||||||
|
expect "(config)#"
|
||||||
|
''
|
||||||
else concatMapStrings (port: ''
|
else concatMapStrings (port: ''
|
||||||
send "interface ethernet ${port}\r"
|
send "interface ethernet ${port}\r"
|
||||||
expect "(config-if)#"
|
expect "(config-if)#"
|
||||||
|
|
Loading…
Reference in New Issue