I am trying to make a script to remove the “unknown” interfaces added in bridges, something like this:
/interface bridge port remove where interface=“unknown”
But the “where” can not be used after remove, only “number”.
Does anyone have any ideas for automating the removal of these “unknown” interfaces?
Hi,
These were interfaces dynamically created by capsman, where remote APs were disconnected for some reason and when they came back capsman creates new interfaces and the old ones are “unknown”.
There are lots of ways to get them there!
But of course the fact that you see interface ‘unknown’ does not mean it is really named ‘unknown’ so that match does not work.
No idea if it needs to be done with script, in the UI of course you can sort on name and then delete the entire block.
You must check few parameter in your case.
Remember that parameter=no and !parameter have differ result.
I add to bridge port a “virtual ethernet” interface and remove it to create a unknow device into bridge port.
In this scenario I found this way:
/interface bridge port print where status=inactive !dynamic !hw-offload
/interface bridge port remove [find status=inactive !dynamic !hw-offload]
:local ifName ""; :foreach id in=[/interface bridge port find where role=[:nothing]] do={ :set ifName [/interface bridge port get $id interface]; :if ([/interface find where name=$ifName] = "" && [/interface list find where name=$ifName] = "") do= { /interface bridge port remove $id; } }
More generally:
:local ifName "";
:foreach id in=[/interface bridge port find where role=[:nothing]] do={
:set ifName [/interface bridge port get $id interface];
:if ([/interface find where name=$ifName] = "" && [/interface list find where name=$ifName] = "") do= {
/interface bridge port remove $id;
}
}