This is a custom fork of the original SSH Kernel project, modified specifically to interface with Juniper network devices. The kernel provides enhanced support for Juniper CLI commands, command completion, and configuration modes.
SSH Kernel is a Jupyter kernel specialized in executing commands remotely with paramiko SSH client.
- Python3.5+
- IPython 7.0+
Host OS (running notebook server):
- Ubuntu 18.04+
- Windows 10 WSL (Ubuntu 18.04+)
Target Devices:
- Juniper network devices with SSH access
- Standard Linux/Unix systems (Ubuntu 16.04+, CentOS 6+)
Since this is a custom fork, you'll need to install it from source:
- Clone the repository:
git clone <repository_url>
cd sshkernel- Install in development mode with dependencies:
pip install -e .- Install the kernel specification:
python -m sshkernel install [--user|--sys-prefix]
# Use --user for user-specific installation (recommended)
# Use --sys-prefix for environment/virtualenv-specific installationVerify that sshkernel is installed correctly by listing available Jupyter kernel specs:
$ jupyter kernelspec list
Available kernels:
python3 /tmp/env/share/jupyter/kernels/python3
ssh /tmp/env/share/jupyter/kernels/ssh # <--
(Path differs depends on environment)To uninstall:
jupyter kernelspec remove ssh
pip uninstall sshkernelThe latest version of this library is mainly developed with Python 3.7.3 installed with pyenv.
Basic examples of using SSH Kernel with Juniper devices:
SSH Kernel obtains configuration data from ~/.ssh/config file to connect to devices.
Possible keywords are as follows:
- HostName
- User
- Port
- IdentityFile
- ForwardAgent
- As private key files in
~/.ssh/are discoverable, you do not necessarily specifyIdentityFile - If you use a ed25519 key, please generate with or convert into old PEM format
- e.g.
ssh-keygen -m PEM -t ed25519 ... - This is because
paramikolibrary doesn't support latest format "RFC4716"
- e.g.
Example for Juniper device:
[~/.ssh/config]
Host juniper-switch
HostName switch.example.com
User admin
Port 22
IdentityFile ~/.ssh/id_rsa_juniper
Host *
User admin
Minimal example:
[~/.ssh/config]
Host router
HostName 192.0.2.1
This fork includes several enhancements for working with Juniper devices:
- Support for Juniper CLI command completion
- Handling of configuration modes (
configure,edit, etc.) - Support for both operational and configuration commands
- Proper handling of Juniper-style prompts and output formatting
- As Jupyter Notebook has limitation to handle
stdin, you may need to change some device configuration and commands to avoid interactive input.- e.g. use publickey-authentication instead of password
- Some shell variables are different from normal interactive shell
- e.g.
$?,$$
- e.g.
This software is released under the terms of the Modified BSD License.
