Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
643 views
in Technique[技术] by (71.8m points)

python 3.x - Napalm connection to Cisco IOS router using telnet

I'm trying to use Napalm to connect to Cisco routers using telnet from the python chevron and getting an error from netmiko.ssh.

Here is the snippet that I am using

from napalm import get_network_driver

driver = get_network_driver('ios')

with driver('ip_address', 'username', 'password', optional_args={'port': 23,'transport': telnet}) as device:

    print(device.get_facts())

Here is the error message that I am receiving:

NAPALM didn't catch this exception. Please, fill a bugfix on https://github.com/napalm-automation/napalm/issues
Don't forget to include this traceback.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:Program FilesPython39libsite-packages
apalmasease.py", line 46, in __enter__
    self.open()
  File "C:Program FilesPython39libsite-packages
apalmiosios.py", line 169, in open
    self.device = self._netmiko_open(
  File "C:Program FilesPython39libsite-packages
apalmasease.py", line 86, in _netmiko_open
    self._netmiko_device = ConnectHandler(
  File "C:Program FilesPython39libsite-packages
etmikossh_dispatcher.py", line 312, in ConnectHandler
    return ConnectionClass(*args, **kwargs)
  File "C:Program FilesPython39libsite-packages
etmikociscocisco_ios.py", line 17, in __init__
    return super().__init__(*args, **kwargs)
  File "C:Program FilesPython39libsite-packages
etmikoase_connection.py", line 346, in __init__
    self._open()
  File "C:Program FilesPython39libsite-packages
etmikoase_connection.py", line 351, in _open
    self.establish_connection()
  File "C:Program FilesPython39libsite-packages
etmikoase_connection.py", line 910, in establish_connection
    self.telnet_login()
  File "C:Program FilesPython39libsite-packages
etmikocisco_base_connection.py", line 171, in telnet_login
    raise NetmikoAuthenticationException(msg)
netmiko.ssh_exception.NetmikoAuthenticationException: Login failed: ip_address

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Login failed on the host with name ip_address, if 'ip_address' is the name of the host you trying to connect, maybe you can to put the host IP in place.

I believe that this short video can help you https://www.youtube.com/watch?v=QTapxlSEo1E

Do you ask yourself where to put the host address?

The name of the host you are trying to connect is 'ip_address'?

The same question to the fields 'username' and 'password'.

You are near. The best for you!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...