How to check including port to bridge?

Hello.

How i can check is eth port into bridge already or not? In script.

try this, change name1 for your interface.

foreach i in=[interface bridge port find] do={
local name1 wlan1
local name2 [interface bridge port get value-name=interface $i]
if ($name1 = $name2) do={ log error “interface $name1 is in a bridge”}
else={log error “interface $name1 is not in a bridge”}}

Thank you! I’ll try to test this script!

:local INTNAME ether1
:put [/interface bridge port find where interface=$INTNAME]

Everything after the :put will return nothing if it isn’t in a bridge or a unique identifier if it is in the bridge. You could also add disabled=no and bridge=“bridge1” to specify if the port is disabled in the bridge port and specify which bridge it is on.

Thanks! How i can use into the scripr “empty answer” of this example?

if [/interface bridge port find where interface=$INTNAME] == “empty?” do={} else={} ?

:if ([/interface bridge port find where interface=$INTNAME] = “”) do={} else={}
Alternatively if you want it o do something if it isn’t blank:
:if ([/interface bridge port find where interface=$INTNAME] != “”) do={} else={}

krakenant, Thanks a lot! It’s Very usefull example for me!

ps: Maybe, can you help me in neighbor topic: http://forum.mikrotik.com/t/how-to-see-ethernet-port-uptime/67669/1 ?

How can I check the pptp interface is there in bridge or not?

miks69, have your interface static name or not?

Yes, I have. But above script is not showing it…

Try:

[greek@RT] >  :if ([/interface bridge port get  number=[/interface bridge port find where point-to-point-port=yes  ] interface] = "work") do={:put "in_bridge"} else={:put "not_in_bridge"}
in_bridge
[greek@RT] >

it seems something wrong in above script because I have an error “no such item”:

:if ([/interface bridge port get number=[/interface bridge port find where point-to-point-port=yes] interface]=“w
ork”) do={:put “in bridge”} else={:put “not in bridge”}

Very strange workaround, but it’s work:
:if ([/interface bridge port find where point-to-point-port=yes] != “”)
do={
:if ([/interface bridge port get number=[/interface bridge port find where point-to-point-port=yes ] interface] = “work”)
do={:put “in_bridge”}
}
else={:put “not_in_bridge”}