How to create a script that does a for on interfaces and creates global variables for each interface with their properti
Posted: Sat Apr 08, 2023 7:07 pm
How to create a script that does a for on interfaces and creates global variables for each interface with their properties.
The way below doesn't work.
Version RouterOS: 6.48.6 and 7.8
The way below doesn't work.
Version RouterOS: 6.48.6 and 7.8
Code: Select all
:foreach iface in=[/interface ethernet find] do={
:local name [/interface ethernet get $iface name]
:local mac [/interface ethernet get $iface mac-address]
:local comment [/interface ethernet get $iface comment]
:local running [/interface ethernet get $iface running]
:local disabled [/interface ethernet get $iface disabled]
:global ("eth" . $iface . "_name") $name
:global ("eth" . $iface . "_mac") $mac
:global ("eth" . $iface . "_comment") $comment
:global ("eth" . $iface . "_running") $running
:global ("eth" . $iface . "_disabled") $disabled
}