netmiko connect to device with different prompt

194 Views Asked by At

I try to connect Cisco ACI using netmiko via console. The prompt on the login is not either > or # but "login as:". enter image description here I think because of that, I got the error. If there anyway to sepcify the expected prompt or is there othe python module support it other than netmiko

Here is the code

device = {
    "device_type": "cisco_nxos",
    "ip": "****",
    "username": "****",
    "password": "****",
    "session_log": 'netmiko_session.log',
    "port": '22'
  }

net_connect = ConnectHandler(**device)

Here is the error

Traceback (most recent call last): File "C:\Users\user\venv\aci_connect.py", line 13, in net_connect = ConnectHandler(**device) File "C:\Users\user\venv\lib\site-packages\netmiko\ssh_dispatcher.py", line 388, in ConnectHandler return ConnectionClass(*args, **kwargs) File "C:\Users\user\venv\lib\site-packages\netmiko\base_connection.py", line 462, in init self._open() File "C:\Users\user\venv\lib\site-packages\netmiko\base_connection.py", line 468, in _open self._try_session_preparation() File "C:\Users\user\venv\lib\site-packages\netmiko\base_connection.py", line 963, in _try_session_preparation self.session_preparation() File "C:\Users\user\venv\lib\site-packages\netmiko\cisco\cisco_nxos_ssh.py", line 14, in session_preparation self._test_channel_read(pattern=r"[>#]") File "C:\Users\user\venv\lib\site-packages\netmiko\base_connection.py", line 1202, in _test_channel_read return self.read_until_pattern(pattern=pattern, read_timeout=20) File "C:\Users\user\venv\lib\site-packages\netmiko\base_connection.py", line 721, in read_until_pattern raise ReadTimeout(msg) netmiko.exceptions.ReadTimeout:

Pattern not detected: '[>#]' in output.

Things you might try to fix this:

  1. Adjust the regex pattern to better identify the terminating string. Note, in many situations the pattern is automatically based on the network device's prompt.
  2. Increase the read_timeout to a larger value.
0

There are 0 best solutions below