O'Reilly logo

JUNOS Automation Cookbook by Adam Chappell

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

How to do it...

We're going to create a SLAX script to call the necessary RPC to get the interface information and with the structured XML document that is returned, we're going to pick out a simple set of parameters and tabulate it in a neat form to make life simpler for the operator. The example is a little contrived, but it's a good illustration of how to call RPCs from within SLAX. The steps are given as follows:

  1. Start with the mandatory SLAX boilerplate as recommended by Juniper. This typically defines version numbers for compatibility and declares namespaces using the following code:
        version 1.0;        ns junos = "http://xml.juniper.net/junos/*/junos";        ns xnm = "http://xml.juniper.net/xnm/1.1/xnm"; ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0"; ...

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