[j-nsp] Unit-ID's revisited / accessing committed configuration

Curtis Call ccall at juniper.net
Thu Apr 26 13:20:59 EDT 2012


> 
> Sorry, I forgot to mention the crucial detail: It has to be available
> to
> a script. Unfortunately that command does not seem to have a junoscript
> equivalent; "display commit-scripts view" does have a junoscript
> equivalent but does not do what I need.
> 

Junos 12.1 added new options for the <get-configuration> commit-scripts attribute, apply and apply-no-transients, that allow you to retrieve the post-commit-script configuration, and prior to Junos 12.1 you could always do something like <command> "show configuration | display xml | display commit-scripts" (be aware that the returned XML structure will be different than <get-configuration>), however, these work by running the configuration through the commit scripts again, so if you try to call them from a commit script you're liable to get a loop.

Why not just have your commit script automatically add the unit number to the apply-macros. i.e. if the unit number is already present in the macro then use it for the logical interface, but if it is missing then figure out the first unused number, use it for the interface, and record it in the macro.




More information about the juniper-nsp mailing list