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

There’s more

PyEZ actually includes a more direct way of invoking command line output, using the cli() method. However, the cli() method comes with a stark warning about only being used for debugging and development and emits a Python warning, which is usually enough to put you off using this technique in production applications.

>>> dev.cli("show interfaces em0")/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/jnpr/junos/device.py:598: RuntimeWarning: CLI command is for debug use only!Instead of:cli('show interfaces em0')Use:rpc.get_interface_information(interface_name='em0')  warnings.warn(warning_string, RuntimeWarning)'\nPhysical interface: em0, Enabled, Physical link is Up\n Interface ...

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