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.

Nokia SR OS/Alcatel AOS - randomly returned ValueError: router prompt not found

See original GitHub issue

I have a problem with randomly returned ValueError and router prompt not found message for Alcatel/Nokia devices. Error occurs totally randomly. When I’m running my script once again after error occurs everything goes fine.

Part of my connection settings (I noticed that the only changes I made before the problem started was increasing the following parameters value):

 connection_credentials = {
           [...]
           "banner_timeout": 60,
           "timeout": 300,
           "session_timeout": 180
}

Stack trace:

[...]
  File "/path/to/file/file.py", line 54, in connect_to_host
    self.connection = ConnectHandler(**connection_credentials)
  File "/usr/local/lib/python3.6/site-packages/netmiko/ssh_dispatcher.py", line 259, in ConnectHandler
    return ConnectionClass(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/netmiko/base_connection.py", line 327, in __init__
    self._open()
  File "/usr/local/lib/python3.6/site-packages/netmiko/base_connection.py", line 333, in _open
    self._try_session_preparation()
  File "/usr/local/lib/python3.6/site-packages/netmiko/base_connection.py", line 756, in _try_session_preparation
    self.session_preparation()
  File "/usr/local/lib/python3.6/site-packages/netmiko/nokia/nokia_sros_ssh.py", line 38, in session_preparation
    self.set_base_prompt()
  File "/usr/local/lib/python3.6/site-packages/netmiko/nokia/nokia_sros_ssh.py", line 52, in set_base_prompt
    cur_base_prompt = super().set_base_prompt(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/netmiko/base_connection.py", line 1081, in set_base_prompt
    raise ValueError(f"Router prompt not found: {repr(prompt)}")
ValueError: Router prompt not found: 'A:'

Logs when the problem doesn’t occur:

09/17/2020 09:30:38:DEBUG:paramiko.transport:userauth is OK
09/17/2020 09:30:38:INFO:paramiko.transport:Authentication (password) successful!
09/17/2020 09:30:38:DEBUG:paramiko.transport:[chan 0] Max packet in: 32768 bytes
09/17/2020 09:30:38:DEBUG:paramiko.transport:[chan 0] Max packet out: 32768 bytes
09/17/2020 09:30:38:DEBUG:paramiko.transport:Secsh channel 0 opened.
09/17/2020 09:30:38:DEBUG:paramiko.transport:[chan 0] Sesch channel 0 request ok
09/17/2020 09:30:38:DEBUG:paramiko.transport:[chan 0] Sesch channel 0 request ok
09/17/2020 09:30:39:DEBUG:netmiko:read_channel: ^M
^M
A:HOST1#
09/17/2020 09:30:39:DEBUG:netmiko:read_channel:
09/17/2020 09:30:41:DEBUG:netmiko:read_channel:
09/17/2020 09:30:41:DEBUG:netmiko:read_channel:
09/17/2020 09:30:41:DEBUG:netmiko:write_channel: b'\n'
09/17/2020 09:30:41:DEBUG:netmiko:read_channel: ^M
A:HOST1#
09/17/2020 09:30:41:DEBUG:netmiko:read_channel:
09/17/2020 09:30:41:DEBUG:netmiko:[find_prompt()]: prompt is A:HOST1#
09/17/2020 09:30:42:DEBUG:netmiko:read_channel:
09/17/2020 09:30:42:DEBUG:netmiko:In disable_paging
09/17/2020 09:30:42:DEBUG:netmiko:Command: environment no more

Logs when the problem occurs:

09/17/2020 09:42:16:DEBUG:paramiko.transport:userauth is OK
09/17/2020 09:42:17:INFO:paramiko.transport:Authentication (password) successful!
09/17/2020 09:42:17:DEBUG:paramiko.transport:[chan 0] Max packet in: 32768 bytes
09/17/2020 09:42:17:DEBUG:paramiko.transport:[chan 0] Max packet out: 32768 bytes
09/17/2020 09:42:17:DEBUG:paramiko.transport:Secsh channel 0 opened.
09/17/2020 09:42:17:DEBUG:paramiko.transport:[chan 0] Sesch channel 0 request ok
09/17/2020 09:42:17:DEBUG:paramiko.transport:[chan 0] Sesch channel 0 request ok
09/17/2020 09:42:18:DEBUG:netmiko:read_channel:

A:HOST2#
09/17/2020 09:42:18:DEBUG:netmiko:read_channel:
09/17/2020 09:42:20:DEBUG:netmiko:read_channel:
09/17/2020 09:42:20:DEBUG:netmiko:read_channel:
09/17/2020 09:42:20:DEBUG:netmiko:write_channel: b'\n'
09/17/2020 09:42:20:DEBUG:netmiko:read_channel:
A:
09/17/2020 09:42:20:DEBUG:netmiko:read_channel: HOST2#
09/17/2020 09:42:20:DEBUG:netmiko:Clear buffer detects data in the channel
09/17/2020 09:42:21:DEBUG:netmiko:read_channel:
09/17/2020 09:42:21:DEBUG:netmiko:[find_prompt()]: prompt is A:
09/17/2020 09:42:21:DEBUG:netmiko:write_channel: b'logout\n'
09/17/2020 09:42:21:DEBUG:paramiko.transport:EOF in transport thread

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ktbyerscommented, Oct 6, 2020

Adding @hellt also.

I will probably look at this, but it might be next week. Not sure I am going to get to it this week.

0reactions
ktbyerscommented, Oct 6, 2020

Okay, it seems like the generally issue is that in some situations find_prompt() is failing to get the last character i.e. the # and that is causing problems.

I will have to look into why that is happening.

Read more comments on GitHub >

github_iconTop Results From Across the Web

7750 SR OS Basic System Configuration Guide
7750 SR OS Router Configuration Guide. This guide describes logical IP routing interfaces and associated attributes such as an IP.
Read more >
7750 SR OS Router Configuration Guide - Nokia Documentation
7750 SR OS Basic System Configuration Guide. This guide describes basic system configurations and operations. • 7750 SR OS System Management Guide.
Read more >
Basic CLI Commands - Nokia Documentation
For example, if the current level is the config router ospf context, the back command moves the cursor to the config router context...
Read more >
CLI Usage - Nokia Documentation
Alcatel -Lucent's SR OS CLI is a command-driven interface accessible through the ... For example, the prompt: A:ALA-1>config>router>if# indicates the active ...
Read more >
BGP - Nokia Documentation
In SR-OS a BGP session is configured using the neighbor command. ... if it did not already exist; the ORIGINATOR_ID indicates the BGP...
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