I’m tring to automate the updating of filter lists for BGP4 peers.
the idea is to use IRRPT (http://sourceforge.net/projects/irrpt/) to daily update BGP4 peering filters based on AS-SET’s from the RIPE database. The irrpt tool has automated scripts to update filters for most router vendors but not for Mikrotik. On Cisco it would result in a batch file which looks like this
no ip as-path access-list 111
ip as-path access-list 111 permit ^_551234$
ip as-path access-list 111 permit ^_661234$
ip as-path access-list 111 deny .*
which would mean the access-path list 111 woud allow AS number 551234 and 661234 but nothing else.
Creating similar commands for adding the regular expressions etc is simple to adopt on mikrotik.
However DELETING a filter list seems to be impossible.
something like
/routing filter delete where chain=peer-as1234
is missing. scripting it with line numbers needs twoway interaction to first find the lines to delete etc. So batchfiles would not work but an interactive script and thats difficult.
So the question is if this can be done by a script maybe?
How are others doing this? all by hand ? or are we the only ones using mikrotik in a world wide BGP4 backbone?
As long as you’re able to get the basic data into a text file on the PC (via IRRPT, retrieving it using wget, or whatever), you could then use a bash script to modify and output a properly formatted RouterOS script. Then you can ftp it to the router with a name of something.auto.rsc, and then script will be automatically run (router needs to be v5.24+ I think for this to work properly). If IRRPT is flexible enough, you could have it output the correct formatting.
You could also just upload a something.rsc script to the router, and then use a script on the router to import it with:
/import something.rsc
As for removing entries, this will remove a filter: