Search code examples
pythonconfignetmiko

Netmiko - comfirming new configuration after save


I am using netmiko to connect to a bunch of cisco controllers and change a small thing in their configuration.
After doing that I would like to save the configuration using the command save config, after which is asks save config? y/n and I would like to pass it y.
Sending the command y like so:

net_connect.send_command('save config')
net_connect.send_command('y')

doesn't work because the command y is unknown.

I've tried sending it like so:

net_connect.send_command('save config y')

But that just ignores the y.
I think the answer given here is helpful but I couldn't completely understand how to apply it to my problem.
Any help is greatly appreciated, Thanks in advance!


Solution

  • I figured it out, turns out there is a save_config method already implemented, Just running

    net_connect.save_config() 
    

    Will save your configuratin.