-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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_telnet Unable to log in properly without a username #3480
Comments
It is possible that |
i had rewrite telnet_login, add a dict to save netmiko sended password and username. |
Where to check out the code too |
my rewrite code:
|
Netmiko 4.x has deprecated the use of max_loops with read_until_pattern.
Parenthesis found in pattern. pattern: {pattern}\n This can be problemtic when used in read_until_pattern(). You should ensure that you use either non-capture groups i.e. '(?:' or that the
pattern={pattern}
Things you might try to fix this:
You can also look at the Netmiko session_log or debug log for more information.\n\n""" |
device_info={ } 直接把密码写在 username 就直接登录了 这块检查有问题 |
english: 把你的telnet_login方法完整的复制出来,不要像上面有中断的,使用markdown语法,实例化时传参是怎样的,还有session log是什么 |
我用的 是官方的 netmiko==4.4.0 没改任何代码 用断点 看到是这个 def read_until_pattern 位置的错误 断点没有断到 telnet_login方法官方的方法
我的代码
日志
终端报错
二 把密码当成username传给netmiko 可以登录
日志
|
从你的图片上看,有个Login authentication, 已经匹配了username_pattern, 当你把password写在username时,在telnet时,188行的第一个read_until_pattern,已经匹配到username_pattern, 然后把username发送过去,刚好就登陆成功了, |
是的 是因为 \r\n 的问题 这应该算个bug 我没账号的时候 不要去匹配username_pattern 直接去找 Password 才对 |
ktbyers的环境跟我们平时的环境会存在一些差异,他的封装是比较理想化的,建议还是要自己进行重写某,类似的问题,我也遇到过不少,但从ktbyers的回复 ,有些他不觉得是bug,可以通过修改参数,当然他也提到过,如果不适用,可以重写 |
Description of Issue/Question
Note: Please check https://guides.github.com/features/mastering-markdown/
to see how to properly format your request.
Setup
Netmiko version
(Paste verbatim output from
pip freeze | grep netmiko
between quotes below)Netmiko device_type (if relevant to the issue)
(Paste
device_type
between quotes below)Steps to Reproduce the Issue
Error Traceback
(Paste the complete traceback of the exception between quotes below)
Relevant Python code
(Please try to essentialize your Python code to the minimum code needed to reproduce the issue)
(Paste the code between the quotes below)
The text was updated successfully, but these errors were encountered: