Training

Books

Navigation
Day One: Navigating The Junos XML Hierarchy

Understanding XML structure and XML hierarchies helps you to more efficiently use Junos automation and leverage native Junos XML capabilities. XML is useful for expressing data in a hierarchy because it uses a series of opening and closing tags to make it easy to navigate through a hierarchy to find specific data.

Junos uses XML natively. While not visible to most users, Junos uses an XML API to convert the CLI commands into XML, and the resulting XML output into a more readable CLI output. Junos automation communicates with Junos via this same XML API. It thereby offers a powerful and comprehensive toolset for interacting with and directing the Junos processes.

Sample Pages

Download Book

Day One books are a free download for our J-Net members*. If you’re not a J-Net member, create a user account now. It’s fast and there’s no commitment or spam. Once you’re a member you can come back and download any of the Day One books.

Download: J-Net Member
Download: Not a J-Net Member

* If you have an existing Juniper user account, you can use it to login to J-Net

About the Author(s)

Tim Fiola is a Network Engineer in Juniper Networks’ Professional Services organization. He is JNCIE-M #419 and has over six years experience working with Junos devices.

Author Q & A

What got you started on this book?

I had been working with Junos Automation for about 5 months and was somewhat proficient but it had not “clicked” yet. It was somewhat frustrating because I could physically see the data I’d be interested in on the screen in XML format, but could not always get to that data quickly in a script. Then I began thinking about the XML data as a map. Once I understood where I was in the map (context node) and how I got there, I had to understand how to navigate to my destination (the desired data). I started keeping notes on the different techniques to move up and down in the XML hierarchy. Those notes formed the basis for this book.

After reading this book, what will the reader learn or know?

The reader will understand how to find and isolate data that is important to them, and then use that data to automate an activity or make the automation itself “smarter”. For example, it may be very useful for a script to understand if it’s running on the master or backup RE. If the script knows this, it can take different actions based on that.

What do you recommend as the next item to read after this book?

I really think “Navigating the Junos XML Hierarchy” goes very well with Curtis Call’s “Applying Junos Operations Automation” Day One book. Curtis’ book is a great intro to the basic SLAX syntax. “Navigating the Junos XML Hierarchy” opens up the other side of the equation: finding and leveraging the specific data you are interested in. These two books I believe will give the reader a great start to creating great automation.

What are your plans for more?

Jamie Panagos and I are starting work on a book covering the design and implementation of an MPLS core and MPLS services on Juniper routers for the enterprise.

What’s your favorite bit/part in the book?

My favorite part in the book is sample 2.16, which shows output from “show interfaces terse | display xml” side-by-side with script output from the same command. In the script output, all the XML tags are hidden, so you see only the text nodes. The text nodes shown in the script line up with the text nodes from actual XML output. The blank spaces between the text nodes line up with the visible XML tags in the command output. When I first realized this, it really helped me to get over my uncertainty about working with XML. Looking at the XML output from the actual command provides a map to help the script writer understand the output from the script.

How hard was it write? Tell us how and when you wrote it?

I used a combination of some personal time and work time to write this book. My manager, Craig Sirkin, was very helpful in creating a schedule where I could work customer jobs and still have some work time to write this book. The writing itself was sometimes tough to do: I had so much inside my head that I wanted to get out, but it had to be written in a way that was clear to the reader. Sometimes I’d labor 15 minutes working out the phrasing of one sentence (thankfully that did not happen for every sentence).

Did you create a testbed for the book? How much set up did it take?

One of the great things about learning Junos automation (and writing this book), is that it does not require what I would consider to be a testbed. All it requires is a single Junos device. On that device, a script writer has the capability to unleash so many of the capabilities of Junos automation: custom commands, event scripts, commit scripts, scripts that can determine which RE they are on and act accordingly, etc.

Who tech reviewed your book?

Curtis Call tech reviewed my book. I could not have asked for a more patient and helpful tech editor.