netmiko enable() should be configurable
See original GitHub issueHi,
I’ve run in to an issue where my routers cannot be configured with netmiko due to the enable() function run in networking.netmiko_send_config
In my particular case, I’m configuring Alcatel SROS devices that do not have a dedicated enable (admin
) password configured, thus failing because of this with the following:
ValueError: Failed to enter enable mode. Please ensure you pass the 'secret' argument to ConnectHandler.
May I suggest you make this configurable some how? As a workaround I’ve made my own netmiko_send_config function with just the line referenced below commented out.
The problematic line is this: https://github.com/nornir-automation/nornir/blob/f5a51269f8faffa3f078d14cadd81695419bfa76/nornir/plugins/tasks/networking/netmiko_send_config.py#L25
Thank you!
Issue Analytics
- State:
- Created 4 years ago
- Comments:23
Top Results From Across the Web
Netmiko - Enter configuration terminal mode - Stack Overflow
There is a configure terminal mode in netmiko , using conn.config_mode() sends configure terminal to the remote device. However, you can use ...
Read more >SSH Configuration with Netmiko - YouTube
Your browser can 't play this video. ... you'll learn how to configure a Secure Shell (SSH) connection using Netmiko.
Read more >netmiko.cisco_base_connection API documentation
CiscoBaseConnection is netmiko SSH class for Cisco and Cisco-like platforms. ... You can enable this if you want to record both channel reads...
Read more >How to Enable Netmiko Logging - Packet Coders
To enable logging for all connections to a file, we can import and use the logging module, as shown below. In this example,...
Read more >Netmiko Library - Python for Network Engineers
You can find the library at https://github.com/ktbyers/netmiko and the latest released ... Simplify the execution of configuration commands.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So let’s do this–near term fix it in Nornir by adding an argument. Longer term potentially fix in Netmiko to allow some way to avoid this issue.
I will create an issue in Netmiko to track the longer term issue.
I am worried that we will just run into this problem elsewhere where Netmiko + other tool is being used (which is why the longer term fix is probably a good idea).
sorry @ktbyers for unnecessarily eating your time
My memory failed me and the current
sros.enable()
code is indeed seems to assume that enable actions happen on SR OS regardless if it is configured or not.check_enable
method only checks if the SR OS node is in admin mode, but if it is not it doesn’t mean it has enable mode configured, that leads to the issue in thesuper.enable()
https://github.com/ktbyers/netmiko/blob/8bbe607a8fbf2a00deeefe2fa7f17c918792949d/netmiko/nokia/nokia_sros_ssh.py#L89-L99I think the code of nokia.enable() might be enhanced to first detect if admin mode is configured on the device and only if it is, it must go through the
super.enable()
routine.Now I recall why that was not an issue with bare netmiko - because in bare netmiko a user decides if he needs to call enable() and user knows if this mode is configured on the device upfront.
So I see two possible solutions:
enable()
sros.enable()
to check if the enable mode is configured on the device, if it is - perform enable. If it doesn’t - pass the function.