Community discussions

MikroTik App
 
User avatar
Chupaka
Forum Guru
Forum Guru
Topic Author
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

v7 new CLI style VS export

Sun Mar 06, 2022 8:31 pm

In ROS v7 we have new CLI style (like /this/is/it), but export still generates the old one. Is it going to be changed some time soon?
 
pe1chl
Forum Guru
Forum Guru
Posts: 10183
Joined: Mon Jun 08, 2015 12:09 pm

Re: v7 new CLI style VS export

Sun Mar 06, 2022 9:00 pm

I also wondered about that... the change is probably made to be more in line with API but why is the export still the old format?
Only thing I can think of is that it is convenient that exports (at least some of them) can still be imported into version 6. But that will be more difficult over time.
 
infabo
Long time Member
Long time Member
Posts: 585
Joined: Thu Nov 12, 2020 12:07 pm

Re: v7 new CLI style VS export

Sun Mar 06, 2022 9:18 pm

Inconsistency is king.
 
mducharme
Trainer
Trainer
Posts: 1777
Joined: Tue Jul 19, 2016 6:45 pm
Location: Vancouver, BC, Canada

Re: v7 new CLI style VS export

Tue Mar 08, 2022 5:14 am

I suspect the export will change to the new format once v6 moves to legacy (after v7 long term is released).
 
pe1chl
Forum Guru
Forum Guru
Posts: 10183
Joined: Mon Jun 08, 2015 12:09 pm

Re: v7 new CLI style VS export

Tue Mar 08, 2022 11:30 am

Hopefully there will be some time, when v7 has been made feature complete and reasonably bug free, when someone at MikroTik looks at the whole export/import thing.
It requires some rework to handle standard tasks like transfer of a config to a new device, reload of a config after a full config reset, etc.
Frankly I would prefer when "backup" is abandoned and everything is done via export, i.e. all info can be (optionally) put in there, and there are options to import a config that is not completely compatible with the device.
(e.g. to skip and ignore config of unknown devices or features, skip explicit MAC addresses and re-generate them, fix the longstanding problem with run-after-reset, log all warnings from an import to a file including the failed commands)

As powerful as the MikroTik routers are, there is one thing where they really suck: when you have bought a shiny new box to replace your aging MIPSBE device, and want to transfer your configuration to that.
This can only be done by an expert. It should be possible for "the clever nephew" to do that. I understand it will probably never be possible for everyone.
 
User avatar
Buckeye
Forum Veteran
Forum Veteran
Posts: 883
Joined: Tue Sep 11, 2018 2:03 am
Location: Ohio, USA

Re: v7 new CLI style VS export

Tue Mar 08, 2022 10:22 pm

100% agree with pe1chl.

About the only thing the current backups are good for is to restore after making changes that introduced unintended side effects, or if a router is damaged and you are replacing with the exact same model. I am not even sure if you can restore to a different version of firmware. (If not, what happens when you attempt to restore? Does it tell you you need to reload firmware xxxx?

There needs to be a complete text based backup, that includes usernames, etc.

All in one file that can be edited, and compared to other configurations, stored in git, etc.

Cisco IOS and Ubiquiti Edgerouters do a better job of this than MikroTik.

The edgerouter backup is a copy of tar.gz of the config directory. The main file is the config.boot that is text, but not the best way to move to a different model, although it can be "edited". But you can easily convert the config.boot to set/delete commands using a utility on the edgerouter, and there is even a perl script than can do it.
config.boot still needs to be kept confidental, as there can be sensitive stuff in it, but that can be done with other encryption utilities, even 7-zip.

There are multiple requests for a single file export that includes everything needed to move to another mikrotik router. There was one with a voting tab, but I can't find it now.
 
WeWiNet
Long time Member
Long time Member
Posts: 591
Joined: Thu Sep 27, 2018 4:11 pm

Re: v7 new CLI style VS export

Wed Mar 09, 2022 5:15 pm

Interestingly, in ROS7 under
/system/history/ print detail
which is used for safe mode etc.
the output is also following the ROS6 syntax as far as I can see.

Seems ROS6 is still somehow under the hood...
 
mducharme
Trainer
Trainer
Posts: 1777
Joined: Tue Jul 19, 2016 6:45 pm
Location: Vancouver, BC, Canada

Re: v7 new CLI style VS export

Fri Mar 11, 2022 2:53 am

Hopefully there will be some time, when v7 has been made feature complete and reasonably bug free, when someone at MikroTik looks at the whole export/import thing.
It requires some rework to handle standard tasks like transfer of a config to a new device, reload of a config after a full config reset, etc.
I agree. In my view the hardest part of accomplishing this is that MikroTik has their "config mode" (where you do configuration) and "execution mode" (where you run commands for diagnostics) in one, whereas other vendors have them separated (Cisco, HPE, etc.). I can copy and paste a Cisco or HPE config to another device even if it already has a bit of config on it, and it will usually apply all right. With MikroTik, because there is no separate config mode, all of the "add" and "set" stuff relies on something either not existing at all or already existing. This means you can't just paste and get it close - you have to make sure you are pasting onto a completely empty device, otherwise it will try to create a new bridge called "bridge" when one already exists, that will fail, then it snowballs from there. This is very confusing for new users and results in a lot of mistakes in configuration.

I think the solution to this might be for them to implement a new "config mode" where all commands you type are considered to be configuration statements. It could be in a JSON format or a Cisco-like format. It wouldn't necessarily look much like current RouterOS syntax but would contain all configuration elements. Any config applied in config mode would overwrite or merge with existing blocks - ex. if a bridge "bridge" existed, it would change the configuration of the existing bridge "bridge" to match.

Aside from the config mode, you could still configure the device using the same old commands in regular execution mode, so it would not break existing scripts and would not mess things up for users who liked things the way they were.
 
pe1chl
Forum Guru
Forum Guru
Posts: 10183
Joined: Mon Jun 08, 2015 12:09 pm

Re: v7 new CLI style VS export

Fri Mar 11, 2022 11:47 am

Well that is true. But it is not what I am mainly worried about. One can reset a device to (almost) completely empty and then import a config.
Those parts that are still left after a full reset are mostly things that the export will "set" instead of "add" so it often works.
A notable exception is that of user groups, which is left when a reset "retaining user information" is done, but then conflicts with an import that uses "add".

What is more important is that the import is so picky about every little detail, e.g. when the exported config has LCD or LED setup and your new device does not have these.
IMHO it should just skip that, or it should just accept the config but then ignore it during use. Now the import stops at that point.
Also the "run after reset" does not work properly because it starts too early in the boot process, before the system is ready to accept configuration.
That is a bug introduced somewhere back in the 6.3x time frame and never fixed. We now have to put /delay 30 at the top of the file to work around it, ridiculous as MikroTik should well know when it is safe to start the import.
Also, interface names are often changing between devices for unclear reasons and this also makes import fail. E.g. SFP ports that are named sfp1 on one and sfpplus1 on another router.
Or WLAN ports where wlan1 and wlan2 are swapped (w.r.t. being 2GHz or 5GHz) between comparable devices.
Maybe there should be some mapping of device names depending on the source of the export (which is in the header), so it knows when importing a config from another router which transformations have to be made on the input before applying it.
 
guipoletto
Member Candidate
Member Candidate
Posts: 195
Joined: Mon Sep 19, 2011 5:31 am

Re: v7 new CLI style VS export

Fri Mar 11, 2022 11:54 pm

Maybe there should be some mapping of device names depending on the source of the export (which is in the header), so it knows when importing a config from another router which transformations have to be made on the input before applying it.
yup, it's called man-hour-notepad :mrgreen:

But adding on to your ideas about partial import:
What if Mikrotik exported each section of the config (e.g. /ip firewall export file=firewall; /interface ethernet export file=ethernet...... )
inside one ZIP file
(as i understand, many sections are already internally stored as separate files / pointer lists, and some other gore)

that would have two advantages:
one: filezise for big-config exports would drop dramatically
two: as sections would already be neatly separated in different RSC files inside the one export "zip", one could easilly have the command "/import sections=a,b,c", or "/import sections=!lcd"
without even having to parse the whole extent of the config
 
pe1chl
Forum Guru
Forum Guru
Posts: 10183
Joined: Mon Jun 08, 2015 12:09 pm

Re: v7 new CLI style VS export

Sat Mar 12, 2022 11:19 am

No, I don't think that is a good idea. I like it that the export files are just text files and can be meaningfully stored in a versioning system like git.
I think the first step should be to ignore minor errors when importing a file, i.e. issue a warning (printing the offending line) and continuing with the next command.
The error output should be logged to a file, especially when the import is started as a run-after-reset.
The thing with incompatible interface names is a more advanced wishlist item that could be deferred or put in some external tool.
(an export file conversion tool where you specify the desired destination device and it would convert your export from your old router into the one expected by the new one)

Who is online

Users browsing this forum: No registered users and 23 guests