Python Installation with Ansible, Netmiko, Paramiko, NAPALM

Windows:
Go To official Website (https://www.python.org/downloads/) & download python
Python 3.6.4 *** or Python 2.7.14. While installing tick option - Add Python 3.7 to PATH.

After, installing Python, you can install Jupyter Notebook to create notebook, to store python scripts and to run directly on network devices.
Installation of Jupyter can be done by PIP. PIP is already installed in Python. 
	To Upgrade PIP Command - pyhon -m pip install --upgrade pip
Command on Windows CMD: python -m pip install jupyter
To Launch Jupyter – Command on Windows CMD: jupyter notebook. It will open browser with IP - http://localhost:8888/tree

Linux:
apt-get update
apt-get install python -y
apt-get install build-essential libssl-dev libffi-dev -y
apt-get install python-pip -y
pip install cryptography
pip install --upgrade pip
pip install paramiko
pip install netmiko

GNS3 Appliance:
Network Automation - This Tool runs in GNS3VM as Docker container which has in build Ubuntu as base with python2 & Python 3 installed. Other installed tools are Netmiko, Pyntc, NAPALM and Ansible
	By Default – No IPv6 address is configured. To get Ipv4 address from DHCP address below are the steps
        Step1: edit file /etc/network/interfaces by command – nano /etc/network/interfaces
	Step2: uncomment last 2 lines – ‘auto eth0’ & ‘iface inet dhcp’ . Then save file.
	Step3: Stop & Start again ‘Network Automation’ and see ipv4 address by command - ifconfig

Ansible, Netmiko, Paramiko, NAPALM & PYNTC

Installation of these libraries can be done on Ubuntu/Windows client running Python.

GNS3 Appliance – Network Automation has pre-installed Paramiko, Netmiko & Ansible

Paramiko – Used for implementation of SSHv2 protocol providing basic server & client functionality

Netmiko is great Python network library for SSH and Telnet network access too many vendor network OS’s including Cisco IOS, Juniper JunOS and Arista EOS and many more.

Ansible: Ansible is an open source IT configuration management (CM) and automation platform, provided by Red Hat. It uses human-readable YAML templates so that users can program repetitive tasks to occur automatically, without learning an advanced language.

NAPALM (Network Automation and Programmability Abstraction Layer with Multivendor support) is a Python library that implements a set of functions to interact with different router vendor devices using a unified API.

NAPALM and pyntc make it easy to configure and interact with network devices using an API such as NETCONF or using SSH. Don’t reinvent the wheel. Use the tools available to you to quickly and easily automate your networks.

Install Paramiko

Paramiko: http://docs.paramiko.org/en/2.4/

apt-get update

apt-get install python -y

apt-get install build-essential libssl-dev libffi-dev -y

apt-get install python-pip –y

apt-get installpython-dev # You may need to install this as well

pip install cryptography

pip install paramiko

To verify is Paramiko is installed or not:

              >>> import paramiko

>>> print paramiko.__version__

Install Netmiko

Netmiko Wiki: https://github.com/ktbyers/netmiko

Standard Tutorial: https://pynet.twb-tech.com/blog/automation/netmiko.html

Supported Device Type: https://github.com/ktbyers/netmiko/blob/master/netmiko/ssh_dispatcher.py

apt-get update

apt-get install python -y

apt-get install build-essential libssl-dev libffi-dev -y

apt-get install python-pip –y

apt-get installpython-dev # You may need to install this as well

pip install cryptography

pip install netmiko

To verify is Netmiko is installed or not:

              >>> import netmiko

>>> print netmiko.__version__

Install Ansible

apt-get update

apt-get install software-properties-common

apt-add-repository ppa:ansible/ansible

press “enter” to confirm the addition of repository

apt-get update

apt-get install ansible

To verify is Ansible is installed or not:

              >>> import ansible

>>> print ansible.__version__

OR

              root@Server-1:~# ansible –version

Network Architect | CCIEx3 #29824 JNCIE #2197 VCIX-NV

Leave a Comment