SROS - Commit triggers NetmikoTimeoutException
See original GitHub issueI’m seeing an issue where I use the Nokia SROS driver to connect to a VM on SROS 16.0R7 in MD-CLI mode. When I call the commit() method after send_config_set() - the configuration on the router commits, but netmiko raises a timeout: netmiko.ssh_exception.NetmikoTimeoutException: Timed-out reading channel, data not available.
Python 3.6.7 netmiko==3.1.0 TiMOS-C-16.0.R7-1 cpm/x86_64 Nokia 7750 SR configuration-mode model-driven
@wisotzky - have you seen anything similar working on #1442 ?
Example:
>>> from netmiko import ConnectHandler
>>> d = {
... 'device_type': 'nokia_sros',
... 'ip': 'router1',
... 'username': username,
... 'password': password,
... 'port': 22,
... 'verbose': False
... }
>>> nc = ConnectHandler(**d)
>>> nc.send_config_set(["configure port 1/1/c10 description test"])
'edit-config exclusive\nINFO: CLI #2060: Entering exclusive configuration mode\nINFO: CLI #2061: Uncommitted changes are discarded on configuration mode exit\n\n(ex)[]\nA:user@router1# configure port 1/1/c10 description test\n\n*(ex)[]\nA:user@router1# '
>>> nc.commit()
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/paramiko/channel.py", line 699, in recv
out = self.in_buffer.read(nbytes, self.timeout)
File "/usr/lib/python3.6/site-packages/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/lib/python3.6/site-packages/netmiko/base_connection.py", line 550, in _read_channel_expect
new_data = self.remote_conn.recv(MAX_BUFFER)
File "/usr/lib/python3.6/site-packages/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 "<stdin>", line 1, in <module>
File "/usr/lib/python3.6/site-packages/netmiko/nokia/nokia_sros_ssh.py", line 128, in commit
output += self.read_until_pattern(r"@")
File "/usr/lib/python3.6/site-packages/netmiko/base_connection.py", line 627, in read_until_pattern
return self._read_channel_expect(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/netmiko/base_connection.py", line 561, in _read_channel_expect
"Timed-out reading channel, data not available."
netmiko.ssh_exception.NetmikoTimeoutException: Timed-out reading channel, data not available.
>>>
The config does get committed, so either it’s just not picking up the return afterwards, or it’s taking too long - which I think is unlikely because it commits almost instantly via CLI.
Example of the same change via CLI
[]
A:user@router1# edit-config exclusive
INFO: CLI #2060: Entering exclusive configuration mode
INFO: CLI #2061: Uncommitted changes are discarded on configuration mode exit
(ex)[]
A:user@router1# configure port 1/1/c10 description test123
*(ex)[]
A:user@router1# commit
(ex)[]
A:user@router1# quit-config
INFO: CLI #2064: Exiting exclusive configuration mode
From nokia/nokia_sros_ssh.py
def commit(self, *args, **kwargs):
"""Activate changes from private candidate for Nokia SR OS"""
output = self._exit_all()
if "@" in self.base_prompt and "*(ex)[" in output:
log.info("Apply uncommitted changes!")
cmd = "commit"
self.write_channel(self.normalize_cmd(cmd))
output += self.read_until_pattern(pattern=re.escape(cmd))
output += self.read_until_pattern(r"@")
return output
Any help is appreciated.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
@hellt that is correct
@ktbyers has this been fixed by #1672 ?