[j-nsp] CLI/OP Script Interaction

Phil Shafer phil at juniper.net
Fri Oct 23 14:13:24 EDT 2009


Judah Scott writes:
>What is a transient change?

Here's some (long-ish) explanatory text:

   You can use commit scripts to generate transient changes, which are
   changes that are not saved in the candidate configuration but are
   propagated to the components of the system.  Transient changes are
   made to the copy of the database that is exported to JUNOS
   components, but not to the candidate or committed configuration
   databases.  This allows configuration changes to be transient, in the
   sense that they are not preserved by the system.

   You can use transient changes to eliminate the repetition of
   well-known policies, thus allowing these policies to be performed
   implicitly.  For example, if MPLS must be enabled on every
   ISO-enabled interface, the change can be transient, so that the
   repetitive or redundant configuration data need not be carried and
   displayed to the user.

   The syntax for transient changes is nearly identical to that for
   permanent changes.  To make transient changes to the configuration,
   include a <transient-change> element within the commit-script-output
   element.  The <transient-change> element contains the desired change
   in the format required by a JUNOScript <load-configuration> RPC
   operation.  For example:

       <transient-change>
         <system>
           <host-name>rdu-03-42</host-name>
         </system>
       </transient-change>

   To enable transient changes, you must configure the
   "allow-transients" statement at the [system scripts commit] level of
   the configuration hierarchy.  Without this statement, the UI will
   ignore transient changes.

   To view and test transient changes, use the "show | display
   commit-scripts" command.  This command displays the post-commit
   scripts contents of the database without actually changing the
   database.  It displays both transient and standard changes.

       [edit]
       cli# show | display commit-scripts

Actually, I think emitting transient changes without allow-transients
is now a commit error.

>Also do you mean an op script can trigger a commit-script
>to make transient changes? (It looks like the second "op script" was meant
>to say "commit-script."

I mean that you could have a script that asks the user some questions,
builds some config from it in the form of an apply-macro, loads
that config, and performs a "commit-configuration" operation.  As
part of that commit, any commit scripts (that are configured) will
be run, and those scripts could generate transient changes from
that apply-macro.

So your op script can't make transient changes, but it can performs
commits, which will trigger commit scripts that can generate transient
changes.

Thanks,
 Phil


More information about the juniper-nsp mailing list