Skip to content
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

NAPALM - Unable to send enable password in Cisco IOS #1 #1954

Open
sjsingh02 opened this issue May 29, 2023 · 1 comment
Open

NAPALM - Unable to send enable password in Cisco IOS #1 #1954

sjsingh02 opened this issue May 29, 2023 · 1 comment

Comments

@sjsingh02
Copy link

Dears,

Apologies for simple question, but I am getting confused with this:

I am trying to use the below simple NAPALM script to automate Cisco IOS devices.

from napalm import get_network_driver
import pprint
import getpass

driver = get_network_driver('ios')
device = driver('192.168.60.152', 'admin', 'cisco')

print('Accessing device 192.168.60.152')
device.open()
facts = device.get_facts()
print(facts)
device.close()

But I am not able to figure out how to send the enable password to Cisco IOS with NAPALM script above.

Getting below error when trying execute:

ubuntu@ubuntu:~/Sripts$ python3 ios_napalm.py
/usr/lib/python3/dist-packages/pkg_resources/init.py:116: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release
warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/init.py:116: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release
warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/init.py:116: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release
warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/init.py:116: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release
warnings.warn(
Accessing device 192.168.60.152
Traceback (most recent call last):
File "/home/ubuntu/Sripts/ios_napalm.py", line 9, in
device.open()
File "/home/ubuntu/.local/lib/python3.10/site-packages/napalm/ios/ios.py", line 172, in open
self.device = self._netmiko_open(
File "/home/ubuntu/.local/lib/python3.10/site-packages/napalm/base/base.py", line 129, in _netmiko_open
self._netmiko_device.enable()
File "/home/ubuntu/.local/lib/python3.10/site-packages/netmiko/cisco_base_connection.py", line 26, in enable
return super().enable(
File "/home/ubuntu/.local/lib/python3.10/site-packages/netmiko/base_connection.py", line 2008, in enable
output += self.read_until_prompt()
File "/home/ubuntu/.local/lib/python3.10/site-packages/netmiko/base_connection.py", line 812, in read_until_prompt
return self.read_until_pattern(
File "/home/ubuntu/.local/lib/python3.10/site-packages/netmiko/base_connection.py", line 721, in read_until_pattern
raise ReadTimeout(msg)
netmiko.exceptions.ReadTimeout:

Pattern not detected: 'router' in output.

Things you might try to fix this:

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.
Increase the read_timeout to a larger value.
You can also look at the Netmiko session_log or debug log for more information.

Using Python 3.10.6, Installed libraries as below:

paramiko 3.1.0
netmiko 4.2.0
napalm 4.1.0

Router Info:

router>en
Password:
router#show ver
Cisco IOS Software, IOSv Software (VIOS-ADVENTERPRISEK9-M), Version 15.5(3)M, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2015 by Cisco Systems, Inc.
Compiled Wed 22-Jul-15 23:04 by prod_rel_team

Thanks in advance for your support

@ktbyers
Copy link
Contributor

ktbyers commented May 30, 2023

@sjsingh02 Use NAPALM's optional_args = {"secret": "my_secret"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants