It would be nice if Mikrotik would share the script to make the normal export so we don't have to find out on our own how to walk the tree of all the sections in the configuration.
An example (not working) how an smartimport file could look
Code: Select all
local keywords "raw led dhcp"
local replace "filter nat mangle raw"
local skip false
:local section do={:if ($1 in $keywords) do={local skip true; local selected $1} else={$1; local skip false; :if ($1 in $replace) do={remove [find]} } on-error={:log warning "Section $1 not available on this device"; local skip true}
:local replace do={$1} on-error={:log error "Section $1 not available on this device. IMPORT ABORTED!!"; :error }
:local toadd do={:if (skip = false) do={add $1} else={:log warning "Skipped adding $1 in $selected"}} on-error={:log warning "Line $1 could not be added in $selected"}
:local toset do={:if (skip = false) do={set $1} else={:log warning "Skipped setting $1 in $selected"}} on-error={:log warning "Line $1 could not be set in $selected"}
$section "/ip firewall mangle"
$toadd "comment=nothing"
$toadd "comment=nothing"
$section "/ip firewall RAW"
$toadd "comment=nothing"
$toadd "comment=nothing"
$section "/interface ethernet switch port"
$toset "0 default-vlan-id=0"
$toset "1 default-vlan-id=0"
$toset "2 default-vlan-id=0"
$replace "/system script"
add comment=nothing
add comment=nothing
So everyone, and I mean everyone, who want to help in coding this is welcome to chime in is welcome!
Started by this request made: viewtopic.php?f=1&t=178045#p877044