New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Huawei special_login_handler is not logging in successfully #2711
Comments
are you trying to do it with Huawei device_type? Cause I have the same problem.
**from netmiko import ConnectHandler cisco1 = { command = "display version" #print() ** Output *Exception has occurred: ReadException |
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 +----------------------------------------------------------------+ User Authentication 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. |
What is this ** after the prompt?
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. |
Does Netmiko 3.4.0 work (i.e. is this only a Netmiko 4.0.0 issue)? |
With netmiko 3.4.0 the data is not parse: Here's the script: cisco1 = { command = "display version" print(output) Here is the output: Huawei Versatile Routing Platform Software NE40E-M2K-B version information: BKP version information: IPU version information: IPU (Master) 3 : uptime is 350 days, 18 hours, 31 minutes Power version information: POWER 4's version information: POWER 5's version information: FAN version information: FAN 6's version information: CLK version information: CLK 7 : uptime is 350 days, 18 hours, 31 minutes With netmiko 4.0.0, and same script, the output is: Exception has occurred: ReadException |
@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 . |
|
I have the same issue with Huawei device |
New version V4.0.0 has problems with huawei devices. |
I can confirm the issue using Netmiko 4.0.0 (latest pip release together with Python 3.10.4) using 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 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). |
I installed it using pip, do you mean rollback version v3.4.0? |
@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: 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 |
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 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:
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 |
* fix(huawei): fix special_login_handler (#2711) * Relocate password change code back to special_login_handler * Fix issue you could get into where prompt might not be available. * Increase timeouts to allow for more time during initial read. Remove the _test_channel_read() * Removing ReadTimeout handling Co-authored-by: Florian Harbecke <florian@harbecke.net>
|
@luweijun1992 Okay, great thanks for testing. I have a new fix here: This has been merged into You should be able to update your code that you are testing with by doing.
This assumes you still have the |
If you could re-test this new fix, that would be very helpful. |
|
But the result of print seems abnormal.
|
Hello!
|
@aztec102 So you are still seeing an issue when you suing Huawei and telnet with Netmiko 4.1.0? |
@ktbyers Yes, i see.
|
Hi!MR.Ktbyers!I have the same issue with H3C(hp_comware_telnet) . from netmiko import ConnectHandler dev = { Traceback (most recent call last): 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 |
@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!
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:
Configuration:
|
@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 The failure above says it failed on the looking for |
Here is
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.
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. |
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:
Environment: Ubuntu 22.04.1 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 Details:
@Toxic-Waste- you can try to edit file 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: 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. |
Incorrect nested groups in regex pattern "combined_pattern". For details please see: ktbyers#2711 (comment)
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: If anyone else wants to test it. |
The telnet issue for Huawei should now be fixed here: |
I am going to lock conversions on this issue (as it is already way too long and already covers multiple issues). If you are still running into Huawei issues, please create a new issue and reference details on the problem that you are encountering. |
The system information is as follows:
error_print:
test instanse
2. python 3.10
3. window 11
Netmiko 3.4.0 Release
out_print
no problem
The text was updated successfully, but these errors were encountered: