How it works…

In step 1, we pull the necessary Python standard library and PyEZ framework definitions into the global namespace so that we can make use of them. Steps 2 through 5 are all very similar to what we’ve seen in previous recipes: setting error handlers, parsing command- line arguments, and opening the PyEZ Device() constructor respectively.

But of particular note, though, in step 1 is the reference to jnpr.junos.op.inventory.ModuleTable, which is, PyEZ-included class that represents a JUNOS device hardware module and is instantiated through a Python factory loader shim from a piece of YAML definition.

YAML is a markup language that is able to define hierarchical datastructures, in a similar way to JSON and XML. It is able to represent ...

Get JUNOS Automation Cookbook 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.