Community discussions

MikroTik App
 
User avatar
pribasv
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 66
Joined: Thu Mar 10, 2011 12:09 pm
Contact:

Feature request: Scripting language improvement

Thu May 15, 2014 6:26 pm

RouterOS actualy provides a usefull scripting feature but the scripting language it's really limited.

It allows you to access and modify all RouterOS features but there are only a few data types, even less functions to manipulate these data types, only basic commands/functions are available, limited loop control, no error or exception handling, etc. Looking throught the forums you'll see that, for example, a simple task like comparing two date values or covert an string to uppercase need complex solutions where in most modern languages are simple opertations.

I know there was an attempt on version 4 to integrate LUA scripting to RouterOS but it was discarted. LUA seems a good option for embedded scripting, but is not the only posibility. It would be good to have a full featured language on RouterOS, say LUA, PERL or Python, even the good old fashioned BASIC would be an improvement. We really wouldn't need a full stack language, but even a limited version of any of these languages with access to RouterOS features should provide an unlimited set of posibilities for our devices.

Going a little further, actually only a few features on RouterOS allow to launch an script: scheduler, netwatch, ... . But suppose we had a full event trap feature. For example, on interface down launch script xxx, or on vpn tunnel stablished/lost do yyy.

I know it's a complex request but it would provide a very powerful feature to a product that already is a great solution.

Thanks
 
jarda
Forum Guru
Forum Guru
Posts: 7756
Joined: Mon Oct 22, 2012 4:46 pm

Re: Feature request: Scripting language improvement

Thu May 15, 2014 6:43 pm

+1 fully agreed.
 
dzoleg
just joined
Posts: 3
Joined: Thu Oct 03, 2013 10:28 am

Re: Feature request: Scripting language improvement

Wed May 21, 2014 7:54 pm

On if-up, if-down events scripts execute must have
 
efaden
Forum Guru
Forum Guru
Posts: 1708
Joined: Sat Mar 30, 2013 1:55 am
Location: New York, USA

Re: Feature request: Scripting language improvement

Wed May 21, 2014 8:12 pm

On if-up, if-down events scripts execute must have
+1
 
dzoleg
just joined
Posts: 3
Joined: Thu Oct 03, 2013 10:28 am

Re: Feature request: Scripting language improvement

Fri May 23, 2014 9:49 pm

And not only after up/down... more importantly execute script after DHCP Client get address
 
User avatar
pribasv
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 66
Joined: Thu Mar 10, 2011 12:09 pm
Contact:

Re: Feature request: Scripting language improvement

Fri May 23, 2014 10:01 pm

When I talk about a full event trap system I mean any kind of event that occurs on a RouterOS. Whatever: a wifi client is registered/disconnected then launch an event, a dhcp lease is asigned/finished then launch another event. Think about as if it worked just like the log, something happens then there's a log entry. Well, instead of a log entry you would associate an event to a script, when the event occurs then the script is called.
 
User avatar
c0d3rSh3ll
Long time Member
Long time Member
Posts: 557
Joined: Mon Jul 25, 2011 9:42 pm
Location: [admin@Chile] >

Re: Feature request: Scripting language improvement

Fri May 23, 2014 10:41 pm

When I talk about a full event trap system I mean any kind of event that occurs on a RouterOS. Whatever: a wifi client is registered/disconnected then launch an event, a dhcp lease is asigned/finished then launch another event. Think about as if it worked just like the log, something happens then there's a log entry. Well, instead of a log entry you would associate an event to a script, when the event occurs then the script is called.

+1


But (maybe) we need a more powerfull cpu for execute every script when an event occurs like connection/desconnection a wireless cpe or any other event what occurs constatly




sent from my mobile phone using tapatalk
 
User avatar
pribasv
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 66
Joined: Thu Mar 10, 2011 12:09 pm
Contact:

Re: Feature request: Scripting language improvement

Fri May 23, 2014 11:08 pm

+1

But (maybe) we need a more powerfull cpu for execute every script when an event occurs like connection/desconnection a wireless cpe or any other event what occurs constatly
Well, you don't use an RB750 to manage thousands of users, lots of firewall rules and many queues. You buy or setup a RouterOS system according to your needs. If you would need to manage complex scripts for a very frequent event you should get a powerfull device. If it's an event that ocurrs once on a relative long time maybe the little RB750 is enough.

If the option of trapping events was there you would dimension you device according to your needs. That's what I like from Mikrotik, from the smallest device up to the most powerfull, all of them have the same system features. The difference only exists in the used hardware and the supported workload (hardware capacity+license level)
 
User avatar
pribasv
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 66
Joined: Thu Mar 10, 2011 12:09 pm
Contact:

Re: Feature request: Scripting language improvement

Wed May 28, 2014 1:55 pm

Something else I found missing yesterday in Mikrotik scripting... File operations: copy, append, move, rename, etc...
 
neticted
Member Candidate
Member Candidate
Posts: 137
Joined: Wed Jan 04, 2012 10:36 am

Re: Feature request: Scripting language improvement

Wed May 28, 2014 2:14 pm

This was requested for years.

Event/trigger feature was promised for version 4 or 5 I think, but we never got it.
 
hzdrus
Frequent Visitor
Frequent Visitor
Posts: 51
Joined: Mon May 14, 2012 3:58 pm

Re: Feature request: Scripting language improvement

Tue Aug 05, 2014 11:33 am

We also find inability to trigger commands/scripts based on events to be very limiting, especially in MPLS VPN deployment.

The following is necessary:
1) Ability to specify commands/scripts to execute inside RADIUS reply
2) Mechanism tro trigger a script for every new log line (so there is no need to use a hack with scheduler executing a script every N seconds)
 
Solaris
Member Candidate
Member Candidate
Posts: 111
Joined: Thu Apr 29, 2010 5:05 pm

Re: Feature request: Scripting language improvement

Fri Aug 15, 2014 12:03 pm

+1 kudos for this!
 
SystemErrorMessage
Member
Member
Posts: 383
Joined: Sat Dec 22, 2012 9:04 pm

Re: Feature request: Scripting language improvement

Thu Nov 06, 2014 4:06 am

definitely agree with this. Could also have multi threaded scripts and not have all scripts run on the same core. Also would be good if scripts are compiled after creation/editing to make it run faster.
 
bronx
newbie
Posts: 39
Joined: Wed Feb 11, 2015 1:04 am
Location: Turin, Italy

Re: Feature request: Scripting language improvement

Sun Feb 15, 2015 9:08 pm

+1 for LUA =)
 
midenok
newbie
Posts: 39
Joined: Fri Dec 27, 2013 5:34 pm

Re: Feature request: Scripting language improvement

Mon Apr 25, 2016 7:47 pm

At least, make the ability to parse any size of text files (by removing 4k limitation or reading by chunks).
Or make /tool fetch to output into array of lines.
Fix this bug.
Or if you don't want to fix any the above, make LUA available!
 
User avatar
docmarius
Forum Guru
Forum Guru
Posts: 1222
Joined: Sat Nov 06, 2010 12:04 pm
Location: Timisoara, Romania
Contact:

Re: Feature request: Scripting language improvement

Mon Apr 25, 2016 7:56 pm

Error handling in scripts would also be a good start.
In current implementations, a command error will exit the script up to the console, even if scripts are nested.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7053
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Feature request: Scripting language improvement

Tue Apr 26, 2016 10:50 am

Error handling in scripts would also be a good start.
In current implementations, a command error will exit the script up to the console, even if scripts are nested.
You can catch those errors
http://wiki.mikrotik.com/wiki/Manual:Sc ... ime_errors
 
User avatar
docmarius
Forum Guru
Forum Guru
Posts: 1222
Joined: Sat Nov 06, 2010 12:04 pm
Location: Timisoara, Romania
Contact:

Re: Feature request: Scripting language improvement

Tue Apr 26, 2016 8:33 pm

You can catch those errors
http://wiki.mikrotik.com/wiki/Manual:Sc ... ime_errors[/quote]

Tnx. I missed that one...
 
HughPH
newbie
Posts: 45
Joined: Sat Feb 13, 2016 2:55 am

Re: Feature request: Scripting language improvement

Fri May 27, 2016 12:15 am

I'm going to add to this my personal want:
Ability to read more than 4096 bytes from a file.
I understand the content property of a file is a string, and that's where the limitation comes from. Perhaps it just needs a binarycontent property that's a byte[]. That could underpin the capacity to read a file line by line. Depends on a lot of things - it may be that we actually get that functionality by having a read mechanism that has a Start position, and then either a Length or an "until" byte. e.g. (and this is pseudocode, not mikrotik code)
while(eof = false)
{
	int fromPosition = currentPosition + 1
	string nextline = readbytes(fromPosition, '\r')
}

Who is online

Users browsing this forum: dandu and 111 guests