I actually really like the scripting syntax of RouterOS. But I'm not a programmer!
My way of thinking is linear, and that doesn't help me when it comes to finding solutions to small syntax rules.
But my brain gets stuck on what the syntax and logic of some recursions in RouterOS are.
I did some tests that obviously failed, but I'll bring them here to show how far I was able to get.
The following command gives me the arrays of interfaces I want.
Code: Select all
:put [/interface find type=ether]
:put [/interface find type=vlan]
:put [/interface find type=bridge]
Code: Select all
:foreach varinterfaceid in={/interface find type=ether} do={:put "$varinterfaceid" }
And this is where I got stuck...
I imagined that I needed to do soothing like:
Code: Select all
:foreach varinterfaceid in={/interface find type=ether} do={/tool/graphing/interface/add [/interface get [:put "$varinterfaceid"} name]
Wrong because of the wrong use of syntax, and wrong because there is no "/interface/get".
Could anybody give me some help with this?