E.g.:
Code: Select all
/routing/bgp/session {
:local prefixes;
:foreach ses in=[find] do={
:set $name [get $ses name]
:set $remote [get $ses "remote.address"]
:set $prefix [/routing/route/print count-only where belongs-to="bgp-IP-$remote"]
:set ($prefixes->$name) $prefix
}
:foreach name,prefix in=$prefixes do={
:put "$name: $prefix"
}
}
The script works OK (as of RouterOS 7.8beta2), but before it outputs the alphabetically sorted list of BGP peers and their prefixes, it first prints the prefix numbers in the random order the sessions are in the list. That is because the
Code: Select all
:set $prefix [/routing/route/print count-only where belongs-to="bgp-IP-$remote"]
How can I suppress that?