ktbyers / netmiko

Multi-vendor library to simplify Paramiko SSH connections to network devices
MIT License
3.59k stars 1.31k forks source link

NetMikoTimeoutException when saving config on Comware 5 switch #248

Closed bkeifer closed 8 years ago

bkeifer commented 8 years ago

I'm trying to save the config on an HP A5500-24G-SFP EI (Comware 5). It takes between 40-45 seconds for the command 'save safely force' to execute. I get the following from netmiko:

Traceback (most recent call last): File "./net.py", line 67, in <module> output = net_connect.send_config_set(commands) File "/home/btk0/.virtualenvs/miko/local/lib/python2.7/site-packages/netmiko/base_connection.py", line 642, in send_config_set output += self.exit_config_mode() File "/home/btk0/.virtualenvs/miko/local/lib/python2.7/site-packages/netmiko/hp/hp_comware_ssh.py", line 25, in exit_config_mode return super(HPComwareSSH, self).exit_config_mode(exit_config=exit_config) File "/home/btk0/.virtualenvs/miko/local/lib/python2.7/site-packages/netmiko/ssh_connection.py", line 48, in exit_config_mode pattern=pattern) File "/home/btk0/.virtualenvs/miko/local/lib/python2.7/site-packages/netmiko/base_connection.py", line 581, in exit_config_mode if self.check_config_mode(): File "/home/btk0/.virtualenvs/miko/local/lib/python2.7/site-packages/netmiko/hp/hp_comware_ssh.py", line 29, in check_config_mode return super(HPComwareSSH, self).check_config_mode(check_string=check_string) File "/home/btk0/.virtualenvs/miko/local/lib/python2.7/site-packages/netmiko/ssh_connection.py", line 30, in check_config_mode pattern=pattern) File "/home/btk0/.virtualenvs/miko/local/lib/python2.7/site-packages/netmiko/base_connection.py", line 565, in check_config_mode output = self.read_until_pattern(pattern=pattern) File "/home/btk0/.virtualenvs/miko/local/lib/python2.7/site-packages/netmiko/base_connection.py", line 400, in read_until_pattern raise NetMikoTimeoutException("Timed-out reading channel, data not available.") netmiko.ssh_exception.NetMikoTimeoutException: Timed-out reading channel, data not available.

Is there any way to have it wait longer for a command to finish?

Thanks for all your hard work!

ktbyers commented 8 years ago

@bkeifer It looks like you are executing the send_config_set() command? Does this need to be a 'config' command on Comware5 or could you execute it using the send_command_expect() method?

send_config_set() has a delay_factor and a max_loops argument (which default to .1 and 150 respectively). You might try increasing these in your call to send_command_set.

bkeifer commented 8 years ago

It doesn't need to be a config command, and switching to send_command_expect with increased delay_factor and max_loops did the trick. Thank you!