[j-nsp] How to query the results tree from a commit script?
Benny Amorsen
benny+usenet at amorsen.dk
Wed May 23 04:22:02 EDT 2012
Curtis Call <ccall at juniper.net> writes:
> In SLAX 1.1 you'd be able to use mvars, but that isn't released in
> Junos yet, so you'll need to use some sort of out-of-script storage
> such as the Utility MIB or a disk file.
>
> BTW, this could cause your unit numbers to jump around between
> commits. (If you remove one VPN then every following VPN will suddenly
> have a lower unit number).
Yes, I discovered that one the hard way.
> Is that going to be a problem for you?
Not for me personally, but apparently an MX does not like a thousand
subinterfaces switching ID's... Not so surprisingly perhaps, but it took
a few minutes before everything was back to normal.
> It might be preferable to store the assigned unit number for each VPN
> within the configuration, perhaps within an apply-macro, so that you
> can ensure that a particular VPN doesn't change. That would allow you
> to assign the numbers randomly as well, which would be more efficient.
> (i.e. when the script makes the transient change it also makes a
> permanent apply-macro change, recording the assigned unit [if it is a
> previously unconfigured VPN])
Yes, I ended up going that route, apart from not choosing randomly. You
are right, random will be more efficient eventually, when a sufficient
number of lines have been added and removed. My solution right now is
O(n).
/Benny
More information about the juniper-nsp
mailing list