Automation

 View Only
last person joined: 6 days ago 

Ask questions and share experiences about Apstra, Paragon, and all things network automation.
  • 1.  Python interpreter on MX (or: development environment for onbox scripts)

    Posted 8 days ago

    Greetings:

    I see the Python interpreter is not available for interactive use on an MX router:

    MX304-LAB-1:~ # /usr/libdata/cscript/import/python
    /usr/libdata/cscript/import/python: Authentication error.

    Overview of Junos Automation Enhancements on Devices Running Junos OS with Enhanced Automation explains that Veriexec is disabled.  There is a version of code " Junos Automation Enhancements " targeted to development environments with Veriexec disabled. 

    It looks like this code is only available for QFX.  Any options for MX?

    Or, to put another way....how do you develop on-box scripts for MX without access to the Python interpreter?  Seems cumbersome to write and debug op and commit scripts without it.

    Thanks



  • 2.  RE: Python interpreter on MX (or: development environment for onbox scripts)

    Posted 6 days ago

    Hi Agallo, 

    Would using Juniper PyEZ fit your needs?

    • https://www.juniper.net/documentation/us/en/software/junos-pyez/junos-pyez-developer/topics/concept/junos-pyez-overview.html



    ------------------------------
    Ethan Jackson / ETH4N3T

    Disclaimer:
    I am a Juniper employee, but all opinions are my own.
    ------------------------------



  • 3.  RE: Python interpreter on MX (or: development environment for onbox scripts)

    Posted 6 days ago

    Thanks, Ethan- 

    I have used PyEZ for some off-box scripting, but was looking for something a little easier to develop, say, a commit script, which would be easier if it was done directly on the MX.

    Thanks




  • 4.  RE: Python interpreter on MX (or: development environment for onbox scripts)

    Posted 6 days ago

    Hi Agallo, 

    Are you able to create a .py file in:

    % cd /var/db/scripts/commit/
    % ls
    services                        services_evpn_commit_script.py  test.py

    It looks like these files can be created within the commit script shell, so this may be somewhere to look into further?



    ------------------------------
    Ethan Jackson / ETH4N3T

    Disclaimer:
    I am a Juniper employee, but all opinions are my own.
    ------------------------------



  • 5.  RE: Python interpreter on MX (or: development environment for onbox scripts)

    Posted yesterday

    I can create files in `/var/db/scripts/`

    I have both op and commit scripts in SLAX and have used some example python scripts as well. 

    I was looking for a way to use the interpreter because that seemed easier than trying to write and debug a script by invoking it via either `op` or `commit`



    ------------------------------
    Andrew Gallo
    ------------------------------