Running commands on cisco routers using python

James Harris james.harris.1 at googlemail.com
Wed May 21 08:33:56 EDT 2008


On 19 May, 16:18, SPJ <mail2... at yahoo.com> wrote:
> Is it possible to run specific commands on cisco router using Python?
> I have to run command "show access-list" on few hundred cisco routers and get the dump into a file. Please let me know if it is feasible and the best way to achieve this.

Can you access the routers with telnet or do you need to use ssh? I've
written loads of Python to access Cisco routers using a wrapper around
the standard telnetlib. Telnetlib supplies an excellent expect
function which makes this work.

It is telnet, though. If I had to use ssh I would probably add it
under the same wrapper so that higher level code could work unchanged.
There may be a way to route the telnet interractions through openssh
or similar externally but I haven't tried that.



More information about the Python-list mailing list