Which version of Python is supported on Junos OS?
From which Junos OS version is Python automation supported?
- Junos OS Release 16.1R1 for MX Series and PTX Series devices
- Junos OS Release 16.2R2 for QFX Series devices
What configuration needs to be enabled before running Python scripts on the box?
[edit system scripts language python] needs to be enabled in the Junos OS configuration.
What is Python on-box scripting and how does it differ from SLAX on-box scripting?
Python on-box scripting is being implemented to provide an alternative to SLAX for operation, event, and commit scripts. SLAX will continue to be in Junos OS going forward and will be supported. Other than the large community of Python support, Python on-box scripting will allow, eventually, loading external modules or libraries to extend the capabilities of the scripts beyond what SLAX is currently capable of.
Which platforms will eventually support Python automation scripts?
Physical: T Series, MX Series, EX Series, PTX Series, and QFX Series devices
Virtual: vMX Series and vQFX Series devices
How do I enable and execute a Python commit script?
How do I debug a Python operation script?
How do I enable and execute a Python operation script?
How do I enable and execute a Python event script?
How do I work with third-party packages on Junos OS?
Third-party import modules can be copied to the /opt/lib/python2.7/site-packages path.
From user scripts or applications, third-party modules can be called from import.
#!/usr/bin/env python from app-module import foo def main(): foo.goo() if __name__ == '__main__': main()
Using the identifier or submodule foo, respective module contents (functions, classes, etc.) can be accessed.
Going forward, for installing third-party modules, the cli>request system software add app-module*.tgz approach can be used from the CLI client.