Revisiting Python and Netmiko

This weekend I am revisiting python and netmiko. Netmiko is basically a phython library that uses ssh connecting to devices to screen scrape, run show and execute commands (in my case) on Cisco routers and switches. I made a blog about writing a simple 881 config template using Python.

Back then I was using a virtualized ubuntu desktop machine, this time I have managed to score myself a dedicated laptop with fedora installed. Let me remind you I am a beginner-half-ass novice linux user so be forgiving if I might have the wrong way to doing things. You can always comment below and give your thoughts.

The install:

As mentioned I am using a HP ProBook 4560s installed with Fedora 21. Before anything else I had to run an update on it.

from the root:

yum update

from usermode:

pip install update –user

You can then go ahead and install python if it is not yet available on your linux box.

yum install python

To find out the version, just type python. Not only will run phython but one of the first things you’ll see would be the version. On my machine, I am using python 2.7.8. Yes, I am aware of version 3 but I guess I am more comfortable with this one for now.

Now its time to install netmiko.

root:

yum install netmiko

usermode:

pip install netmiko –user

You would know if your netmiko is properly installed if you run python and you issue the command:

Python 2.7.8 (default, Nov 10 2014, 08:19:18)
[GCC 4.9.2 20141101 (Red Hat 4.9.2-1)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> from netmiko import ConnectHandler
>>>

and it doesn’t bark back at you with an error message.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s