We’re going to build a Python script, pyez-show-route.py, which will use the PyEZ framework to login to a JUNOS router and query the routing table for an internet destination, extract the returned data, and print it nicely on the user’s console. The user will be able to invoke our script in the following way:
pyez-show-route.py [-h] [-p port] [-u username] [-t target] [-R instance] destination
The following table provides the different arguments and their description:
|-p||TCP port to contact NETCONF-over-SSH|
|-R||Routing instance on the JUNOS router|
The steps for the recipe are as follows:
- Start by defining the interpreter as usual and defining the Python modules ...