Python & Junos on Windows

If you haven't already checked out Jeremy Schulman's blogs about how to get started using Python with JUNOS (NETCONF), then I suggest that you head here and check it out!

I'm here to help get all those who choose to use Windows as their development environment get started so that you will be able to do the same things as if you setup your development environment in a VM...or on a *nix box.

First off, you'll need to install Python on your Windows box. There's a great resource to get you started (and a great Python reference in general) that can be found here. Please make sure that you do ALL of the steps found there, which includes installing/setting up the Python Setuptools and PIP.

Once you have completed your basic Python setup, you'll need to install a couple of additional modules before you will be able to install the ones from Juniper. You will need to download and install the following:

For the following modules, unzip them and extract the bin, include, and lib directories in the root of your Python installation (should be something like C:\Python27)

libxml2 (  
libxslt (  
iconv (  
zlib (  

For lxml, run the executable like you did for PyCrypto for installation.


Make sure that you download the ones that match your Python version (2.7) and architecture (32 vs. 64)!

There are a lot of other good, useful binary modules for Windows on Christoph Gohlke's repo.

Once all of these modules have been installed, we'll install the following one via the command-line. Open up a command (or Powershell) prompt as Administrator, and run the following command:

pip install paramiko

Now it's time to download the Juniper modules, and install them. For the ncclient module, you can download it from their Github repo. Once you have it downloaded, unzip the files into a directory and run from the command-line:

python install

Once this module has finished installing, you can run the following command to install the other one that you'll need:

pip install junos-eznc

Now you should be ready to test! Place the following commands in a file, and then run it:

from pprint import pprint  
from jnpr.junos import Device

dev = Device(host='somehost', user='username', password='password')  

You should see something similar to the following once you run the program:

{'2RE': False,
 'RE0': {'last_reboot_reason': 'Router rebooted after a normal shutdown.',
         'model': 'RE-SRX240H2',
         'status': 'OK',
         'up_time': '17 days, 1 hour, 34 minutes, 27 seconds'},
 'fqdn': '',
 'hostname': 'firewall',
 'ifd_style': 'CLASSIC',
 'model': 'SRX240H2',
 'personality': 'SRX_BRANCH',
 'serialnumber': 'AAAAAA1112',
 'switch_style': 'VLAN',
 'version': '12.1X44-D20.3',
 'version_info': junos.versino_info(major=(12, 1), type=X, minor=(44, 'D', 20), build=3)}

Now that you're up and running, please make sure you check out Jeremy's blog(s) regarding using Python with JUNOS.