Chapter 5. Commit Scripts

Commit scripts are a powerful way to modify the commit process. They let you transform the configuration between the time the user types commit and the time the configuration is read by the daemons. You can enforce custom configuration checks, automatically fix common configuration mistakes, and dynamically expand the configuration. In short, you can customize the configuration process to make it work for your environment.

Use Cases

Before diving into the details, let’s take a look at some of the target use cases for commit scripts.

Custom Configuration Checks

The Junos software enforces a set of configuration checks that ensure basic configuration sanity. For example, the Junos software may prevent you from committing a BGP configuration that references a policy that is undefined, or it may prevent you from configuring the same IP address for two different BGP peers. However, these configuration checks do not ensure the configuration is correct for your environment. Rather, they merely check that the configuration may be suitable for some environment. Put differently, they check that the configuration is syntactically correct, not contextually correct. And this behavior makes sense. After all, how is the Junos software to know what makes sense in any given network?

However, you may know a certain configuration is appropriate, or inappropriate, for your environment. Some organizations distill this knowledge into standards or configuration templates. Using commit ...

Get Automating Junos Administration now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.