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 it works…

In steps 1 and 2, we simply initialize the Python environment and connect to the remote JUNOS node.

In the subsequent steps, we use the display_xml_rpc() method on the Device object in order to make an RPC call to the JUNOS device which executes the equivalent of the | display xml rpc command modifier in order to determine the XML RPC associated with the command line.

Because Juniper haven’t implemented absolutely every aspect of the command line functionality into the XML RPI API, sometimes it isn’t possible to translate the command line into an RPC call, as seen in step 6.

But when an XML RPC call is available, it is returned within an XML structured document and the lxml.etree.dump() function shows the raw format. Once learned, ...

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