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};
|
||||
isAccess = config.site.net ? ${name};
|
||||
netConfig = config.site.net.${name};
|
||||
isTrunk = !isAccess;
|
||||
isBond = isTrunk && builtins.length linkConfig.ports > 1;
|
||||
isTrunk = linkConfig.trunk;
|
||||
isBond = builtins.length linkConfig.ports > 1;
|
||||
vlans = concatStringsSep "," (map toString (sort linkConfig.vlans));
|
||||
ports = concatStringsSep "," linkConfig.ports;
|
||||
in
|
||||
|
@ -108,6 +108,29 @@ with lib;
|
|||
send "exit\r"
|
||||
expect "(config)#"
|
||||
'') 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: ''
|
||||
send "interface ethernet ${port}\r"
|
||||
expect "(config-if)#"
|
||||
|
|
Loading…
Reference in New Issue