Automation Overview Junos – Part-1

Automation Overview Junos:

Junos automation suite -> used to automate operational and configuration tasks on network devices running the Junos operating system (Junos OS)
Consists of ::-> commit scripts, operation (op) scripts, event policies/scripts, and macros.

Junos automation simplifies complex configurations and reduces potential configuration errors -> It saves time by automating operational and configuration tasks.
It also speeds troubleshooting and maximizes network uptime by warning of potential problems and automatically responding to system events.

Junos automation scripts can be written in either of two scripting languages:

1. Extensible Stylesheet Language Transformations (XSLT)
XSLT is a standard for processing Extensible Markup Language (XML) data and is designed to convert one XML document into another.

2. Stylesheet Language Alternative Syntax (SLAX)
SLAX is an alternative to XSLT. It has a simple syntax that follows the style of C and PERL, but retains the same semantics as XSLT.
Programmers who are familiar with C often find it easier to learn and use SLAX. Scripts written in one language are easily converted to the other.

1. Commit Scripts
> to automate the commit process, When a candidate configuration is committed, it is inspected by each active commit script. If a configuration violates your custom rules, the script can instruct Junos OS to take appropriate action. A commit script can perform the following actions:

a. Generate and display custom warning messages to the user
b. Generate and log custom system log (syslog) messages
c. Change the configuration to conform to the custom configuration rules
d. Generate a commit error and halt the commit operation

NOTE: Commit scripts, when used in conjunction with macros, allow you to simplify the Junos configuration and, at the same time, extend it with your own custom configuration syntax.

2. Op Scripts
To automate operational tasks and network troubleshooting, can be executed manually in the CLI or upon user login, or they can be called from another script. Op scripts can process user arguments and can be constructed to:

a. Create custom operational mode commands
b. Execute a series of operational mode commands
c. Customize the output of operational mode commands
d. Shorten troubleshooting time by gathering operational information and iteratively narrowing down the cause of a network problem

e. Perform controlled configuration changes
f. Monitor the overall status of a device by creating a general operation script that periodically checks network warning parameters, such as high CPU usage.

3. Event Policy
> An event policy is an if-then-else construct that defines actions to be executed by the software on receipt of an event such as a system log message or SNMP trap.
> Event policies can be executed in response to a single system event or to correlated system events. For each policy, you can configure multiple actions including:

a. Ignore the event
b. Upload a file to a specified destination
c. Execute Junos OS operational mode commands
d. Execute Junos OS event scripts

3.1 Event Scripts
Triggered automatically by defined event policies in response to a system event and can instruct Junos OS to take immediate action.

An event script automates network troubleshooting and network management by doing the following:

> a. Automatically diagnose and fix problems in the network
> b. Monitor the overall status of a device
> c. Run automatically as part of an event policy that detects periodic error conditions
> d. Change the configuration in response to a problem

Here is a simple junos commit script that checks if a given interface is assigned to trust zone or not. It is very basic of course but can be extended using junos automation reference documents.


Once you create this script place it under /var/db/scripts/commit/test.slax

Then enable it via cli in the configuration

>>>>>##junos >set system scripts commit file test.slax

You will see that if the interface ge-0/0/0.0 isn’t assigned to the trust zone you will receive the error message in <message> tag.








The combination of Ansible and Juniper’s automation and orchestration tools bring together the knowledge and expertise of experienced IT solutions developers, operators, and administrators across organizations.

The joint solution addresses the most common applications of automation and orchestration in the management and provisioning of IT resources, including:

  1. Configuration automation
  2. Test-driven networking
  3. Continuous compliance

The joint solution includes Ansible modules developed specifically for Juniper Networks Junos OS.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s