napalm-automation-community / napalm-dellos10

NAPALM Driver for Dell EMC OS10 Enterprise
http://dellos10-napalm.readthedocs.io/en/latest/
Apache License 2.0
10 stars 11 forks source link

Timeout/SSH connection drop when generating rollback_config.txt #24

Open tmshlvck opened 4 years ago

tmshlvck commented 4 years ago

I am trying to merge & commit configuration changes over napalm-dellos10 module. I am getting the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/paramiko-2.7.1-py3.8.egg/paramiko/channel.py", line 699, in recv
    out = self.in_buffer.read(nbytes, self.timeout)
  File "/usr/local/lib/python3.8/dist-packages/paramiko-2.7.1-py3.8.egg/paramiko/buffered_pipe.py", line 164, in read
    raise PipeTimeout()
paramiko.buffered_pipe.PipeTimeout

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/netmiko-3.1.1-py3.8.egg/netmiko/base_connection.py", line 550, in _read_channel_expect
    new_data = self.remote_conn.recv(MAX_BUFFER)
  File "/usr/local/lib/python3.8/dist-packages/paramiko-2.7.1-py3.8.egg/paramiko/channel.py", line 701, in recv
    raise socket.timeout()
socket.timeout

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/batchbox.py", line 4, in <module>
    __import__('pkg_resources').run_script('nak==1.0', 'batchbox.py')
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 667, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1470, in run_script
    exec(script_code, namespace, namespace)
  File "/usr/local/lib/python3.8/dist-packages/nak-1.0-py3.8.egg/EGG-INFO/scripts/batchbox.py", line 118, in <module>
  File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/nak-1.0-py3.8.egg/EGG-INFO/scripts/batchbox.py", line 106, in main
  File "/usr/local/lib/python3.8/dist-packages/nak-1.0-py3.8.egg/EGG-INFO/scripts/batchbox.py", line 46, in apply_yamls
  File "/usr/local/lib/python3.8/dist-packages/nak-1.0-py3.8.egg/nak/box.py", line 92, in update_config
  File "/usr/local/lib/python3.8/dist-packages/nak-1.0-py3.8.egg/nak/box.py", line 75, in _apply_text
  File "/usr/local/lib/python3.8/dist-packages/napalm_dellos10-1.0.7-py3.8.egg/napalm_dellos10/dellos10.py", line 394, in commit_config
  File "/usr/local/lib/python3.8/dist-packages/napalm_dellos10-1.0.7-py3.8.egg/napalm_dellos10/dellos10.py", line 481, in _gen_rollback_cfg
  File "/usr/local/lib/python3.8/dist-packages/netmiko-3.1.1-py3.8.egg/netmiko/base_connection.py", line 1471, in send_command_expect
    return self.send_command(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/netmiko-3.1.1-py3.8.egg/netmiko/utilities.py", line 347, in wrapper_decorator
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/netmiko-3.1.1-py3.8.egg/netmiko/base_connection.py", line 1390, in send_command
    new_data = self.read_until_pattern(pattern=re.escape(cmd))
  File "/usr/local/lib/python3.8/dist-packages/netmiko-3.1.1-py3.8.egg/netmiko/base_connection.py", line 627, in read_until_pattern
    return self._read_channel_expect(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/netmiko-3.1.1-py3.8.egg/netmiko/base_connection.py", line 560, in _read_channel_expect
    raise NetmikoTimeoutException(
netmiko.ssh_exception.NetmikoTimeoutException: Timed-out reading channel, data not available.

I got this in the end of netmiko debug log:

DEBUG:netmiko:read_channel: 
DEBUG:netmiko:write_channel: b'copy running-config home://rollback_config.txt\n'
DEBUG:netmiko:Pattern is: copy\ running\-config\ home://rollback_config\.txt
DEBUG:netmiko:_read_channel_expect read_data: cop
DEBUG:netmiko:_read_channel_expect read_data: y running-configuration home://rollback_config.txt

DEBUG:netmiko:_read_channel_expect read_data: itchy# 
DEBUG:paramiko.transport:Dropping user packet because connection is dead.

I am testing this with

itchy# show version
Dell EMC Networking OS10 Enterprise
Copyright (c) 1999-2020 by Dell Inc. All Rights Reserved.
OS Version: 10.5.1.2
Build Version: 10.5.1.2.167
Build Time: 2020-05-18T17:49:15+0000
System Type: S5248F-ON
Architecture: x86_64
Up Time: 6 weeks 5 days 19:06:07

I hacked this library and disabled call of self._gen_rollback_cfg() in commit_config() and it seems to be working fine.

And I have these versions of *miko libraries:

th@taz:~/napalm-dellos10$ pip3 list | grep miko
netmiko                3.1.1      
paramiko               2.7.1 
ktbyers commented 4 years ago

Does this Dell OS10 have a way to set the terminal width? If so, do you know what the command for that is?

Regards, Kirk

tmshlvck commented 4 years ago

No, I tried google and in-CLI help for obvious beginning, but no luck so far:

itchy# terminal ? length Set terminal length monitor Enable logging

... that was it.