ValueError:Failed to exit configuration mode
See original GitHub issueHI dear ktbyers: I have an issue about the netmiko, my code is:
from netmiko import ConnectHandler
import netmiko
import getpass
import socket
username = input('Enter your SSH/Telnet username: ')
password_now = getpass.getpass('Enter your SSH/Telnet password now: ')
password = getpass.getpass('Enter your new password: ')
cisco_3560_18 = {
'device_type':'cisco_ios',
'ip':'XXXXXXX',
'username':username,
'password':password_now
}
cisco_3560_19 = {
'device_type':'cisco_ios',
'ip':'1XXXXXXX9',
'username':username,
'password':password_now
}
devices_cisco = [cisco_3560_18,cisco_3560_19]
for device in devices_cisco:
try:
connect = ConnectHandler(**device)
print('Successfully connected to ' + device['ip'])
config_commands ='username admin secret 12345'
#connect.send_command('conf t')
output = connect.send_config_set(config_commands)
print(output)
except netmiko.ssh_exception.NetMikoTimeoutException:
print(device['ip' + 'is not reachable.'])
except netmiko.ssh_exception.NetmikoAuthenticationException:
print('username or password incorrect')
and there is an error is :ValueError:Failed to exit configuration mode (output = connect.send_config_set(config_commands))
and i follow your reply for other issue add the ‘exit_config_mode=False’ and ‘delay_factor=4’ there will be another error: username admin secret 12345 ^ %invalid input detected at ‘^’ marker. XXXXX#
this two swtiches is cisco WS-C3560-24TS, and ios is :C3560-IPSERVICESK9-M
and i use netmiko.send_command to show information can works.
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Failed to enter configuration mode in Netmiko while trying ...
I'm new to Python and Netmiko. I;m trying to use netmiko to login to aruba switches. while i pass on some commands using...
Read more >netmiko.juniper.juniper API documentation
Commit the entered configuration. Raise an error and return the failure if the commit fails. Automatically enters configuration mode.
Read more >How to use the netmiko.log function in netmiko
... config mode if self.check_config_mode(): raise ValueError("Failed to exit configuration mode") log.debug(f"exit_config_mode: {output}") return output.
Read more >Python ConnectHandler.enable Examples, netmiko. ...
def main(): ''' Connects to router and switches to config mode ... "ipv6" #else: # raise ValueError("BGP neighbor parsing failed") """ 'show ip...
Read more >4. Configuring in the MD-CLI
Navigation outside the configure branch is allowed and does not exit the configuration mode. (ex)[configure router "Base"]. A:admin@node-2# /show uptime. System ...
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
Thank you!Kirk,when i change the hostname of the device, the problem is solved. Thank you very much!
@Mic0623 Yeah, sorry you ran into this…unfortunately, certain string patterns for determining device state (config mode, enable mode, et cetera) are necessary.