l2tp-client per script enable not consistent working

hello there,

i have made a customscript for the tr069 client to reach the server either over lte1 or ether1 for failoverreasons.
to reach the management on the lte1 side i did an l2tp-client successfuly.

to only establish the l2tp-client (via lte1) i do it on availibilitybases - so if primay target is not reachable, enable the l2tp-client.

:local i 0; {:do {:set i ($i + 1)} while (($i < 5) && ([/ping 8.8.8.8 interval=3 count=1 interface=vlan31-hsi ]=0))};
:if ($i=5 && [/ip route get [find comment=“floating-hsi”] distance]=255) do={:log info “Primary hsi down”;
/ip route set [find comment=“floating-hsi”] distance=1
/ip route set [find comment=“floating-mgt”] distance=4
/interface l2tp-client enable 0
}

its not reproduceable but from time to time the script cannot enable the l2tp-client (which is disabled if primary is available again).

the error i receive on the cli (when i try to execute is:
no such item (4)

if i try to enable it a second time its no problem to enable the client.

any ideas? - may this is a bug?

thank you!

christian

Hi,

I had the same issue. If I added a “/interface l2tp-client print” before accessing the element it worked for me every time. Looks like the interpreter needs to evaluate the elements in a category first before you can reliably access the elements. It makes no difference if you try to access via element number or name.

Bye,
wil

hey wil!

wow! great help!

yes it works with this workaround!

thank you!

christian

hey again,

jfyi:

/interface l2tp-client find name XX
is also working.

greetings

christian

Can you try and see if this also works?

/ip route set [find where comment=“floating-hsi”] distance=1
/ip route set [find where comment=“floating-mgt”] distance=4

hi,

just checked it out. - no its not working.

christian

Thanks for checking out.