i've been using script unix server , it's working perfectly. when use same script( minor command changes) connect hp procurve switches , script crashes error. part of script below:
ssh = paramiko.sshclient() ssh.set_missing_host_key_policy(paramiko.autoaddpolicy()) ssh.connect(address, username=userna, password=passwd) stdin,stdout,stderr= ssh.exec_command("show ver") line in stdout: print '... ' + line.strip('\n') ssh.close() this gives error
traceback (most recent call last): file "c:/users/kucar/desktop/my_python/switchmodel", line 34, in <module> stdin,stdout,stderr= ssh.exec_command("show ver") file "c:\python27\lib\site-packages\paramiko\client.py", line 379, in exec_command chan.exec_command(command) file "c:\python27\lib\site-packages\paramiko\channel.py", line 218, in exec_command self._wait_for_event() file "c:\python27\lib\site-packages\paramiko\channel.py", line 1122, in _wait_for_event raise e sshexception: channel closed. i've found similar complaints in web seems solution not provided @ all. switch open ssh , works fine putty. appreciate if give ideas me. cannot "show ver" command manually 100 switches.
as @dobbo mentioned above have invoke_shell() on channel can execute multiple commands. hp procurve has ansi escape codes in output have strip out. finally, hp procurve throws "press key continue" message have past @ least on devices.
i have hp procurve handler in library https://github.com/ktbyers/netmiko
set device_type "hp_procurve".
exscript has sort of procurve handler though haven't dug enough work.
Comments
Post a Comment