OSError: Search pattern never detected in connecthandler for aruba_os

728 Views Asked by At

Morning everyone ,

I'm trying to write some switch troubleshooting python code's and to do that I wrote this for the test, but it dosen't work and I hope that someone can help :).

switch type : aruba 2530

python ver : 3.9.4

Netmiko : 4.1.0

CODE :

import netmiko
from netmiko import ConnectHandler
adresse = input ("donner adr")
passsword=input("donner mot de passe ")
cmd= input("donner cmd")
connection =ConnectHandler(device_type="aruba_os", ip=adr, username='admin', password=pas,global_delay_factor= 2)
print(connection.sendcommand(cmd,expect_string=r'#'))
connection.disconnect()

result :

Traceback (most recent call last):

File "C:\Users\g558125\Desktop\Nouveau dossier (3)\mini2.py", line 18, in

connection =ConnectHandler(device_type="aruba_os", ip=adr, username='admin', password=pas,global_delay_factor= 2)

File "C:\Nouveau dossier\lib\site-packages\netmiko\ssh_dispatcher.py", line 344, in ConnectHandler

return ConnectionClass(*args, **kwargs)

File "C:\Nouveau dossier\lib\site-packages\netmiko\aruba\aruba_ssh.py", line 20, in init

return super().__init__(**kwargs)

File "C:\Nouveau dossier\lib\site-packages\netmiko\base_connection.py", line 434, in init

self._open()

File "C:\Nouveau dossier\lib\site-packages\netmiko\base_connection.py", line 440, in _open

self._try_session_preparation()

File "C:\Nouveau dossier\lib\site-packages\netmiko\base_connection.py", line 879, in

_try_session_preparation

self.session_preparation()

File "C:\Nouveau dossier\lib\site-packages\netmiko\aruba\aruba_ssh.py", line 26, in session_preparation

self._test_channel_read(pattern=r"[>#]")

File "C:\Nouveau dossier\lib\site-packages\netmiko\base_connection.py", line 1119, in _test_channel_read

return self.read_until_pattern(pattern=pattern, read_timeout=20)

File "C:\Nouveau dossier\lib\site-packages\netmiko\base_connection.py", line 651, 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.

You can also look at the Netmiko session_log or debug log for more information.

enter image description here

1

There are 1 best solutions below

0
On

Can you change as the device_type="hp_procurve" or device_type="aruba_procurve" and try check it again?