O'Reilly logo

Automating Junos Administration by Stacy Smith, Jonathan Looney

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2. RPC Mechanisms

The building block of Junos management automation is the remote procedure call (RPC). Just as the drivers of the CLI are the commands a user enters, the drivers of Junos management automation are RPCs.

RPCs are equivalent to commands in many ways, but there are some differences. The main difference is that RPCs take structured input. (They also return structured output by default; however, that is orthogonal to the input format, as both the CLI and some automation mechanisms can return various output formats.) A secondary difference is that MGD assumes that CLI commands are being run from the cli process on the router, while it makes no such assumption with RPCs. While the CLI commands and RPCs often access the same code, there are times when they follow slightly different code paths. One example of slightly different code paths is discussed in “The file Commands: The Exceptions That Prove the Rule”.

For automation purposes, it is helpful to be able to use structured data for both input and output. Using structured data allows the automation script and the Junos software to clearly communicate information to each other. The next section begins by talking about the structured data model, then applies the structured data model to RPC input and output.

Structured Data Model

Structured data has many benefits for the purposes of automation. I remember writing automation scripts years ago that used the Expect language. These scripts sent input to a router and expected ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required