Closed quinntwohao closed 2 years ago
are you trying to do it with Huawei device_type?
Cause I have the same problem. Tes instance
**from netmiko import ConnectHandler from getpass import getpass from pprint import pprint
cisco1 = { "device_type": "huawei", "host": "10.179.28.2", "username": "jmmorales", "password": getpass(), }
command = "display version" with ConnectHandler(**cisco1) as net_connect: print(net_connect.find_prompt())
output = net_connect.send_command(command, use_textfsm=True)
pprint(output)
**
Output
*Exception has occurred: ReadException
Unable to successfully split output based on pattern:
pattern=((Change now|Please choose))|([]>]\s$)
output='\nInfo: The max number of VTY users is 15, the number of current VTY users online is 2, and total number of terminal users online is 2.\n The current login time is 2022-03-29 18:05:20-06:00.\nInfo: The device is not enabled with secure boot, please enable it.\n
Can one of you show me what the Huawei login looks like? In other words, if you login manually what does the CLI session look like?
Yeah sure,
There it is:
**jm@JMG-MBA ~ % ssh jmmorales@10.179.28.2
+----------------------------------------------------------------+ | Este equipo es propiedad privada, | | si no tiene autorizacion para ingresar al equipo, por favor | | cancele la conexion inmediatamente,cualquier anomalia sera | | reportada a las autoridades correspondientes. | +----------------------------------------------------------------+
User Authentication (jmimorales@10.179.28.2) Enter password:
Warning: Negotiated identity key for server authentication is not safe. It is recommended that you disable the insecure algorithm or upgrade the client.
Info: The max number of VTY users is 15, the number of current VTY users online is 1, and total number of terminal users online is 1. The current login time is 2022-03-29 21:09:19-06:00. Info: The device is not enabled with secure boot, please enable it. GNCYGTAJN2D2C02B02EII1> **
What is this ** after the prompt?
GNCYGTAJN2D2C02B02EII1>
**
Is that really there or was that an error in the posting above?
that was and error, those **** are not on the prompt.
Its because I wanna make the output to be in bold text.
I have the same problem after having cloned the repository to another computer.
on the computer where I create the rep. it's working fine
I'm using another version of pycharm
I managed to solve the problem. I was connecting by ConnectionHandler and I switched to HuawelTelnet
Does Netmiko 3.4.0 work (i.e. is this only a Netmiko 4.0.0 issue)?
@migmorales22
With netmiko 3.4.0 the data is not parse:
Here's the script: from netmiko import ConnectHandler from getpass import getpass from pprint import pprint
cisco1 = { "device_type": "huawei", "host": "10.179.28.2", "username": "huawei", "password": getpass(), }
command = "display version" with ConnectHandler(**cisco1) as net_connect: output = net_connect.send_command(command, use_textfsm=True)
print(output)
Here is the output:
Huawei Versatile Routing Platform Software VRP (R) software, Version 8.190 (NE40E V800R011C10SPC100) Copyright (C) 2012-2019 Huawei Technologies Co., Ltd. HUAWEI NE40E-M2K-B uptime is 350 days, 18 hours, 31 minutes
NE40E-M2K-B version information:
BKP version information: PCB Version : CX68BKP01D REV A IPU Slot Quantity : 1 CARD Slot Quantity : 3
IPU version information:
IPU (Master) 3 : uptime is 350 days, 18 hours, 31 minutes
StartupTime 2021/04/13 18:22:50
SDRAM Memory Size : 16384 M bytes
FLASH Memory Size : 128 M bytes
CFCARD Memory Size : 4096 M bytes
IPU CR5B0BKP0393 version information
CPU PCB Version : CX68E4NLAXFB REV B
EPLD Version : 004
FPGA Version : 009
FPGA2 Version : 008
NPU PCB Version : CX68E4NLAXFA REV A
FPGA Version : 102
FPGA2 Version : 007
NP Version : 100
TM Version : 110
NSE Version : NSE REV A
BootROM Version : 04.73
Power version information:
POWER 4's version information: PCB Version : CX68PSUF REV B
POWER 5's version information: PCB Version : CX68PSUF REV B
FAN version information:
FAN 6's version information: PCB Version : CX68FCBD REV A
CLK version information:
CLK 7 : uptime is 350 days, 18 hours, 31 minutes StartupTime 2021/04/13 18:22:50 FPGA Version : 1509 DSP Version : 17060021 (project1) josemiguelmorales@MIG-MBA ~ %
With netmiko 4.0.0, and same script, the output is:
Exception has occurred: ReadException
Unable to successfully split output based on pattern:
pattern=((Change now|Please choose))|([]>]\s*$)
output='\nInfo: The max number of VTY users is 11, the number of current VTY users online is 1, and total number of terminal users online is 1.\n The current login time is 2022-03-30 12:56:58-04:00.\n The last login time is 2022-03-30 12:53:46-04:00 from 181.209.150.62 through SSH.\n
@migmorales22 So in Netmiko 3.4.0, you connect, but your TextFSM parsing doesn't work properly (i.e. you have a different issue, but not a connection issue).
Is that correct?
Yes, that's correct,
With netmiko 3.4.0 its the textfsm that doesn't parse the output of the send command, and in netmiko 4.0.0 is the "Exception has occurred:ReadException"
I couldn't connect to Huawei devices after upgrading to V4.0.0 .
Connecting to 192.168.1.100:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
WARNING! The remote SSH server rejected X11 forwarding request.
Info: The max number of VTY users is 10, and the number
of current VTY users on line is 1.
The current login time is 2022-03-31 15:03:24+08:00.
Info: Lastest accessed IP: 192.168.1.100 Time: 2022-03-31 14:58:54+08:00 Password will expire in: -
Info: Smart-upgrade is currently disabled. Enable Smart-upgrade to get recommended version information.
<HUAWEI>
I have the same issue with Huawei device
New version V4.0.0 has problems with huawei devices. @ktbyers
I can confirm the issue using Netmiko 4.0.0 (latest pip release together with Python 3.10.4) using device_type = 'huawei'
.
With the Netmiko 3.4.0 release everything works fine. Also, it doesn't seem to make any difference whether the password change prompt is displayed or not (see both tracebacks below).
netmiko.exceptions.ReadException: Unable to successfully split output based on pattern:
pattern=((Change now|Please choose))|([\]>]\s*$)
output='\nWarning: The password will expire in 11 days.\nThe password needs to be changed. Change now? [Y/N]: '
results=['\nWarning: The password will expire in 11 days.\nThe password needs to be changed. ', 'Change now', 'Change now', None, '? [Y/N]: ']
netmiko.exceptions.ReadException: Unable to successfully split output based on pattern:
pattern=((Change now|Please choose))|([\]>]\s*$)
output='\nInfo: Current mode: Monitor (automatically making switching decisions).\nWarning: The intelligent upgrade function is disabled. Log in to the web platform and enable this function.\n ----------------------------------------------------------------------------- \n User last login information: [...] \n -----------------------------------------------------------------------------\n<AC6508>'
results=['\nInfo: Current mode: Monitor (automatically making switching decisions).\nWarning: The intelligent upgrade function is disabled. Log in to the web platform and enable this function.\n ----------------------------------------------------------------------------- \n User last login information: [...] \n -----------------------------------------------------------------------------\n<AC6508', None, None, '>', '']
After spending some time investigating the issue I found out that the pattern matching logic in read_until_pattern
expects the pattern to split exactly in 3 parts (using re.split), see base_connection.py#L579 for reference. Seems this change was introduced during some fundamental changes to the channel reading logic in in https://github.com/ktbyers/netmiko/commit/793100dcfd76d3eb5089ba4cd27c99e3c3c0f886.
I have proposed a fix and documented some more info in #2719.
When will the new version be released.
@luweijun1992 Just pin to Netmiko 3.4.0 or directly use the proposed fix from Git (i.e. you don't need a new release to work around this).
@luweijun1992 Just pin to Netmiko 3.4.0 or directly use the proposed fix from Git (i.e. you don't need a new release to work around this).
I installed it using pip, do you mean rollback version v3.4.0? Still want to use the new version, need the new function send_multiline()
@luweijun1992 You could use my proposed fix directly with pip like below until a fixed Netmiko version is available.
pip install 'git+https://github.com/fharbe/netmiko.git@fix_huawei_login#egg=netmiko'
Updated PR here:
https://github.com/ktbyers/netmiko/pull/2728
Can anyone test that this works properly?
@luweijun1992 @pyhas @migmorales22 @nivaldoinacios @quinnhao Let me know is someone can test the PR here:
I want to try to include this in a Netmiko release that I would release shortly.
Thanks, Kirk
@luweijun1992 @pyhas @migmorales22 @nivaldoinacios @quinnhao Let me know is someone can test the PR here:
2728
I want to try to include this in a Netmiko release that I would release shortly.
Thanks, Kirk
Looking forward to the release of the new version, I go back to the old version v3.4.0
@luweijun1992 Yep, I need someone to test that it fixes the issue. Can you do that?
@luweijun1992 Yep, I need someone to test that it fixes the issue. Can you do that?
No problem, I will test the new release.
Yeah, I really need someone to test it beforehand i.e. before it gets merged into develop
(and before there is a release).
Yeah, I really need someone to test it beforehand i.e. before it gets merged into
develop
(and before there is a release).
Please tell me how to cooperate with you for the test. Maybe you can send me the fixed file and I'll overwrite the old file for testing.
@luweijun1992 pip install it and see if the previous failure occurs or not.
You can pip install a specific commit. You can also pip install a branch. Some of this pip syntax is confusing, but should be available online. I usually do:
git clone <repo>
cd <repo>
pip uninstall netmiko
pip install -e .
i.e. I usually just install it from the local repository. You have to make sure you clone the right location. I will merge into the develop
branch (right now). So the above should work (as git will clone the develop
branch automatically).
@luweijun1992 pip install it and see if the previous failure occurs or not.
You can pip install a specific commit. You can also pip install a branch. Some of this pip syntax is confusing, but should be available online. I usually do:
git clone <repo> cd <repo> pip uninstall netmiko pip install -e .
i.e. I usually just install it from the local repository. You have to make sure you clone the right location. I will merge into the
develop
branch (right now). So the above should work (as git will clone thedevelop
branch automatically).git clone https://github.com/ktbyers/netmiko.git cd netmiko pip install -e .
[Running] python -u "d:\ssh_conn.py"
Traceback (most recent call last):
File "d:\ssh_conn.py", line 26, in <module>
with ConnectHandler(**huawei) as net_connect:
File "d:\netmiko\netmiko\ssh_dispatcher.py", line 344, in ConnectHandler
return ConnectionClass(*args, **kwargs)
File "d:\netmiko\netmiko\base_connection.py", line 434, in __init__
self._open()
File "d:\netmiko\netmiko\base_connection.py", line 439, in _open
self.establish_connection()
File "d:\netmiko\netmiko\base_connection.py", line 1092, in establish_connection
self.special_login_handler()
File "d:\netmiko\netmiko\huawei\huawei.py", line 18, in special_login_handler
data = self.read_until_pattern(pattern=rf"({password_change_prompt}|[>\]])")
File "d:\netmiko\netmiko\base_connection.py", line 631, in read_until_pattern
raise ReadException(msg)
netmiko.exceptions.ReadException: Unable to successfully split output based on pattern:
pattern=((Change now|Please choose)|[>\]])
output='\nInfo: The max number of VTY users is 10, and the number\n of current VTY users on line is 1.\n The current login time is 2009-02-09 21:53:27+08:00.\n<S5700-10P>'
results=['\nInfo: The max number of VTY users is 10, and the number\n of current VTY users on line is 1.\n The current login time is 2009-02-09 21:53:27+08:00.\n<S5700-10P', '>', None, '']
[Done] exited with code=1 in 8.166 seconds
@luweijun1992 Okay, great thanks for testing.
I have a new fix here:
https://github.com/ktbyers/netmiko/pull/2737
This has been merged into develop
.
You should be able to update your code that you are testing with by doing.
cd <github repo directory>
git fetch origin
git rebase origin/develop
This assumes you still have the develop
branch checked out (which you should).
If you could re-test this new fix, that would be very helpful.
@luweijun1992 Okay, great thanks for testing.
I have a new fix here:
2737
This has been merged into
develop
.You should be able to update your code that you are testing with by doing.
cd <github repo directory> git fetch origin git rebase origin/develop
This assumes you still have the
develop
branch checked out (which you should). The test was successful.
@luweijun1992 Okay, great thanks for testing.
I have a new fix here:
2737
This has been merged into
develop
.You should be able to update your code that you are testing with by doing.
cd <github repo directory> git fetch origin git rebase origin/develop
This assumes you still have the
develop
branch checked out (which you should).
But the result of print seems abnormal.
print(result)
Hello! @ktbyers 4.1.0 is ok work ssh, problem use huawei_telnet
Traceback (most recent call last):
File "/home/mikholap/Рабочий стол/my-projects/mikholap-scripts/core and aggregation/asw_vlan_probros_pub.py", line 17, in <module>
net_connect = ConnectHandler(**device)
File "/home/mikholap/.local/lib/python3.10/site-packages/netmiko/ssh_dispatcher.py", line 344, in ConnectHandler
return ConnectionClass(*args, **kwargs)
File "/home/mikholap/.local/lib/python3.10/site-packages/netmiko/base_connection.py", line 434, in __init__
self._open()
File "/home/mikholap/.local/lib/python3.10/site-packages/netmiko/base_connection.py", line 439, in _open
self.establish_connection()
File "/home/mikholap/.local/lib/python3.10/site-packages/netmiko/base_connection.py", line 1009, in establish_connection
self.telnet_login()
File "/home/mikholap/.local/lib/python3.10/site-packages/netmiko/huawei/huawei.py", line 150, in telnet_login
output = self.read_until_pattern(pattern=combined_pattern)
File "/home/mikholap/.local/lib/python3.10/site-packages/netmiko/base_connection.py", line 631, in read_until_pattern
raise ReadException(msg)
netmiko.exceptions.ReadException: Unable to successfully split output based on pattern:
pattern=(]\s*$|>\s*$|(Change now|Please choose 'YES' or 'NO').+)
output=':\nInfo: The max number of VTY users is 10, and the number\n of current VTY users on line is 2.\n The current login time is 2022-05-13 13:46:34+04:00.\nInfo: Smart-upgrade is currently disabled. Enable Smart-upgrade to get recommended version information.\n<***>'
results=[':\nInfo: The max number of VTY users is 10, and the number\n of current VTY users on line is 2.\n The current login time is 2022-05-13 13:46:34+04:00.\nInfo: Smart-upgrade is currently disabled. Enable Smart-upgrade to get recommended version information.\n<***', '>', None, '']
@aztec102 So you are still seeing an issue when you suing Huawei and telnet with Netmiko 4.1.0?
@ktbyers Yes, i see.
import re
from netmiko import ConnectHandler
host = input('Input Dest host: ')
device = {
'device_type': 'huawei_telnet',
'ip': host,
'username': 'login',
'password': 'pass',
'port' : 23,
'verbose': True,
'session_log': f'{host}.log'
}
net_connect = ConnectHandler(**device)
pip3 list | grep netmiko
netmiko 4.1.0
Hi!MR.Ktbyers!I have the same issue with H3C(hp_comware_telnet) . SSH(hp_comware) was perfect ! I like it ! but telnet never succeeded.
from netmiko import ConnectHandler
dev = { 'device_type': "hp_comware_telnet", 'host': '192.168.11.1', 'username': 'admin', 'password': 'admin', 'port': 23, } net_con = ConnectHandler(**dev) output = net_con.send_command('display current-configuration') print(output)
Traceback (most recent call last):
File "C:\Users\18592\AppData\Roaming\JetBrains\PyCharm2022.1\scratches\scratch_6.py", line 10, in
Pattern not detected: 'to continue|[>\]]' in output.
Things you might try to fix this:
You can also look at the Netmiko session_log or debug log for more information.
1、windows 10 2、python3.10.4 3、netmiko 4.1.1 THANK YOU!
@zhtjames Can you show me what a manual telnet looks like i.e. copy and paste the manual telnet session here. You can obscure/change your username and password or anything else that is confidential.
@zhtjames ???
@ktbyers, you are great, thank you for netmiko! I faced the same issue when try telnet. Below is manual telnet session you asked for:
user@my-secret-host:~$ telnet 10.166.66.66
Trying 10.166.66.66...
Connected to 10.166.66.66.
Escape character is '^]'.
Warning: Telnet is not a secure protocol, and it is recommended to use Stelnet.
Login authentication
Username:my-secret-username
Password:
Info: The max number of VTY users is 5, and the number
of current VTY users on line is 1.
<my-secret-prompt>
<my-secret-prompt>quit
Info: The max number of VTY users is 5, and the number
of current VTY users on line is 0.Connection closed by foreign host.
user@my-secret-host:~$
Python code:
from netmiko import ConnectHandler
device = {
'device_type': 'huawei_telnet',
'host': '10.166.66.66',
'username': 'my-secret-username',
'password': 'my-secret-password',
}
net_connect = ConnectHandler(**device)
net_connect.disconnect()
Exception:
Traceback (most recent call last):
File "issue.py", line 10, in <module>
net_connect = ConnectHandler(**device)
File "/home/user/.local/lib/python3.8/site-packages/netmiko/ssh_dispatcher.py", line 365, in ConnectHandler
return ConnectionClass(*args, **kwargs)
File "/home/user/.local/lib/python3.8/site-packages/netmiko/base_connection.py", line 439, in __init__
self._open()
File "/home/user/.local/lib/python3.8/site-packages/netmiko/base_connection.py", line 444, in _open
self.establish_connection()
File "/home/user/.local/lib/python3.8/site-packages/netmiko/base_connection.py", line 1034, in establish_connection
self.telnet_login()
File "/home/user/.local/lib/python3.8/site-packages/netmiko/huawei/huawei.py", line 155, in telnet_login
output = self.read_until_pattern(pattern=combined_pattern)
File "/home/user/.local/lib/python3.8/site-packages/netmiko/base_connection.py", line 672, in read_until_pattern
raise ReadTimeout(msg)
netmiko.exceptions.ReadTimeout:
Pattern not detected: "(]\\s*$|>\\s*$|(Change now|Please choose 'YES' or 'NO').+)" 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.
Configuration:
netmiko==4.1.2
Python 3.8.10
Linux Mint 20.3
@TimGa Is it possible that you can look in the debugger and see what happened right before this:
https://github.com/ktbyers/netmiko/blob/develop/netmiko/huawei/huawei.py#L155
i.e. add a Pdb debug breakpoint right before this and see what is in the return_msg
variable?
The failure above says it failed on the looking for >
which should be in the output after the password is sent.
Here is return_msg
content:
Warning: Telnet is not a secure protocol, and it is recommended to use Stelnet.
Login authentication
Username:my-secret-username
Password
It turned out that password in my python script was incorrect - I mixed up IPs and passwords of different devices while investigation. As far as I understood, ReadTimeout raises while waiting for pattern after incorrect password. And it looks like that in my case the reason for timeout is that device has big delay between asking for password re-entry. Here is manual telnet with incorrect password, just in case:
Trying 10.166.66.66...
Connected to 10.166.66.66.
Escape character is '^]'.
Warning: Telnet is not a secure protocol, and it is recommended to use Stelnet.
Login authentication
Username:my-secret-username
Password:
Error: Local authentication is rejected
Username:my-secret-username
Password:
Error: Local authentication is rejected
Username:my-secret-username
Password:
Error: Local authentication is rejected
Connection closed by foreign host.
P.S. Sorry for the confusion! I was confused with "ReadTimeout:Pattern not detected:" and didn't even think about password issue, cause usually it is NetmikoAuthenticationException. So maybe it is better to raise auth instead of timeout in such situation, but offcourse it is up to you to decide.
Important: Actual problem is still remains - I can't connect to some huawei device using telnet, but actual error is not ReadTimeout
but ReadException: Unable to successfully split output based on pattern
. I'll try to investigate it and write results here in few days.
I am going to leave this open and flag at it as an issue where improvement should be made.
Hi all,
I seem to be running into this issue as well since the new version:
File "/home/<snip>/devops/test-development/network/huawei_bulk_patch.py", line 19, in <module>
print(net_connect = ConnectHandler(**device))
File "/home/<snip>/.local/lib/python3.10/site-packages/netmiko/ssh_dispatcher.py", line 365, in ConnectHandler
return ConnectionClass(*args, **kwargs)
File "/home/<snip>/.local/lib/python3.10/site-packages/netmiko/base_connection.py", line 439, in __init__
self._open()
File "/home/<snip>/.local/lib/python3.10/site-packages/netmiko/base_connection.py", line 444, in _open
self.establish_connection()
File "/home/<snip>/.local/lib/python3.10/site-packages/netmiko/base_connection.py", line 1034, in establish_connection
self.telnet_login()
File "/home/<snip>/.local/lib/python3.10/site-packages/netmiko/huawei/huawei.py", line 155, in telnet_login
output = self.read_until_pattern(pattern=combined_pattern)
File "/home/<snip>/.local/lib/python3.10/site-packages/netmiko/base_connection.py", line 652, in read_until_pattern
raise ReadException(msg)
netmiko.exceptions.ReadException: Unable to successfully split output based on pattern:
pattern=(]\s*$|>\s*$|(Change now|Please choose 'YES' or 'NO').+)
output=':\n ----------------------------------------------------------------------------- \n User last login information: \n -----------------------------------------------------------------------------\n Access Type: Telnet \n IP-Address : <snip> \n Time : 2022-08-29 11:21:20+02:00 DST \n -----------------------------------------------------------------------------\n<support-network-labo-ar1220>'
results=[':\n ----------------------------------------------------------------------------- \n User last login information: \n -----------------------------------------------------------------------------\n Access Type: Telnet \n IP-Address : <snip> \n Time : 2022-08-29 11:21:20+02:00 DST \n -----------------------------------------------------------------------------\n<support-network-labo-ar1220', '>', None, '']
Environment: Ubuntu 22.04.1 Python 3.10.4 netmiko 4.1.2
How can I help to investigate this? (not the best coder in the world but I will try to do my best)
The reason for Huawei telnet trouble netmiko.exceptions.ReadException: Unable to successfully split output based on pattern
is that pattern (]\s*$|>\s*$|(Change now|Please choose 'YES' or 'NO').+)
contains nested group (nested parentheses). To fix this issue, changes of source code needed.
combined_pattern
created - i mean this pattern (]\s*$|>\s*$|(Change now|Please choose 'YES' or 'NO').+)
combined_pattern
passes to read_until_pattern
method here https://github.com/ktbyers/netmiko/blob/f3b5da244e6ce1e5fd7bd89fd36b090e854828b4/netmiko/huawei/huawei.py#L155result
list of length = 4, and this is the reason for ReadException
here: https://github.com/ktbyers/netmiko/blob/f3b5da244e6ce1e5fd7bd89fd36b090e854828b4/netmiko/base_connection.py#L645result
) = 4 is that combined_pattern
has nested parentheses here:
(]\s*$|>\s*$|(Change now|Please choose 'YES' or 'NO').+)
^ ^
@Toxic-Waste- you can try to edit file /home/<snip>/.local/lib/python3.10/site-packages/netmiko/huawei/huawei.py
on line 131
change this:
password_change_prompt = r"(Change now|Please choose 'YES' or 'NO').+"
to this:
password_change_prompt = r"Change now|Please choose 'YES' or 'NO'"
But you must understand that:
@ktbyers I can try to analize side effects of proposed changes and craft Pull Request if you like. But if you think that PR is redundant, please let me know. Thanks!
@TimGa Yeah, if you want to do a PR that is fine. We can also do a non-capture group like we did when we fixed the SSH Huawei driver here:
https://github.com/ktbyers/netmiko/pull/2737
Might be less side-effects in doing the non-capture group (since that would change the regex pattern less)...but would need to look at it and test it some more.
Hi all,
I seem to be running into this issue as well since the new version:
File "/home/<snip>/devops/test-development/network/huawei_bulk_patch.py", line 19, in <module> print(net_connect = ConnectHandler(**device)) File "/home/<snip>/.local/lib/python3.10/site-packages/netmiko/ssh_dispatcher.py", line 365, in ConnectHandler return ConnectionClass(*args, **kwargs) File "/home/<snip>/.local/lib/python3.10/site-packages/netmiko/base_connection.py", line 439, in __init__ self._open() File "/home/<snip>/.local/lib/python3.10/site-packages/netmiko/base_connection.py", line 444, in _open self.establish_connection() File "/home/<snip>/.local/lib/python3.10/site-packages/netmiko/base_connection.py", line 1034, in establish_connection self.telnet_login() File "/home/<snip>/.local/lib/python3.10/site-packages/netmiko/huawei/huawei.py", line 155, in telnet_login output = self.read_until_pattern(pattern=combined_pattern) File "/home/<snip>/.local/lib/python3.10/site-packages/netmiko/base_connection.py", line 652, in read_until_pattern raise ReadException(msg) netmiko.exceptions.ReadException: Unable to successfully split output based on pattern: pattern=(]\s*$|>\s*$|(Change now|Please choose 'YES' or 'NO').+) output=':\n ----------------------------------------------------------------------------- \n User last login information: \n -----------------------------------------------------------------------------\n Access Type: Telnet \n IP-Address : <snip> \n Time : 2022-08-29 11:21:20+02:00 DST \n -----------------------------------------------------------------------------\n<support-network-labo-ar1220>' results=[':\n ----------------------------------------------------------------------------- \n User last login information: \n -----------------------------------------------------------------------------\n Access Type: Telnet \n IP-Address : <snip> \n Time : 2022-08-29 11:21:20+02:00 DST \n -----------------------------------------------------------------------------\n<support-network-labo-ar1220', '>', None, '']
Environment: Ubuntu 22.04.1 Python 3.10.4 netmiko 4.1.2
How can I help to investigate this? (not the best coder in the world but I will try to do my best)
To solve this problem you should use lib netmiko V 3.4.0 instead of netmiko V 4.0.0 >> to connect Huawei devices.
您好!我已收到您的邮件。
@ammarhayder I'm still using version 3.4.0 because the versions above break the telnet connection for huawei
There is a proposed fix for the Huawei telnet issue here:
https://github.com/ktbyers/netmiko/pull/2935
If anyone else wants to test it.
The system information is as follows:
error_print:
test instanse
out_print
no problem