Script to add ports to a bridge

Script to add ports to a bridge


# First, set port type i.e.: ether or sfp

# This is for interfaces not named “ether” like SFP

# Second set the bridge name

# Then set ports in range form using SlavePortStart and SlavePortStop.

Paste this into a terminal to create the script, change the variables outlined above and run the script.

/system script
add name="Set Ports" owner=admin policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive source="#\r\
    \n#\r\
    \n# \r\
    \n# First, set port type i.e.: ether or sfp \r\
    \n# This is for interfaces not named \93ether\94 like SFP\r\
    \n# Second, set the bridge name\r\
    \n# Then set ports in range form using SlavePortStart and SlavePortStop.\r\
    \n:global PortType \"ether\"\r\
    \n:global BridgeName \"bridge1\"\r\
    \n:global SlavePortsStart \"1\"\r\
    \n:global SlavePortsStop \"9\"\r\
    \n:for i from=\$SlavePortsStart to=\$SlavePortsStop do={\r\
    \n/interface bridge port add interface=(\$PortType . \$i) bridge=\$BridgeNam\
    e\r\
    \n}"