Install Junos Snapshot Administrator in Python
SUMMARY Install Junos Snapshot Administrator in Python (JSNAPy) on a remote network management system.
You install Junos Snapshot Administrator in Python (JSNAPy) on a remote network management system. Prior to installing JSNAPy, ensure that the server is running an OS that supports Python 3.8 or later. This includes, but is not limited to:
-
Linux (CentOS, Debian, Fedora, FreeBSD, and Ubuntu)
-
macOS
Windows does not support installing JSNAPy.
To install JSNAPy, first install the prerequisite software and then install JSNAPy as described in the following sections:
To upgrade an existing JSNAPy installation, see the following section:
Install Prerequisite Software
Before you install JSNAPy, ensure that the server has the following software installed:
-
Python 3.8 or later
-
All prerequisite software for the given operating system, which is outlined in Table 1
OS |
Dependencies |
---|---|
CentOS |
|
Debian |
|
Fedora |
|
FreeBSD |
|
OSX |
|
Ubuntu |
|
Install the JSNAPy Library
You can install JSNAPy under the system-installed Python or in a Python virtual
environment. You can use the Python package manager, pip
, to
install JSNAPy from the following locations:
-
Python Package Index (PyPI) at https://pypi.org/
-
Juniper/jsnapy GitHub repository
The following sections outline the JSNAPy installation tasks and results:
- Install JSNAPy Under the System-Installed Python
- Install JSNAPy in a Python Virtual Environment
- JSNAPy Directories and Files
Install JSNAPy Under the System-Installed Python
To install JSNAPy under the system-installed Python on the remote server:
Install JSNAPy using
pip
.To install the latest JSNAPy release from PyPI:
On Ubuntu, include the following options:
user@server:~$ sudo pip3 install jsnapy --no-binary :all: --no-cache-dir
Otherwise, use the following command:
user@server:~$ sudo pip3 install jsnapy
To install the latest JSNAPy development code from GitHub:
On Ubuntu, include the following options:
user@server:~$ sudo pip3 install git+https://github.com/Juniper/jsnapy.git --no-binary :all: --no-cache-dir
Otherwise, use the following command.
user@server:~$ sudo pip3 install git+https://github.com/Juniper/jsnapy.git
Note:The latest code in the GitHub source repository is under active development and might not be stable.
Create the JSNAPy snapshots and testfiles directories. Specify the paths to the default directory locations in the user's home directory.
user@server:~$ mkdir -p ~/jsnapy/snapshots user@server:~$ mkdir -p ~/jsnapy/testfiles
Note:Alternatively, you can update the JSNAPy configuration file (jsnapy.cfg) to specify alternate locations for the snapshots and testfiles directories.
Install JSNAPy in a Python Virtual Environment
To install JSNAPy in an existing Python virtual environment:
Navigate to your virtual environment and activate it. For example:
user@server:~$ cd jsnapy-venv user@server:~/jsnapy-venv$ source .venv/bin/activate (.venv) user@server:~/jsnapy-venv$
Install JSNAPy using
pip
.To install the latest JSNAPy release from PyPI:
On Ubuntu and macOS, include the following options:
(.venv) user@server:~/jsnapy-venv$ pip install jsnapy --no-binary :all: --no-cache-dir
Otherwise, use the following command:
(.venv) user@server:~/jsnapy-venv$ pip install jsnapy
To install the latest JSNAPy development code from GitHub:
On Ubuntu and macOS, include the following options:
(.venv) user@server:~/jsnapy-venv$ pip install git+https://github.com/Juniper/jsnapy.git --no-binary :all: --no-cache-dir
Otherwise, use the following command:
(.venv) user@server:~/jsnapy-venv$ pip install git+https://github.com/Juniper/jsnapy.git
Note:The latest code in the GitHub source repository is under active development and might not be stable.
JSNAPy Directories and Files
JSNAPy uses the directories and files listed in Table 2.
Directory or File Name |
Purpose |
---|---|
jsnapy.cfg |
File that specifies the default paths for configuration files, snapshot files, and test files. |
logging.yml |
File that specifies the settings for logging JSNAPy events and messages. |
snapshots/ |
Default directory for the storage of JSNAPy snapshot files. The snapshot filenames include the device name and the test. |
testfiles/ |
Default directory for JSNAPy test files. |
Table 3 outlines the default locations for the JSNAPy files and directories for the given environment. The table also indicates whether the JSNAPy installer automatically generates the file or directory during the installation.
Files |
Environment |
Default Location |
JSNAPY Creates |
---|---|---|---|
jsnapy.cfg |
Non-virtual |
/etc/jsnapy/ |
Yes |
Virtual |
/etc/jsnapy/ directory inside the virtual environment |
Yes |
|
logging.yml |
Non-virtual |
/var/log/jsnapy/ |
Yes |
Virtual |
/var/log/jsnapy/ directory inside the virtual environment |
Yes |
|
Configuration and test files |
Non-virtual |
~/jsnapy/testfiles |
No |
Virtual |
/etc/jsnapy/testfiles directory inside the virtual environment |
Yes |
|
Snapshots |
Non-virtual |
~/jsnapy/snapshots |
No |
Virtual |
/etc/jsnapy/snapshots directory inside the virtual environment |
Yes |
Upgrade JSNAPy
Juniper Networks periodically updates the JSNAPy code in GitHub for improvements
and bug fixes. You can upgrade your JSNAPy installation at any time to the
latest release posted on https://pypi.org/ or to the latest development code in the
Juniper/jsnapy
GitHub repository. You can use the
pip
command with the upgrade flag (-U
or
--upgrade
) to update the existing installation as described
in the following sections:
Upgrade JSNAPy Under the System-Installed Python
To update JSNAPy after you have installed it under the system-installed Python:
-
To update JSNAPy to the latest released code in PyPI, use the following command:
user@server:~$ sudo pip3 install -U jsnapy
-
To update jsnapy to the latest development code in GitHub, use the following command:
user@server:~$ sudo pip3 install -U git+https://github.com/Juniper/jsnapy.git
Note:The latest code in the GitHub source repository is under active development and might not be stable.
Upgrade JSNAPy in a Python Virtual Environment
To update JSNAPy after you have installed it in a Python virtual environment:
-
To update JSNAPy to the latest released code in PyPI, use the following command:
(.venv) user@server:~/jsnapy-venv$ pip install -U jsnapy
-
To update JSNAPy to the latest development code in GitHub, use the following command:
(.venv) user@server:~/jsnapy-venv$ pip install -U git+https://github.com/Juniper/jsnapy.git
Note:The latest code in the GitHub source repository is under active development and might not be stable.