[Tutor] SSH session problems with network devices
I have Python code that opens a telnet session with a network device and performs a multitude of tasks. Now, I am trying to establish and maintain an SSH connection as an alternative to telent. My research has found that the SSH implementation some network device manufacturers use is not consistent and the problems I'm having are common. I'm hoping to find someone who has found a solution. I am using Paramiko, but I am not limited to that. I am also exploring Appgate MindTerm http://www.appgate.com/index/products/mindterm/. My Paramiko code works correctly when connecting with a Linux system. But when I connect with a router, the connection is dropped immediately after a command is exectued, so it isn't possible to send a sequence of interrelated commands. For example, I want to change the screen paging value so that complete results from the next command will stream back without stopping for --MORE--. Or I need to change the user level and enter a password followed by a series of commands. I have reviewed relevant postings from on the Paramiko list, but there are no clear solutions. http://www.lag.net/pipermail/paramiko/2010-June/001322.html http://www.lag.net/pipermail/paramiko/2010-June/001320.html http://www.lag.net/pipermail/paramiko/2010-March/001284.html I have tried three methods, unsuccessfully, for establishing and maintaining an SSH connection. My test code is at http://pastebin.ca/1918235. I would appreciate any help. I'm open to a non-Paramiko solution, but it has to plug-and-play with the Python utility code I already have. And I hope to keep it simple. Thank you, David Heiser ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] SSH session problems with network devices
On Fri, Aug 27, 2010 at 2:54 AM, davidheise...@gmail.com wrote: My Paramiko code works correctly when connecting with a Linux system. But when I connect with a router, the connection is dropped immediately after a command is exectued, so it isn't possible to send a sequence of interrelated commands. What Router is this ? What OS does it run ? I may have some experience with this as I often ssh into various networking devices including Linux servers and systems, etc... cheers James -- -- James Mills -- -- Problems are solved by method ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] SSH session problems with network devices
On Fri, Aug 27, 2010 at 8:42 AM, davidheise...@gmail.com wrote: I'm running tests on - Cisco IOS Software, s72033_rp Software (s72033_rp-ADVIPSERVICESK9_WAN-M), Version 12.2 It's running SSHv2.0 My solution should be portable to other vendor/models. Can you normally ssh into your Cisco routers and be presented with a shell of some kind ? cheers James PS: Please post to the list. -- -- James Mills -- -- Problems are solved by method ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] SSH session problems with network devices
On Fri, 27 Aug 2010 02:54:27 am davidheise...@gmail.com wrote: I have Python code that opens a telnet session with a network device and performs a multitude of tasks. Now, I am trying to establish and maintain an SSH connection as an alternative to telent. My research has found that the SSH implementation some network device manufacturers use is not consistent and the problems I'm having are common. I'm hoping to find someone who has found a solution. Hi David, you may be better off on a more senior discussion list than this. It's not really a beginners question, and you may benefit from having a lit more eyes on your question :) Have you tried python-l...@python.org or its newsgroup mirror comp.lang.python ? http://mail.python.org/mailman/listinfo/python-list -- Steven D'Aprano ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] SSH session problems with network devices
On Fri, Aug 27, 2010 at 9:13 AM, davidheise...@gmail.com wrote: Yes. No problem. The point is that I have Python programs that normally access these devices by telnet to complex tasks. I have to find a way to use SSH to replace the telnet in my code. I actually have no experience with Cisco devices, but the question that remains to be seen really is; Why are your Cisco devices terminating the SSH connection after the first command ? This actually might be a terminal or some kind of configuration issue (if you can normally ssh into your Cisco devices and get a prompt/terminal). Ssh'ing and executing remote commands might be interpreted differently by the Cisco ssh/shell/etc. It might be worth your while looking into this as it'll have nothing at all to do with Python or Paramiko.. cheers James -- -- James Mills -- -- Problems are solved by method ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor