one script runs, one doesn't IPSEC Policy GET

Title says it all:

If I run this script…the variable populates in Environment

# dec/12/2012 13:39:12 by RouterOS 5.14
# software id = BP5N-2J88
#
/system script
add name=test policy=\
    ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \
    source=":global test1 [/ip ipsec policy get 19 sa-dst-address]"

If I run this script it does not.

I have 25 IPSEC Policies, and more to go…I can use ‘get’ up to policy #19 then at 20…it fails…why??

# dec/12/2012 13:39:12 by RouterOS 5.14
# software id = BP5N-2J88
#
/system script
add name=test policy=\
    ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \
    source=":global test1 [/ip ipsec policy get 20 sa-dst-address]"

Have I run into a “limit” of some sort that I am not aware of…

Thank you in advance…my MT scripting education continues…

Also if there is a way for me to debug this…and see the failure as it is happening…please tell me how…

Never use numbers unless you are in the console, and have then from a print, in scripts you use [find ]. The are very few exception to this rule. and as you have seen your self, it may work i one situation, but not nesseserely in an other, thats why you never use numbers in scripts. There are some internal reasons for this, so it is by design.

Thanks for the tip…

I wish I knew how to implement it…

So instead of “get” i use "find " to set the variable…find the sa-src-address in the policy numbered 20? How do I find the sa-src-address in ipsec policy #20

what else is it called besides the sa-src-address in ipsec policy # 20?

find a unique comment in the policy to identify it, then grab the sa-src-address…i quess.

So how would that be written?

A little suggestion here, and I went looking for an example …


Thank you…this worked…


:global test1 [/ip ipsec policy get [find comment="tunnel20"] sa-dst-address]

KARMA Added for you!!!