Making raw CLI commands from PyEZ
In this recipe, we’ll use the PyEZ framework to execute an RPC on our JUNOS device that simply executes a raw command line string. Even though the unstructured, human-focused, command line text output is perilous to work with for automation applications, sometimes there are situations where you just need the output to a specific command.
We’ll look at ways that PyEZ can help with that.
Getting ready
In order to complete this recipe, you’ll need Python 2.7 in a Linux or BSD-based development environment of your choice. You should have already completed:
How to do it…
We’re going to write a new Python script, pyez-command-line.py
, that will take an argument a Junos device name and a command line to execute on the device:
pyez-show-route.py [-h] [-p port] [-u username] target “command”
The following table gives the argument...