cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
492
Views
0
Helpful
1
Replies

Save startup-configuration from switchs/routers cisco with python script?

I Would like to backup my switchs/routers configuration cisco automatically.

I try to create this script :

#!/usr/bin/env python3
#-*- conding: utf-8 -*-

from netmiko import ConnectHandler

cisco_test = {
    'device_type': 'cisco_ios',
    'host': 'xxx.xxx.xxx.xxx',
    'username': 'xxxxxx',
    'password': 'xxxxxxxxxx',
    'secret': 'xxxxxxx',
    }

net_connect = ConnectHandler(**cisco_test)
net_connect.enable()

config_commands = ['copy start tftp://xxx.xxx.xxx.xxx/test.bin']

output = net_connect.send_config_set(config_commands)

print(output)
net_connect.exit_enable_mode()

But it doesn't work... Could you show me how to do that ?

1 Reply 1

Francesco Molino
VIP Alumni
VIP Alumni

Hi

 

Here a post that matches exactly your issue.

All explaination is in there why it's not working the way you're doing it.

 

https://stackoverflow.com/questions/59888222/save-startup-configuration-from-switchs-routers-cisco-with-python-script

 


Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question

Review Cisco Networking for a $25 gift card