question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SROS - Commit triggers NetmikoTimeoutException

See original GitHub issue

I’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:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jtisheycommented, Apr 29, 2020

@hellt that is correct

0reactions
helltcommented, Apr 29, 2020

@ktbyers has this been fixed by #1672 ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

4. Configuration Workflow Commands
Commit Confirmed Commands. Table 5 compares the commit commands of the Nokia SR OS MD-CLI to those used by Junos OS and IOS...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found