osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SSH/Telnet program to Router/switch


In article <d343f9af-54f2-4709-9a99-1ad5708c1f34 at googlegroups.com>,
 Sujith S <sujiths80 at gmail.com> wrote:

> Hi,
> 
> I am new to programming and python. I am looking for a python script to do 
> ssh/telnet to a network equipment ? I know tcl/perl does this using 
> expect/send. 
> 
> Do we have expect available in python as well or need to use some other 
> method ?

You want two libraries.

First, the low-level paramiko (http://www.lag.net/paramiko/) which 
handles all the basic ssh connection stuff.

Next, fabric (http://docs.fabfile.org/en/1.8/), which layers a very easy 
to use application layer on top of paramiko.  Fabric is most commonly 
used in conjunction with a near command-line driver tool called fab, but 
you can also work directly with the library layer 
(http://docs.fabfile.org/en/1.8/usage/library.html).

Fabric rocks.  Don't waste your time with anything else (but see the 
next paragraph).

As far as I know, fabric only works with ssh.  If you are forced to use 
telnet to talk to legacy equipment, that's another problem.