Page 1 of 1

comment in export for broken reference

Posted: Tue Sep 14, 2021 10:08 am
by eworm
RouterOS configuration works with referencing configuration items. Things break when an item is removed and reference points to a non-existent id:
[admin@ros7] > /interface/bridge/add name=test
[admin@ros7] > /ip/address/add address=10.0.0.1/24 interface=test
[admin@ros7] > /interface/bridge/remove test
[admin@ros7] > /ip/address/print
Flags: I, D - DYNAMIC
Columns: ADDRESS, NETWORK, INTERFACE
ADDRESS NETWORK INTERFACE
0 D 10.7.7.159/24 10.7.7.0 bridge
1 I 10.0.0.1/24 10.0.0.0 *B
When printing the configuration you see the dangling id (*B in this case). However exporting the configuration you can not see this:
[admin@ros7] > /ip/address/export
/ip address
add address=10.0.0.1/24 network=10.0.0.0
In case of broken references I would like to see a comment in export showing the issue, something like:
[admin@ros7] > /ip/address/export
/ip address
# WARNING: broken reference to internal id *B
add address=10.0.0.1/24 network=10.0.0.0
I contacted support (SUP-58120) an their answer was:
Thank you for your request, if there will be more, similar request like yours, we will see how this can be added in the future versions.
So if you think this would be a good addition please cast your vote by opening a support ticket.

Re: comment in export for broken reference

Posted: Tue Sep 14, 2021 10:29 am
by rextended
Is not a 7 prerogative, also on 6 the same:

terminal code

pri
Flags: X - disabled, I - invalid, D - dynamic 
 #   ADDRESS            NETWORK         INTERFACE                                
 0 I 6.6.6.6/24         6.6.6.0         *B                                       

export
/ip address
add address=6.6.6.6/24 network=6.6.6.0

Re: comment in export for broken reference

Posted: Tue Sep 14, 2021 12:04 pm
by eworm
Yes, it is the same there. As active development moved to v7 and my examples use new syntax I decided to post here.

Re: comment in export for broken reference

Posted: Wed Sep 22, 2021 10:05 am
by nescafe2002
I think it would be better if the export for ip address followed the same rule as for bridge port: export interface ID instead of omitting interface attribute.

[admin@MikroTik] > /interface bridge port export
# sep/22/2021 09:00:35 by RouterOS 7.1rc4
/interface bridge port
add bridge=docker interface=veth1

[admin@MikroTik] > /interface veth remove veth1

[admin@MikroTik] > /interface bridge port export
# sep/22/2021 09:01:37 by RouterOS 7.1rc4
/interface bridge port
add bridge=docker interface=*E

Re: comment in export for broken reference

Posted: Wed Sep 22, 2021 1:29 pm
by eworm
Fine with me... Thought searching for the comment should be easier.
But there should be a way to detect broken reference in export. Just silently ignoring is the wrong way.