Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All
     

    Related Documentation

     

    Installing Junos PyEZ

    Junos PyEZ is a Python library that enables you to manage and automate devices running Junos OS. You can install Junos PyEZ on a UNIX-like operating system or on Windows.

    Juniper Networks also provides a Junos PyEZ Docker image that enables you to run Junos PyEZ as a Docker container. The Docker container is a lightweight, self-contained system that bundles Junos PyEZ, its dependencies, and Python into a single portable container. The Docker image enables you to quickly run Junos PyEZ in interactive mode, as an executable package, or as a terminal on any platform that supports Docker.

    To manually install Junos PyEZ and its dependencies, see the following sections:

    To use the Junos PyEZ Docker image, see the following section:

    Installing Junos PyEZ Dependencies

    Before you install the Junos PyEZ package on the configuration management server, ensure that the server has the following software installed:

    • Python 2.6, Python 2.7, or Python 3.4
    • All dependencies for the given operating system, which are outlined in Table 1

    Note: Python 3.x is only supported in Junos PyEZ Release 2.0 and later releases.

    Table 1: Junos PyEZ Dependencies

    Operating System

    Dependencies

    CentOS

    • pip
    • python-devel
    • libxml2-devel
    • libxslt-devel
    • gcc
    • openssl
    • libffi-devel

    Debian

    • python-pip
    • python-dev
    • libxml2-dev
    • libxslt-dev
    • libssl-dev
    • libffi-dev

    Fedora

    • python-pip
    • python-devel (required for Python 2)
    • python3-devel (required for Python 3)
    • libxml2-devel
    • libxslt-devel
    • gcc
    • openssl
    • libffi-devel

    FreeBSD

    • py27-pip
    • libxml2
    • libxslt

    OSX

    Note: If Junos PyEZ does not successfully install using pip, try using easy_install to install the lxml library and then Junos PyEZ.

    • xcode
    • pip

    Ubuntu

    • python-pip
    • python-dev
    • libxml2-dev
    • libxslt-dev
    • libssl-dev
    • libffi-dev

    Windows

    • pip
    • pycrypto
    • ecdsa

    Installing the Junos PyEZ Package

    After you install the Junos PyEZ dependencies on the configuration management server, you can install the latest release of Junos PyEZ from the Python Package Index (PyPI). You can also download the latest version of the code from the Junos PyEZ GitHub repository. To install Junos PyEZ from GitHub, you must have Git installed on the configuration management server.

    To install the current release of Junos PyEZ from PyPI, execute the following command on the command line (use sudo pip where appropriate):

    [root@server]# pip install junos-eznc

    Note: The pip command name might vary depending on your operating system and version of Python. Before installing Junos PyEZ using pip, use the pip -V command to display the version, and verify that the pip command corresponds to the version of Python that you are using for Junos PyEZ on your system. If the version is not the same as the Python version used for Junos PyEZ, then try using the pip2 or pip3 commands instead of pip.

    Note: To upgrade an existing version of Junos PyEZ, include the -U or --upgrade option when executing the pip install command.

    To install Junos PyEZ from the GitHub project master branch, execute the following command on the command line (use sudo pip where appropriate):

    [root@server]# pip install git+https://github.com/Juniper/py-junos-eznc.git

    For additional information about installing Junos PyEZ and any required dependencies, see the INSTALL file for your specific operating system in the Junos PyEZ GitHub repository at https://github.com/Juniper/py-junos-eznc.

    Using the Junos PyEZ Docker Image

    Docker is a software container platform that is used to package and run an application and its dependencies in an isolated container. Juniper Networks provides a Junos PyEZ Dockerfile as well as Junos PyEZ Docker images, which are automatically built for every Junos PyEZ release. The prebuilt Docker images include Python 2.7.x.

    You can customize and use the Dockerfile to build your own Junos PyEZ Docker image, or you can use one of the prebuilt Docker images, which are stored on Docker Hub, to run Junos PyEZ as a Docker container. You can run the container in interactive mode, as an executable package, or as a terminal.

    To use a prebuilt Junos PyEZ Docker image on your configuration management server:

    1. Install Docker.

      See the Docker website at https://www.docker.com for instructions on installing and configuring Docker on your specific operating system.

    2. Download the juniper/pyez Docker image from Docker Hub.
      • To download the latest image, issue the following command:

        user@host:~$ docker pull juniper/pyez

        Note: The latest Junos PyEZ Docker image is built using the most recently committed code in the Junos PyEZ source repository, which is under active development and might not be stable.

      • To download a specific image, append the appropriate release tag to the image name, for example, 2.1.2.

        user@host:~$ docker pull juniper/pyez:tag
    3. Move to the local directory that contains your scripts.

      When you run the Docker container, the local scripts are mounted to /scripts in the container.

    4. Run the container.

      For instructions on running the container, see the official usage examples at DOCKER-EXAMPLES.md.

     

    Related Documentation

     

    Modified: 2017-08-29