Page 1 of 1

Feature request: Append values to configuration

Posted: Wed Sep 21, 2016 11:48 am
by Splash
Example:

When adding additional interfaces to a VRF on the CLI, one has to 'set' the current list with the additional interfaces rather than just appending the new interfaces to the existing list.
Current:
/ip route vrf set [find routing-mark=EXAMPLE] interfaces=vlan1,vlan2,vlan3
Requested:
/ip route vrf append [find routing-mark=EXAMPLE] interfaces=vlan4,vlan5

Re: Feature request: Append values to configuration

Posted: Wed Sep 21, 2016 2:53 pm
by mrz
/ip route vrf set [find routing-mark=EXAMPLE] interfaces="$[get [find routing-mark=EXAMPLE] interfaces],vlan4,vlan5"

Re: Feature request: Append values to configuration

Posted: Fri Sep 23, 2016 3:46 pm
by Splash
Interesting workaround :)
Thanks!

Re: Feature request: Append values to configuration

Posted: Wed Jun 12, 2019 12:58 am
by TheD
/ip route vrf set [find routing-mark=EXAMPLE] interfaces="$[get [find routing-mark=EXAMPLE] interfaces],vlan4,vlan5"

I've tried this workaround, but only works if the data from the retrieved variable is added to the interfaces command. For example:
/ip route vrf set [find routing-mark=EXAMPLE] interfaces="$[get  [find routing-mark=EXAMPLE] interfaces]"


if I try to add another interface, I get the following error.
input does not match any value of interface
Any idea why? I've tried everything I could think of.

Re: Feature request: Append values to configuration

Posted: Wed Jun 12, 2019 10:10 am
by mrz
One of the interfaces you are trying to add does not exist, so you get an error.

Re: Feature request: Append values to configuration

Posted: Wed Jun 12, 2019 10:36 pm
by TheD
One of the interfaces you are trying to add does not exist, so you get an error.

As much as I wish that was true, it unfortunately isn't. Please see configuration below:
/interface vlan
add comment="L2VPN - CVID 4" interface=bo1v400 name=bo1v400v4 vlan-id=4
add comment="Customer VRF" interface=bo2v900 name=bo2v900v1204 vlan-id=1204
add comment="IRL" interface=bo2v951 name=bo2v951v1204 vlan-id=1204

/ip route vrf set [ find routing-mark=customer1 ] interfaces="$[ get [ find routing-mark=customer1] interfaces ],bo1v400v4"


bo2v900v1204 and bo2v951v1204 are already in the VRF and I would like additional interface added to the VRF, which is in this case interface bo1v400v4. If I run the following command, the command is accepted and already existing interfaces are still in the VRF:
/ip route vrf set [ find routing-mark=customer1 ] interfaces="$[ get [ find routing-mark=customer1] interfaces ]"

... but if I try to apply the following command. I get the error that follows.
/ip route vrf set [ find routing-mark=customer1 ] interfaces="$[ get [ find routing-mark=customer1 ] interfaces ],bo1v400v4"
input does not match any value of interface

Re: Feature request: Append values to configuration

Posted: Thu Jun 13, 2019 10:57 am
by mrz
Post /ip route vrf print output

Re: Feature request: Append values to configuration

Posted: Thu Jun 13, 2019 11:20 pm
by TheD
Post /ip route vrf print output
Here it is:
 routing-mark=customer1 interfaces=bo2v951v1204,bo2v900v1204 route-distinguisher=65000:1204 import-route-targets=65000:1204,65000:999 export-route-targets=65000:1204,65000:1000
I've omitted the output of other VRFs for security purposes. Interface bo1v400v4 is not assigned to any other VRF.

Re: Feature request: Append values to configuration

Posted: Fri Jun 14, 2019 12:43 pm
by mrz
Works for me, if in your script you try to add new interface to the VRF right after it is created, then make sure that you add some delay or check if interface exist. Interface may not appear right away if CPU has some load.

Re: Feature request: Append values to configuration

Posted: Sat Jul 20, 2019 6:26 pm
by TheD
Works for me, if in your script you try to add new interface to the VRF right after it is created, then make sure that you add some delay or check if interface exist. Interface may not appear right away if CPU has some load.
The VRF is already present before the script execution, also the CPU is running on 1%, it's barely used CCR1036, so there's definitely enough processing power. I wish Mikrotik would just add "append" command rather than just set/unset. This solution unfortunately (and surprisingly) doesn't work for me.

Re: Feature request: Append values to configuration

Posted: Thu Dec 26, 2019 2:41 pm
by greek
Works for me, if in your script you try to add new interface to the VRF right after it is created, then make sure that you add some delay or check if interface exist. Interface may not appear right away if CPU has some load.
No, it's not working. I have same problem.
/ip route vrf
add interfaces=pptp-001,vlan28p1 routing-mark=clientVRF
[admin@FinalFantasy-2(bkp)] /ip route vrf> :global inn "$[get [find routing-mark=clientVRF] interfaces]"                                                        
[admin@FinalFantasy-2(bkp)] /ip route vrf> :put $inn
pptp-001;vlan2833p1
[admin@FinalFantasy-2(bkp)] /ip route vrf> :set inn "$inn;pptp-002"
[admin@FinalFantasy-2(bkp)] /ip route vrf> :put $inn
pptp-001;pptp-002;vlan2833p1;pptp-002
^^^^^^^^^^^^^^^^^----------------
How it can be ??
[admin@FinalFantasy-2(bkp)] /ip route vrf> /ip route vrf set [find routing-mark=clientVRF] interfaces="$[get [find routing-mark=clientVRF] interfaces],pptp-002"
;              
input does not match any value of interface
[admin@FinalFantasy-2(bkp)] /ip route vrf> 

Re: Feature request: Append values to configuration

Posted: Thu Dec 26, 2019 4:29 pm
by greek
Right answer is:

/ip route vrf set [find routing-mark=clientVRF] interfaces=([get [find routing-mark=clientVRF] interfaces], "newVlan");

It's because [get [find routing-mark=clientVRF] interfaces] is array, not string.